aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-12-07 11:46:49 +0800
committerchai <chaifix@163.com>2018-12-07 11:46:49 +0800
commitec6920656d8225538baaac677b62aa564fc1055e (patch)
tree1ee41f8aaad1bc5d324df8b6e4af0fd9ee2e281c
parent150944ee9e41df2ae5ee25c7845c3f5b2bd74af0 (diff)
*particle system demo
-rw-r--r--bin/SDL2.dllbin1279488 -> 1242112 bytes
-rw-r--r--bin/game/main.lua3
-rw-r--r--bin/jin.exebin554496 -> 1703424 bytes
-rw-r--r--bin/lua51.dllbin364544 -> 364544 bytes
-rw-r--r--build/vc++/jin/jin.vcxproj4
-rw-r--r--src/lua/common/je_lua_shared.cpp1
-rw-r--r--src/lua/common/je_lua_shared.hpp8
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp4
8 files changed, 13 insertions, 7 deletions
diff --git a/bin/SDL2.dll b/bin/SDL2.dll
index 0b08ce2..47c1b1e 100644
--- a/bin/SDL2.dll
+++ b/bin/SDL2.dll
Binary files differ
diff --git a/bin/game/main.lua b/bin/game/main.lua
index 6851c45..8de71f1 100644
--- a/bin/game/main.lua
+++ b/bin/game/main.lua
@@ -62,12 +62,11 @@ local function createAnimation(path, count, r, c, w, h, loop, speed)
return jin.graphics.newAnimation(sprs, loop, speed)
end
local Pi = 3.1415
-local tex = nil
function jin.core.onLoad()
-- bitmap = jin.graphics.newBitmap(200, 200, function(w, h, x, y)
-- return {255*math.sin(x/w),255 - 255,255*math.cos(y/w),255}
-- end)
- tex = jin.graphics.newTexture("particle.png")
+ local tex = jin.graphics.newTexture("particle.png")
particle_sprite = jin.graphics.newSprite(tex, jin.graphics.SpriteOrigin.MIDDLECENTER)
ps = jin.graphics.newParticleSystem()
diff --git a/bin/jin.exe b/bin/jin.exe
index c74c8b7..fffa828 100644
--- a/bin/jin.exe
+++ b/bin/jin.exe
Binary files differ
diff --git a/bin/lua51.dll b/bin/lua51.dll
index 88d71ef..4857c1e 100644
--- a/bin/lua51.dll
+++ b/bin/lua51.dll
Binary files differ
diff --git a/build/vc++/jin/jin.vcxproj b/build/vc++/jin/jin.vcxproj
index 20cad7c..1a0ca08 100644
--- a/build/vc++/jin/jin.vcxproj
+++ b/build/vc++/jin/jin.vcxproj
@@ -91,7 +91,7 @@
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <SubSystem>Windows</SubSystem>
+ <SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -107,7 +107,7 @@
<BrowseInformation>true</BrowseInformation>
</ClCompile>
<Link>
- <SubSystem>Windows</SubSystem>
+ <SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
diff --git a/src/lua/common/je_lua_shared.cpp b/src/lua/common/je_lua_shared.cpp
index 91a5105..eecf632 100644
--- a/src/lua/common/je_lua_shared.cpp
+++ b/src/lua/common/je_lua_shared.cpp
@@ -1,5 +1,6 @@
#include "je_lua.h"
#include "je_lua_shared.hpp"
+#include "libjin/jin.h"
namespace JinEngine
{
diff --git a/src/lua/common/je_lua_shared.hpp b/src/lua/common/je_lua_shared.hpp
index bfe0629..f89783d 100644
--- a/src/lua/common/je_lua_shared.hpp
+++ b/src/lua/common/je_lua_shared.hpp
@@ -13,7 +13,7 @@ namespace JinEngine
class LuaObject;
///
- /// Thread safe.
+ /// ̰߳ȫĹģ塣
///
class SharedBase
{
@@ -29,8 +29,10 @@ namespace JinEngine
SharedBase(const SharedBase&);
- // ͬһ̵߳lua_StateУLuaObjectEngineObjectӦһһӦLuaObject(lua runtime)
- // üͻաEngine-sideüΪά̵ͬ߳lua_StateͬһEngineObject
+ // ͬһ̵߳lua_StateУLuaObjectEngineObjectӦһһӦLuaObject(lua runtime)ü
+ // աEngine-sideüΪά̵ͬ߳lua_StateͬһEngineObjectÿLuaObjectһ
+ // Sharedʱһüͬһ߳УһEngineObjectֻһLuaObject󶨣new
+ // instanceУômCountͱEngineObjectĹ߳
void retain();
void release();
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
index 2fc8ecf..ea9a265 100644
--- a/src/lua/modules/graphics/je_lua_graphics.cpp
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -737,6 +737,7 @@ namespace JinEngine
int o = luax_checkinteger(L, 3);
Origin origin = static_cast<Origin>(o);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, origin), Jin_Lua_Sprite));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
}
else if (n == 4)
{
@@ -748,18 +749,21 @@ namespace JinEngine
int ox = luax_checkinteger(L, 3);
int oy = luax_checkinteger(L, 4);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, quad, ox, oy), Jin_Lua_Sprite));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
}
else if (n == 2)
{
int o = luax_checkinteger(L, 2);
Origin origin = static_cast<Origin>(o);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, origin), Jin_Lua_Sprite));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
}
else if (n == 3)
{
int ox = luax_checkinteger(L, 2);
int oy = luax_checkinteger(L, 3);
LuaObject* p = luax_newinstance(L, Jin_Lua_Sprite, new Shared<Sprite>(new Sprite(graphic, ox, oy), Jin_Lua_Sprite));
+ p->setDependency((int)SpriteDependency::DEP_GRAPHIC, objGraphic->getSharedBase());
}
else
{