diff --git a/Code/DanBias.sln b/Code/DanBias.sln index 6d11c6b9..22937dd2 100644 --- a/Code/DanBias.sln +++ b/Code/DanBias.sln @@ -52,8 +52,8 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Mixed Platforms.Build.0 = Release|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Release|x64 - {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Release|x64 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.ActiveCfg = Debug|Win32 + {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|Win32.Build.0 = Debug|Win32 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.ActiveCfg = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Debug|x64.Build.0 = Release|x64 {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -64,8 +64,8 @@ Global {0EC83E64-230E-48EF-B08C-6AC9651B4F82}.Release|x64.Build.0 = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Mixed Platforms.Build.0 = Release|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Release|x64 - {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Release|x64 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.ActiveCfg = Debug|Win32 + {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|Win32.Build.0 = Debug|Win32 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.ActiveCfg = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Debug|x64.Build.0 = Release|x64 {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -76,8 +76,8 @@ Global {F10CBC03-9809-4CBA-95D8-327C287B18EE}.Release|x64.Build.0 = Release|x64 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Mixed Platforms.Build.0 = Release|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Release|x64 - {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.Build.0 = Release|x64 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.ActiveCfg = Debug|Win32 + {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|Win32.Build.0 = Debug|Win32 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.ActiveCfg = Release|x64 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Debug|x64.Build.0 = Release|x64 {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -88,8 +88,8 @@ Global {4285BD3F-3C6C-4670-B7AF-A29AFEF5F6A8}.Release|x64.Build.0 = Release|x64 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Mixed Platforms.Build.0 = Release|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Release|x64 - {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.Build.0 = Release|x64 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.ActiveCfg = Debug|Win32 + {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|Win32.Build.0 = Debug|Win32 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.ActiveCfg = Release|x64 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Debug|x64.Build.0 = Release|x64 {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -100,8 +100,8 @@ Global {34D6295A-00DD-4B1A-8258-97DA2818EC26}.Release|x64.Build.0 = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Mixed Platforms.Build.0 = Release|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Release|x64 - {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Release|x64 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|Win32.Build.0 = Debug|Win32 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.ActiveCfg = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Debug|x64.Build.0 = Release|x64 {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -112,8 +112,8 @@ Global {35AEA3C0-E0A7-4E1E-88CD-514AA5A442B1}.Release|x64.Build.0 = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Mixed Platforms.Build.0 = Release|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.ActiveCfg = Release|x64 - {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.Build.0 = Release|x64 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.ActiveCfg = Debug|Win32 + {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|Win32.Build.0 = Debug|Win32 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.ActiveCfg = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Debug|x64.Build.0 = Release|x64 {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -124,8 +124,8 @@ Global {7E3990D2-3D94-465C-B58D-64A74B3ECF9B}.Release|x64.Build.0 = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.ActiveCfg = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Mixed Platforms.Build.0 = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Release|x64 - {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Release|x64 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.ActiveCfg = Debug|Win32 + {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|Win32.Build.0 = Debug|Win32 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.ActiveCfg = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Debug|x64.Build.0 = Release|x64 {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE}.Release|Mixed Platforms.ActiveCfg = Release|x64 @@ -172,8 +172,8 @@ Global {C5AA09D0-6594-4CD3-BD92-1D380C7B3B50}.Release|x64.Build.0 = Release|x64 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.ActiveCfg = Release|Win32 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Mixed Platforms.Build.0 = Release|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Release|Win32 - {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Release|Win32 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32 + {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Release|x64 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Release|x64 {104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32 diff --git a/Code/Game/DanBiasGame/DLLMain.cpp b/Code/Game/DanBiasGame/DLLMain.cpp index a4c548e1..e2d438ba 100644 --- a/Code/Game/DanBiasGame/DLLMain.cpp +++ b/Code/Game/DanBiasGame/DLLMain.cpp @@ -1,8 +1,8 @@ - +#define NOMINMAX #include BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved ) { - MessageBox(0, L"DanBiasGame Loaded", 0, 0); + //MessageBox(0, L"DanBiasGame Loaded", 0, 0); return TRUE; } \ No newline at end of file diff --git a/Code/Game/DanBiasGame/DanBiasGame.vcxproj b/Code/Game/DanBiasGame/DanBiasGame.vcxproj index d2d48214..0b9d07d3 100644 --- a/Code/Game/DanBiasGame/DanBiasGame.vcxproj +++ b/Code/Game/DanBiasGame/DanBiasGame.vcxproj @@ -72,6 +72,7 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; + $(SolutionDir)..\External\Include\;$(IncludePath) true @@ -79,6 +80,7 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; + $(SolutionDir)..\External\Include\;$(IncludePath) false @@ -86,6 +88,7 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) C:\Program Files %28x86%29\Visual Leak Detector\lib\Win32;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; + $(SolutionDir)..\External\Include\;$(IncludePath) false @@ -93,6 +96,7 @@ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) C:\Program Files %28x86%29\Visual Leak Detector\lib\Win64;$(LibraryPath)$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; + $(SolutionDir)..\External\Include\;$(IncludePath) @@ -100,7 +104,7 @@ Level3 Disabled - DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) @@ -108,7 +112,7 @@ Windows true OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -117,7 +121,7 @@ Level3 Disabled - DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) true $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) @@ -125,7 +129,7 @@ Windows true OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + OysterGraphics_$(PlatformShortName)D.dll;%(DelayLoadDLLs) @@ -136,7 +140,7 @@ MaxSpeed true true - DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) @@ -146,7 +150,7 @@ true true OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + OysterGraphics_x86.dll;%(DelayLoadDLLs) @@ -157,7 +161,7 @@ MaxSpeed true true - DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + DANBIAS_CLIENT;DANBIAS_GAME_DLL_EXPORT;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true $(SolutionDir)GameLogic;$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;%(AdditionalIncludeDirectories) @@ -167,7 +171,7 @@ true true OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;%(AdditionalDependencies) - OysterGraphics_$(PlatformShortName)D.dll;GameLogic_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + OysterGraphics_x86.dll;%(DelayLoadDLLs) @@ -182,7 +186,7 @@ - + diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp new file mode 100644 index 00000000..09fa36b8 --- /dev/null +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -0,0 +1,229 @@ +#define NOMINMAX +#include +#include "Include\DanBiasGame.h" + +namespace DanBias +{ + __int64 DanBiasGame::cntsPerSec = 0; + __int64 DanBiasGame::prevTimeStamp = 0; + float DanBiasGame::secsPerCnt = 0; + InputClass* DanBiasGame::inputObj = NULL; + HINSTANCE DanBiasGame::g_hInst = NULL; + HWND DanBiasGame::g_hWnd = NULL; + +#pragma region Game Data + class DanBiasGamePrivateData + { + + public: + DanBiasGamePrivateData() + { + + } + ~DanBiasGamePrivateData() + { + + } + + public: + + } data; +#pragma endregion + + //-------------------------------------------------------------------------------------- + // Interface API functions + //-------------------------------------------------------------------------------------- + DanBiasClientReturn DanBiasGame::Initiate(DanBiasGameDesc& desc) + { + if( FAILED( InitWindow( desc.hinst, desc.nCmdShow ) )) + return DanBiasClientReturn_Error; + + if( FAILED( InitDirect3D() ) ) + return DanBiasClientReturn_Error; + + if( FAILED( InitGame() ) ) + return DanBiasClientReturn_Error; + + cntsPerSec = 0; + QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec); + secsPerCnt = 1.0f / (float)cntsPerSec; + + prevTimeStamp = 0; + QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp); + + return DanBiasClientReturn_Sucess; + } + + DanBiasClientReturn DanBiasGame::Run() + { + // Main message loop + MSG msg = {0}; + while(WM_QUIT != msg.message) + { + if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE) ) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + else + { + __int64 currTimeStamp = 0; + QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp); + float dt = (currTimeStamp - prevTimeStamp) * secsPerCnt; + + //render + Update(dt); + Render(dt); + + prevTimeStamp = currTimeStamp; + } + } + return DanBiasClientReturn_Sucess; + } + + void DanBiasGame::Release() + { + CleanUp(); + } + + + //-------------------------------------------------------------------------------------- + // Register class and create window + //-------------------------------------------------------------------------------------- + HRESULT DanBiasGame::InitWindow( HINSTANCE hInstance, int nCmdShow ) + { + // Register class + WNDCLASSEX wcex; + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = 0; + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = NULL; + wcex.lpszClassName = L"BTH_D3D_Template"; + wcex.hIconSm = 0; + if( !RegisterClassEx(&wcex) ) + return E_FAIL; + + // Adjust and create window + g_hInst = hInstance; + RECT rc = { 0, 0, 1024, 768 }; + AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE ); + + if(!(g_hWnd = CreateWindow( + L"BTH_D3D_Template", + L"BTH - Direct3D 11.0 Template", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + rc.right - rc.left, + rc.bottom - rc.top, + NULL, + NULL, + hInstance, + NULL))) + { + return E_FAIL; + } + ShowWindow( g_hWnd, nCmdShow ); + + return S_OK; + } + + //-------------------------------------------------------------------------------------- + // Create Direct3D with Oyster Graphics + //-------------------------------------------------------------------------------------- + HRESULT DanBiasGame::InitDirect3D() + { + if(Oyster::Graphics::API::Init(g_hWnd, false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess) + return E_FAIL; + return S_OK; + } + + //-------------------------------------------------------------------------------------- + // Init the input and the game + //------------------------------------------------------------------------------------- + HRESULT DanBiasGame::InitGame() + { + inputObj = new InputClass; + if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768)) + { + MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK); + return E_FAIL; + } + + return S_OK; + } + + HRESULT DanBiasGame::Update(float deltaTime) + { + inputObj->Update(); + + return S_OK; + } + + HRESULT DanBiasGame::Render(float deltaTime) + { + int isPressed = 0; + if(inputObj->IsKeyPressed(DIK_A)) + { + isPressed = 1; + } + + Oyster::Graphics::API::NewFrame(Oyster::Math3D::Float4x4::null, Oyster::Math3D::Float4x4::null); + + wchar_t title[255]; + swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed)); + SetWindowText(g_hWnd, title); + + Oyster::Graphics::API::EndFrame(); + + return S_OK; + } + + HRESULT DanBiasGame::CleanUp() + { + return S_OK; + } + + //-------------------------------------------------------------------------------------- + // Called every time the application receives a message + //-------------------------------------------------------------------------------------- + LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) + { + PAINTSTRUCT ps; + HDC hdc; + + switch (message) + { + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + case WM_KEYDOWN: + + switch(wParam) + { + case VK_ESCAPE: + PostQuitMessage(0); + break; + } + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; + } + +} //End namespace DanBias \ No newline at end of file diff --git a/Code/Game/DanBiasGame/DanBiasMaincpp.cpp b/Code/Game/DanBiasGame/DanBiasMaincpp.cpp index 23c1a119..0b7ea666 100644 --- a/Code/Game/DanBiasGame/DanBiasMaincpp.cpp +++ b/Code/Game/DanBiasGame/DanBiasMaincpp.cpp @@ -9,7 +9,7 @@ #include #include "DllInterfaces/GFXAPI.h" -#include "IGame.h" +//#include "IGame.h" #include "L_inputClass.h" @@ -28,7 +28,7 @@ HINSTANCE g_hInst = NULL; HWND g_hWnd = NULL; -GameLogic::IGame* game; +//GameLogic::IGame* game; InputClass* inputObj; @@ -205,34 +205,34 @@ HRESULT InitGame() MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK); return false; } - game = new GameLogic::IGame(); + /*game = new GameLogic::IGame(); game->Init(); game->StartGame(); - + */ return S_OK; } HRESULT Update(float deltaTime) { inputObj->Update(); - GameLogic::keyInput key = GameLogic::keyInput_none; + //GameLogic::keyInput key = GameLogic::keyInput_none; - if(inputObj->IsKeyPressed(DIK_W)) - { - key = GameLogic::keyInput_W; - } - else if(inputObj->IsKeyPressed(DIK_A)) - { - key = GameLogic::keyInput_A; - } - else if(inputObj->IsKeyPressed(DIK_S)) - { - key = GameLogic::keyInput_S; - } - else if(inputObj->IsKeyPressed(DIK_D)) - { - key = GameLogic::keyInput_D; - } + //if(inputObj->IsKeyPressed(DIK_W)) + //{ + // key = GameLogic::keyInput_W; + //} + //else if(inputObj->IsKeyPressed(DIK_A)) + //{ + // key = GameLogic::keyInput_A; + //} + //else if(inputObj->IsKeyPressed(DIK_S)) + //{ + // key = GameLogic::keyInput_S; + //} + //else if(inputObj->IsKeyPressed(DIK_D)) + //{ + // key = GameLogic::keyInput_D; + //} float pitch = 0; float yaw = 0; @@ -243,7 +243,7 @@ HRESULT Update(float deltaTime) yaw = inputObj->GetYaw(); //} - game->Update(key, pitch, yaw); + //game->Update(key, pitch, yaw); return S_OK; @@ -258,7 +258,7 @@ HRESULT Render(float deltaTime) //std::cout<<"test"; } - game->Render(); + //game->Render(); wchar_t title[255]; swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed)); SetWindowText(g_hWnd, title); @@ -271,11 +271,11 @@ HRESULT Render(float deltaTime) HRESULT CleanUp() { - if(game) + /*if(game) { - delete game; - game = NULL; - } + delete game; + game = NULL; + }*/ return S_OK; } //-------------------------------------------------------------------------------------- diff --git a/Code/Game/DanBiasGame/Include/DanBiasGame.h b/Code/Game/DanBiasGame/Include/DanBiasGame.h index c24fe460..d1adba92 100644 --- a/Code/Game/DanBiasGame/Include/DanBiasGame.h +++ b/Code/Game/DanBiasGame/Include/DanBiasGame.h @@ -7,10 +7,17 @@ #define DANBIAS_GAME_DLL __declspec(dllimport) #endif +#define NOMINMAX +#include + +#include "DllInterfaces/GFXAPI.h" +#include "L_inputClass.h" + namespace DanBias { extern "C" { + enum DanBiasClientReturn { DanBiasClientReturn_Error, @@ -21,17 +28,42 @@ namespace DanBias { //Stuff goes here... int port; - }; + HINSTANCE hinst; + int nCmdShow; + }; + LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); + class DANBIAS_GAME_DLL DanBiasGame { public: + //-------------------------------------------------------------------------------------- + // Interface API functions + //-------------------------------------------------------------------------------------- static DanBiasClientReturn Initiate(DanBiasGameDesc& desc); static DanBiasClientReturn Run(); static void Release(); + + private: + + static HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow); + static HRESULT InitDirect3D(); + static HRESULT InitGame(); + + static HRESULT Update(float deltaTime); + static HRESULT Render(float deltaTime); + static HRESULT CleanUp(); + private: + static __int64 cntsPerSec; + static __int64 prevTimeStamp; + static float secsPerCnt; + static InputClass* inputObj; + static HINSTANCE g_hInst; + static HWND g_hWnd; }; + }//End Extern "C" -} //End namspace DanBias +} //End namespace DanBias #endif // !DANBIASGAME_DANBIASGAME_H diff --git a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj index 2605ece8..5a4ebeb6 100644 --- a/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj +++ b/Code/Game/DanBiasLauncher/DanBiasLauncher.vcxproj @@ -71,32 +71,32 @@ $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(IncludePath) - $(OutDir)..\DLL\;$(LibraryPath); + $(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath) + $(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; true $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D - $(IncludePath) - $(OutDir)..\DLL\;$(LibraryPath); + $(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath) + $(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; false $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(IncludePath) - $(OutDir)..\DLL\;$(LibraryPath); + $(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath) + $(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; false $(SolutionDir)..\Bin\Executable\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) - $(IncludePath) - $(OutDir)..\DLL\;$(LibraryPath); + $(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath) + $(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL; @@ -105,13 +105,13 @@ Level3 Disabled WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - $(SolutionDir)Game\DanBiasServer\Include + $(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include Windows true - DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - DanBiasServer_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) + GameLogic_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) @@ -121,13 +121,13 @@ Level3 Disabled WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - $(SolutionDir)Game\DanBiasServer\Include + $(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include Windows true - DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs) - DanBiasServer_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) + GameLogic_$(PlatformShortName)D.dll;OysterGraphics_$(PlatformShortName)D.dll;DanBiasServer_$(PlatformShortName)D.dll;DanBiasGame_$(PlatformShortName)D.dll;%(DelayLoadDLLs) + Input_$(PlatformShortName)D.lib;GameLogic_$(PlatformShortName)D.lib;DanBiasServer_$(PlatformShortName)D.lib;DanBiasGame_$(PlatformShortName)D.lib;%(AdditionalDependencies) @@ -139,15 +139,15 @@ true true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - $(SolutionDir)Game\DanBiasServer\Include + $(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include Windows true true true - DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs) - DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) + GameLogic_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs) + Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) @@ -159,20 +159,46 @@ true true WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - $(SolutionDir)Game\DanBiasServer\Include + $(SolutionDir)Input;$(SolutionDir)Include;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterGraphics\;$(SolutionDir)Game\DanBiasServer\Include;$(SolutionDir)Game\DanBiasGame\Include Windows true true true - DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs) - DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) + GameLogic_$(PlatformShortName).dll;OysterGraphics_$(PlatformShortName).dll;DanBiasServer_$(PlatformShortName).dll;DanBiasGame_$(PlatformShortName).dll;%(DelayLoadDLLs) + Input_$(PlatformShortName).lib;GameLogic_$(PlatformShortName).lib;DanBiasServer_$(PlatformShortName).lib;DanBiasGame_$(PlatformShortName).lib;%(AdditionalDependencies) + + + {104fa3e9-94d9-4e1d-a941-28a03bc8a095} + + + {7e3990d2-3d94-465c-b58d-64a74b3ecf9b} + + + {2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee} + + + {0ec83e64-230e-48ef-b08c-6ac9651b4f82} + + + {f10cbc03-9809-4cba-95d8-327c287b18ee} + + + {2a1bc987-af42-4500-802d-89cd32fc1309} + + + {52380daa-0f4a-4d97-8e57-98df39319caf} + + + {b1195bb9-b3a5-47f0-906c-8dea384d1520} + + diff --git a/Code/Game/DanBiasLauncher/Launcher.cpp b/Code/Game/DanBiasLauncher/Launcher.cpp index b1cab1ee..dff589fc 100644 --- a/Code/Game/DanBiasLauncher/Launcher.cpp +++ b/Code/Game/DanBiasLauncher/Launcher.cpp @@ -1,10 +1,11 @@ ///////////////////////////////////////////////// // Launcher to launch Danbias server or client // ///////////////////////////////////////////////// +#define NOMINMAX #include -#define DANBIAS_SERVER -//#define DANBIAS_CLIENT +//#define DANBIAS_SERVER +#define DANBIAS_CLIENT #if defined(DANBIAS_SERVER) @@ -30,8 +31,21 @@ int WINAPI WinMain( HINSTANCE hinst, HINSTANCE prevInst, PSTR cmdLine, int cmdSh DanBias::DanBiasServer::Release(); } #elif defined(DANBIAS_CLIENT) + if(SetDllDirectory(L"..\\DLL") == FALSE) + { + return cmdShow; + } // Game client starter code goes here - return cmdShow; + DanBias::DanBiasGameDesc gameDesc; + gameDesc.port = 1; + gameDesc.hinst = hinst; + gameDesc.nCmdShow = cmdShow; + + if( DanBias::DanBiasGame::Initiate(gameDesc) == DanBias::DanBiasClientReturn_Sucess) + { + DanBias::DanBiasGame::Run(); + DanBias::DanBiasGame::Release(); + } #endif return cmdShow; diff --git a/Code/Game/DanBiasServer/DanBiasServer_Impl.cpp b/Code/Game/DanBiasServer/DanBiasServer_Impl.cpp index 4d4c753b..83450989 100644 --- a/Code/Game/DanBiasServer/DanBiasServer_Impl.cpp +++ b/Code/Game/DanBiasServer/DanBiasServer_Impl.cpp @@ -3,6 +3,7 @@ namespace DanBias { + #pragma region Server Data class DanBiasServerPrivateData { diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj index c22b4ef8..8afb5bb4 100644 --- a/Code/Game/GameLogic/GameLogic.vcxproj +++ b/Code/Game/GameLogic/GameLogic.vcxproj @@ -101,6 +101,7 @@ true OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies) + GamePhysics_$(PlatformShortName)D.dll diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index a1f03da3..67385874 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -17,7 +17,7 @@ Object::Object(std::wstring objFile) //model = new Model(); model = Oyster::Graphics::API::CreateModel(objFile); - + API::SimpleBodyDescription sbDesc; //sbDesc.centerPosition = diff --git a/Code/Input/L_inputClass.h b/Code/Input/L_inputClass.h index 129024c2..08358135 100644 --- a/Code/Input/L_inputClass.h +++ b/Code/Input/L_inputClass.h @@ -7,7 +7,6 @@ #ifndef _INPUTCLASS_H_ #define _INPUTCLASS_H_ - #define DIRECTINPUT_VERSION 0x0800 #pragma comment(lib, "dinput8.lib") diff --git a/Code/OysterPhysics3D/OysterPhysics3D.vcxproj b/Code/OysterPhysics3D/OysterPhysics3D.vcxproj index 2113cccb..f24f23e4 100644 --- a/Code/OysterPhysics3D/OysterPhysics3D.vcxproj +++ b/Code/OysterPhysics3D/OysterPhysics3D.vcxproj @@ -24,26 +24,26 @@ - DynamicLibrary + StaticLibrary true v110 MultiByte - DynamicLibrary + StaticLibrary true v110 MultiByte - DynamicLibrary + StaticLibrary false v110 true MultiByte - DynamicLibrary + StaticLibrary false v110 true @@ -69,21 +69,25 @@ $(SolutionDir)..\External\Lib\$(ProjectName)\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D + .lib $(SolutionDir)..\External\Lib\$(ProjectName)\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) + .lib $(SolutionDir)..\External\Lib\$(ProjectName)\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName)D + .lib $(SolutionDir)..\External\Lib\$(ProjectName)\ $(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\ $(ProjectName)_$(PlatformShortName) + .lib