From 85b0b5d30e3e5946c90073a5e07dc3f35df87ea2 Mon Sep 17 00:00:00 2001 From: Patedam Date: Sat, 1 Feb 2025 21:05:13 -0500 Subject: [PATCH] Added Game project that will contain the game + game framework --- Game/Game.vcxproj | 111 ++++++++++++++++++++++++++++++++++++++ Game/Game.vcxproj.filters | 22 ++++++++ Game/dllmain.cpp | 66 +++++++++++++++++++++++ 3 files changed, 199 insertions(+) create mode 100644 Game/Game.vcxproj create mode 100644 Game/Game.vcxproj.filters create mode 100644 Game/dllmain.cpp diff --git a/Game/Game.vcxproj b/Game/Game.vcxproj new file mode 100644 index 0000000..7d7fd0a --- /dev/null +++ b/Game/Game.vcxproj @@ -0,0 +1,111 @@ + + + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {B7B12DCC-1A69-4371-A9FE-D6E7671497B0} + Win32Proj + Game + 10.0.26100.0 + + + + x64 + + + DynamicLibrary + true + ClangCL + Unicode + + + DynamicLibrary + false + ClangCL + true + Unicode + + + + + + + + + + + + + + + true + $(SolutionDir)Juliet\include\;$(SolutionDir)Game;$(IncludePath) + $(SolutionDir)\bin\$(Platform)\$(Configuration)\;$(LibraryPath) + $(SolutionDir)\bin\$(Platform)\$(Configuration)\ + $(SolutionDir)Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + + + false + + + + NotUsing + Level3 + Disabled + true + _DEBUG;CPPDYNAMICLIBRARYTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + stdcpp20 + + + Windows + true + + + + + NotUsing + Level3 + MaxSpeed + true + true + true + NDEBUG;CPPDYNAMICLIBRARYTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + true + + + + + + + + + {1bbc0b92-e4d8-4838-974b-439c5c501e82} + Juliet + + + + + + + + + + \ No newline at end of file diff --git a/Game/Game.vcxproj.filters b/Game/Game.vcxproj.filters new file mode 100644 index 0000000..255b476 --- /dev/null +++ b/Game/Game.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/Game/dllmain.cpp b/Game/dllmain.cpp new file mode 100644 index 0000000..ac4b1ff --- /dev/null +++ b/Game/dllmain.cpp @@ -0,0 +1,66 @@ +#include +#include // TODO: remove because our dll should not be platform dependant + +#include +#include + +// Test code +namespace Game +{ + struct Door + { + DECLARE_ENTITY() + bool IsOpened; + }; + DEFINE_ENTITY(Door); + + struct Rock + { + DECLARE_ENTITY() + int Health; + }; + DEFINE_ENTITY(Rock); + +} // namespace Game + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + using namespace Game; + + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + { + // Entity Use case + InitEntityManager(); + auto& manager = GetEntityManager(); + Door* door = MakeEntity(manager, 10.0f, 2.0f); + door->IsOpened = true; + + Entity* ent = door->Base; + Door* stillDoor = DownCast(ent); + Assert(door == stillDoor); + + Rock* rock = MakeEntity(manager, 1.f, 2.f); + rock->Health = 100; + Assert(door->Base != rock->Base); + + printf("Door is %s\n", door->IsOpened ? "Opened" : "Closed"); + printf("Rock has %d health points\n", rock->Health); + + // Have to manually free for now because im not using arenas or anything + free(door->Base); + free(door); + free(rock->Base); + free(rock); + + break; + } + + case DLL_THREAD_ATTACH: break; + case DLL_THREAD_DETACH: break; + case DLL_PROCESS_DETACH: break; + } + + return TRUE; +}