aboutsummaryrefslogtreecommitdiff
path: root/src/lua/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/graphics')
-rw-r--r--src/lua/graphics/Canvas.cpp24
-rw-r--r--src/lua/graphics/Canvas.h60
-rw-r--r--src/lua/graphics/Color.h19
-rw-r--r--src/lua/graphics/Font.h52
-rw-r--r--src/lua/graphics/Image.cpp26
-rw-r--r--src/lua/graphics/Image.h65
-rw-r--r--src/lua/graphics/JSL.cpp20
-rw-r--r--src/lua/graphics/JSL.h92
-rw-r--r--src/lua/graphics/graphics.h18
-rw-r--r--src/lua/graphics/luaopen_Canvas.cpp31
-rw-r--r--src/lua/graphics/luaopen_Font.cpp4
-rw-r--r--src/lua/graphics/luaopen_Image.cpp35
-rw-r--r--src/lua/graphics/luaopen_JSL.cpp35
-rw-r--r--src/lua/graphics/luaopen_graphics.cpp34
14 files changed, 65 insertions, 450 deletions
diff --git a/src/lua/graphics/Canvas.cpp b/src/lua/graphics/Canvas.cpp
deleted file mode 100644
index 1714e77..0000000
--- a/src/lua/graphics/Canvas.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "Canvas.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- Canvas* Canvas::createCanvas(int w, int h)
- {
- Canvas* canvas = new Canvas();
- canvas->canvas = jin::graphics::Canvas::createCanvas(w, h);
- return canvas;
- }
-
- void Canvas::unbind()
- {
- jin::graphics::Canvas::unbind();
- }
-
-} // graphics
-} // lua
-} // jin \ No newline at end of file
diff --git a/src/lua/graphics/Canvas.h b/src/lua/graphics/Canvas.h
deleted file mode 100644
index 4494db4..0000000
--- a/src/lua/graphics/Canvas.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef __JIN_LUA_GRAPHICS_CANVAS_H
-#define __JIN_LUA_GRAPHICS_CANVAS_H
-#include "libjin/jin.h"
-#include "../luaopen_types.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- class Canvas : public Object
- {
- public:
- static Canvas* createCanvas(int w, int h);
-
- int getWidth()
- {
- return canvas->getWidth();
- }
- int getHeight()
- {
- return canvas->getHeight();
- }
- void setAnchor(int x, int y)
- {
- canvas->setAnchor(x, y);
- }
- inline const jin::graphics::Canvas* getRawCanvas() const
- {
- return canvas;
- }
- void bind()
- {
- canvas->bind();
- }
-
- void draw(int x, int y, float sx, float sy, float r)
- {
- canvas->draw(x, y, sx, sy, r);
- }
-
- static void unbind();
-
- private:
- Canvas() {}
- ~Canvas()
- {
- delete canvas;
- }
- jin::graphics::Canvas* canvas;
-
- };
-
-} // graphics
-} // lua
-} // jin
-
-#endif // __JIN_LUA_GRAPHICS_CANVAS_H \ No newline at end of file
diff --git a/src/lua/graphics/Color.h b/src/lua/graphics/Color.h
deleted file mode 100644
index 4110bc4..0000000
--- a/src/lua/graphics/Color.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __JIN_LUA_GRAPHICS_COLOR_H
-#define __JIN_LUA_GRAPHICS_COLOR_H
-#include "libjin/jin.h"
-#include "../luaopen_types.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- typedef jin::graphics::color color;
-
-} // graphics
-} // lua
-} // jin
-
-#endif // __JIN_LUA_GRAPHICS_COLOR_H \ No newline at end of file
diff --git a/src/lua/graphics/Font.h b/src/lua/graphics/Font.h
deleted file mode 100644
index 3343690..0000000
--- a/src/lua/graphics/Font.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef __JIN_LUA_GRAPHICS_FONT_H
-#define __JIN_LUA_GRAPHICS_FONT_H
-#include "libjin/jin.h"
-#include "../luaopen_types.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- class Font : public Object
- {
- public:
- Font()
- {
- font = new jin::graphics::Font();
- }
-
- void box(const char* str, int fheight, int spacing, int lheight, int* w, int * h)
- {
- font->box(str, fheight, spacing, lheight, w, h);
- }
- void loadb(const unsigned char* data)
- {
- font->loadb(data);
- }
- void render(
- const char* text, // rendered text
- float x, float y, // render position
- int fheight, // font height
- int spacing, // font spacing
- int lheight) // line height
- {
- font->render(text, x, y, fheight, spacing, lheight);
- }
- private:
- ~Font()
- {
- delete font;
- }
-
- jin::graphics::Font* font;
-
- };
-
-} // graphics
-} // lua
-} // jin
-
-#endif // __JIN_LUA_GRAPHICS_FONT_H \ No newline at end of file
diff --git a/src/lua/graphics/Image.cpp b/src/lua/graphics/Image.cpp
deleted file mode 100644
index 15c576a..0000000
--- a/src/lua/graphics/Image.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "Image.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- Image* Image::createImage(const char* file)
- {
- Image* image = new Image();
- image->image = jin::graphics::Texture::createTexture(file);
- return image;
- }
-
- Image* Image::createImage(const void* mem, size_t size)
- {
- Image* image = new Image();
- image->image = jin::graphics::Texture::createTexture(mem, size);
- return image;
- }
-
-} // graphics
-} // lua
-} // jin \ No newline at end of file
diff --git a/src/lua/graphics/Image.h b/src/lua/graphics/Image.h
deleted file mode 100644
index 0d1d010..0000000
--- a/src/lua/graphics/Image.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef __JIN_LUA_GRAPHICS_IMAGE_H
-#define __JIN_LUA_GRAPHICS_IMAGE_H
-#include "libjin/jin.h"
-#include "../luaopen_types.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- class Image : public Object
- {
- public:
- static Image* createImage(const char* file);
- static Image* createImage(const void* mem, size_t size);
-
- int getWidth()
- {
- return image->getWidth();
- }
-
- int getHeight()
- {
- return image->getHeight();
- }
-
- void setAnchor(int x, int y)
- {
- image->setAnchor(x, y);
- }
-
- jin::graphics::color getPixel(int x, int y)
- {
- return image->getPixel(x, y);
- }
-
- inline const jin::graphics::Texture* getRawImage() const
- {
- return image;
- }
-
- void draw(int x, int y, float sx, float sy, float r)
- {
- image->draw(x, y, sx, sy, r);
- }
-
- private:
- Image() {};
-
- ~Image()
- {
- delete image;
- }
-
- jin::graphics::Texture* image;
-
- };
-
-} // graphics
-} // lua
-} // jin
-
-#endif // __JIN_LUA_GRAPHICS_IMAGE_H \ No newline at end of file
diff --git a/src/lua/graphics/JSL.cpp b/src/lua/graphics/JSL.cpp
deleted file mode 100644
index 42ec2c8..0000000
--- a/src/lua/graphics/JSL.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "JSL.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- JSLProgram* JSLProgram::currentJSLProgram = nullptr;
- JSLProgram* JSLProgram::createJSLProgram(const char* program)
- {
- JSLProgram* jslprogram = new JSLProgram();
- jslprogram->jslprogram = jin::graphics::JSLProgram::createJSLProgram(program);
- return jslprogram;
- }
-
-} // graphics
-} // lua
-} // jin \ No newline at end of file
diff --git a/src/lua/graphics/JSL.h b/src/lua/graphics/JSL.h
deleted file mode 100644
index af6c54d..0000000
--- a/src/lua/graphics/JSL.h
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef __JIN_LUA_GRAPHICS_JSL_H
-#define __JIN_LUA_GRAPHICS_JSL_H
-#include "libjin/jin.h"
-#include "../luaopen_types.h"
-#include "Image.h"
-#include "Color.h"
-#include "Canvas.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- class JSLProgram : public Object
- {
- public:
- static JSLProgram* createJSLProgram(const char* program);
-
- inline void use()
- {
- currentJSLProgram = this;
- jslprogram->use();
- }
-
- static inline void unuse()
- {
- currentJSLProgram = nullptr;
- jin::graphics::JSLProgram::unuse();
- }
-
- void sendFloat(const char* name, float number)
- {
- jslprogram->sendFloat(name, number);
- }
-
- void sendImage(const char* name, const Image* image)
- {
- jslprogram->sendTexture(name, image->getRawImage());
- }
-
- void sendVec2(const char* name, float x, float y)
- {
- jslprogram->sendVec2(name, x, y);
- }
-
- void sendVec3(const char* name, float x, float y, float z)
- {
- jslprogram->sendVec3(name, x, y, z);
- }
-
- void sendVec4(const char* name, float x, float y, float z, float w)
- {
- jslprogram->sendVec4(name, x, y, z, w);
- }
-
- void sendCanvas(const char* name, const Canvas* canvas)
- {
- jslprogram->sendCanvas(name, canvas->getRawCanvas());
- }
-
- void sendColor(const char* name, const lua::graphics::color* col)
- {
- jslprogram->sendColor(name, col);
- }
-
- static inline JSLProgram* getCurrentJSL()
- {
- return currentJSLProgram;
- }
-
- private:
-
- static JSLProgram* currentJSLProgram;
-
- JSLProgram() {}
-
- ~JSLProgram()
- {
- delete jslprogram;
- }
-
- jin::graphics::JSLProgram * jslprogram;
-
- };
-
-} // graphics
-} // lua
-} // jin
-
-#endif // __JIN_LUA_GRAPHICS_JSL_H \ No newline at end of file
diff --git a/src/lua/graphics/graphics.h b/src/lua/graphics/graphics.h
deleted file mode 100644
index bd9bec1..0000000
--- a/src/lua/graphics/graphics.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef __JIN_LUA_GRAPHICS_GRAPHICS_H
-#define __JIN_LUA_GRAPHICS_GRAPHICS_H
-#include "libjin/jin.h"
-#include "../luaopen_types.h"
-
-namespace jin
-{
-namespace lua
-{
-namespace graphics
-{
-
- typedef jin::graphics::RENDER_MODE RENDER_MODE;
-
-}
-}
-}
-#endif \ No newline at end of file
diff --git a/src/lua/graphics/luaopen_Canvas.cpp b/src/lua/graphics/luaopen_Canvas.cpp
index d08b181..7b694e9 100644
--- a/src/lua/graphics/luaopen_Canvas.cpp
+++ b/src/lua/graphics/luaopen_Canvas.cpp
@@ -1,50 +1,49 @@
#include "lua/luax.h"
#include "lua/luaopen_types.h"
-#include "Canvas.h"
+#include "libjin/jin.h"
namespace jin
{
namespace lua
{
- using namespace lua::graphics;
+ using namespace jin::graphics;
- static inline Canvas* checkCanvas(lua_State* L)
+ static inline Ref<Canvas>& checkCanvas(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
- if (proxy != nullptr)
- return (Canvas*)proxy->object;
- return nullptr;
- }
+ Ref<Canvas>* ref = (Ref<Canvas>*)proxy->reference;
+ return *ref;
+ }
static int l_getWidth(lua_State* L)
{
- Canvas* c = checkCanvas(L);
- luax_pushnumber(L, c->getWidth());
+ Ref<Canvas>& ref = checkCanvas(L);
+ luax_pushnumber(L, (*ref).getWidth());
return 1;
}
static int l_getHeight(lua_State* L)
{
- Canvas* c = checkCanvas(L);
- luax_pushnumber(L, c->getHeight());
+ Ref<Canvas>& ref = checkCanvas(L);
+ luax_pushnumber(L, (*ref).getHeight());
return 1;
}
static int l_getSize(lua_State* L)
{
- Canvas* c = checkCanvas(L);
- luax_pushnumber(L, c->getWidth());
- luax_pushnumber(L, c->getHeight());
+ Ref<Canvas>& ref = checkCanvas(L);
+ luax_pushnumber(L, (*ref).getWidth());
+ luax_pushnumber(L, (*ref).getHeight());
return 2;
}
static int l_setAnchor(lua_State* L)
{
- Canvas* c = checkCanvas(L);
+ Ref<Canvas>& ref = checkCanvas(L);
int x = luax_checknumber(L, 1);
int y = luax_checknumber(L, 2);
- c->setAnchor(x, y);
+ (*ref).setAnchor(x, y);
return 0;
}
diff --git a/src/lua/graphics/luaopen_Font.cpp b/src/lua/graphics/luaopen_Font.cpp
index 8585d46..341af87 100644
--- a/src/lua/graphics/luaopen_Font.cpp
+++ b/src/lua/graphics/luaopen_Font.cpp
@@ -19,13 +19,13 @@ namespace lua
static int l_box(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_FONT, sizeof(Proxy));
- Font* font = (Font*)proxy->object;
+ Ref<Font>& ref = proxy->getRef<Font>();
const char* text = luax_checkstring(L, 2);
int fheight = luax_checknumber(L, 3);
int spacing = luax_checknumber(L, 4);
int lheight = luax_checknumber(L, 5);
int w, h;
- font->box(text, fheight, lheight, spacing, &w, &h);
+ (*ref).box(text, fheight, lheight, spacing, &w, &h);
luax_pushnumber(L, w);
luax_pushnumber(L, h);
return 2;
diff --git a/src/lua/graphics/luaopen_Image.cpp b/src/lua/graphics/luaopen_Image.cpp
index 8d89a80..b1672d5 100644
--- a/src/lua/graphics/luaopen_Image.cpp
+++ b/src/lua/graphics/luaopen_Image.cpp
@@ -1,43 +1,42 @@
#include "lua/luax.h"
#include "lua/luaopen_types.h"
-#include "Image.h"
-#include "Color.h"
+#include "libjin/jin.h"
namespace jin
{
namespace lua
{
- using namespace lua::graphics;
+ using namespace jin::graphics;
- static inline Image* checkImage(lua_State* L)
+ typedef Texture Image;
+
+ static inline Ref<Image>& checkImage(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_IMAGE);
- if (proxy != nullptr)
- return (Image*)proxy->object;
- return nullptr;
+ return proxy->getRef<Image>();
}
static int l_getWidth(lua_State* L)
{
- Image* i = checkImage(L);
- luax_pushnumber(L, i->getWidth());
+ Ref<Image>& ref = checkImage(L);
+ luax_pushnumber(L, (*ref).getWidth());
return 1;
}
static int l_getHeight(lua_State *L)
{
- Image* i = checkImage(L);
- luax_pushnumber(L, i->getHeight());
+ Ref<Image>& ref = checkImage(L);
+ luax_pushnumber(L, (*ref).getHeight());
return 1;
}
static int l_getPixel(lua_State* L)
{
- Image* i = checkImage(L);
+ Ref<Image>& ref = checkImage(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
- color c = i->getPixel(x, y);
+ color c = (*ref).getPixel(x, y);
luax_pushnumber(L, c.rgba.r);
luax_pushnumber(L, c.rgba.g);
luax_pushnumber(L, c.rgba.b);
@@ -47,18 +46,18 @@ namespace lua
static int l_setAnchor(lua_State* L)
{
- Image* i = checkImage(L);
+ Ref<Image>& ref = checkImage(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
- i->setAnchor(x, y);
+ (*ref).setAnchor(x, y);
return 0;
}
static int l_getSize(lua_State* L)
{
- Image* i = checkImage(L);
- luax_pushnumber(L, i->getWidth());
- luax_pushnumber(L, i->getHeight());
+ Ref<Image>& ref = checkImage(L);
+ luax_pushnumber(L, (*ref).getWidth());
+ luax_pushnumber(L, (*ref).getHeight());
return 2;
}
diff --git a/src/lua/graphics/luaopen_JSL.cpp b/src/lua/graphics/luaopen_JSL.cpp
index 774f2b6..e644c35 100644
--- a/src/lua/graphics/luaopen_JSL.cpp
+++ b/src/lua/graphics/luaopen_JSL.cpp
@@ -1,23 +1,20 @@
#include "lua/luax.h"
#include "lua/luaopen_types.h"
-#include "Image.h"
-#include "JSL.h"
-#include "Canvas.h"
-#include "Color.h"
+#include "libjin/jin.h"
namespace jin
{
namespace lua
{
- using namespace lua::graphics;
+ using namespace jin::graphics;
- static inline JSLProgram* checkJSLProgram(lua_State* L)
+ typedef Texture Image;
+
+ static inline Ref<JSLProgram>& checkJSLProgram(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_SHADER);
- if(proxy != nullptr)
- return (JSLProgram*)proxy->object;
- return nullptr;
+ return proxy->getRef<JSLProgram>();
}
static enum VARIABLE_TYPE
@@ -51,7 +48,7 @@ namespace lua
*/
static int l_send(lua_State* L)
{
- JSLProgram* jsl = checkJSLProgram(L);
+ Ref<JSLProgram>& ref = checkJSLProgram(L);
// number Image Texel
const char* typestr = luax_checkstring(L, 2);
// variable name
@@ -64,28 +61,28 @@ namespace lua
case NUMBER:
{
float number = luax_checknumber(L, 4);
- jsl->sendFloat(variable, number);
+ (*ref).sendFloat(variable, number);
break;
}
case IMAGE:
{
Proxy* proxy = (Proxy*)luax_checktype(L, 4, JIN_GRAPHICS_IMAGE);
- Image* tex = (Image*)proxy->object;
- jsl->sendImage(variable, tex);
+ Ref<Image>& tex = proxy->getRef<Image>();
+ (*ref).sendTexture(variable, &(*tex));
break;
}
case CANVAS:
{
Proxy* proxy = (Proxy*)luax_checktype(L, 4, JIN_GRAPHICS_CANVAS);
- Canvas* canvas = (Canvas*)proxy->object;
- jsl->sendCanvas(variable, canvas);
+ Ref<Canvas>& canvas = proxy->getRef<Canvas>();
+ (*ref).sendCanvas(variable, &(*canvas));
break;
}
case VEC2:
{
float x = luax_checknumber(L, 4);
float y = luax_checknumber(L, 5);
- jsl->sendVec2(variable, x, y);
+ (*ref).sendVec2(variable, x, y);
break;
}
case VEC3:
@@ -93,7 +90,7 @@ namespace lua
float x = luax_checknumber(L, 4);
float y = luax_checknumber(L, 5);
float z = luax_checknumber(L, 6);
- jsl->sendVec3(variable, x, y, z);
+ (*ref).sendVec3(variable, x, y, z);
break;
}
case VEC4:
@@ -102,7 +99,7 @@ namespace lua
float y = luax_checknumber(L, 5);
float z = luax_checknumber(L, 6);
float w = luax_checknumber(L, 7);
- jsl->sendVec4(variable, x, y, z, w);
+ (*ref).sendVec4(variable, x, y, z, w);
break;
}
case COLOR:
@@ -112,7 +109,7 @@ namespace lua
col.rgba.g = luax_checkinteger(L, 5);
col.rgba.b = luax_checkinteger(L, 6);
col.rgba.a = luax_checkinteger(L, 7);
- jsl->sendColor(variable, &col);
+ (*ref).sendColor(variable, &col);
break;
}
default:
diff --git a/src/lua/graphics/luaopen_graphics.cpp b/src/lua/graphics/luaopen_graphics.cpp
index 5b7f848..dc8c9a1 100644
--- a/src/lua/graphics/luaopen_graphics.cpp
+++ b/src/lua/graphics/luaopen_graphics.cpp
@@ -2,23 +2,17 @@
#include "libjin/jin.h"
#include "lua/luaopen_types.h"
#include "lua/embed/graphics.lua.h"
-#include "Canvas.h"
-#include "Color.h"
-#include "Font.h"
-#include "Image.h"
-#include "JSL.h"
-#include "graphics.h"
namespace jin
{
namespace lua
{
-
- using namespace lua::graphics;
- using jin::graphics::Window;
+ using namespace jin::graphics;
using jin::filesystem::Filesystem;
using jin::filesystem::Buffer;
+ typedef Texture Image;
+
/**
* jin.graphics context, storge some module
* shared variables.
@@ -87,8 +81,8 @@ namespace lua
fs->read(f, &b);
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_IMAGE, sizeof(Proxy));
- Image* img = Image::createImage(b.data, b.size);
- proxy->bind(img, JIN_GRAPHICS_IMAGE);
+ Image* img = Image::createTexture(b.data, b.size);
+ proxy->bind(new Ref<Image>(img), JIN_GRAPHICS_IMAGE);
return 1;
}
@@ -101,7 +95,7 @@ namespace lua
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_SHADER, sizeof(Proxy));
const char* program = luax_checkstring(L, 1);
JSLProgram* jsl = JSLProgram::createJSLProgram(program);
- proxy->bind(jsl, JIN_GRAPHICS_SHADER);
+ proxy->bind(new Ref<JSLProgram>(jsl), JIN_GRAPHICS_SHADER);
return 1;
}
@@ -115,7 +109,8 @@ namespace lua
int h = luax_checknumber(L, 2);
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_CANVAS, sizeof(Proxy));
Canvas* cvs = Canvas::createCanvas(w, h);
- proxy->bind(cvs, JIN_GRAPHICS_CANVAS);
+ Ref<Canvas>* ref = new Ref<Canvas>(cvs);
+ proxy->bind(ref, JIN_GRAPHICS_CANVAS);
return 1;
}
@@ -157,13 +152,13 @@ namespace lua
if (luax_istype(L, 1, JIN_GRAPHICS_IMAGE))
{
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Image* tex = (Image*)proxy->object;
+ Image* tex = &*proxy->getRef<Image>();
tex->draw(x, y, sx, sy, r);
}
else if (luax_istype(L, 1, JIN_GRAPHICS_CANVAS))
{
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Canvas* p = (Canvas*)proxy->object;
+ Canvas* p = &*proxy->getRef<Canvas>();
p->draw(x, y, sx, sy, r);
}
else
@@ -214,8 +209,8 @@ namespace lua
return 0;
}
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
- Canvas* c = (Canvas*)proxy->object;
- c->bind();
+ Ref<Canvas>& ref = proxy->getRef<Canvas>();
+ (*ref).bind();
return 0;
}
@@ -235,7 +230,7 @@ namespace lua
if (luax_istype(L, 1, JIN_GRAPHICS_SHADER))
{
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- JSLProgram* jsl = (JSLProgram*)proxy->object;
+ JSLProgram* jsl = &*proxy->getRef<JSLProgram>();
jsl->use();
}
else
@@ -412,7 +407,8 @@ namespace lua
fs->read(path, &b);
font->loadb((const unsigned char*)b.data);
}
- proxy->bind(font, JIN_GRAPHICS_FONT);
+ Ref<Font>* ref = new Ref<Font>(font);
+ proxy->bind(ref, JIN_GRAPHICS_FONT);
return 1;
}