diff --git a/JGE/JGE.vcxproj b/JGE/JGE.vcxproj index 3501f9b5d..67d51a139 100644 --- a/JGE/JGE.vcxproj +++ b/JGE/JGE.vcxproj @@ -72,7 +72,7 @@ MaxSpeed OnlyExplicitInline - Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories) + Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -86,6 +86,7 @@ Level3 true Default + true NDEBUG;%(PreprocessorDefinitions) @@ -99,7 +100,7 @@ Disabled - Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories) + Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDLL @@ -113,6 +114,7 @@ true EditAndContinue Default + true _DEBUG;%(PreprocessorDefinitions) @@ -126,7 +128,7 @@ Full OnlyExplicitInline - Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories) + Dependencies/SDL/include;Dependencies/include;$(JGEEXTRAS);../Boost;../projects/mtg/include;include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_HAS_ITERATOR_DEBBUGING=0;%(PreprocessorDefinitions) true MultiThreadedDLL @@ -141,6 +143,7 @@ true ProgramDatabase Default + true NDEBUG;%(PreprocessorDefinitions) @@ -152,6 +155,7 @@ + @@ -276,6 +280,7 @@ %(PreprocessorDefinitions) + Disabled %(AdditionalIncludeDirectories) @@ -288,7 +293,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - diff --git a/JGE/src/SDLmain.cpp b/JGE/src/SDLmain.cpp index 87fffd302..ec4eeae28 100644 --- a/JGE/src/SDLmain.cpp +++ b/JGE/src/SDLmain.cpp @@ -3,7 +3,11 @@ #include #else #include +#ifdef WIN32 +#undef GL_VERSION_2_0 #endif +#endif + #include "../include/JGE.h" #include "../include/JTypes.h" #include "../include/JApp.h" @@ -50,8 +54,11 @@ class SdlApp { SDL_Event Event; - while(Running && SDL_WaitEventTimeout(&Event, 50)) { - OnEvent(&Event); + while(Running) { + while(SDL_WaitEventTimeout(&Event, 0)) { + OnEvent(&Event); + } + OnUpdate(); } OnCleanup(); @@ -108,7 +115,8 @@ class SdlApp { void OnMouseClicked(const SDL_MouseButtonEvent& event); void OnMouseMoved(const SDL_MouseMotionEvent& event); void OnEvent(SDL_Event* Event) { - if(Event->type < SDL_USEREVENT) DebugTrace("Event received" << Event->type); +/* if(Event->type < SDL_USEREVENT) + DebugTrace("Event received" << Event->type);*/ switch(Event->type){ case SDL_QUIT: { @@ -178,7 +186,6 @@ class SdlApp { } } void OnUpdate(); - void OnRender(); void OnCleanup() { SDL_FreeSurface(Surf_Display); SDL_Quit(); @@ -260,14 +267,6 @@ void DestroyGame(void) g_engine = NULL; } -Uint32 OnTimer( Uint32 interval ) -{ - SDL_Event event; - event.user.type = WAGIC_UPDATE_EVENT; - SDL_PushEvent(&event); - return 30; -} - void SdlApp::OnUpdate() { static int tickCount; Uint32 dt; @@ -288,7 +287,10 @@ void SdlApp::OnUpdate() { cerr << oor.what(); } - OnRender(); + if(g_engine) + g_engine->Render(); + + SDL_GL_SwapBuffers(); } void SdlApp::OnKeyPressed(const SDL_KeyboardEvent& event) @@ -483,21 +485,10 @@ bool SdlApp::OnInit() { JGECreateDefaultBindings(); - SDL_SetTimer(30, OnTimer); - return true; }; -void SdlApp::OnRender() { - - if(g_engine) - g_engine->Render(); - - SDL_GL_SwapBuffers(); -}; - - -#if (defined ANDROID) +#if (defined ANDROID) || (defined WIN32) int SDL_main(int argc, char * argv[]) #else int main(int argc, char* argv[]) diff --git a/projects/mtg/mtg_vs2010.sln b/projects/mtg/mtg_vs2010.sln index 25cb48f01..9d8d1cc7e 100644 --- a/projects/mtg/mtg_vs2010.sln +++ b/projects/mtg/mtg_vs2010.sln @@ -1,29 +1,54 @@  Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +# Visual C++ Express 2010 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mtg", "template.vcxproj", "{53024371-2293-4D40-8ECF-FCB470B50DA1}" + ProjectSection(ProjectDependencies) = postProject + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JGE", "..\..\JGE\JGE.vcxproj", "{89159C26-2282-404A-A194-103B0A49DF7B}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "..\..\JGE\Dependencies\SDL\VisualC\SDL\SDL_VS2010.vcxproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 Profile|Win32 = Profile|Win32 + Profile|x64 = Profile|x64 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {53024371-2293-4D40-8ECF-FCB470B50DA1}.Debug|Win32.ActiveCfg = Debug|Win32 {53024371-2293-4D40-8ECF-FCB470B50DA1}.Debug|Win32.Build.0 = Debug|Win32 + {53024371-2293-4D40-8ECF-FCB470B50DA1}.Debug|x64.ActiveCfg = Debug|Win32 {53024371-2293-4D40-8ECF-FCB470B50DA1}.Profile|Win32.ActiveCfg = Profile|Win32 {53024371-2293-4D40-8ECF-FCB470B50DA1}.Profile|Win32.Build.0 = Profile|Win32 + {53024371-2293-4D40-8ECF-FCB470B50DA1}.Profile|x64.ActiveCfg = Profile|Win32 {53024371-2293-4D40-8ECF-FCB470B50DA1}.Release|Win32.ActiveCfg = Release|Win32 {53024371-2293-4D40-8ECF-FCB470B50DA1}.Release|Win32.Build.0 = Release|Win32 + {53024371-2293-4D40-8ECF-FCB470B50DA1}.Release|x64.ActiveCfg = Release|Win32 {89159C26-2282-404A-A194-103B0A49DF7B}.Debug|Win32.ActiveCfg = Debug|Win32 {89159C26-2282-404A-A194-103B0A49DF7B}.Debug|Win32.Build.0 = Debug|Win32 + {89159C26-2282-404A-A194-103B0A49DF7B}.Debug|x64.ActiveCfg = Debug|Win32 {89159C26-2282-404A-A194-103B0A49DF7B}.Profile|Win32.ActiveCfg = Profile|Win32 {89159C26-2282-404A-A194-103B0A49DF7B}.Profile|Win32.Build.0 = Profile|Win32 + {89159C26-2282-404A-A194-103B0A49DF7B}.Profile|x64.ActiveCfg = Profile|Win32 {89159C26-2282-404A-A194-103B0A49DF7B}.Release|Win32.ActiveCfg = Release|Win32 {89159C26-2282-404A-A194-103B0A49DF7B}.Release|Win32.Build.0 = Release|Win32 + {89159C26-2282-404A-A194-103B0A49DF7B}.Release|x64.ActiveCfg = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.ActiveCfg = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|Win32.Build.0 = Debug|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.ActiveCfg = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Debug|x64.Build.0 = Debug|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Profile|Win32.ActiveCfg = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Profile|x64.ActiveCfg = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Profile|x64.Build.0 = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.ActiveCfg = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|Win32.Build.0 = Release|Win32 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.ActiveCfg = Release|x64 + {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/projects/mtg/template.vcxproj b/projects/mtg/template.vcxproj index 519f5bf71..02b7e7d2d 100644 --- a/projects/mtg/template.vcxproj +++ b/projects/mtg/template.vcxproj @@ -127,7 +127,7 @@ 0x0c09 - odbc32.lib;odbccp32.lib;libpng.lib;fmodvc.lib;zdll.lib;libjpeg-static-mt.lib;freetype.lib;%(AdditionalDependencies) + glu32.lib;opengl32.lib;odbc32.lib;odbccp32.lib;SDL.lib;libpng.lib;fmodvc.lib;zdll.lib;libjpeg-static-mt.lib;freetype.lib;%(AdditionalDependencies) true ..\..\JGE\Dependencies\lib;..\..\JGE\lib\win;..\..\Boost\lib;%(AdditionalLibraryDirectories) LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) @@ -170,14 +170,14 @@ false Use PrecompiledHeader.h - false + true _DEBUG;%(PreprocessorDefinitions) 0x0c09 - odbc32.lib;odbccp32.lib;libpngd.lib;fmodvc.lib;libjpeg-static-mt-debug.lib;freetype.lib;%(AdditionalDependencies) + glu32.lib;opengl32.lib;odbc32.lib;odbccp32.lib;SDL.lib;libpngd.lib;fmodvc.lib;libjpeg-static-mt-debug.lib;freetype.lib;%(AdditionalDependencies) true ..\..\JGE\Dependencies\lib;..\..\JGE\lib\win;..\..\Boost\lib;%(AdditionalLibraryDirectories) LIBCD;LIBC;MSVCRT;LIBCMTD;%(IgnoreSpecificDefaultLibraries) @@ -228,7 +228,7 @@ 0x0c09 - odbc32.lib;odbccp32.lib;libpng.lib;fmodvc.lib;zdll.lib;libjpeg-static-mt.lib;freetype.lib;%(AdditionalDependencies) + glu32.lib;opengl32.lib;odbc32.lib;odbccp32.lib;SDL.lib;libpng.lib;fmodvc.lib;zdll.lib;libjpeg-static-mt.lib;freetype.lib;%(AdditionalDependencies) true ..\..\JGE\Dependencies\lib;..\..\JGE\lib\win;..\..\Boost\lib;%(AdditionalLibraryDirectories) LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) @@ -279,7 +279,7 @@ 0x0c09 - odbc32.lib;odbccp32.lib;libpngd.lib;fmodvc.lib;jge_debug.lib;libjpeg-static-mt-debug.lib;freetype.lib;%(AdditionalDependencies) + glu32.lib;opengl32.lib;odbc32.lib;odbccp32.lib;SDL.lib;libpngd.lib;fmodvc.lib;jge_debug.lib;libjpeg-static-mt-debug.lib;freetype.lib;%(AdditionalDependencies) true ..\..\JGE\Dependencies\lib;..\..\JGE\lib\win;..\..\Boost\lib;%(AdditionalLibraryDirectories) LIBCD;LIBC;MSVCRT;LIBCMTD;%(IgnoreSpecificDefaultLibraries)