Changeset 1173
- Timestamp:
- Mar 26, 2012, 8:18:40 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure.ac
r1168 r1173 47 47 dnl Available platforms: some of these are not public 48 48 AM_CONDITIONAL(HAVE_PS3, test -f src/platform/ps3/ps3app.cpp) 49 AM_CONDITIONAL(HAVE_XBOX, false) 49 50 50 51 AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no") -
trunk/src/Makefile.am
r1160 r1173 20 20 \ 21 21 $(ps3_sources) \ 22 $(xbox_sources) \ 22 23 $(nacl_sources) \ 23 24 $(sdl_sources) \ … … 55 56 56 57 if HAVE_PS3 57 ps3_sources = 58 ps3_sources = \ 58 59 platform/ps3/threadbase.h \ 59 60 platform/ps3/ps3app.cpp platform/ps3/ps3app.h \ … … 61 62 endif 62 63 64 if HAVE_XBOX 65 xbox_sources = \ 66 platform/xbox/xboxapp.cpp platform/xbox/xboxapp.h 67 endif 68 -
trunk/src/application/application.cpp
r1106 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 18 18 #if defined __CELLOS_LV2__ 19 19 # include "platform/ps3/ps3app.h" 20 #elif defined _XBOX 21 # include "platform/xbox/xboxapp.h" 20 22 #elif defined __native_client__ 21 23 # include "platform/nacl/naclapp.h" … … 42 44 #if defined __CELLOS_LV2__ 43 45 Ps3App app; 46 #elif defined _XBOX 47 XboxApp app; 44 48 #elif defined __native_client__ 45 49 NaClApp app; -
trunk/src/debug/quad.cpp
r1135 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 13 13 #endif 14 14 15 #if defined WIN32 && !defined _XBOX 15 #if !defined _XBOX /* This file is meaningless on Xbox */ 16 17 #if defined WIN32 && !_XBOX 16 18 # define _USE_MATH_DEFINES /* for M_PI */ 17 19 # define WIN32_LEAN_AND_MEAN … … 1118 1120 } /* namespace lol */ 1119 1121 1122 #endif /* !defined _XBOX */ -
trunk/src/debug/sphere.cpp
r1163 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 13 13 #endif 14 14 15 #if defined WIN32 && !defined _XBOX 15 #if !defined _XBOX /* This file is meaningless on Xbox */ 16 17 #if defined WIN32 16 18 # define _USE_MATH_DEFINES /* for M_PI */ 17 19 # define WIN32_LEAN_AND_MEAN … … 209 211 } /* namespace lol */ 210 212 213 #endif /* !defined _XBOX */ -
trunk/src/dict.cpp
r958 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 18 18 #include "core.h" 19 19 20 #if defined WIN3220 #if defined _WIN32 || defined _XBOX 21 21 # define strcasecmp _stricmp 22 22 #endif -
trunk/src/gradient.cpp
r960 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 12 12 # include "config.h" 13 13 #endif 14 15 #if !defined _XBOX /* This file is meaningless on Xbox */ 14 16 15 17 #include <cmath> … … 242 244 } /* namespace lol */ 243 245 246 #endif /* !defined _XBOX */ -
trunk/src/real.cpp
r1163 r1173 13 13 #endif 14 14 15 #if defined WIN32 && !defined _XBOX 15 #if defined _XBOX 16 # define _USE_MATH_DEFINES /* for M_PI */ 17 # include <xtl.h> 18 # undef near /* Fuck Microsoft */ 19 # undef far /* Fuck Microsoft again */ 20 #elif defined WIN32 16 21 # define _USE_MATH_DEFINES /* for M_PI */ 17 22 # define WIN32_LEAN_AND_MEAN -
trunk/src/shader/shader.cpp
r832 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 39 39 40 40 private: 41 #if defined _XBOX 42 41 43 #if !defined __CELLOS_LV2__ 42 44 GLuint prog_id, vert_id, frag_id; -
trunk/src/thread/threadbase.h
r1144 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 19 19 #if defined HAVE_PTHREAD_H 20 20 # include <pthread.h> 21 #elif defined _XBOX 22 # include <xtl.h> 23 # undef near /* Fuck Microsoft */ 24 # undef far /* Fuck Microsoft again */ 21 25 #elif defined _WIN32 22 26 # include <windows.h> 27 # undef near /* Fuck Microsoft */ 28 # undef far /* Fuck Microsoft again */ 23 29 #else 24 30 # error No threading support yet :( -
trunk/src/timer.cpp
r1082 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 21 21 #elif defined _XBOX 22 22 # include <xtl.h> 23 # undef near /* Fuck Microsoft */ 24 # undef far /* Fuck Microsoft again */ 23 25 # include <xbox.h> 24 26 #elif defined _WIN32 -
trunk/src/vector.cpp
r1149 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 13 13 #endif 14 14 15 #if defined WIN32 && !defined _XBOX 15 #if defined _XBOX 16 # define _USE_MATH_DEFINES /* for M_PI */ 17 # include <xtl.h> 18 # undef near /* Fuck Microsoft */ 19 # undef far /* Fuck Microsoft again */ 20 #elif defined _WIN32 16 21 # define _USE_MATH_DEFINES /* for M_PI */ 17 22 # define WIN32_LEAN_AND_MEAN -
trunk/src/video.cpp
r1108 r1173 2 2 // Lol Engine 3 3 // 4 // Copyright: (c) 2010-201 1Sam Hocevar <sam@hocevar.net>4 // Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net> 5 5 // This program is free software; you can redistribute it and/or 6 6 // modify it under the terms of the Do What The Fuck You Want To … … 15 15 #include <cmath> 16 16 17 #if defined _WIN32 && !defined _XBOX 17 #if _XBOX 18 # include <xtl.h> 19 # undef near /* Fuck Microsoft */ 20 # undef far /* Fuck Microsoft again */ 21 #elif defined _WIN32 18 22 # define WIN32_LEAN_AND_MEAN 19 23 # include <windows.h> … … 37 41 static mat4 proj_matrix, view_matrix; 38 42 static ivec2 saved_viewport; 43 #if defined _XBOX 44 static Direct3D *d3d_ctx; 45 static D3DDevice *d3d_dev; 46 #endif 39 47 }; 40 48 41 49 mat4 VideoData::proj_matrix; 42 50 mat4 VideoData::view_matrix; 43 44 51 ivec2 VideoData::saved_viewport(0, 0); 52 53 #if defined _XBOX 54 Direct3D *VideoData::d3d_ctx; 55 D3DDevice *VideoData::d3d_dev; 56 #endif 45 57 46 58 /* … … 50 62 void Video::Setup(ivec2 size) 51 63 { 52 #if defined USE_GLEW && !defined __APPLE__ 64 #if defined _XBOX 65 VideoData::d3d_ctx = Direct3DCreate9(D3D_SDK_VERSION); 66 if (!VideoData::d3d_ctx) 67 { 68 Log::Error("cannot initialise D3D\n"); 69 exit(EXIT_FAILURE); 70 } 71 72 D3DPRESENT_PARAMETERS d3dpp; 73 memset(&d3dpp, 0, sizeof(d3dpp)); 74 75 XVIDEO_MODE VideoMode; 76 XGetVideoMode( &VideoMode ); 77 if (size.x > VideoMode.dwDisplayWidth) 78 size.x = VideoMode.dwDisplayWidth; 79 if (size.y > VideoMode.dwDisplayHeight) 80 size.y = VideoMode.dwDisplayHeight; 81 VideoData::saved_viewport = size; 82 83 d3dpp.BackBufferWidth = size.x; 84 d3dpp.BackBufferHeight = size.y; 85 d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; 86 d3dpp.BackBufferCount = 1; 87 d3dpp.EnableAutoDepthStencil = TRUE; 88 d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; 89 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; 90 d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; 91 92 if (!VideoData::d3d_ctx->CreateDevice(0, D3DDEVTYPE_HAL, NULL, 93 D3DCREATE_HARDWARE_VERTEXPROCESSING, 94 &d3dpp, &VideoData::d3d_dev)) 95 { 96 Log::Error("cannot create D3D device\n"); 97 exit(EXIT_FAILURE); 98 } 99 #else 100 # if defined USE_GLEW && !defined __APPLE__ 53 101 /* Initialise GLEW if necessary */ 54 102 GLenum glerr = glewInit(); … … 58 106 exit(EXIT_FAILURE); 59 107 } 60 # endif108 # endif 61 109 62 110 /* Initialise OpenGL */ … … 67 115 glClearDepth(1.0); 68 116 69 # if defined HAVE_GL_2X && !defined __APPLE__117 # if defined HAVE_GL_2X && !defined __APPLE__ 70 118 glShadeModel(GL_SMOOTH); 71 119 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 120 # endif 72 121 #endif 73 122 } … … 127 176 { 128 177 ivec2 size = GetSize(); 178 #if defined _XBOX 179 VideoData::d3d_dev->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER 180 | D3DCLEAR_STENCIL, 181 D3DCOLOR_XRGB(26, 51, 77), 1.0f, 0); 182 #else 129 183 glViewport(0, 0, size.x, size.y); 130 184 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 185 #endif 131 186 132 187 SetFov(0.0f); … … 140 195 void Video::Capture(uint32_t *buffer) 141 196 { 197 #if _XBOX 198 /* TODO */ 199 #else 142 200 GLint v[4]; 143 # if defined __CELLOS_LV2__201 # if defined __CELLOS_LV2__ 144 202 // FIXME: use psglCreateDeviceAuto && psglGetDeviceDimensions 145 203 v[2] = 1920; 146 204 v[3] = 1080; 147 # else205 # else 148 206 glGetIntegerv(GL_VIEWPORT, v); 149 # endif207 # endif 150 208 int width = v[2], height = v[3]; 151 209 152 # if defined HAVE_GL_2X210 # if defined HAVE_GL_2X 153 211 glPixelStorei(GL_PACK_ROW_LENGTH, 0); 154 # endif212 # endif 155 213 glPixelStorei(GL_PACK_ALIGNMENT, 1); 156 214 157 # if defined GL_BGRA215 # if defined GL_BGRA 158 216 glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, buffer); 159 # else217 # else 160 218 glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); 161 # endif219 # endif 162 220 163 221 for (int j = 0; j < height / 2; j++) … … 168 226 buffer[(height - j - 1) * width + i] = tmp; 169 227 } 228 #endif 170 229 } 171 230 172 231 ivec2 Video::GetSize() 173 232 { 233 #if _XBOX 234 return VideoData::saved_viewport; 235 #elif 1 174 236 /* GetSize() is called too often on the game thread; we cannot rely on 175 237 * the GL context at this point */ 176 #if 1177 238 return VideoData::saved_viewport; 178 239 #elif defined __CELLOS_LV2__ -
trunk/win32/lolcore.vcxproj
r1166 r1173 170 170 <ClCompile Include="..\src\platform\sdl\sdlapp.cpp" /> 171 171 <ClCompile Include="..\src\platform\sdl\sdlinput.cpp" /> 172 <ClCompile Include="..\src\platform\xbox\xboxapp.cpp" /> 172 173 <ClCompile Include="..\src\profiler.cpp" /> 173 174 <ClCompile Include="..\src\real.cpp" /> … … 224 225 <ClInclude Include="..\src\platform\sdl\sdlapp.h" /> 225 226 <ClInclude Include="..\src\platform\sdl\sdlinput.h" /> 227 <ClInclude Include="..\src\platform\xbox\xboxapp.h" /> 226 228 <ClInclude Include="..\src\profiler.h" /> 227 229 <ClInclude Include="..\src\sample.h" /> -
trunk/win32/lolcore.vcxproj.filters
r1155 r1173 39 39 <UniqueIdentifier>{123803f1-1722-4421-8245-098667654cda}</UniqueIdentifier> 40 40 </Filter> 41 <Filter Include="src\platform\xbox"> 42 <UniqueIdentifier>{317cb5cc-5dcc-4e14-be90-40a125a2e2ec}</UniqueIdentifier> 43 </Filter> 41 44 </ItemGroup> 42 45 <ItemGroup> … … 185 188 <Filter>src\image\codec</Filter> 186 189 </ClCompile> 190 <ClCompile Include="..\src\platform\xbox\xboxapp.cpp"> 191 <Filter>src\platform\xbox</Filter> 192 </ClCompile> 187 193 </ItemGroup> 188 194 <ItemGroup> … … 346 352 <Filter>src\image</Filter> 347 353 </ClInclude> 354 <ClInclude Include="..\src\platform\xbox\xboxapp.h"> 355 <Filter>src\platform\xbox</Filter> 356 </ClInclude> 348 357 </ItemGroup> 349 358 </Project>
Note: See TracChangeset
for help on using the changeset viewer.