From b4bd76b8b02996767798b76cc65dee9ea27f1167 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 7 Dec 2018 08:46:17 +0800 Subject: *misc --- bin/ParticleSystem.exe | Bin 1053696 -> 0 bytes bin/SDL2.dll | Bin 1279488 -> 1279488 bytes bin/game/config.lua | 2 +- bin/game/main.lua | 10 +- bin/jin.exe | Bin 1597440 -> 2056704 bytes bin/lua51.dll | Bin 364544 -> 364544 bytes build/vc++/3rdparty/Lua51/Lua51.vcxproj | 185 +++++++++++++++++++++ build/vc++/3rdparty/Lua51/Lua51.vcxproj.filters | 64 +++++++ build/vc++/3rdparty/Lua51/Lua51.vcxproj.user | 4 + .../3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj | 2 +- build/vc++/jin.sln | 11 ++ src/jin/main.cpp | 2 +- src/libjin/graphics/je_window.cpp | 5 +- src/lua/embed/embed.h | 26 ++- src/lua/jin.cpp | 3 +- src/lua/modules/graphics/je_lua_graphics.cpp | 2 +- 16 files changed, 293 insertions(+), 23 deletions(-) delete mode 100644 bin/ParticleSystem.exe create mode 100644 build/vc++/3rdparty/Lua51/Lua51.vcxproj create mode 100644 build/vc++/3rdparty/Lua51/Lua51.vcxproj.filters create mode 100644 build/vc++/3rdparty/Lua51/Lua51.vcxproj.user diff --git a/bin/ParticleSystem.exe b/bin/ParticleSystem.exe deleted file mode 100644 index b3ffd73..0000000 Binary files a/bin/ParticleSystem.exe and /dev/null differ diff --git a/bin/SDL2.dll b/bin/SDL2.dll index 65f23c8..0b08ce2 100644 Binary files a/bin/SDL2.dll and b/bin/SDL2.dll differ diff --git a/bin/game/config.lua b/bin/game/config.lua index 095ee28..ba2e9df 100644 --- a/bin/game/config.lua +++ b/bin/game/config.lua @@ -1,6 +1,6 @@ return { title = "window form", - icon = "splash.png", + --icon = "splash.png", vsync = true } \ No newline at end of file diff --git a/bin/game/main.lua b/bin/game/main.lua index 9070d2c..8ff5e68 100644 --- a/bin/game/main.lua +++ b/bin/game/main.lua @@ -61,9 +61,9 @@ local function createAnimation(path, count, r, c, w, h, loop, speed) end 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) + -- 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) shader_program = jin.graphics.newShader(shader) shader_program2 = jin.graphics.newShader(shader2) local animation = createAnimation("anim2.png", 27, 3, 10, 200, 200, true, 50) @@ -113,12 +113,12 @@ function jin.core.onDraw() --jin.graphics.draw(sprs[2], 150, 150, 1, 1, 0) local x, y = jin.mouse.getPosition() animator:render(x, y, 1, 1, 0) - jin.graphics.print(#sprs, 10, 10) + --jin.graphics.print(#sprs, 10, 10) jin.graphics.draw(spr, 100, 200, 1, 1, 0) --jin.graphics.useShader(shader_program2) --jin.graphics.draw(tex, 0, 0,0.2, 0.2) --jin.graphics.unuseShader() if stop then - jin.graphics.print("Quit", 100, 300) + --jin.graphics.print("Quit", 100, 300) end end \ No newline at end of file diff --git a/bin/jin.exe b/bin/jin.exe index 92d3665..b2288e4 100644 Binary files a/bin/jin.exe and b/bin/jin.exe differ diff --git a/bin/lua51.dll b/bin/lua51.dll index a47ab15..5f7d120 100644 Binary files a/bin/lua51.dll and b/bin/lua51.dll differ diff --git a/build/vc++/3rdparty/Lua51/Lua51.vcxproj b/build/vc++/3rdparty/Lua51/Lua51.vcxproj new file mode 100644 index 0000000..64eef69 --- /dev/null +++ b/build/vc++/3rdparty/Lua51/Lua51.vcxproj @@ -0,0 +1,185 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5} + Lua51 + 8.1 + + + + StaticLibrary + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)..\..\bin + lua51 + + + + Level3 + Disabled + true + true + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + + + + + Level3 + Disabled + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/vc++/3rdparty/Lua51/Lua51.vcxproj.filters b/build/vc++/3rdparty/Lua51/Lua51.vcxproj.filters new file mode 100644 index 0000000..caba523 --- /dev/null +++ b/build/vc++/3rdparty/Lua51/Lua51.vcxproj.filters @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/vc++/3rdparty/Lua51/Lua51.vcxproj.user b/build/vc++/3rdparty/Lua51/Lua51.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/vc++/3rdparty/Lua51/Lua51.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj b/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj index 30333ce..59e6f10 100644 --- a/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj +++ b/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj @@ -22,7 +22,7 @@ 15.0 {45AC0438-98A8-4369-A21D-BBCBE7995B34} LuaJIT205 - 10.0.17134.0 + 8.1 diff --git a/build/vc++/jin.sln b/build/vc++/jin.sln index ed41fc7..2fa044e 100644 --- a/build/vc++/jin.sln +++ b/build/vc++/jin.sln @@ -47,6 +47,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml2", "3rdparty\tinyxm EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luax", "3rdparty\luax\luax.vcxproj", "{C6B16179-5640-4D41-8756-0525D25EB569}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lua51", "3rdparty\Lua51\Lua51.vcxproj", "{4156CD69-6FC4-4B32-B008-BB94C8AE17F5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -183,6 +185,14 @@ Global {C6B16179-5640-4D41-8756-0525D25EB569}.Release|x64.Build.0 = Release|x64 {C6B16179-5640-4D41-8756-0525D25EB569}.Release|x86.ActiveCfg = Release|Win32 {C6B16179-5640-4D41-8756-0525D25EB569}.Release|x86.Build.0 = Release|Win32 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Debug|x64.ActiveCfg = Debug|x64 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Debug|x64.Build.0 = Debug|x64 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Debug|x86.ActiveCfg = Debug|Win32 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Debug|x86.Build.0 = Debug|Win32 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Release|x64.ActiveCfg = Release|x64 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Release|x64.Build.0 = Release|x64 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Release|x86.ActiveCfg = Release|Win32 + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -206,6 +216,7 @@ Global {45AC0438-98A8-4369-A21D-BBCBE7995B34} = {2A2F610D-E42B-426F-8DC8-79E0C6FCCDD2} {A5B92785-7D5A-4910-AA54-C0872F3C605D} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92} {C6B16179-5640-4D41-8756-0525D25EB569} = {65DFFFA6-F434-47FB-9DB2-DCF019060B92} + {4156CD69-6FC4-4B32-B008-BB94C8AE17F5} = {2A2F610D-E42B-426F-8DC8-79E0C6FCCDD2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {633D8D43-3349-43F7-8835-7D7F58BAD2A8} diff --git a/src/jin/main.cpp b/src/jin/main.cpp index f76bda7..e2f5763 100644 --- a/src/jin/main.cpp +++ b/src/jin/main.cpp @@ -17,7 +17,7 @@ using namespace JinEngine::Filesystem; // Load game under cwd. static void load(const char* cwd) { - // Global lua runtime. + // Main thread lua runtime. lua_State* L = luax_newstate(); // Open lua standard module. diff --git a/src/libjin/graphics/je_window.cpp b/src/libjin/graphics/je_window.cpp index 148f1b9..e7cdf06 100644 --- a/src/libjin/graphics/je_window.cpp +++ b/src/libjin/graphics/je_window.cpp @@ -68,7 +68,7 @@ namespace JinEngine if (mWnd == NULL) return false; - // Set window icon + // Set window icon. try { Bitmap* bitmap = new Bitmap(icon); @@ -97,9 +97,6 @@ namespace JinEngine // Bind to default canvas. gl.unbindCanvas(); gl.unuseShader(); - //Shader::unuse(); - // Avoid white blinnk. - swapBuffers(); return true; } diff --git a/src/lua/embed/embed.h b/src/lua/embed/embed.h index a063e65..4b1c6d9 100644 --- a/src/lua/embed/embed.h +++ b/src/lua/embed/embed.h @@ -14,30 +14,38 @@ namespace JinEngine }; // Embed scripts. -#include "scripts/graphics.lua.h" -#include "scripts/keyboard.lua.h" -#include "scripts/mouse.lua.h" -#include "scripts/boot.lua.h" + #include "scripts/graphics.lua.h" + #include "scripts/keyboard.lua.h" + #include "scripts/mouse.lua.h" + #include "scripts/boot.lua.h" // In order. - static const jin_Embed scripts[] = { + static const jin_Embed modules[] = { { "graphics.lua", graphics_lua }, { "keyboard.lua", keyboard_lua }, { "mouse.lua", mouse_lua }, - { "boot.lua", boot_lua }, { 0, 0 } }; - static void boot(lua_State* L) + static const jin_Embed boot_script = { "boot", boot_lua }; + + static void load(lua_State* L) { - for (int i = 0; scripts[i].file; ++i) + for (int i = 0; modules[i].file; ++i) { - const char* file = scripts[i].file, *source = scripts[i].source; + const char* file = modules[i].file, *source = modules[i].source; if (luax_loadbuffer(L, source, strlen(source), file) == 0) lua_call(L, 0, 0); } } + static void run(lua_State* L) + { + const char* file = boot_script.file, *source = boot_script.source; + if (luax_loadbuffer(L, source, strlen(source), file) == 0) + lua_call(L, 0, 0); + } + } // namespace Embed } // namespace JinEngine diff --git a/src/lua/jin.cpp b/src/lua/jin.cpp index b11488b..79a7bf8 100644 --- a/src/lua/jin.cpp +++ b/src/lua/jin.cpp @@ -95,8 +95,9 @@ namespace JinEngine luax_newtable(L); luax_setfieldstring(L, "cwd", cwd); luax_setfield(L, -2, "args"); + Embed::load(L); luax_clearstack(L); - JinEngine::Embed::boot(L); + Embed::run(L); } } // namespace Lua diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp index 8ace62c..981e30f 100644 --- a/src/lua/modules/graphics/je_lua_graphics.cpp +++ b/src/lua/modules/graphics/je_lua_graphics.cpp @@ -34,7 +34,7 @@ namespace JinEngine namespace Lua { -#include "../../resources/font.ttf.h" + #include "../../resources/font.ttf.h" static struct { -- cgit v1.1-26-g67d0