From a22741efd694332f3b69e087ed77e353ed75a85d Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 25 Aug 2015 13:10:39 -0400 Subject: Add bouken.viewport bindings --- (limited to 'src/scripting/bindings') diff --git a/src/scripting/bindings/local.mk b/src/scripting/bindings/local.mk index 44655b5..1ec4a43 100644 --- a/src/scripting/bindings/local.mk +++ b/src/scripting/bindings/local.mk @@ -1 +1,2 @@ -boukengine_SOURCES += +boukengine_SOURCES += \ + src/scripting/bindings/viewport.c 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 + * . + */ + +#include +#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); +} -- cgit v0.9.1