diff --git a/.gitignore b/.gitignore index f19a100..ed8d70e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,11 @@ bin/ build/ intermediate/ +packages/ +*.vcxproj +*.vcxproj.user compile_commands.json Makefile +.vs +.idea +*.sln diff --git a/Build.lua b/Build.lua index 3402f02..a2777cf 100644 --- a/Build.lua +++ b/Build.lua @@ -1,12 +1,14 @@ workspace "Fencer-Template" architecture "x64" configurations { "Debug", "Release", "Dist" } + language "C" startproject "Game" filter "system:windows" + defines { "SDL_MAIN_HANDLED" } buildoptions { "/EHsc", "/Zc:preprocessor" } - OutputDir = "%{cfg.system}-%{cfg.architecture}/${cfg.buildcfg}" + OutputDir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}" group "Core" diff --git a/SDL2.dll b/SDL2.dll new file mode 100644 index 0000000..e26bcb1 Binary files /dev/null and b/SDL2.dll differ diff --git a/SDL2.lib b/SDL2.lib new file mode 100644 index 0000000..99c5321 Binary files /dev/null and b/SDL2.lib differ diff --git a/SDL2_image.dll b/SDL2_image.dll new file mode 100644 index 0000000..277e981 Binary files /dev/null and b/SDL2_image.dll differ diff --git a/SDL2_image.lib b/SDL2_image.lib new file mode 100644 index 0000000..b29fee0 Binary files /dev/null and b/SDL2_image.lib differ diff --git a/SDL2main.lib b/SDL2main.lib new file mode 100644 index 0000000..241e7c3 Binary files /dev/null and b/SDL2main.lib differ diff --git a/SDL2test.lib b/SDL2test.lib new file mode 100644 index 0000000..1fa2ecb Binary files /dev/null and b/SDL2test.lib differ diff --git a/core/Build-Core.lua b/core/Build-Core.lua index c4dbd8a..8bdb34e 100644 --- a/core/Build-Core.lua +++ b/core/Build-Core.lua @@ -6,7 +6,7 @@ project "Engine-Core" defines { "VMATH_SDL" } - files { "src/**.c" } + files { "src/**.c", "src/**.h" } includedirs { "src/" } targetdir ( "../bin/" .. OutputDir .. "/%{prj.name}" ) diff --git a/core/src/asset.h b/core/src/asset.h index c113ed5..f5739b7 100644 --- a/core/src/asset.h +++ b/core/src/asset.h @@ -23,7 +23,7 @@ static inline Asset T##_as_Asset(T* x) {\ TC_FN_TYPECHECK(asset_id, get_id_f, T*);\ TC_FN_TYPECHECK(void, set_id_f, T*, asset_id);\ TC_FN_TYPECHECK(Drop, T##_as_Drop, T*);\ - static IAsset tc = (IAsset){\ + static IAsset const tc = {\ .get_id = (asset_id(*const)(void*)) get_id_f,\ .set_id = (void(*const)(void*,asset_id)) set_id_f,\ };\ diff --git a/core/src/spritesheet.h b/core/src/spritesheet.h index 8d76e38..6d56887 100644 --- a/core/src/spritesheet.h +++ b/core/src/spritesheet.h @@ -25,7 +25,7 @@ impl_Drop_for(Spritesheet, _internal_spritesheet_destroy ) -impl_Asset_for(Spritesheet, +impl_Asset_for(Spritesheet, spritesheet_get_asset_id, spritesheet_set_asset_id ) diff --git a/core/src/vmath.h b/core/src/vmath.h index 9b2aed2..4c92d6b 100644 --- a/core/src/vmath.h +++ b/core/src/vmath.h @@ -4,6 +4,11 @@ #include "stddef.h" #include +#if defined _WIN32 && ! defined isnanf +# define isnanf(x) _isnanf(x) +# define HAVE_ISNANF +#endif + #if VMATH_SDL == 1 #include diff --git a/game/Build-Game.lua b/game/Build-Game.lua index 82d3bd6..fd6bf22 100644 --- a/game/Build-Game.lua +++ b/game/Build-Game.lua @@ -1,12 +1,12 @@ project "Game" - kind "ConsoleApp" + kind "WindowedApp" language "C" staticruntime "Off" targetdir "bin/%{cfg.buildcfg}" defines { "VMATH_SDL" } - files { "src/*.c" } + files { "src/**.c", "src/**.h" } includedirs { "src/", "../core/src" @@ -15,11 +15,16 @@ project "Game" "Engine-Core" } - links { "SDL2", "SDL2_image", "SDL2_ttf", "m", "cjson"} - targetdir ("../bin/" .. OutputDir .. "/%{prj.name}" ) objdir ("../intermediate/" .. OutputDir .. "/%{prj.name}" ) + filter "system:linux" + links { "SDL2", "SDL2_image", "SDL2_ttf", "m", "cjson"} + + filter "system:windows" + linkoptions { "/ENTRY:mainCRTStartup" } + links { "../SDL2.dll", "../SDL2_image.dll" } + filter "configurations:Debug" defines { "DEBUG" } runtime "Debug"