diff options
Diffstat (limited to 'src/lua/modules')
-rw-r--r-- | src/lua/modules/audio/je_lua_audio.cpp | 2 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_bitmap.cpp | 2 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_graphics.cpp | 30 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_spritesheet.cpp | 4 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_texture_font.cpp | 2 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_ttf.cpp | 2 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_ttf_data.cpp | 2 | ||||
-rw-r--r-- | src/lua/modules/net/je_lua_net.cpp | 4 | ||||
-rw-r--r-- | src/lua/modules/net/je_lua_socket.cpp | 6 | ||||
-rw-r--r-- | src/lua/modules/thread/je_lua_thread.cpp | 4 | ||||
-rw-r--r-- | src/lua/modules/time/je_lua_time.cpp | 2 | ||||
-rw-r--r-- | src/lua/modules/time/je_lua_timer.cpp | 6 |
12 files changed, 33 insertions, 33 deletions
diff --git a/src/lua/modules/audio/je_lua_audio.cpp b/src/lua/modules/audio/je_lua_audio.cpp index 61b9556..57500eb 100644 --- a/src/lua/modules/audio/je_lua_audio.cpp +++ b/src/lua/modules/audio/je_lua_audio.cpp @@ -97,7 +97,7 @@ namespace JinEngine luax_pushnil(L); return 1; } - Proxy* proxy = luax_newinstance(L, Jin_Lua_Source, new Shared<Source>(src, Jin_Lua_Source)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Source, new Shared<Source>(L, src, Jin_Lua_Source)); return 1; } diff --git a/src/lua/modules/graphics/je_lua_bitmap.cpp b/src/lua/modules/graphics/je_lua_bitmap.cpp index 2495fb3..056ed70 100644 --- a/src/lua/modules/graphics/je_lua_bitmap.cpp +++ b/src/lua/modules/graphics/je_lua_bitmap.cpp @@ -90,7 +90,7 @@ namespace JinEngine SharedBitmap shared = checkBitmap(L); Bitmap* bitmap = shared.getObject(); Bitmap* b = Bitmap::clone(bitmap); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(b, Jin_Lua_Bitmap)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(L, b, Jin_Lua_Bitmap)); return 1; } diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp index 82793be..36829ab 100644 --- a/src/lua/modules/graphics/je_lua_graphics.cpp +++ b/src/lua/modules/graphics/je_lua_graphics.cpp @@ -207,7 +207,7 @@ namespace JinEngine return 1; } } - Proxy* proxy = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(bitmap, Jin_Lua_Bitmap)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Bitmap, new Shared<Bitmap>(L, bitmap, Jin_Lua_Bitmap)); return 1; } @@ -227,7 +227,7 @@ namespace JinEngine const char* path = luax_checkstring(L, 1); texture = Texture::createTexture(path); } - Proxy* proxy = luax_newinstance(L, Jin_Lua_Texture, new Shared<Texture>(texture, Jin_Lua_Texture)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Texture, new Shared<Texture>(L, texture, Jin_Lua_Texture)); return 1; } @@ -241,7 +241,7 @@ namespace JinEngine luax_pushnil(L); return 1; } - Proxy* proxy = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(jsl, Jin_Lua_Shader)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(L, jsl, Jin_Lua_Shader)); return 1; } @@ -264,7 +264,7 @@ namespace JinEngine luax_pushnil(L); return 1; } - Proxy* proxy = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(jsl, Jin_Lua_Shader)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Shader, new Shared<Shader>(L, jsl, Jin_Lua_Shader)); return 1; } @@ -273,7 +273,7 @@ namespace JinEngine int w = luax_checknumber(L, 1); int h = luax_checknumber(L, 2); Canvas* cvs = Canvas::createCanvas(w, h); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Canvas, new Shared<Canvas>(cvs, Jin_Lua_Canvas)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Canvas, new Shared<Canvas>(L, cvs, Jin_Lua_Canvas)); return 1; } @@ -684,7 +684,7 @@ namespace JinEngine fs->read(path, b); fd = TTFData::createTTFData(&b, b.size()); } - Proxy* proxy = luax_newinstance(L, Jin_Lua_TTFData, new Shared<TTFData>(fd, Jin_Lua_TTFData)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_TTFData, new Shared<TTFData>(L, fd, Jin_Lua_TTFData)); return 1; } @@ -707,7 +707,7 @@ namespace JinEngine unsigned length; const char* data = luax_checklstring(L, 1, &length); Text* text = new Text(encode, data, length); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Text, new Shared<Text>(text, Jin_Lua_Text)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Text, new Shared<Text>(L, text, Jin_Lua_Text)); return 1; } @@ -735,7 +735,7 @@ namespace JinEngine quad.h = luax_rawgetnumberthenpop(L, 2, 4); int o = luax_checkinteger(L, 3); Origin origin = static_cast<Origin>(o); - Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, origin), Jin_Lua_Sprite)); + Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, quad, origin), Jin_Lua_Sprite)); } else if (n == 4) { @@ -746,19 +746,19 @@ namespace JinEngine quad.h = luax_rawgetnumberthenpop(L, 2, 4); int ox = luax_checkinteger(L, 3); int oy = luax_checkinteger(L, 4); - Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, ox, oy), Jin_Lua_Sprite)); + Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, quad, ox, oy), Jin_Lua_Sprite)); } else if (n == 2) { int o = luax_checkinteger(L, 2); Origin origin = static_cast<Origin>(o); - Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, origin), Jin_Lua_Sprite)); + Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, origin), Jin_Lua_Sprite)); } else if (n == 3) { int ox = luax_checkinteger(L, 2); int oy = luax_checkinteger(L, 3); - Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, ox, oy), Jin_Lua_Sprite)); + Proxy* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(L, new Sprite(graphic, ox, oy), Jin_Lua_Sprite)); } else { @@ -780,7 +780,7 @@ namespace JinEngine if (pxyGraphic != nullptr) { Graphic* graphic = pxyGraphic->getObject<Graphic>(); - Shared<SpriteSheet>* shrSSheet = new Shared<SpriteSheet>(new SpriteSheet(graphic), Jin_Lua_SpriteSheet); + Shared<SpriteSheet>* shrSSheet = new Shared<SpriteSheet>(L, new SpriteSheet(graphic), Jin_Lua_SpriteSheet); Shared<Graphic>& shrGraphic = pxyGraphic->getShared<Graphic>(); shrSSheet->setDependency((int)SpriteSheetDependency::DEP_GRAPHIC, &shrGraphic); Proxy* pxySSheet = luax_newinstance(L, Jin_Lua_SpriteSheet, shrSSheet); @@ -794,7 +794,7 @@ namespace JinEngine LUA_IMPLEMENT int l_newAnimation(lua_State* L) { int argc = luax_gettop(L); - Shared<Animation>* shrAnimation = new Shared<Animation>(new Animation(), Jin_Lua_Animation); + Shared<Animation>* shrAnimation = new Shared<Animation>(L, new Animation(), Jin_Lua_Animation); if (argc >= 3) { if (!luax_istable(L, 1)) @@ -825,7 +825,7 @@ namespace JinEngine LUA_IMPLEMENT int l_newAnimator(lua_State* L) { int argc = luax_gettop(L); - Shared<Animator>* shrAniamtor = new Shared<Animator>(new Animator(), Jin_Lua_Animator); + Shared<Animator>* shrAniamtor = new Shared<Animator>(L, new Animator(), Jin_Lua_Animator); if (argc >= 1) { Proxy* pxyAnimation = (Proxy*)luax_checktype(L, 1, Jin_Lua_Animation); @@ -884,7 +884,7 @@ namespace JinEngine // Delete temporary text. delete text; } - Proxy* proxy = luax_newinstance(L, Jin_Lua_TextureFont, new Shared<TextureFont>(textureFont, Jin_Lua_TextureFont)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_TextureFont, new Shared<TextureFont>(L, textureFont, Jin_Lua_TextureFont)); return 1; } diff --git a/src/lua/modules/graphics/je_lua_spritesheet.cpp b/src/lua/modules/graphics/je_lua_spritesheet.cpp index 362a78d..3f22319 100644 --- a/src/lua/modules/graphics/je_lua_spritesheet.cpp +++ b/src/lua/modules/graphics/je_lua_spritesheet.cpp @@ -48,7 +48,7 @@ namespace JinEngine origin = static_cast<Origin>(o); spr = sheet->createSprite(quad, origin); } - Shared<Sprite>* shrSprite = new Shared<Sprite>(spr, Jin_Lua_Sprite); + Shared<Sprite>* shrSprite = new Shared<Sprite>(L, spr, Jin_Lua_Sprite); shrSprite->setDependency((int)SpriteDependency::DEP_SPRITESHEET, &shrSSheet); Proxy* pxySprite = luax_newinstance(L, Jin_Lua_Sprite, shrSprite); return 1; @@ -97,7 +97,7 @@ namespace JinEngine for (int i = 0; i < sprs.size(); ++i) { Sprite* spr = sprs[i]; - Shared<Sprite>* shrSpr = new Shared<Sprite>(spr, Jin_Lua_Sprite); + Shared<Sprite>* shrSpr = new Shared<Sprite>(L, spr, Jin_Lua_Sprite); shrSpr->setDependency((int)SpriteDependency::DEP_GRAPHIC, shrGraphic); Proxy* pxys = (Proxy*)luax_newinstance(L, Jin_Lua_Sprite, shrSpr); luax_rawseti(L, -2, i + 1); diff --git a/src/lua/modules/graphics/je_lua_texture_font.cpp b/src/lua/modules/graphics/je_lua_texture_font.cpp index 6c62ee2..58677eb 100644 --- a/src/lua/modules/graphics/je_lua_texture_font.cpp +++ b/src/lua/modules/graphics/je_lua_texture_font.cpp @@ -44,7 +44,7 @@ namespace JinEngine Text* text = p2->getObject<Text>(); page = tf->typeset(*text, lineheight, spacing); } - Shared<Page>* shrPage = new Shared<Page>(page, Jin_Lua_Page); + Shared<Page>* shrPage = new Shared<Page>(L, page, Jin_Lua_Page); shrPage->setDependency((int)PageDependency::DEP_TEXTURE_FONT, &shrTexFont); Proxy* pxyPage = luax_newinstance(L, Jin_Lua_Page, shrPage); return 1; diff --git a/src/lua/modules/graphics/je_lua_ttf.cpp b/src/lua/modules/graphics/je_lua_ttf.cpp index fb4b0df..c3d9aae 100644 --- a/src/lua/modules/graphics/je_lua_ttf.cpp +++ b/src/lua/modules/graphics/je_lua_ttf.cpp @@ -44,7 +44,7 @@ namespace JinEngine Text* text = pxyText->getObject<Text>(); page = ttf->typeset(*text, lineheight, spacing); } - Shared<Page>* refPage = new Shared<Page>(page, Jin_Lua_Page); + Shared<Page>* refPage = new Shared<Page>(L, page, Jin_Lua_Page); refPage->setDependency((int)PageDependency::DEP_TTF, &shrTTF); Proxy* pxyPage = luax_newinstance(L, Jin_Lua_Page, refPage); return 1; diff --git a/src/lua/modules/graphics/je_lua_ttf_data.cpp b/src/lua/modules/graphics/je_lua_ttf_data.cpp index 8042d69..7fcadcd 100644 --- a/src/lua/modules/graphics/je_lua_ttf_data.cpp +++ b/src/lua/modules/graphics/je_lua_ttf_data.cpp @@ -22,7 +22,7 @@ namespace JinEngine Shared<TTFData>& shrFontData = pxyTTFData->getShared<TTFData>(); TTFData* fontData = shrFontData.getObject(); TTF* font = fontData->createTTF(fontsize); - Shared<TTF>* shrTTF = new Shared<TTF>(font, Jin_Lua_TTF); + Shared<TTF>* shrTTF = new Shared<TTF>(L, font, Jin_Lua_TTF); shrTTF->setDependency((int)TTFDependency::DEP_TTFDATA, &shrFontData); Proxy* pxyTTF = luax_newinstance(L, Jin_Lua_TTF, shrTTF); return 1; diff --git a/src/lua/modules/net/je_lua_net.cpp b/src/lua/modules/net/je_lua_net.cpp index 4b5513a..058b4e8 100644 --- a/src/lua/modules/net/je_lua_net.cpp +++ b/src/lua/modules/net/je_lua_net.cpp @@ -49,7 +49,7 @@ namespace Lua } } Socket* socket = new Socket(info); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(socket, Jin_Lua_Socket)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(L, socket, Jin_Lua_Socket)); return 1; } @@ -57,7 +57,7 @@ namespace Lua { int size = luax_checkinteger(L, 1); Net::Buffer* buffer = new Net::Buffer(size); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(buffer, Jin_Lua_Buffer)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(L, buffer, Jin_Lua_Buffer)); return 1; } diff --git a/src/lua/modules/net/je_lua_socket.cpp b/src/lua/modules/net/je_lua_socket.cpp index 3eed91f..899c70a 100644 --- a/src/lua/modules/net/je_lua_socket.cpp +++ b/src/lua/modules/net/je_lua_socket.cpp @@ -34,7 +34,7 @@ namespace JinEngine { SharedSocket socket = checkSocket(L); Socket* client = socket->accept(); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(client, Jin_Lua_Socket)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Socket, new Shared<Socket>(L, client, Jin_Lua_Socket)); return 1; } @@ -45,7 +45,7 @@ namespace JinEngine char buffer[BUFFER_SIZE] = {0}; int size = socket->receive(buffer, BUFFER_SIZE); Net::Buffer* netBuffer = new Net::Buffer(buffer, size); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(netBuffer, Jin_Lua_Buffer)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(L, netBuffer, Jin_Lua_Buffer)); return 1; } @@ -58,7 +58,7 @@ namespace JinEngine char buffer[BUFFER_SIZE]; int size = socket->receiveFrom(buffer, BUFFER_SIZE, address, port); Net::Buffer* netBuffer = new Net::Buffer(buffer, size); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(netBuffer, Jin_Lua_Buffer)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Buffer, new Shared<Buffer>(L, netBuffer, Jin_Lua_Buffer)); return 1; } diff --git a/src/lua/modules/thread/je_lua_thread.cpp b/src/lua/modules/thread/je_lua_thread.cpp index 2444e7b..4e0442e 100644 --- a/src/lua/modules/thread/je_lua_thread.cpp +++ b/src/lua/modules/thread/je_lua_thread.cpp @@ -27,7 +27,7 @@ namespace JinEngine SharedThread shared = *(Shared<Thread>*)t; lua_State* L = lua_open(); luax_openlibs(L); - luaopen_jin(L); + open(L); luax_getglobal(L, MODULE_NAME); Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread, &shared); luax_setfield(L, -2, "_curThread"); @@ -215,7 +215,7 @@ namespace JinEngine const char* name = luax_checkstring(L, 1); const char* code = luax_checkstring(L, 2); Thread* thread = new Thread(name, code, threadRunner); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread, new Shared<Thread>(thread, Jin_Lua_Thread)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread, new Shared<Thread>(L, thread, Jin_Lua_Thread)); return 1; } diff --git a/src/lua/modules/time/je_lua_time.cpp b/src/lua/modules/time/je_lua_time.cpp index 4eb579f..54ab798 100644 --- a/src/lua/modules/time/je_lua_time.cpp +++ b/src/lua/modules/time/je_lua_time.cpp @@ -33,7 +33,7 @@ namespace JinEngine LUA_IMPLEMENT int l_newTimer(lua_State* L) { - Shared<Timer>* shrTimer = new Shared<Timer>(new Timer(), Jin_Lua_Timer); + Shared<Timer>* shrTimer = new Shared<Timer>(L, new Timer(), Jin_Lua_Timer); luax_newinstance(L, Jin_Lua_Timer, shrTimer); return 1; } diff --git a/src/lua/modules/time/je_lua_timer.cpp b/src/lua/modules/time/je_lua_timer.cpp index ccb902a..570e537 100644 --- a/src/lua/modules/time/je_lua_timer.cpp +++ b/src/lua/modules/time/je_lua_timer.cpp @@ -44,7 +44,7 @@ namespace JinEngine for(int i = 4; i <= n; ++i) func->pushParam(i); Timer::Handler* handler = shared->every(s, timerCallback, func, finishCallback); - Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler); + Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(L, handler, Jin_Lua_Handler); Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler, shrHandler); return 1; } @@ -60,7 +60,7 @@ namespace JinEngine for (int i = 4; i <= n; ++i) func->pushParam(i); Timer::Handler* handler = shared->after(s, timerCallback, func, finishCallback); - Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler); + Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(L, handler, Jin_Lua_Handler); Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler, shrHandler); return 1; } @@ -77,7 +77,7 @@ namespace JinEngine for (int i = 5; i <= n; ++i) func->pushParam(i); Timer::Handler* handler = shared->repeat(s, count, timerCallback, func, finishCallback); - Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler); + Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(L, handler, Jin_Lua_Handler); Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler, shrHandler); return 1; } |