diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libjin/graphics/particles/je_particle.cpp | 6 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_graphics.cpp | 26 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/libjin/graphics/particles/je_particle.cpp b/src/libjin/graphics/particles/je_particle.cpp index fc3dc54..71c0426 100644 --- a/src/libjin/graphics/particles/je_particle.cpp +++ b/src/libjin/graphics/particles/je_particle.cpp @@ -125,6 +125,10 @@ namespace JinEngine void Particle::update(float dt) { + life += dt; + alive = life < lifeTime; + if (!alive) + return; float t = life / lifeTime; if ((updateFlags & UPDATE_COLOR) != 0) color = def->colorDef.overTime.value.getColor(t); @@ -159,8 +163,6 @@ namespace JinEngine spriteIndex = lerp<int>(0, n - 1, t); //jin_log_info("sprite index %d", spriteIndex); } - life += dt; - alive = life < lifeTime; } void Particle::render() diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp index ea9a265..c6e6e13 100644 --- a/src/lua/modules/graphics/je_lua_graphics.cpp +++ b/src/lua/modules/graphics/je_lua_graphics.cpp @@ -56,13 +56,13 @@ namespace JinEngine Window* wnd = Window::get(); Window::Setting setting; - setting.width = luax_getfieldinteger(L, 1, "width"); - setting.height = luax_getfieldinteger(L, 1, "height"); - setting.title = luax_getfieldstring(L, 1, "title"); - setting.icon = luax_getfieldstring(L, 1, "icon"); - setting.vsync = luax_getfieldbool(L, 1, "vsync"); - setting.fullscreen = luax_getfieldbool(L, 1, "fullscreen"); - setting.resizable = luax_getfieldbool(L, 1, "resizable"); + setting.width = luax_getfieldinteger(L, 1, "width"); + setting.height = luax_getfieldinteger(L, 1, "height"); + setting.title = luax_getfieldstring(L, 1, "title"); + setting.icon = luax_getfieldstring(L, 1, "icon"); + setting.vsync = luax_getfieldbool(L, 1, "vsync"); + setting.fullscreen = luax_getfieldbool(L, 1, "fullscreen"); + setting.resizable = luax_getfieldbool(L, 1, "resizable"); context.initialized = wnd->start(&setting); if (!context.initialized) { @@ -994,7 +994,7 @@ namespace JinEngine { "destroy", l_destroy }, { "hideWindow", l_hideWindow }, { "showWindow", l_showWindow }, - /* creators */ + /* creators */ { "newBitmap", l_newBitmap }, { "newTexture", l_newTexture }, { "newShader", l_newShader }, @@ -1017,22 +1017,22 @@ namespace JinEngine { "setColor", l_setColor }, { "getColor", l_getColor }, { "present", l_present }, - /* canvas */ + /* canvas */ { "bindCanvas", l_bindCanvas }, { "unbindCanvas", l_unbindCanvas }, - /* shader */ + /* shader */ { "useShader", l_useShader }, - /* shapes */ + /* shapes */ { "point", l_point }, { "line", l_line }, { "rect", l_rect }, { "circle", l_circle }, { "triangle", l_triangle }, { "polygon", l_polygon }, - /* font */ + /* font */ { "setFont", l_setFont }, { "unsetFont", l_unsetFont }, - /* transform */ + /* transform */ { "pushMatrix", l_pushMatrix }, { "clearMatrix", l_clearMatrix }, { "popMatrix", l_popMatrix }, |