From 1f42c01174f01bd9755d7fccb4fcf31f75671a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Mon, 17 Dec 2012 00:29:06 -0300 Subject: [PATCH] Fixed hgignore. It was ignoring files that didn't have to. Added the files wrongly ignored. Changed EE::MemoryManager::LogResults() to EE::MemoryManager::ShowResults(). Because it's not loging anything! --- .hgignore | 44 +- include/eepp/base/memorymanager.hpp | 2 +- projects/linux/ee.creator.user | 2 +- .../windows/vc2010/eepp/cdeps/cdeps.vcxproj | 247 ------ projects/windows/vc2010/eepp/eepp.sln | 51 -- .../windows/vc2010/eepp/eepp/eepp.vcxproj | 689 ---------------- .../vc2010/empty_window/empty_window.ico | Bin 3262 -> 0 bytes .../vc2010/empty_window/empty_window.vcxproj | 155 ---- .../windows/vc2010/empty_window/small.ico | Bin 3262 -> 0 bytes src/eepp/base/memorymanager.cpp | 2 +- .../SDL2/src/power/android/SDL_syspower.c | 41 + .../src/video/android/SDL_androidclipboard.c | 26 + .../src/video/android/SDL_androidclipboard.h | 10 + .../src/video/cocoa/SDL_cocoamessagebox.h | 29 + .../src/video/cocoa/SDL_cocoamessagebox.m | 82 ++ .../src/video/uikit/SDL_uikitmessagebox.h | 31 + .../src/video/uikit/SDL_uikitmessagebox.m | 114 +++ .../SDL2/src/video/uikit/SDL_uikitmodes.h | 51 ++ .../SDL2/src/video/uikit/SDL_uikitmodes.m | 320 ++++++++ .../src/video/windows/SDL_windowsmessagebox.c | 282 +++++++ .../src/video/windows/SDL_windowsmessagebox.h | 29 + .../SDL2/src/video/x11/SDL_x11messagebox.c | 746 ++++++++++++++++++ .../SDL2/src/video/x11/SDL_x11messagebox.h | 28 + src/examples/empty_window/empty_window.cpp | 2 +- .../external_shader/external_shader.cpp | 2 +- src/test/eetest.cpp | 2 +- 26 files changed, 1812 insertions(+), 1175 deletions(-) delete mode 100644 projects/windows/vc2010/eepp/cdeps/cdeps.vcxproj delete mode 100644 projects/windows/vc2010/eepp/eepp.sln delete mode 100644 projects/windows/vc2010/eepp/eepp/eepp.vcxproj delete mode 100644 projects/windows/vc2010/empty_window/empty_window.ico delete mode 100644 projects/windows/vc2010/empty_window/empty_window.vcxproj delete mode 100644 projects/windows/vc2010/empty_window/small.ico create mode 100644 src/eepp/helper/SDL2/src/power/android/SDL_syspower.c create mode 100644 src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c create mode 100644 src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h create mode 100644 src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h create mode 100644 src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m create mode 100644 src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h create mode 100644 src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m create mode 100644 src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h create mode 100644 src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m create mode 100644 src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c create mode 100644 src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h create mode 100644 src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c create mode 100644 src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h diff --git a/.hgignore b/.hgignore index 4f72b3c5f..efcd16698 100644 --- a/.hgignore +++ b/.hgignore @@ -1,28 +1,18 @@ syntax: glob -*.DS_Store -data/** -fonts/** -obj/** -libs/** -make/** -bin/** -assets/** -projects/windows/vc2010/eepp/cdeps/Debug/** -projects/windows/vc2010/eepp/cdeps/Release/** -projects/windows/vc2010/empty_window/Debug/** -projects/windows/vc2010/empty_window/Release/** -projects/windows/vc2010/eepp/Debug/** -projects/windows/vc2010/eepp/Release/** -projects/windows/vc2010/eepp/DebugDynamic/** -projects/windows/vc2010/eepp/ReleaseDynamic/** -projects/windows/vc2010/eepp/eepp/DebugDynamic/** -projects/windows/vc2010/eepp/eepp/ReleaseDynamic/** -projects/windows/vc2010/eepp/eepp/Debug/** -projects/windows/vc2010/eepp/eepp/Release/** -projects/windows/vc2010/empty_window/empty_window.vcxproj.filters -projects/windows/vc2010/empty_window/empty_window.vcxproj.user -projects/src/** -projects/android-project/data/** -projects/android-project/gen/** -log.log -ee* +./obj +./fonts +./libs +./make +./assets +./projects/android-project/bin +./projects/android-project/obj +./projects/android-project/data +./projects/android-project/gen +*\.user +*\.filters +*\.suo +*\.DS_Store +./eees-* +./eeew-* +./eetest-* +log.log \ No newline at end of file diff --git a/include/eepp/base/memorymanager.hpp b/include/eepp/base/memorymanager.hpp index ce36c0b4b..42a4aa648 100644 --- a/include/eepp/base/memorymanager.hpp +++ b/include/eepp/base/memorymanager.hpp @@ -31,7 +31,7 @@ class EE_API MemoryManager { static bool RemovePointer( void * Data ); - static void LogResults(); + static void ShowResults(); template static T* Delete( T * Data ) { diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index d169dd7fb..36ecb3232 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/projects/windows/vc2010/eepp/cdeps/cdeps.vcxproj b/projects/windows/vc2010/eepp/cdeps/cdeps.vcxproj deleted file mode 100644 index 9de1ae839..000000000 --- a/projects/windows/vc2010/eepp/cdeps/cdeps.vcxproj +++ /dev/null @@ -1,247 +0,0 @@ - - - - - DebugDynamic - Win32 - - - Debug - Win32 - - - ReleaseDynamic - Win32 - - - Release - Win32 - - - - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02} - Win32Proj - cdeps - eepp-cdeps - - - - StaticLibrary - true - Unicode - - - StaticLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - StaticLibrary - false - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - ../../../../../src/eepp/helper/zlib;../../../../../src/eepp/helper/libzip;..\..\..\..\..\include\eepp\helper\SOIL - - - Windows - true - - - - - - - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - ../../../../../src/eepp/helper/zlib;../../../../../src/eepp/helper/libzip;..\..\..\..\..\include\eepp\helper\SOIL - - - Windows - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../../../../../src/eepp/helper/zlib;../../../../../src/eepp/helper/libzip;..\..\..\..\..\include\eepp\helper\SOIL - - - Windows - true - true - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - ../../../../../src/eepp/helper/zlib;../../../../../src/eepp/helper/libzip;..\..\..\..\..\include\eepp\helper\SOIL - - - Windows - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/projects/windows/vc2010/eepp/eepp.sln b/projects/windows/vc2010/eepp/eepp.sln deleted file mode 100644 index b6596505d..000000000 --- a/projects/windows/vc2010/eepp/eepp.sln +++ /dev/null @@ -1,51 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eepp", "eepp\eepp.vcxproj", "{5DA0ACF1-A253-4226-A737-694899255E64}" - ProjectSection(ProjectDependencies) = postProject - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02} = {CA9BF50E-0CCE-4E61-A070-8B37BC274E02} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eepp-cdeps", "cdeps\cdeps.vcxproj", "{CA9BF50E-0CCE-4E61-A070-8B37BC274E02}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "empty_window", "..\empty_window\empty_window.vcxproj", "{A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}" - ProjectSection(ProjectDependencies) = postProject - {5DA0ACF1-A253-4226-A737-694899255E64} = {5DA0ACF1-A253-4226-A737-694899255E64} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - DebugDynamic|Win32 = DebugDynamic|Win32 - Release|Win32 = Release|Win32 - ReleaseDynamic|Win32 = ReleaseDynamic|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5DA0ACF1-A253-4226-A737-694899255E64}.Debug|Win32.ActiveCfg = DebugDynamic|Win32 - {5DA0ACF1-A253-4226-A737-694899255E64}.Debug|Win32.Build.0 = DebugDynamic|Win32 - {5DA0ACF1-A253-4226-A737-694899255E64}.DebugDynamic|Win32.ActiveCfg = DebugDynamic|Win32 - {5DA0ACF1-A253-4226-A737-694899255E64}.DebugDynamic|Win32.Build.0 = DebugDynamic|Win32 - {5DA0ACF1-A253-4226-A737-694899255E64}.Release|Win32.ActiveCfg = Release|Win32 - {5DA0ACF1-A253-4226-A737-694899255E64}.Release|Win32.Build.0 = Release|Win32 - {5DA0ACF1-A253-4226-A737-694899255E64}.ReleaseDynamic|Win32.ActiveCfg = ReleaseDynamic|Win32 - {5DA0ACF1-A253-4226-A737-694899255E64}.ReleaseDynamic|Win32.Build.0 = ReleaseDynamic|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.Debug|Win32.ActiveCfg = Debug|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.Debug|Win32.Build.0 = Debug|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.DebugDynamic|Win32.ActiveCfg = Debug|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.DebugDynamic|Win32.Build.0 = Debug|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.Release|Win32.ActiveCfg = Release|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.Release|Win32.Build.0 = Release|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.ReleaseDynamic|Win32.ActiveCfg = Release|Win32 - {CA9BF50E-0CCE-4E61-A070-8B37BC274E02}.ReleaseDynamic|Win32.Build.0 = Release|Win32 - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}.Debug|Win32.ActiveCfg = Debug|Win32 - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}.Debug|Win32.Build.0 = Debug|Win32 - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}.DebugDynamic|Win32.ActiveCfg = Debug|Win32 - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}.DebugDynamic|Win32.Build.0 = Debug|Win32 - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}.Release|Win32.ActiveCfg = Release|Win32 - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}.Release|Win32.Build.0 = Release|Win32 - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA}.ReleaseDynamic|Win32.ActiveCfg = Debug|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/projects/windows/vc2010/eepp/eepp/eepp.vcxproj b/projects/windows/vc2010/eepp/eepp/eepp.vcxproj deleted file mode 100644 index ce9b4f5da..000000000 --- a/projects/windows/vc2010/eepp/eepp/eepp.vcxproj +++ /dev/null @@ -1,689 +0,0 @@ - - - - - DebugDynamic - Win32 - - - Debug - Win32 - - - ReleaseDynamic - Win32 - - - Release - Win32 - - - - {5DA0ACF1-A253-4226-A737-694899255E64} - Win32Proj - eepp - - - - StaticLibrary - true - Unicode - - - DynamicLibrary - true - Unicode - - - StaticLibrary - false - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - Level3 - Disabled - WIN32;EE_BACKEND_SDL_ACTIVE;EE_SDL_VERSION_1_2;STB_IMAGE_WRITE_IMPLEMENTATION;_DEBUG;_LIB;DEBUG;EE_DEBUG;EE_MEMORY_MANAGER;%(PreprocessorDefinitions) - ..\..\..\..\..\include\eepp\helper\chipmunk;..\..\..\..\..\src\eepp\helper\zlib;..\..\..\..\..\src;..\..\..\..\..\include;..\..\..\..\..\include\eepp\helper\SOIL;..\..\..\..\..\include\eepp\helper\glew - 4068;4355;%(DisableSpecificWarnings) - true - CompileAsCpp - $(IntDir)/%(RelativeDir)/ - - - Windows - true - - - ../Debug/eepp-cdeps.lib;%(AdditionalDependencies) - - - - - - - Level3 - Disabled - WIN32;EE_DYNAMIC;EE_EXPORTS;EE_BACKEND_SDL_ACTIVE;EE_SDL_VERSION_1_2;STB_IMAGE_WRITE_IMPLEMENTATION;_DEBUG;_LIB;DEBUG;EE_DEBUG;EE_MEMORY_MANAGER;%(PreprocessorDefinitions) - ..\..\..\..\..\include\eepp\helper\chipmunk;..\..\..\..\..\src\eepp\helper\zlib;..\..\..\..\..\src;..\..\..\..\..\include;..\..\..\..\..\include\eepp\helper\SOIL;..\..\..\..\..\include\eepp\helper\glew - 4068;4355;%(DisableSpecificWarnings) - true - CompileAsCpp - $(IntDir)/%(RelativeDir)/ - - - Windows - true - ../Debug/eepp-cdeps.lib;freetype.lib;OpenAL32.lib;OpenGL32.lib;glu32.lib;SDL.lib;%(AdditionalDependencies) - - - ../Debug/eepp-cdeps.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;EE_BACKEND_SDL_ACTIVE;EE_SDL_VERSION_1_2;STB_IMAGE_WRITE_IMPLEMENTATION;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(IntDir)/%(RelativeDir)/ - ..\..\..\..\..\include\eepp\helper\chipmunk;..\..\..\..\..\src\eepp\helper\zlib;..\..\..\..\..\src;..\..\..\..\..\include;..\..\..\..\..\include\eepp\helper\SOIL;..\..\..\..\..\include\eepp\helper\glew - CompileAsCpp - 4068;4355;%(DisableSpecificWarnings) - - - Windows - true - true - true - - - Release/eepp-cdeps.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;EE_DYNAMIC;EE_EXPORTS;EE_BACKEND_SDL_ACTIVE;EE_SDL_VERSION_1_2;STB_IMAGE_WRITE_IMPLEMENTATION;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(IntDir)/%(RelativeDir)/ - ..\..\..\..\..\include\eepp\helper\chipmunk;..\..\..\..\..\src\eepp\helper\zlib;..\..\..\..\..\src;..\..\..\..\..\include;..\..\..\..\..\include\eepp\helper\SOIL;..\..\..\..\..\include\eepp\helper\glew - CompileAsCpp - 4068;4355;%(DisableSpecificWarnings) - - - Windows - true - true - true - ../Release/eepp-cdeps.lib;freetype.lib;OpenAL32.lib;OpenGL32.lib;glu32.lib;SDL.lib;%(AdditionalDependencies) - - - Release/eepp-cdeps.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/projects/windows/vc2010/empty_window/empty_window.ico b/projects/windows/vc2010/empty_window/empty_window.ico deleted file mode 100644 index 15625893eac49f44ce9fa243ea2b130b65da55e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3262 zcmc&$dvH|M89(>j_jB*w$L`(tEBnl5lT9`xkYw{BkU)3|L9~dV!=s>%RAVh-Dq6&M zM`|r9h%EzlbP8CfEmOui?Tq82R&i`gTgFbM)(5pJwMjZqB{u zJHK)@Cx<8*LnZH2!YS9GU9x8-BPYKO;|2OW5gm? zXE&o#1c5k#!UQrR2|*;!>thlLihTa@zYl0E^_P{)7O=T!U`6l1vDc*KgKSq9p-E)1 zNm@|G8kSp%zMRj~7-0njd%;E^H0g||1Yk7v#xO}|*z~QJCMFh3w=P$P zN?bM|c@br(j9?kze3*%%~|66g6!yz>+nN34+MaABi=`1jR+r zh->u9{j({r?ob2dT!b8K2*Q(Y%BH0v4uu}wUOe-rzP^WG&MASu8G;9F8t!~t(Ok|1 zO;N1lRg`(Wjk5gXsCF)!!-29idG};ezmJ z$p;6!f4Q!qkWCd5$fe$h77>2BEkK)h|bz)P}s<7x$I>)jM~z zx0h4VBzwo+o5$}MOGeP*4T~3DIgrdK&2txl^V6!>R4(Ycb7X?2DX(*_(?Vv@Ui-{V zr}nA|WW*xCSg<7=?P*wX%ffl9I~0$x{ejiCJ-P8}eB$KKpMI+CnPU&$^!U9CuPBul z_ev_o2@Y>ST6y(l;RbUWlS?LqLd*0xJZ{*w-M+7F=&DUtfCdLBufM!wadRXa2NDJr z=8qrW`p3T>{LztBRr|<0?>_SB2M@hb)cV+=>tA~DYyExbh1ajFR8LJ+Up;kd)#Sf!`|y*) zr8dOz6u5_5rJDPDT>;g&)n7$Js1m#vKd zsXAO7)*pQ-><{`=>wIa`2UhXAcJi7t=919E;Jst_un+$aP<0 z8l$e6Q6!<~&i?qg{VNoxZOij)(&SyJx!f^h&cK|}(4M0cpZtA))jn-k?Mh{`TKW8o zsSl^7zW?U?_y6LxYj-}mL6UJIZK^6s(v;hybU!@Sv3mjJ0XU&NI0pDn*>5~@dKVHP zxez#F6tA0zW(;r8oyeM{?!?ZgHdgGPRVrtI!}C(D+8>?W_uhMVA31hkQ;Ua_M2Ihv zLvkkkeB}q9+8>Ma5W!$J7jt5~fbcYPn4sfnCB*0|%6HE&402#J_v$;lD%Iats%NLc zs{n1=m8v~u?>+wJj_bA#msvZVl;2*%NRe*o_(I-X+=X$n&_r{(sZtR*R z!I&CI#!wdh);_sw@&QC4eW2vM>e_SJ!66?Kh_P%Qqai~_vBpHSrFhl#!;kE_Wa9Rg zlYhGdKx=R6-E-)=Cl6fy_PYn}disH{Zo3i^216r$RqLzvnSoa}3N9|tn8GGh zQ^+19WW)k4)s*aVqpHmWxNrI%2&^044GuDt%%>Wb( zWa;SA@r}#oGwZfo^7^s$C*Qw)@{2d_{Px_wA^)>~KK%HRt@$=f)HER9!N(}}?D*{8 z?Lf71gjE+4@xe<9s+Y4l@-}1zi|3oe;qIc#5JPdR*qJiDe5tqa%?DTSKCa5+e(f#hH=Co5uPUbOLy^xm`3FbAvVV z#i^@LKganH2Z>6R+hZYdTOvpIQa z&DwB?Dh-t8FYk&c1b-q%v828-v(~mtZ|y`01YJpbRv#9S(zgh10fb>F$#ffjU3J$R z3Bq)doYw`(z!=0u}{te81*RP5H<$8Y6o#SqF09Zr#umQzg^ht-$h31pW0jOGMQAx|pC zB;(FWIHX>&o*Phvx$W%yVXoh5eC`i?m!dB1#A3Z?Ly8+Z6GxduF2Da=LH-hU{XwKb z2Yf6u&?_~@oK>*SBNCbdt(Q~^yDwcy>Bz8HDVdjJj{7nrzdp$k^!d@G&j_1 zmZNCexv&2ea4^+Ha={P<$pTpANJ7&ILE;qANm&e&Uoey&E&~W9Q`U?;YfN)gN8)7> zQv~4iwa^n~mgDNNeDPjTxIM`PcDhFAHNjj|0Zona`M^3ho(H!9VIvtVUAWhax^HBL zf|6YC*c>xK;2-qEHKH&yfsXAclulV8y?%GVTMd?U8(6BfQ}B2Z8Jtq<^lD)Lzn^~t Dmj5AG diff --git a/projects/windows/vc2010/empty_window/empty_window.vcxproj b/projects/windows/vc2010/empty_window/empty_window.vcxproj deleted file mode 100644 index 8155cf9ce..000000000 --- a/projects/windows/vc2010/empty_window/empty_window.vcxproj +++ /dev/null @@ -1,155 +0,0 @@ - - - - - DebugDynamic - Win32 - - - Debug - Win32 - - - ReleaseDynamic - Win32 - - - Release - Win32 - - - - {A0A6E0E5-1746-4C79-9E5C-1DEEED59B2BA} - Win32Proj - empty_window - - - - Application - true - Unicode - - - Application - true - Unicode - - - Application - false - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\..\..\..\src;..\..\..\..\include - - - - - Windows - true - ../eepp/DebugDynamic/eepp.lib;SDL.lib;SDLmain.lib;%(AdditionalDependencies) - - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\..\..\..\src;..\..\..\..\include - - - - - Windows - true - freetype.lib;OpenAL32.lib;OpenGL32.lib;glu32.lib;SDL.lib;SDLmain.lib;../eepp/Debug/eepp.lib;%(AdditionalDependencies) - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\..\..\..\..\src - - - Windows - true - true - true - ../eepp/Debug/eepp.lib;%(AdditionalDependencies) - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - ..\..\..\..\..\src - - - Windows - true - true - true - ../eepp/Debug/eepp.lib;%(AdditionalDependencies) - - - - - - - - - - - - - \ No newline at end of file diff --git a/projects/windows/vc2010/empty_window/small.ico b/projects/windows/vc2010/empty_window/small.ico deleted file mode 100644 index 15625893eac49f44ce9fa243ea2b130b65da55e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3262 zcmc&$dvH|M89(>j_jB*w$L`(tEBnl5lT9`xkYw{BkU)3|L9~dV!=s>%RAVh-Dq6&M zM`|r9h%EzlbP8CfEmOui?Tq82R&i`gTgFbM)(5pJwMjZqB{u zJHK)@Cx<8*LnZH2!YS9GU9x8-BPYKO;|2OW5gm? zXE&o#1c5k#!UQrR2|*;!>thlLihTa@zYl0E^_P{)7O=T!U`6l1vDc*KgKSq9p-E)1 zNm@|G8kSp%zMRj~7-0njd%;E^H0g||1Yk7v#xO}|*z~QJCMFh3w=P$P zN?bM|c@br(j9?kze3*%%~|66g6!yz>+nN34+MaABi=`1jR+r zh->u9{j({r?ob2dT!b8K2*Q(Y%BH0v4uu}wUOe-rzP^WG&MASu8G;9F8t!~t(Ok|1 zO;N1lRg`(Wjk5gXsCF)!!-29idG};ezmJ z$p;6!f4Q!qkWCd5$fe$h77>2BEkK)h|bz)P}s<7x$I>)jM~z zx0h4VBzwo+o5$}MOGeP*4T~3DIgrdK&2txl^V6!>R4(Ycb7X?2DX(*_(?Vv@Ui-{V zr}nA|WW*xCSg<7=?P*wX%ffl9I~0$x{ejiCJ-P8}eB$KKpMI+CnPU&$^!U9CuPBul z_ev_o2@Y>ST6y(l;RbUWlS?LqLd*0xJZ{*w-M+7F=&DUtfCdLBufM!wadRXa2NDJr z=8qrW`p3T>{LztBRr|<0?>_SB2M@hb)cV+=>tA~DYyExbh1ajFR8LJ+Up;kd)#Sf!`|y*) zr8dOz6u5_5rJDPDT>;g&)n7$Js1m#vKd zsXAO7)*pQ-><{`=>wIa`2UhXAcJi7t=919E;Jst_un+$aP<0 z8l$e6Q6!<~&i?qg{VNoxZOij)(&SyJx!f^h&cK|}(4M0cpZtA))jn-k?Mh{`TKW8o zsSl^7zW?U?_y6LxYj-}mL6UJIZK^6s(v;hybU!@Sv3mjJ0XU&NI0pDn*>5~@dKVHP zxez#F6tA0zW(;r8oyeM{?!?ZgHdgGPRVrtI!}C(D+8>?W_uhMVA31hkQ;Ua_M2Ihv zLvkkkeB}q9+8>Ma5W!$J7jt5~fbcYPn4sfnCB*0|%6HE&402#J_v$;lD%Iats%NLc zs{n1=m8v~u?>+wJj_bA#msvZVl;2*%NRe*o_(I-X+=X$n&_r{(sZtR*R z!I&CI#!wdh);_sw@&QC4eW2vM>e_SJ!66?Kh_P%Qqai~_vBpHSrFhl#!;kE_Wa9Rg zlYhGdKx=R6-E-)=Cl6fy_PYn}disH{Zo3i^216r$RqLzvnSoa}3N9|tn8GGh zQ^+19WW)k4)s*aVqpHmWxNrI%2&^044GuDt%%>Wb( zWa;SA@r}#oGwZfo^7^s$C*Qw)@{2d_{Px_wA^)>~KK%HRt@$=f)HER9!N(}}?D*{8 z?Lf71gjE+4@xe<9s+Y4l@-}1zi|3oe;qIc#5JPdR*qJiDe5tqa%?DTSKCa5+e(f#hH=Co5uPUbOLy^xm`3FbAvVV z#i^@LKganH2Z>6R+hZYdTOvpIQa z&DwB?Dh-t8FYk&c1b-q%v828-v(~mtZ|y`01YJpbRv#9S(zgh10fb>F$#ffjU3J$R z3Bq)doYw`(z!=0u}{te81*RP5H<$8Y6o#SqF09Zr#umQzg^ht-$h31pW0jOGMQAx|pC zB;(FWIHX>&o*Phvx$W%yVXoh5eC`i?m!dB1#A3Z?Ly8+Z6GxduF2Da=LH-hU{XwKb z2Yf6u&?_~@oK>*SBNCbdt(Q~^yDwcy>Bz8HDVdjJj{7nrzdp$k^!d@G&j_1 zmZNCexv&2ea4^+Ha={P<$pTpANJ7&ILE;qANm&e&Uoey&E&~W9Q`U?;YfN)gN8)7> zQv~4iwa^n~mgDNNeDPjTxIM`PcDhFAHNjj|0Zona`M^3ho(H!9VIvtVUAWhax^HBL zf|6YC*c>xK;2-qEHKH&yfsXAclulV8y?%GVTMd?U8(6BfQ}B2Z8Jtq<^lD)Lzn^~t Dmj5AG diff --git a/src/eepp/base/memorymanager.cpp b/src/eepp/base/memorymanager.cpp index 9db6392e6..4e63a616c 100644 --- a/src/eepp/base/memorymanager.cpp +++ b/src/eepp/base/memorymanager.cpp @@ -63,7 +63,7 @@ bool MemoryManager::RemovePointer( void * Data ) { return true; } -void MemoryManager::LogResults() { +void MemoryManager::ShowResults() { #ifdef EE_MEMORY_MANAGER if ( EE::PrintDebugInLog ) { diff --git a/src/eepp/helper/SDL2/src/power/android/SDL_syspower.c b/src/eepp/helper/SDL2/src/power/android/SDL_syspower.c new file mode 100644 index 000000000..6c33f13d3 --- /dev/null +++ b/src/eepp/helper/SDL2/src/power/android/SDL_syspower.c @@ -0,0 +1,41 @@ +#include "SDL_config.h" + +#ifndef SDL_POWER_DISABLED +#if SDL_POWER_ANDROID + +#include "SDL_power.h" + +#include "../../core/android/SDL_android.h" + +SDL_bool +SDL_GetPowerInfo_Android(SDL_PowerState * state, int *seconds, int *percent) +{ + int battery; + int plugged; + int charged; + + if (Android_JNI_GetPowerInfo(&plugged, &charged, &battery, seconds, percent) != -1) { + if (plugged) { + if (charged) { + *state = SDL_POWERSTATE_CHARGED; + } else if (battery) { + *state = SDL_POWERSTATE_CHARGING; + } else { + *state = SDL_POWERSTATE_NO_BATTERY; + *seconds = -1; + *percent = -1; + } + } else { + *state = SDL_POWERSTATE_ON_BATTERY; + } + } else { + *state = SDL_POWERSTATE_UNKNOWN; + *seconds = -1; + *percent = -1; + } + + return SDL_TRUE; +} + +#endif /* SDL_POWER_ANDROID */ +#endif /* SDL_POWER_DISABLED */ diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c new file mode 100644 index 000000000..031c90f8d --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.c @@ -0,0 +1,26 @@ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_ANDROID + +#include "SDL_androidvideo.h" + +#include "../../core/android/SDL_android.h" + +int +Android_SetClipboardText(_THIS, const char *text) +{ + return Android_JNI_SetClipboardText(text); +} + +char * +Android_GetClipboardText(_THIS) +{ + return Android_JNI_GetClipboardText(); +} + +SDL_bool Android_HasClipboardText(_THIS) +{ + return Android_JNI_HasClipboardText(); +} + +#endif /* SDL_VIDEO_DRIVER_ANDROID */ diff --git a/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h new file mode 100644 index 000000000..d1eb6632c --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/android/SDL_androidclipboard.h @@ -0,0 +1,10 @@ +#include "SDL_config.h" + +#ifndef _SDL_androidclipboard_h +#define _SDL_androidclipboard_h + +extern int Android_SetClipboardText(_THIS, const char *text); +extern char *Android_GetClipboardText(_THIS); +extern SDL_bool Android_HasClipboardText(_THIS); + +#endif /* _SDL_androidclipboard_h */ diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h new file mode 100644 index 000000000..4d639060f --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.h @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_COCOA + +extern int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + +#endif /* SDL_VIDEO_DRIVER_COCOA */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m new file mode 100644 index 000000000..fea487d13 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/cocoa/SDL_cocoamessagebox.m @@ -0,0 +1,82 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_COCOA + +#if defined(__APPLE__) && defined(__POWERPC__) +#include +#undef bool +#undef vector +#undef pixel +#endif + +#include "SDL_messagebox.h" +#include "SDL_cocoavideo.h" + + +/* Display a Cocoa message box */ +int +Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ + Cocoa_RegisterApp(); + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSAlert* alert = [[NSAlert alloc] init]; + + if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { + [alert setAlertStyle:NSCriticalAlertStyle]; + } else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { + [alert setAlertStyle:NSWarningAlertStyle]; + } else { + [alert setAlertStyle:NSInformationalAlertStyle]; + } + + [alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]]; + [alert setInformativeText:[NSString stringWithUTF8String:messageboxdata->message]]; + + const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; + int i; + for (i = 0; i < messageboxdata->numbuttons; ++i) { + NSButton *button = [alert addButtonWithTitle:[[NSString alloc] initWithUTF8String:buttons[i].text]]; + if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { + [button setKeyEquivalent:@"\r"]; + } else if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) { + [button setKeyEquivalent:@"\033"]; + } else { + [button setKeyEquivalent:@""]; + } + } + + NSInteger clicked = [alert runModal]; + clicked -= NSAlertFirstButtonReturn; + *buttonid = buttons[clicked].buttonid; + [alert release]; + + [pool release]; + + return 0; +} + +#endif /* SDL_VIDEO_DRIVER_COCOA */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h new file mode 100644 index 000000000..8c61f790a --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_UIKIT + +extern SDL_bool UIKit_ShowingMessageBox(); + +extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m new file mode 100644 index 000000000..2ff1d0822 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmessagebox.m @@ -0,0 +1,114 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_UIKIT + +#include "SDL.h" +#include "SDL_uikitvideo.h" + + +/* Display a UIKit message box */ + +static SDL_bool s_showingMessageBox = SDL_FALSE; + +@interface UIKit_UIAlertViewDelegate : NSObject { +@private + int *clickedButtonIndex; +} + +- (id)initWithButtonIndex:(int *)_buttonIndex; +- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; + +@end + +@implementation UIKit_UIAlertViewDelegate + +- (id)initWithButtonIndex:(int *)buttonIndex +{ + self = [self init]; + if (self == nil) { + return nil; + } + self->clickedButtonIndex = buttonIndex; + + return self; +} + +- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; +{ + *clickedButtonIndex = buttonIndex; +} + +@end // UIKit_UIAlertViewDelegate + + +SDL_bool +UIKit_ShowingMessageBox() +{ + return s_showingMessageBox; +} + +int +UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ + int clicked; + + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + UIAlertView* alert = [[UIAlertView alloc] init]; + + alert.title = [NSString stringWithUTF8String:messageboxdata->title]; + alert.message = [NSString stringWithUTF8String:messageboxdata->message]; + alert.delegate = [[UIKit_UIAlertViewDelegate alloc] initWithButtonIndex:&clicked]; + + const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; + int i; + for (i = 0; i < messageboxdata->numbuttons; ++i) { + [alert addButtonWithTitle:[[NSString alloc] initWithUTF8String:buttons[i].text]]; + } + + // Set up for showing the alert + clicked = messageboxdata->numbuttons; + + [alert show]; + + // Run the main event loop until the alert has finished + // Note that this needs to be done on the main thread + s_showingMessageBox = SDL_TRUE; + while (clicked == messageboxdata->numbuttons) { + [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; + } + s_showingMessageBox = SDL_FALSE; + + *buttonid = messageboxdata->buttons[clicked].buttonid; + + [alert.delegate release]; + [alert release]; + + [pool release]; + + return 0; +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h new file mode 100644 index 000000000..4831bac5a --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.h @@ -0,0 +1,51 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#ifndef _SDL_uikitmodes_h +#define _SDL_uikitmodes_h + +#include "SDL_uikitvideo.h" + +typedef struct +{ + UIScreen *uiscreen; + CGFloat scale; +} SDL_DisplayData; + +typedef struct +{ + UIScreenMode *uiscreenmode; + CGFloat scale; +} SDL_DisplayModeData; + +extern BOOL SDL_UIKit_supports_multiple_displays; + +extern SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen); + +extern int UIKit_InitModes(_THIS); +extern void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); +extern void UIKit_QuitModes(_THIS); + +#endif /* _SDL_uikitmodes_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m new file mode 100644 index 000000000..7e1d2cfb2 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/uikit/SDL_uikitmodes.m @@ -0,0 +1,320 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_UIKIT + +#include "SDL_assert.h" +#include "SDL_uikitmodes.h" + + +BOOL SDL_UIKit_supports_multiple_displays = NO; + + +static int +UIKit_AllocateDisplayModeData(SDL_DisplayMode * mode, + UIScreenMode * uiscreenmode, CGFloat scale) +{ + SDL_DisplayModeData *data = NULL; + + if (uiscreenmode != nil) { + /* Allocate the display mode data */ + data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); + if (!data) { + SDL_OutOfMemory(); + return -1; + } + + data->uiscreenmode = uiscreenmode; + [data->uiscreenmode retain]; + + data->scale = scale; + } + + mode->driverdata = data; + + return 0; +} + +static void +UIKit_FreeDisplayModeData(SDL_DisplayMode * mode) +{ + if (!SDL_UIKit_supports_multiple_displays) { + // Not on at least iPhoneOS 3.2 (versions prior to iPad). + SDL_assert(mode->driverdata == NULL); + } else if (mode->driverdata != NULL) { + SDL_DisplayModeData *data = (SDL_DisplayModeData *)mode->driverdata; + [data->uiscreenmode release]; + SDL_free(data); + mode->driverdata = NULL; + } +} + +static int +UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h, + UIScreenMode * uiscreenmode, CGFloat scale) +{ + SDL_DisplayMode mode; + SDL_zero(mode); + + mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = 0; + if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode, scale) < 0) { + return -1; + } + + mode.w = w; + mode.h = h; + if (SDL_AddDisplayMode(display, &mode)) { + return 0; + } else { + UIKit_FreeDisplayModeData(&mode); + return -1; + } +} + +static int +UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, CGFloat scale, + UIScreenMode * uiscreenmode, SDL_bool addRotation) +{ + if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode, scale) < 0) { + return -1; + } + + if (addRotation) { + // Add the rotated version + if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode, scale) < 0) { + return -1; + } + } + + return 0; +} + +static int +UIKit_AddDisplay(UIScreen *uiscreen) +{ + CGSize size = [uiscreen bounds].size; + + // Make sure the width/height are oriented correctly + if (UIKit_IsDisplayLandscape(uiscreen) != (size.width > size.height)) { + CGFloat height = size.width; + size.width = size.height; + size.height = height; + } + + // When dealing with UIKit all coordinates are specified in terms of + // what Apple refers to as points. On earlier devices without the + // so called "Retina" display, there is a one to one mapping between + // points and pixels. In other cases [UIScreen scale] indicates the + // relationship between points and pixels. Since SDL has no notion + // of points, we must compensate in all cases where dealing with such + // units. + CGFloat scale; + if ([UIScreen instancesRespondToSelector:@selector(scale)]) { + scale = [uiscreen scale]; // iOS >= 4.0 + } else { + scale = 1.0f; // iOS < 4.0 + } + + SDL_VideoDisplay display; + SDL_DisplayMode mode; + SDL_zero(mode); + mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.w = (int)(size.width * scale); + mode.h = (int)(size.height * scale); + + UIScreenMode * uiscreenmode = nil; + // UIScreenMode showed up in 3.2 (the iPad and later). We're + // misusing this supports_multiple_displays flag here for that. + if (SDL_UIKit_supports_multiple_displays) { + uiscreenmode = [uiscreen currentMode]; + } + + if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode, scale) < 0) { + return -1; + } + + SDL_zero(display); + display.desktop_mode = mode; + display.current_mode = mode; + + /* Allocate the display data */ + SDL_DisplayData *data = (SDL_DisplayData *) SDL_malloc(sizeof(*data)); + if (!data) { + SDL_OutOfMemory(); + UIKit_FreeDisplayModeData(&display.desktop_mode); + return -1; + } + + [uiscreen retain]; + data->uiscreen = uiscreen; + data->scale = scale; + + display.driverdata = data; + SDL_AddVideoDisplay(&display); + + return 0; +} + +SDL_bool +UIKit_IsDisplayLandscape(UIScreen *uiscreen) +{ + if (uiscreen == [UIScreen mainScreen]) { + return UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]); + } else { + CGSize size = [uiscreen bounds].size; + return (size.width > size.height); + } +} + +int +UIKit_InitModes(_THIS) +{ + // this tells us whether we are running on ios >= 3.2 + SDL_UIKit_supports_multiple_displays = [UIScreen instancesRespondToSelector:@selector(currentMode)]; + + // Add the main screen. + if (UIKit_AddDisplay([UIScreen mainScreen]) < 0) { + return -1; + } + + // If this is iPhoneOS < 3.2, all devices are one screen, 320x480 pixels. + // The iPad added both a larger main screen and the ability to use + // external displays. So, add the other displays (screens in UI speak). + if (SDL_UIKit_supports_multiple_displays) { + for (UIScreen *uiscreen in [UIScreen screens]) { + // Only add the other screens + if (uiscreen != [UIScreen mainScreen]) { + if (UIKit_AddDisplay(uiscreen) < 0) { + return -1; + } + } + } + } + + /* We're done! */ + return 0; +} + +void +UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) +{ + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + + SDL_bool isLandscape = UIKit_IsDisplayLandscape(data->uiscreen); + SDL_bool addRotation = (data->uiscreen == [UIScreen mainScreen]); + + if (SDL_UIKit_supports_multiple_displays) { + // availableModes showed up in 3.2 (the iPad and later). We should only + // land here for at least that version of the OS. + for (UIScreenMode *uimode in [data->uiscreen availableModes]) { + CGSize size = [uimode size]; + int w = (int)size.width; + int h = (int)size.height; + + // Make sure the width/height are oriented correctly + if (isLandscape != (w > h)) { + int tmp = w; + w = h; + h = tmp; + } + + // Add the native screen resolution. + UIKit_AddDisplayMode(display, w, h, data->scale, uimode, addRotation); + + if (data->scale != 1.0f) { + // Add the native screen resolution divided by its scale. + // This is so devices capable of e.g. 640x960 also advertise + // 320x480. + UIKit_AddDisplayMode(display, + (int)(size.width / data->scale), + (int)(size.height / data->scale), + 1.0f, uimode, addRotation); + } + } + } else { + const CGSize size = [data->uiscreen bounds].size; + int w = (int)size.width; + int h = (int)size.height; + + // Make sure the width/height are oriented correctly + if (isLandscape != (w > h)) { + int tmp = w; + w = h; + h = tmp; + } + + UIKit_AddDisplayMode(display, w, h, 1.0f, nil, addRotation); + } +} + +int +UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) +{ + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + + if (!SDL_UIKit_supports_multiple_displays) { + // Not on at least iPhoneOS 3.2 (versions prior to iPad). + SDL_assert(mode->driverdata == NULL); + } else { + SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; + [data->uiscreen setCurrentMode:modedata->uiscreenmode]; + + if (data->uiscreen == [UIScreen mainScreen]) { + if (mode->w > mode->h) { + if (!UIKit_IsDisplayLandscape(data->uiscreen)) { + [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; + } + } else if (mode->w < mode->h) { + if (UIKit_IsDisplayLandscape(data->uiscreen)) { + [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO]; + } + } + } + } + return 0; +} + +void +UIKit_QuitModes(_THIS) +{ + // Release Objective-C objects, so higher level doesn't free() them. + int i, j; + for (i = 0; i < _this->num_displays; i++) { + SDL_VideoDisplay *display = &_this->displays[i]; + + UIKit_FreeDisplayModeData(&display->desktop_mode); + for (j = 0; j < display->num_display_modes; j++) { + SDL_DisplayMode *mode = &display->display_modes[j]; + UIKit_FreeDisplayModeData(mode); + } + + SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; + [data->uiscreen release]; + SDL_free(data); + display->driverdata = NULL; + } +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c new file mode 100644 index 000000000..bb5eaaf24 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.c @@ -0,0 +1,282 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_WINDOWS + +#include "SDL.h" +#include "SDL_windowsvideo.h" + + +/* Display a Windows message box */ + +typedef struct +{ + LPDLGTEMPLATE lpDialog; + Uint8 *data; + size_t size; + size_t used; +} WIN_DialogData; + + +static INT_PTR MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam) +{ + switch ( iMessage ) { + case WM_COMMAND: + /* Return the ID of the button that was pushed */ + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + + default: + break; + } + return FALSE; +} + +static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space) +{ + size_t size = dialog->size; + + if (size == 0) { + size = space; + } else { + while ((dialog->used + space) > size) { + size *= 2; + } + } + if (size > dialog->size) { + void *data = SDL_realloc(dialog->data, size); + if (!data) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + dialog->data = data; + dialog->size = size; + dialog->lpDialog = (LPDLGTEMPLATE)dialog->data; + } + return SDL_TRUE; +} + +static SDL_bool AlignDialogData(WIN_DialogData *dialog, size_t size) +{ + size_t padding = (dialog->used % size); + + if (!ExpandDialogSpace(dialog, padding)) { + return SDL_FALSE; + } + + dialog->used += padding; + + return SDL_TRUE; +} + +static SDL_bool AddDialogData(WIN_DialogData *dialog, const void *data, size_t size) +{ + if (!ExpandDialogSpace(dialog, size)) { + return SDL_FALSE; + } + + SDL_memcpy(dialog->data+dialog->used, data, size); + dialog->used += size; + + return SDL_TRUE; +} + +static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string) +{ + WCHAR *wstring; + WCHAR *p; + size_t count; + SDL_bool status; + + if (!string) { + string = ""; + } + + wstring = WIN_UTF8ToString(string); + if (!wstring) { + return SDL_FALSE; + } + + /* Find out how many characters we have, including null terminator */ + count = 0; + for (p = wstring; *p; ++p) { + ++count; + } + ++count; + + status = AddDialogData(dialog, wstring, count*sizeof(WCHAR)); + SDL_free(wstring); + return status; +} + +static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, DWORD exStyle, int x, int y, int w, int h, int id, const char *caption) +{ + DLGITEMTEMPLATE item; + WORD marker = 0xFFFF; + WORD extraData = 0; + + SDL_zero(item); + item.style = style; + item.dwExtendedStyle = exStyle; + item.x = x; + item.y = y; + item.cx = w; + item.cy = h; + item.id = id; + + if (!AlignDialogData(dialog, sizeof(DWORD))) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &item, sizeof(item))) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &marker, sizeof(marker))) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &type, sizeof(type))) { + return SDL_FALSE; + } + if (!AddDialogString(dialog, caption)) { + return SDL_FALSE; + } + if (!AddDialogData(dialog, &extraData, sizeof(extraData))) { + return SDL_FALSE; + } + ++dialog->lpDialog->cdit; + + return SDL_TRUE; +} + +static SDL_bool AddDialogStatic(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text) +{ + DWORD style = WS_VISIBLE | WS_CHILD | SS_LEFT | SS_NOPREFIX; + return AddDialogControl(dialog, 0x0082, style, 0, x, y, w, h, -1, text); +} + +static SDL_bool AddDialogButton(WIN_DialogData *dialog, int x, int y, int w, int h, const char *text, int id, SDL_bool isDefault) +{ + DWORD style = WS_VISIBLE | WS_CHILD; + if (isDefault) { + style |= BS_DEFPUSHBUTTON; + } else { + style |= BS_PUSHBUTTON; + } + return AddDialogControl(dialog, 0x0080, style, 0, x, y, w, h, id, text); +} + +static void FreeDialogData(WIN_DialogData *dialog) +{ + if (dialog->data) { + SDL_free(dialog->data); + } + SDL_free(dialog); +} + +static WIN_DialogData *CreateDialogData(int w, int h, const char *caption) +{ + WIN_DialogData *dialog; + DLGTEMPLATE dialogTemplate; + + SDL_zero(dialogTemplate); + dialogTemplate.style = (WS_CAPTION | DS_CENTER); + dialogTemplate.x = 0; + dialogTemplate.y = 0; + dialogTemplate.cx = w; + dialogTemplate.cy = h; + + dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog)); + if (!dialog) { + return NULL; + } + + if (!AddDialogData(dialog, &dialogTemplate, sizeof(dialogTemplate))) { + FreeDialogData(dialog); + return NULL; + } + + /* There is no menu or special class */ + if (!AddDialogString(dialog, "") || !AddDialogString(dialog, "")) { + FreeDialogData(dialog); + return NULL; + } + + if (!AddDialogString(dialog, caption)) { + FreeDialogData(dialog); + return NULL; + } + + return dialog; +} + +int +WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ + WIN_DialogData *dialog; + int i, x, y, w, h, gap, which; + const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; + + /* FIXME: Need a better algorithm for laying out the message box */ + + dialog = CreateDialogData(570, 260, messageboxdata->title); + if (!dialog) { + return -1; + } + + w = 100; + h = 25; + gap = 10; + x = gap; + y = 50; + + if (!AddDialogStatic(dialog, x, y, 550, 100, messageboxdata->message)) { + FreeDialogData(dialog); + return -1; + } + + y += 110; + + for (i = 0; i < messageboxdata->numbuttons; ++i) { + SDL_bool isDefault; + + if (buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) { + isDefault = SDL_TRUE; + } else { + isDefault = SDL_FALSE; + } + if (!AddDialogButton(dialog, x, y, w, h, buttons[i].text, i, isDefault)) { + FreeDialogData(dialog); + return -1; + } + x += w + gap; + } + + /* FIXME: If we have a parent window, get the Instance and HWND for them */ + which = DialogBoxIndirect(NULL, dialog->lpDialog, NULL, (DLGPROC)MessageBoxDialogProc); + *buttonid = buttons[which].buttonid; + + FreeDialogData(dialog); + return 0; +} + +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h new file mode 100644 index 000000000..29c3eb850 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/windows/SDL_windowsmessagebox.h @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_WINDOWS + +extern int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + +#endif /* SDL_VIDEO_DRIVER_WINDOWS */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c new file mode 100644 index 000000000..e7d71e1d8 --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.c @@ -0,0 +1,746 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "SDL_config.h" + +#if SDL_VIDEO_DRIVER_X11 + +#include "SDL.h" +#include "SDL_x11video.h" +#include "SDL_x11dyn.h" +#include "SDL_assert.h" + +#include + + +#define SDL_FORK_MESSAGEBOX 1 + +#if SDL_FORK_MESSAGEBOX +#include +#include +#include +#include +#endif + +#define MAX_BUTTONS 8 /* Maximum number of buttons supported */ +#define MAX_TEXT_LINES 32 /* Maximum number of text lines supported */ +#define MIN_BUTTON_WIDTH 64 /* Minimum button width */ +#define MIN_DIALOG_WIDTH 200 /* Minimum dialog width */ +#define MIN_DIALOG_HEIGHT 100 /* Minimum dialog height */ + +static const char g_MessageBoxFontLatin1[] = "-*-*-medium-r-normal--0-120-*-*-p-0-iso8859-1"; +static const char g_MessageBoxFont[] = "-*-*-*-*-*-*-*-*-*-*-*-*-*-*"; + +static const SDL_MessageBoxColor g_default_colors[ SDL_MESSAGEBOX_COLOR_MAX ] = { + { 56, 54, 53 }, // SDL_MESSAGEBOX_COLOR_BACKGROUND, + { 209, 207, 205 }, // SDL_MESSAGEBOX_COLOR_TEXT, + { 140, 135, 129 }, // SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, + { 105, 102, 99 }, // SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, + { 205, 202, 53 }, // SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, +}; + +#define SDL_MAKE_RGB( _r, _g, _b ) ( ( ( Uint32 )( _r ) << 16 ) | \ + ( ( Uint32 )( _g ) << 8 ) | \ + ( ( Uint32 )( _b ) ) ) + +typedef struct SDL_MessageBoxButtonDataX11 { + int x, y; /* Text position */ + int length; /* Text length */ + int text_width; /* Text width */ + + SDL_Rect rect; /* Rectangle for entire button */ + + const SDL_MessageBoxButtonData *buttondata; /* Button data from caller */ +} SDL_MessageBoxButtonDataX11; + +typedef struct TextLineData { + int width; /* Width of this text line */ + int length; /* String length of this text line */ + const char *text; /* Text for this line */ +} TextLineData; + +typedef struct SDL_MessageBoxDataX11 { + XFontSet font_set; /* for UTF-8 systems */ + XFontStruct *font_struct; /* Latin1 (ASCII) fallback. */ + Window window; + Display *display; + long event_mask; + Atom wm_protocols; + Atom wm_delete_message; + + int dialog_width; /* Dialog box width. */ + int dialog_height; /* Dialog box height. */ + + int xtext, ytext; /* Text position to start drawing at. */ + int numlines; /* Count of Text lines. */ + int text_height; /* Height for text lines. */ + TextLineData linedata[ MAX_TEXT_LINES ]; + + int *pbuttonid; /* Pointer to user return buttonid value. */ + + int button_press_index; /* Index into buttondata/buttonpos for button which is pressed (or -1). */ + int mouse_over_index; /* Index into buttondata/buttonpos for button mouse is over (or -1). */ + + int numbuttons; /* Count of buttons. */ + const SDL_MessageBoxButtonData *buttondata; + SDL_MessageBoxButtonDataX11 buttonpos[ MAX_BUTTONS ]; + + Uint32 color[ SDL_MESSAGEBOX_COLOR_MAX ]; + + const SDL_MessageBoxData *messageboxdata; +} SDL_MessageBoxDataX11; + +/* Maximum helper for ints. */ +static __inline__ int +IntMax( int a, int b ) +{ + return ( a > b ) ? a : b; +} + +/* Return width and height for a string. */ +static void +GetTextWidthHeight( SDL_MessageBoxDataX11 *data, const char *str, int nbytes, int *pwidth, int *pheight ) +{ + if (SDL_X11_HAVE_UTF8) { + XRectangle overall_ink, overall_logical; + Xutf8TextExtents(data->font_set, str, nbytes, &overall_ink, &overall_logical); + *pwidth = overall_logical.width; + *pheight = overall_logical.height; + } else { + XCharStruct text_structure; + int font_direction, font_ascent, font_descent; + XTextExtents( data->font_struct, str, nbytes, + &font_direction, &font_ascent, &font_descent, + &text_structure ); + *pwidth = text_structure.width; + *pheight = text_structure.ascent + text_structure.descent; + } +} + +/* Return index of button if position x,y is contained therein. */ +static int +GetHitButtonIndex( SDL_MessageBoxDataX11 *data, int x, int y ) +{ + int i; + int numbuttons = data->numbuttons; + SDL_MessageBoxButtonDataX11 *buttonpos = data->buttonpos; + + for ( i = 0; i < numbuttons; i++ ) { + SDL_Rect *rect = &buttonpos[ i ].rect; + + if ( ( x >= rect->x ) && + ( x <= ( rect->x + rect->w ) ) && + ( y >= rect->y ) && + ( y <= ( rect->y + rect->h ) ) ) { + return i; + } + } + + return -1; +} + +/* Initialize SDL_MessageBoxData structure and Display, etc. */ +static int +X11_MessageBoxInit( SDL_MessageBoxDataX11 *data, const SDL_MessageBoxData * messageboxdata, int * pbuttonid ) +{ + int i; + int numbuttons = messageboxdata->numbuttons; + const SDL_MessageBoxButtonData *buttondata = messageboxdata->buttons; + const SDL_MessageBoxColor *colorhints; + + if ( numbuttons > MAX_BUTTONS ) { + SDL_SetError("Too many buttons (%d max allowed)", MAX_BUTTONS); + return -1; + } + + data->dialog_width = MIN_DIALOG_WIDTH; + data->dialog_height = MIN_DIALOG_HEIGHT; + data->messageboxdata = messageboxdata; + data->buttondata = buttondata; + data->numbuttons = numbuttons; + data->pbuttonid = pbuttonid; + + data->display = XOpenDisplay( NULL ); + if ( !data->display ) { + SDL_SetError("Couldn't open X11 display"); + return -1; + } + + if (SDL_X11_HAVE_UTF8) { + char **missing = NULL; + int num_missing = 0; + data->font_set = XCreateFontSet(data->display, g_MessageBoxFont, + &missing, &num_missing, NULL); + if ( missing != NULL ) { + XFreeStringList(missing); + } + if ( data->font_set == NULL ) { + SDL_SetError("Couldn't load font %s", g_MessageBoxFont); + return -1; + } + } else { + data->font_struct = XLoadQueryFont( data->display, g_MessageBoxFontLatin1 ); + if ( data->font_struct == NULL ) { + SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1); + return -1; + } + } + + if ( messageboxdata->colorScheme ) { + colorhints = messageboxdata->colorScheme->colors; + } else { + colorhints = g_default_colors; + } + + /* Convert our SDL_MessageBoxColor r,g,b values to packed RGB format. */ + for ( i = 0; i < SDL_MESSAGEBOX_COLOR_MAX; i++ ) { + data->color[ i ] = SDL_MAKE_RGB( colorhints[ i ].r, colorhints[ i ].g, colorhints[ i ].b ); + } + + return 0; +} + +/* Calculate and initialize text and button locations. */ +static int +X11_MessageBoxInitPositions( SDL_MessageBoxDataX11 *data ) +{ + int i; + int ybuttons; + int text_width_max = 0; + int button_text_height = 0; + int button_width = MIN_BUTTON_WIDTH; + const SDL_MessageBoxData *messageboxdata = data->messageboxdata; + + /* Go over text and break linefeeds into separate lines. */ + if ( messageboxdata->message && messageboxdata->message[ 0 ] ) { + const char *text = messageboxdata->message; + TextLineData *plinedata = data->linedata; + + for ( i = 0; i < MAX_TEXT_LINES; i++, plinedata++ ) { + int height; + char *lf = SDL_strchr( ( char * )text, '\n' ); + + data->numlines++; + + /* Only grab length up to lf if it exists and isn't the last line. */ + plinedata->length = ( lf && ( i < MAX_TEXT_LINES - 1 ) ) ? ( lf - text ) : SDL_strlen( text ); + plinedata->text = text; + + GetTextWidthHeight( data, text, plinedata->length, &plinedata->width, &height ); + + /* Text and widths are the largest we've ever seen. */ + data->text_height = IntMax( data->text_height, height ); + text_width_max = IntMax( text_width_max, plinedata->width ); + + text += plinedata->length + 1; + + /* Break if there are no more linefeeds. */ + if ( !lf ) + break; + } + + /* Bump up the text height slightly. */ + data->text_height += 2; + } + + /* Loop through all buttons and calculate the button widths and height. */ + for ( i = 0; i < data->numbuttons; i++ ) { + int height; + + data->buttonpos[ i ].buttondata = &data->buttondata[ i ]; + data->buttonpos[ i ].length = SDL_strlen( data->buttondata[ i ].text ); + + GetTextWidthHeight( data, data->buttondata[ i ].text, SDL_strlen( data->buttondata[ i ].text ), + &data->buttonpos[ i ].text_width, &height ); + + button_width = IntMax( button_width, data->buttonpos[ i ].text_width ); + button_text_height = IntMax( button_text_height, height ); + } + + if ( data->numlines ) { + /* x,y for this line of text. */ + data->xtext = data->text_height; + data->ytext = data->text_height + data->text_height; + + /* Bump button y down to bottom of text. */ + ybuttons = 3 * data->ytext / 2 + ( data->numlines - 1 ) * data->text_height; + + /* Bump the dialog box width and height up if needed. */ + data->dialog_width = IntMax( data->dialog_width, 2 * data->xtext + text_width_max ); + data->dialog_height = IntMax( data->dialog_height, ybuttons ); + } else { + /* Button y starts at height of button text. */ + ybuttons = button_text_height; + } + + if ( data->numbuttons ) { + int x, y; + int width_of_buttons; + int button_spacing = button_text_height; + int button_height = 2 * button_text_height; + + /* Bump button width up a bit. */ + button_width += button_text_height; + + /* Get width of all buttons lined up. */ + width_of_buttons = data->numbuttons * button_width + ( data->numbuttons - 1 ) * button_spacing; + + /* Bump up dialog width and height if buttons are wider than text. */ + data->dialog_width = IntMax( data->dialog_width, width_of_buttons + 2 * button_spacing ); + data->dialog_height = IntMax( data->dialog_height, ybuttons + 2 * button_height ); + + /* Location for first button. */ + x = ( data->dialog_width - width_of_buttons ) / 2; + y = ybuttons + ( data->dialog_height - ybuttons - button_height ) / 2; + + for ( i = 0; i < data->numbuttons; i++ ) { + /* Button coordinates. */ + data->buttonpos[ i ].rect.x = x; + data->buttonpos[ i ].rect.y = y; + data->buttonpos[ i ].rect.w = button_width; + data->buttonpos[ i ].rect.h = button_height; + + /* Button text coordinates. */ + data->buttonpos[ i ].x = x + ( button_width - data->buttonpos[ i ].text_width ) / 2; + data->buttonpos[ i ].y = y + ( button_height - button_text_height - 1 ) / 2 + button_text_height; + + /* Scoot over for next button. */ + x += button_width + button_spacing; + } + } + + return 0; +} + +/* Free SDL_MessageBoxData data. */ +static void +X11_MessageBoxShutdown( SDL_MessageBoxDataX11 *data ) +{ + if ( data->font_set != NULL ) { + XFreeFontSet( data->display, data->font_set ); + data->font_set = NULL; + } + + if ( data->font_struct != NULL ) { + XFreeFont( data->display, data->font_struct ); + data->font_struct = NULL; + } + + if ( data->display ) { + if ( data->window != None ) { + XUnmapWindow( data->display, data->window ); + XDestroyWindow( data->display, data->window ); + data->window = None; + } + + XCloseDisplay( data->display ); + data->display = NULL; + } +} + +/* Create and set up our X11 dialog box indow. */ +static int +X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) +{ + int x, y; + XSizeHints *sizehints; + XSetWindowAttributes wnd_attr; + Display *display = data->display; + SDL_WindowData *windowdata = NULL; + const SDL_MessageBoxData *messageboxdata = data->messageboxdata; + + if ( messageboxdata->window ) { + windowdata = (SDL_WindowData *)messageboxdata->window->driverdata; + } + + data->event_mask = ExposureMask | + ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask | + StructureNotifyMask | FocusChangeMask | PointerMotionMask; + wnd_attr.event_mask = data->event_mask; + + data->window = XCreateWindow( + display, DefaultRootWindow( display ), + 0, 0, + data->dialog_width, data->dialog_height, + 0, CopyFromParent, InputOutput, CopyFromParent, + CWEventMask, &wnd_attr ); + if ( data->window == None ) { + SDL_SetError("Couldn't create X window"); + return -1; + } + + if ( windowdata ) { + /* http://tronche.com/gui/x/icccm/sec-4.html#WM_TRANSIENT_FOR */ + XSetTransientForHint( display, data->window, windowdata->xwindow ); + } + + XStoreName( display, data->window, messageboxdata->title ); + + /* Allow the window to be deleted by the window manager */ + data->wm_protocols = XInternAtom( display, "WM_PROTOCOLS", False ); + data->wm_delete_message = XInternAtom( display, "WM_DELETE_WINDOW", False ); + XSetWMProtocols( display, data->window, &data->wm_delete_message, 1 ); + + if ( windowdata ) { + XWindowAttributes attrib; + Window dummy; + + XGetWindowAttributes(display, windowdata->xwindow, &attrib); + x = attrib.x + ( attrib.width - data->dialog_width ) / 2; + y = attrib.y + ( attrib.height - data->dialog_height ) / 3 ; + XTranslateCoordinates(display, windowdata->xwindow, DefaultRootWindow( display ), x, y, &x, &y, &dummy); + } else { + int screen = DefaultScreen( display ); + x = ( DisplayWidth( display, screen ) - data->dialog_width ) / 2; + y = ( DisplayHeight( display, screen ) - data->dialog_height ) / 3 ; + } + XMoveWindow( display, data->window, x, y ); + + sizehints = XAllocSizeHints(); + if ( sizehints ) { + sizehints->flags = USPosition | USSize | PMaxSize | PMinSize; + sizehints->x = x; + sizehints->y = y; + sizehints->width = data->dialog_width; + sizehints->height = data->dialog_height; + + sizehints->min_width = sizehints->max_width = data->dialog_width; + sizehints->min_height = sizehints->max_height = data->dialog_height; + + XSetWMNormalHints( display, data->window, sizehints ); + + XFree( sizehints ); + } + + XMapRaised( display, data->window ); + return 0; +} + +/* Draw our message box. */ +static void +X11_MessageBoxDraw( SDL_MessageBoxDataX11 *data, GC ctx ) +{ + int i; + Window window = data->window; + Display *display = data->display; + + XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_BACKGROUND ] ); + XFillRectangle( display, window, ctx, 0, 0, data->dialog_width, data->dialog_height ); + + XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_TEXT ] ); + for ( i = 0; i < data->numlines; i++ ) { + TextLineData *plinedata = &data->linedata[ i ]; + + if (SDL_X11_HAVE_UTF8) { + Xutf8DrawString( display, window, data->font_set, ctx, + data->xtext, data->ytext + i * data->text_height, + plinedata->text, plinedata->length ); + } else { + XDrawString( display, window, ctx, + data->xtext, data->ytext + i * data->text_height, + plinedata->text, plinedata->length ); + } + } + + for ( i = 0; i < data->numbuttons; i++ ) { + SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[ i ]; + const SDL_MessageBoxButtonData *buttondata = buttondatax11->buttondata; + int border = ( buttondata->flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT ) ? 2 : 0; + int offset = ( ( data->mouse_over_index == i ) && ( data->button_press_index == data->mouse_over_index ) ) ? 1 : 0; + + XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND ] ); + XFillRectangle( display, window, ctx, + buttondatax11->rect.x - border, buttondatax11->rect.y - border, + buttondatax11->rect.w + 2 * border, buttondatax11->rect.h + 2 * border ); + + XSetForeground( display, ctx, data->color[ SDL_MESSAGEBOX_COLOR_BUTTON_BORDER ] ); + XDrawRectangle( display, window, ctx, + buttondatax11->rect.x, buttondatax11->rect.y, + buttondatax11->rect.w, buttondatax11->rect.h ); + + XSetForeground( display, ctx, ( data->mouse_over_index == i ) ? + data->color[ SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED ] : + data->color[ SDL_MESSAGEBOX_COLOR_TEXT ] ); + + if (SDL_X11_HAVE_UTF8) { + Xutf8DrawString( display, window, data->font_set, ctx, + buttondatax11->x + offset, + buttondatax11->y + offset, + buttondata->text, buttondatax11->length ); + } else { + XDrawString( display, window, ctx, + buttondatax11->x + offset, buttondatax11->y + offset, + buttondata->text, buttondatax11->length ); + } + } +} + +/* Loop and handle message box event messages until something kills it. */ +static int +X11_MessageBoxLoop( SDL_MessageBoxDataX11 *data ) +{ + GC ctx; + XGCValues ctx_vals; + SDL_bool close_dialog = SDL_FALSE; + SDL_bool has_focus = SDL_TRUE; + KeySym last_key_pressed = XK_VoidSymbol; + unsigned long gcflags = GCForeground | GCBackground; + + SDL_zero(ctx_vals); + ctx_vals.foreground = data->color[ SDL_MESSAGEBOX_COLOR_BACKGROUND ]; + ctx_vals.background = data->color[ SDL_MESSAGEBOX_COLOR_BACKGROUND ]; + + if (!SDL_X11_HAVE_UTF8) { + gcflags |= GCFont; + ctx_vals.font = data->font_struct->fid; + } + + ctx = XCreateGC( data->display, data->window, gcflags, &ctx_vals ); + if ( ctx == None ) { + SDL_SetError("Couldn't create graphics context"); + return -1; + } + + data->button_press_index = -1; /* Reset what button is currently depressed. */ + data->mouse_over_index = -1; /* Reset what button the mouse is over. */ + + while( !close_dialog ) { + XEvent e; + SDL_bool draw = SDL_TRUE; + + XWindowEvent( data->display, data->window, data->event_mask, &e ); + + /* If XFilterEvent returns True, then some input method has filtered the + event, and the client should discard the event. */ + if ( ( e.type != Expose ) && XFilterEvent( &e, None ) ) + continue; + + switch( e.type ) { + case Expose: + if ( e.xexpose.count > 0 ) { + draw = SDL_FALSE; + } + break; + + case FocusIn: + /* Got focus. */ + has_focus = SDL_TRUE; + break; + + case FocusOut: + /* lost focus. Reset button and mouse info. */ + has_focus = SDL_FALSE; + data->button_press_index = -1; + data->mouse_over_index = -1; + break; + + case MotionNotify: + if ( has_focus ) { + /* Mouse moved... */ + data->mouse_over_index = GetHitButtonIndex( data, e.xbutton.x, e.xbutton.y ); + } + break; + + case ClientMessage: + if ( e.xclient.message_type == data->wm_protocols && + e.xclient.format == 32 && + e.xclient.data.l[ 0 ] == data->wm_delete_message ) { + close_dialog = SDL_TRUE; + } + break; + + case KeyPress: + /* Store key press - we make sure in key release that we got both. */ + last_key_pressed = XLookupKeysym( &e.xkey, 0 ); + break; + + case KeyRelease: { + Uint32 mask = 0; + KeySym key = XLookupKeysym( &e.xkey, 0 ); + + /* If this is a key release for something we didn't get the key down for, then bail. */ + if ( key != last_key_pressed ) + break; + + if ( key == XK_Escape ) + mask = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT; + else if ( ( key == XK_Return ) || ( key == XK_KP_Enter ) ) + mask = SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT; + + if ( mask ) { + int i; + + /* Look for first button with this mask set, and return it if found. */ + for ( i = 0; i < data->numbuttons; i++ ) { + SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[ i ]; + + if ( buttondatax11->buttondata->flags & mask ) { + *data->pbuttonid = buttondatax11->buttondata->buttonid; + close_dialog = SDL_TRUE; + break; + } + } + } + break; + } + + case ButtonPress: + data->button_press_index = -1; + if ( e.xbutton.button == Button1 ) { + /* Find index of button they clicked on. */ + data->button_press_index = GetHitButtonIndex( data, e.xbutton.x, e.xbutton.y ); + } + break; + + case ButtonRelease: + /* If button is released over the same button that was clicked down on, then return it. */ + if ( ( e.xbutton.button == Button1 ) && ( data->button_press_index >= 0 ) ) { + int button = GetHitButtonIndex( data, e.xbutton.x, e.xbutton.y ); + + if ( data->button_press_index == button ) { + SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[ button ]; + + *data->pbuttonid = buttondatax11->buttondata->buttonid; + close_dialog = SDL_TRUE; + } + } + data->button_press_index = -1; + break; + } + + if ( draw ) { + /* Draw our dialog box. */ + X11_MessageBoxDraw( data, ctx ); + } + } + + XFreeGC( data->display, ctx ); + return 0; +} + +static int +X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ + int ret; + SDL_MessageBoxDataX11 data; + char *origlocale; + + SDL_zero(data); + + if ( !SDL_X11_LoadSymbols() ) + return -1; + + origlocale = setlocale(LC_ALL, NULL); + if (origlocale != NULL) { + origlocale = SDL_strdup(origlocale); + if (origlocale == NULL) { + SDL_OutOfMemory(); + return -1; + } + setlocale(LC_ALL, ""); + } + + /* This code could get called from multiple threads maybe? */ + XInitThreads(); + + /* Initialize the return buttonid value to -1 (for error or dialogbox closed). */ + *buttonid = -1; + + /* Init and display the message box. */ + ret = X11_MessageBoxInit( &data, messageboxdata, buttonid ); + if ( ret != -1 ) { + ret = X11_MessageBoxInitPositions( &data ); + if ( ret != -1 ) { + ret = X11_MessageBoxCreateWindow( &data ); + if ( ret != -1 ) { + ret = X11_MessageBoxLoop( &data ); + } + } + } + + X11_MessageBoxShutdown( &data ); + + if (origlocale) { + setlocale(LC_ALL, origlocale); + SDL_free(origlocale); + } + + return ret; +} + +/* Display an x11 message box. */ +int +X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +{ +#if SDL_FORK_MESSAGEBOX + /* Use a child process to protect against setlocale(). Annoying. */ + pid_t pid; + int fds[2]; + int status = 0; + + if (pipe(fds) == -1) { + return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */ + } + + pid = fork(); + if (pid == -1) { /* failed */ + close(fds[0]); + close(fds[1]); + return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */ + } else if (pid == 0) { /* we're the child */ + int exitcode = 0; + close(fds[0]); + status = X11_ShowMessageBoxImpl(messageboxdata, buttonid); + if (write(fds[1], &status, sizeof (int)) != sizeof (int)) + exitcode = 1; + else if (write(fds[1], buttonid, sizeof (int)) != sizeof (int)) + exitcode = 1; + close(fds[1]); + _exit(exitcode); /* don't run atexit() stuff, static destructors, etc. */ + } else { /* we're the parent */ + pid_t rc; + close(fds[1]); + do { + rc = waitpid(pid, &status, 0); + } while ((rc == -1) && (errno == EINTR)); + + SDL_assert(rc == pid); /* not sure what to do if this fails. */ + + if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) { + SDL_SetError("msgbox child process failed"); + return -1; + } + + if (read(fds[0], &status, sizeof (int)) != sizeof (int)) + status = -1; + else if (read(fds[0], buttonid, sizeof (int)) != sizeof (int)) + status = -1; + close(fds[0]); + + return status; + } +#else + return X11_ShowMessageBoxImpl(messageboxdata, buttonid); +#endif +} +#endif /* SDL_VIDEO_DRIVER_X11 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h new file mode 100644 index 000000000..6f01c1d1d --- /dev/null +++ b/src/eepp/helper/SDL2/src/video/x11/SDL_x11messagebox.h @@ -0,0 +1,28 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2012 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#if SDL_VIDEO_DRIVER_X11 + +extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + +#endif /* SDL_VIDEO_DRIVER_X11 */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/examples/empty_window/empty_window.cpp b/src/examples/empty_window/empty_window.cpp index 30bb369f2..f7d848012 100644 --- a/src/examples/empty_window/empty_window.cpp +++ b/src/examples/empty_window/empty_window.cpp @@ -46,7 +46,7 @@ EE_MAIN_FUNC int main (int argc, char * argv []) cEngine::DestroySingleton(); // If was compiled in debug mode it will print the memory manager report - EE::MemoryManager::LogResults(); + EE::MemoryManager::ShowResults(); return 0; } diff --git a/src/examples/external_shader/external_shader.cpp b/src/examples/external_shader/external_shader.cpp index 8713bf832..db7877210 100644 --- a/src/examples/external_shader/external_shader.cpp +++ b/src/examples/external_shader/external_shader.cpp @@ -255,7 +255,7 @@ EE_MAIN_FUNC int main (int argc, char * argv []) cEngine::DestroySingleton(); - EE::MemoryManager::LogResults(); + EE::MemoryManager::ShowResults(); return 0; } diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index 217b1bf99..ca8fe6532 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -1938,7 +1938,7 @@ EE_MAIN_FUNC int main (int argc, char * argv []) { eeDelete( Test ); - EE::MemoryManager::LogResults(); + EE::MemoryManager::ShowResults(); return 0; }