43 {$ELSE} |
43 {$ELSE} |
44 ProgrTex: PTexture; |
44 ProgrTex: PTexture; |
45 {$ENDIF} |
45 {$ENDIF} |
46 |
46 |
47 procedure init_uStore; |
47 procedure init_uStore; |
|
48 procedure free_uStore; |
|
49 |
48 procedure StoreLoad; |
50 procedure StoreLoad; |
49 procedure StoreRelease; |
51 procedure StoreRelease; |
50 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); |
52 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); |
51 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); |
53 procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); |
52 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); |
54 procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); |
1183 WriteLnToConsole(msgOK); |
1185 WriteLnToConsole(msgOK); |
1184 {$ENDIF} |
1186 {$ENDIF} |
1185 |
1187 |
1186 WriteToConsole(msgLoading + 'progress sprite: '); |
1188 WriteToConsole(msgLoading + 'progress sprite: '); |
1187 texsurf:= LoadImage(Pathz[ptGraphics] + '/Progress', ifCritical or ifTransparent); |
1189 texsurf:= LoadImage(Pathz[ptGraphics] + '/Progress', ifCritical or ifTransparent); |
1188 {$IFDEF SDL13notworking} |
1190 |
1189 ProgrTex:= SDL_CreateTextureFromSurface(0, texsurf); |
|
1190 {$ELSE} |
|
1191 ProgrTex:= Surface2Tex(texsurf, false); |
1191 ProgrTex:= Surface2Tex(texsurf, false); |
1192 {$ENDIF} |
1192 |
1193 squaresize:= texsurf^.w shr 1; |
1193 squaresize:= texsurf^.w shr 1; |
1194 numsquares:= texsurf^.h div squaresize; |
1194 numsquares:= texsurf^.h div squaresize; |
1195 SDL_FreeSurface(texsurf); |
1195 SDL_FreeSurface(texsurf); |
1196 end; |
1196 end; |
1197 |
1197 |
1198 {$IFDEF SDL13notworking} |
|
1199 TryDo(ProgrTex <> 0, 'Error - Progress Texure is 0!', true); |
|
1200 {$ELSE} |
|
1201 TryDo(ProgrTex <> nil, 'Error - Progress Texure is nil!', true); |
1198 TryDo(ProgrTex <> nil, 'Error - Progress Texure is nil!', true); |
1202 {$ENDIF} |
|
1203 |
1199 |
1204 glClear(GL_COLOR_BUFFER_BIT); |
1200 glClear(GL_COLOR_BUFFER_BIT); |
1205 glEnable(GL_TEXTURE_2D); |
1201 glEnable(GL_TEXTURE_2D); |
1206 if Step < numsquares then r.x:= 0 |
1202 if Step < numsquares then r.x:= 0 |
1207 else r.x:= squaresize; |
1203 else r.x:= squaresize; |
1208 |
1204 |
1209 r.y:= (Step mod numsquares) * squaresize; |
1205 r.y:= (Step mod numsquares) * squaresize; |
1210 r.w:= squaresize; |
1206 r.w:= squaresize; |
1211 r.h:= squaresize; |
1207 r.h:= squaresize; |
1212 |
1208 |
1213 {$IFDEF SDL13notworking} |
|
1214 SDL_RenderCopy(ProgrTex, nil, @r); |
|
1215 {$ELSE} |
|
1216 DrawFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex); |
1209 DrawFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex); |
1217 {$ENDIF} |
1210 |
1218 glDisable(GL_TEXTURE_2D); |
1211 glDisable(GL_TEXTURE_2D); |
1219 SDL_GL_SwapBuffers(); |
1212 SDL_GL_SwapBuffers(); |
|
1213 {$IFDEF SDL13} |
|
1214 SDL_RenderPresent(); |
|
1215 {$ENDIF} |
1220 inc(Step); |
1216 inc(Step); |
|
1217 |
1221 end; |
1218 end; |
1222 |
1219 |
1223 |
1220 |
1224 procedure FinishProgress; |
1221 procedure FinishProgress; |
1225 begin |
1222 begin |
1226 WriteLnToConsole('Freeing progress surface... '); |
1223 WriteLnToConsole('Freeing progress surface... '); |
1227 {$IFDEF SDL13notworking} |
|
1228 SDL_DestroyTexture(ProgrTex); |
|
1229 {$ELSE} |
|
1230 FreeTexture(ProgrTex); |
1224 FreeTexture(ProgrTex); |
1231 {$ENDIF} |
|
1232 |
1225 |
1233 {$IFDEF IPHONEOS} |
1226 {$IFDEF IPHONEOS} |
1234 // show overlay buttons |
1227 // show overlay buttons |
1235 IPH_showControls; |
1228 IPH_showControls; |
1236 {$ENDIF} |
1229 {$ENDIF} |