equal
deleted
inserted
replaced
35 numsquares : LongInt; |
35 numsquares : LongInt; |
36 ProgrTex: PTexture; |
36 ProgrTex: PTexture; |
37 MissionIcons: PSDL_Surface; |
37 MissionIcons: PSDL_Surface; |
38 ropeIconTex: PTexture; |
38 ropeIconTex: PTexture; |
39 rotationQt: GLfloat; |
39 rotationQt: GLfloat; |
40 wScreen: LongInt; |
|
41 hScreen: LongInt; |
|
42 |
40 |
43 procedure initModule; |
41 procedure initModule; |
44 procedure freeModule; |
42 procedure freeModule; |
45 |
43 |
46 procedure StoreLoad; |
44 procedure StoreLoad; |
1143 var vendor: shortstring; |
1141 var vendor: shortstring; |
1144 {$IFDEF DARWIN} |
1142 {$IFDEF DARWIN} |
1145 one: LongInt; |
1143 one: LongInt; |
1146 {$ENDIF} |
1144 {$ENDIF} |
1147 begin |
1145 begin |
1148 // initialized here because when initModule is called cScreenWidth/Height are not yet set |
|
1149 if (uStore.wScreen = 0) and (uStore.hScreen = 0) then |
|
1150 begin |
|
1151 uStore.wScreen:= cScreenWidth; |
|
1152 uStore.hScreen:= cScreenHeight; |
|
1153 end; |
|
1154 |
1146 |
1155 {$IFDEF IPHONEOS} |
1147 {$IFDEF IPHONEOS} |
1156 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); // no double buffering |
1148 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 0); // no double buffering |
1157 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); |
1149 SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 1); |
1158 {$ELSE} |
1150 {$ELSE} |
1215 // just avoid 'never used' compiler warning for now |
1207 // just avoid 'never used' compiler warning for now |
1216 if cGPUVendor = gvUnknown then cGPUVendor:= gvUnknown; |
1208 if cGPUVendor = gvUnknown then cGPUVendor:= gvUnknown; |
1217 {$ENDIF} |
1209 {$ENDIF} |
1218 |
1210 |
1219 // set view port to whole window |
1211 // set view port to whole window |
1220 {$IFDEF IPHONEOS} |
1212 if rotationQt = 0 then |
1221 glViewport(0, 0, cScreenHeight, cScreenWidth); |
1213 glViewport(0, 0, cScreenWidth, cScreenHeight) |
1222 {$ELSE} |
1214 else |
1223 glViewport(0, 0, cScreenWidth, cScreenHeight); |
1215 glViewport(0, 0, cScreenHeight, cScreenWidth); |
1224 {$ENDIF} |
|
1225 |
1216 |
1226 glMatrixMode(GL_MODELVIEW); |
1217 glMatrixMode(GL_MODELVIEW); |
1227 // prepare default translation/scaling |
1218 // prepare default translation/scaling |
1228 glLoadIdentity(); |
1219 glLoadIdentity(); |
1229 glRotatef(rotationQt, 0, 0, 1); |
1220 glRotatef(rotationQt, 0, 0, 1); |
1253 else // other scaling |
1244 else // other scaling |
1254 begin |
1245 begin |
1255 glPushMatrix; // save default scaling |
1246 glPushMatrix; // save default scaling |
1256 glLoadIdentity; |
1247 glLoadIdentity; |
1257 glRotatef(rotationQt, 0, 0, 1); |
1248 glRotatef(rotationQt, 0, 0, 1); |
1258 glScalef(f / wScreen, -f / hScreen, 1.0); |
1249 glScalef(f / cScreenWidth, -f / cScreenHeight, 1.0); |
1259 glTranslatef(0, -cScreenHeight / 2, 0); |
1250 glTranslatef(0, -cScreenHeight / 2, 0); |
1260 end; |
1251 end; |
1261 |
1252 |
1262 cScaleFactor:= f; |
1253 cScaleFactor:= f; |
1263 end; |
1254 end; |
1290 |
1281 |
1291 r.y:= (Step mod numsquares) * squaresize; |
1282 r.y:= (Step mod numsquares) * squaresize; |
1292 r.w:= squaresize; |
1283 r.w:= squaresize; |
1293 r.h:= squaresize; |
1284 r.h:= squaresize; |
1294 |
1285 |
1295 DrawFromRect( -squaresize div 2, (hScreen - squaresize) shr 1, @r, ProgrTex); |
1286 DrawFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex); |
1296 |
1287 |
1297 SDL_GL_SwapBuffers(); |
1288 SDL_GL_SwapBuffers(); |
1298 {$IFDEF SDL13} |
1289 {$IFDEF SDL13} |
1299 SDL_RenderPresent(); |
1290 SDL_RenderPresent(); |
1300 {$ENDIF} |
1291 {$ENDIF} |
1564 |
1555 |
1565 procedure initModule; |
1556 procedure initModule; |
1566 begin |
1557 begin |
1567 PixelFormat:= nil; |
1558 PixelFormat:= nil; |
1568 SDLPrimSurface:= nil; |
1559 SDLPrimSurface:= nil; |
1569 {$IFDEF IPHONEOS} |
1560 |
1570 rotationQt:= -90; |
1561 {$IFNDEF IPHONEOS} |
1571 {$ELSE} |
|
1572 rotationQt:= 0; |
1562 rotationQt:= 0; |
1573 cGPUVendor:= gvUnknown; |
1563 cGPUVendor:= gvUnknown; |
1574 {$ENDIF} |
1564 {$ENDIF} |
1575 // really initalized in storeLoad |
|
1576 uStore.wScreen:= 0; |
|
1577 uStore.hScreen:= 0; |
|
1578 |
1565 |
1579 cScaleFactor:= 2.0; |
1566 cScaleFactor:= 2.0; |
1580 SupportNPOTT:= false; |
1567 SupportNPOTT:= false; |
1581 Step:= 0; |
1568 Step:= 0; |
1582 ProgrTex:= nil; |
1569 ProgrTex:= nil; |