add Widget module

This commit is contained in:
josh committed 2014-07-27 09:28:35 -04:00
1 parent b455fb9e15
commit f2d3942f8a
6 files changed
+67

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
#include "Widget.h"
#include "ruby.h"
#include "gl3w.h"
static VALUE ruby_class;
static VALUE Widget_render_begin(VALUE self)
{
int x = FIX2INT(rb_iv_get(self, "@x"));
int y = FIX2INT(rb_iv_get(self, "@y"));
int width = FIX2INT(rb_iv_get(self, "@width"));
int height = FIX2INT(rb_iv_get(self, "@height"));
glViewport(x, y, width, height);
return Qnil;
}
void Widget_Init()
{
ruby_class = rb_define_module("Widget");
rb_define_method(ruby_class, "render_begin", (VALUE(*)(...))Widget_render_begin, 0);
}
+6
View File
@@ -0,0 +1,6 @@
#ifndef WIDGET_H
#define WIDGET_H
void Widget_Init();
#endif
+2
View File
@@ -4,6 +4,7 @@
#include "Font.h"
#include "GLProgram.h"
#include "GLShader.h"
#include "Widget.h"
#include "Window.h"
using namespace std;
@@ -55,6 +56,7 @@ static int bootstrap()
Font_Init();
GLProgram_Init();
GLShader_Init();
Widget_Init();
Window_Init();
rb_eval_string_protect(