add initial Buffer class

This commit is contained in:
Josh Holtrop 2014-08-14 21:11:25 -04:00
parent d76838f229
commit bdf0e1c6bc
3 changed files with 25 additions and 0 deletions

17
src/Buffer.cc Normal file
View File

@ -0,0 +1,17 @@
#include "Buffer.h"
#include "ruby.h"
static VALUE ruby_class;
static VALUE Buffer_brackets(VALUE self, VALUE index)
{
/* TODO: implement for real */
VALUE s = rb_funcall(index, rb_intern("to_s"), 0);
return s;
}
void Buffer_Init()
{
ruby_class = rb_define_class("Buffer", rb_cObject);
rb_define_method(ruby_class, "[]", (VALUE(*)(...))Buffer_brackets, 1);
}

6
src/Buffer.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef BUFFER_H
#define BUFFER_H
void Buffer_Init();
#endif

View File

@ -1,6 +1,7 @@
#include <iostream>
#include "ruby.h"
#include "Buffer.h"
#include "Font.h"
#include "GL.h"
#include "GLProgram.h"
@ -54,6 +55,7 @@ static int bootstrap()
int rv = 0;
int err_state = 0;
Buffer_Init();
Font_Init();
GL_Init();
GLProgram_Init();