summaryrefslogtreecommitdiffstats
path: root/src/scripting/bindings
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-08-25 13:10:39 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-08-25 13:10:39 (EDT)
commita22741efd694332f3b69e087ed77e353ed75a85d (patch)
tree2e0deb024870eac54a6ecf4f4969d156444a3265 /src/scripting/bindings
parent2c4ba39153c8fd7b03e81689ed6103dc91ce0168 (diff)
downloadoverworld-rpg-a22741efd694332f3b69e087ed77e353ed75a85d.zip
overworld-rpg-a22741efd694332f3b69e087ed77e353ed75a85d.tar.gz
overworld-rpg-a22741efd694332f3b69e087ed77e353ed75a85d.tar.bz2
Add bouken.viewport bindings
Diffstat (limited to 'src/scripting/bindings')
-rw-r--r--src/scripting/bindings/local.mk3
-rw-r--r--src/scripting/bindings/viewport.c43
2 files changed, 45 insertions, 1 deletions
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
+ * <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);
+}