diff options
Diffstat (limited to 'src/scripting/bindings/viewport.c')
-rw-r--r-- | src/scripting/bindings/viewport.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/scripting/bindings/viewport.c b/src/scripting/bindings/viewport.c new file mode 100644 index 0000000..2f3c03d --- /dev/null +++ b/src/scripting/bindings/viewport.c @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2015 Patrick "P. J." McDermott + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#include <SDL.h> +#include "../../viewport.h" +#include "../ffi.h" +#include "../bindings.h" + +static struct ffi_namespace *ns; + +static void +binding_set_size(void) +{ + Uint16 width; + Uint16 height; + + width = ffi_stack_get_int(); + height = ffi_stack_get_int(); + + init_viewport(width, height, 8); +} + +void +bindings_viewport_init(void) +{ + ns = ffi_add_namespace(top_ns, "viewport"); + ffi_add_function(ns, "set_size", binding_set_size); +} |