author | unc0rr |
Sun, 12 Apr 2009 15:30:41 +0000 | |
changeset 1967 | 213d368a002f |
parent 1939 | 4b8e4cd9e7c0 |
child 1989 | 129e8c4fe554 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
883 | 3 |
* Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
4 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
4 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
4 | 17 |
*) |
18 |
||
19 |
unit uStore; |
|
20 |
interface |
|
1906 | 21 |
uses uConsts, uTeams, SDLh, |
22 |
{$IFDEF IPHONE} |
|
23 |
gles11, |
|
24 |
{$ELSE} |
|
25 |
GL, |
|
26 |
{$ENDIF} |
|
27 |
uFloat; |
|
4 | 28 |
{$INCLUDE options.inc} |
29 |
||
30 |
procedure StoreInit; |
|
31 |
procedure StoreLoad; |
|
32 |
procedure StoreRelease; |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
33 |
procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
34 |
procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); |
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
35 |
procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); |
1939 | 36 |
procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
37 |
procedure DrawSurfSprite(X, Y, Height, Frame: LongInt; Source: PTexture); |
762 | 38 |
procedure DrawTexture(X, Y: LongInt; Texture: PTexture); |
1251 | 39 |
procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, Frames: LongInt); |
822 | 40 |
procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); |
853 | 41 |
procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); |
822 | 42 |
procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); |
762 | 43 |
procedure DrawCentered(X, Top: LongInt; Source: PTexture); |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
44 |
procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1854
diff
changeset
|
45 |
procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); |
1431 | 46 |
procedure DrawFillRect(r: TSDL_Rect); |
762 | 47 |
function RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture; |
4 | 48 |
procedure RenderHealth(var Hedgehog: THedgehog); |
49 |
procedure AddProgress; |
|
510 | 50 |
procedure FinishProgress; |
518 | 51 |
function LoadImage(const filename: string; hasAlpha, critical, setTransparent: boolean): PSDL_Surface; |
753 | 52 |
procedure SetupOpenGL; |
4 | 53 |
|
1525 | 54 |
var PixelFormat: PSDL_PixelFormat = nil; |
55 |
SDLPrimSurface: PSDL_Surface = nil; |
|
1023 | 56 |
PauseTexture, |
57 |
ConfirmTexture: PTexture; |
|
4 | 58 |
|
59 |
implementation |
|
1906 | 60 |
uses uMisc, uConsole, uLand, uLocale; |
4 | 61 |
|
690 | 62 |
var |
761 | 63 |
HHTexture: PTexture; |
4 | 64 |
|
65 |
procedure StoreInit; |
|
66 |
begin |
|
67 |
||
68 |
end; |
|
69 |
||
351 | 70 |
procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); |
47 | 71 |
var r: TSDL_Rect; |
72 |
begin |
|
73 |
r:= rect^; |
|
83 | 74 |
if Clear then SDL_FillRect(Surface, @r, 0); |
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
75 |
|
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
76 |
BorderColor:= SDL_MapRGB(Surface^.format, BorderColor shr 16, BorderColor shr 8, BorderColor and $FF); |
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
77 |
FillColor:= SDL_MapRGB(Surface^.format, FillColor shr 16, FillColor shr 8, FillColor and $FF); |
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
78 |
|
351 | 79 |
r.y:= rect^.y + 1; |
80 |
r.h:= rect^.h - 2; |
|
47 | 81 |
SDL_FillRect(Surface, @r, BorderColor); |
351 | 82 |
r.x:= rect^.x + 1; |
83 |
r.w:= rect^.w - 2; |
|
84 |
r.y:= rect^.y; |
|
85 |
r.h:= rect^.h; |
|
47 | 86 |
SDL_FillRect(Surface, @r, BorderColor); |
351 | 87 |
r.x:= rect^.x + 2; |
88 |
r.y:= rect^.y + 1; |
|
89 |
r.w:= rect^.w - 4; |
|
90 |
r.h:= rect^.h - 2; |
|
47 | 91 |
SDL_FillRect(Surface, @r, FillColor); |
351 | 92 |
r.x:= rect^.x + 1; |
93 |
r.y:= rect^.y + 2; |
|
94 |
r.w:= rect^.w - 2; |
|
95 |
r.h:= rect^.h - 4; |
|
47 | 96 |
SDL_FillRect(Surface, @r, FillColor) |
97 |
end; |
|
98 |
||
371 | 99 |
function WriteInRoundRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: string): TSDL_Rect; |
351 | 100 |
var w, h: LongInt; |
4 | 101 |
tmpsurf: PSDL_Surface; |
102 |
clr: TSDL_Color; |
|
351 | 103 |
Result: TSDL_Rect; |
4 | 104 |
begin |
355 | 105 |
TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), w, h); |
4 | 106 |
Result.x:= X; |
107 |
Result.y:= Y; |
|
202 | 108 |
Result.w:= w + FontBorder * 2 + 4; |
109 |
Result.h:= h + FontBorder * 2; |
|
351 | 110 |
DrawRoundRect(@Result, cWhiteColor, cColorNearBlack, Surface, true); |
189 | 111 |
clr.r:= Color shr 16; |
112 |
clr.g:= (Color shr 8) and $FF; |
|
113 |
clr.b:= Color and $FF; |
|
355 | 114 |
tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr.value); |
202 | 115 |
Result.x:= X + FontBorder + 2; |
116 |
Result.y:= Y + FontBorder; |
|
199 | 117 |
SDLTry(tmpsurf <> nil, true); |
4 | 118 |
SDL_UpperBlit(tmpsurf, nil, Surface, @Result); |
119 |
SDL_FreeSurface(tmpsurf); |
|
120 |
Result.x:= X; |
|
121 |
Result.y:= Y; |
|
202 | 122 |
Result.w:= w + FontBorder * 2 + 4; |
351 | 123 |
Result.h:= h + FontBorder * 2; |
124 |
WriteInRoundRect:= Result |
|
4 | 125 |
end; |
126 |
||
127 |
procedure StoreLoad; |
|
844 | 128 |
var s: string; |
4 | 129 |
|
1185 | 130 |
procedure WriteNames(Font: THWFont); |
131 |
var t: LongInt; |
|
132 |
i: LongInt; |
|
133 |
r, rr: TSDL_Rect; |
|
134 |
drY: LongInt; |
|
135 |
texsurf: PSDL_Surface; |
|
136 |
begin |
|
137 |
r.x:= 0; |
|
138 |
r.y:= 0; |
|
139 |
drY:= - 4; |
|
140 |
for t:= 0 to Pred(TeamsCount) do |
|
141 |
with TeamsArray[t]^ do |
|
142 |
begin |
|
143 |
NameTagTex:= RenderStringTex(TeamName, Clan^.Color, Font); |
|
690 | 144 |
|
1185 | 145 |
r.w:= cTeamHealthWidth + 5; |
146 |
r.h:= NameTagTex^.h; |
|
690 | 147 |
|
1185 | 148 |
texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, r.w, r.h, 32, RMask, GMask, BMask, AMask); |
149 |
TryDo(texsurf <> nil, errmsgCreateSurface, true); |
|
150 |
TryDo(SDL_SetColorKey(texsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
|
690 | 151 |
|
1185 | 152 |
DrawRoundRect(@r, cWhiteColor, cColorNearBlack, texsurf, true); |
153 |
rr:= r; |
|
154 |
inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4); |
|
155 |
DrawRoundRect(@rr, Clan^.Color, Clan^.Color, texsurf, false); |
|
156 |
HealthTex:= Surface2Tex(texsurf); |
|
157 |
SDL_FreeSurface(texsurf); |
|
690 | 158 |
|
1185 | 159 |
dec(drY, r.h + 2); |
160 |
DrawHealthY:= drY; |
|
161 |
for i:= 0 to 7 do |
|
162 |
with Hedgehogs[i] do |
|
163 |
if Gear <> nil then |
|
1242 | 164 |
begin |
1185 | 165 |
NameTagTex:= RenderStringTex(Name, Clan^.Color, fnt16); |
1294
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1251
diff
changeset
|
166 |
if Hat <> 'NoHat' then |
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1251
diff
changeset
|
167 |
begin |
1698 | 168 |
texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, false, false, false); |
169 |
if texsurf <> nil then |
|
170 |
begin |
|
171 |
HatTex:= Surface2Tex(texsurf); |
|
172 |
SDL_FreeSurface(texsurf) |
|
173 |
end |
|
1294
50198e5c7f02
- Hedgehog doesn't take off hat when shooting from shotgun
unc0rr
parents:
1251
diff
changeset
|
174 |
end |
1242 | 175 |
end; |
1185 | 176 |
end; |
177 |
end; |
|
4 | 178 |
|
1185 | 179 |
procedure MakeCrossHairs; |
180 |
var t: LongInt; |
|
181 |
tmpsurf, texsurf: PSDL_Surface; |
|
182 |
Color, i: Longword; |
|
183 |
begin |
|
184 |
s:= Pathz[ptGraphics] + '/' + cCHFileName; |
|
185 |
tmpsurf:= LoadImage(s, true, true, false); |
|
4 | 186 |
|
1185 | 187 |
for t:= 0 to Pred(TeamsCount) do |
188 |
with TeamsArray[t]^ do |
|
189 |
begin |
|
190 |
texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, tmpsurf^.w, tmpsurf^.h, 32, RMask, GMask, BMask, AMask); |
|
191 |
TryDo(texsurf <> nil, errmsgCreateSurface, true); |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
192 |
|
1185 | 193 |
Color:= Clan^.Color; |
194 |
Color:= SDL_MapRGB(texsurf^.format, Color shr 16, Color shr 8, Color and $FF); |
|
195 |
SDL_FillRect(texsurf, nil, Color); |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
196 |
|
1185 | 197 |
SDL_UpperBlit(tmpsurf, nil, texsurf, nil); |
777 | 198 |
|
1185 | 199 |
TryDo(tmpsurf^.format^.BytesPerPixel = 4, 'Ooops', true); |
777 | 200 |
|
1185 | 201 |
if SDL_MustLock(texsurf) then |
202 |
SDLTry(SDL_LockSurface(texsurf) >= 0, true); |
|
777 | 203 |
|
1185 | 204 |
// make black pixel be alpha-transparent |
205 |
for i:= 0 to texsurf^.w * texsurf^.h - 1 do |
|
206 |
if PLongwordArray(texsurf^.pixels)^[i] = $FF000000 then PLongwordArray(texsurf^.pixels)^[i]:= 0; |
|
777 | 207 |
|
1185 | 208 |
if SDL_MustLock(texsurf) then |
209 |
SDL_UnlockSurface(texsurf); |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
210 |
|
1185 | 211 |
CrosshairTex:= Surface2Tex(texsurf); |
212 |
SDL_FreeSurface(texsurf) |
|
213 |
end; |
|
351 | 214 |
|
1185 | 215 |
SDL_FreeSurface(tmpsurf) |
216 |
end; |
|
4 | 217 |
|
1185 | 218 |
procedure InitHealth; |
219 |
var i, t: LongInt; |
|
220 |
begin |
|
221 |
for t:= 0 to Pred(TeamsCount) do |
|
222 |
if TeamsArray[t] <> nil then |
|
223 |
with TeamsArray[t]^ do |
|
224 |
begin |
|
225 |
for i:= 0 to cMaxHHIndex do |
|
226 |
if Hedgehogs[i].Gear <> nil then |
|
227 |
RenderHealth(Hedgehogs[i]); |
|
228 |
end |
|
229 |
end; |
|
4 | 230 |
|
1185 | 231 |
procedure LoadGraves; |
232 |
var t: LongInt; |
|
233 |
texsurf: PSDL_Surface; |
|
234 |
begin |
|
235 |
for t:= 0 to Pred(TeamsCount) do |
|
236 |
if TeamsArray[t] <> nil then |
|
237 |
with TeamsArray[t]^ do |
|
238 |
begin |
|
239 |
if GraveName = '' then GraveName:= 'Simple'; |
|
240 |
texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, false, true, true); |
|
241 |
GraveTex:= Surface2Tex(texsurf); |
|
242 |
SDL_FreeSurface(texsurf) |
|
243 |
end |
|
244 |
end; |
|
4 | 245 |
|
844 | 246 |
var ii: TSprite; |
247 |
fi: THWFont; |
|
248 |
ai: TAmmoType; |
|
249 |
tmpsurf: PSDL_Surface; |
|
250 |
i: LongInt; |
|
4 | 251 |
begin |
252 |
for fi:= Low(THWFont) to High(THWFont) do |
|
1185 | 253 |
with Fontz[fi] do |
254 |
begin |
|
255 |
s:= Pathz[ptFonts] + '/' + Name; |
|
256 |
WriteToConsole(msgLoading + s + '... '); |
|
257 |
Handle:= TTF_OpenFont(Str2PChar(s), Height); |
|
258 |
SDLTry(Handle <> nil, true); |
|
259 |
TTF_SetFontStyle(Handle, style); |
|
260 |
WriteLnToConsole(msgOK) |
|
261 |
end; |
|
4 | 262 |
AddProgress; |
53 | 263 |
|
4 | 264 |
WriteNames(fnt16); |
70 | 265 |
MakeCrossHairs; |
4 | 266 |
LoadGraves; |
267 |
||
268 |
AddProgress; |
|
269 |
for ii:= Low(TSprite) to High(TSprite) do |
|
1185 | 270 |
with SpritesData[ii] do |
1939 | 271 |
if (not cReducedQuality) or |
272 |
((ii <> sprSky) and (ii <> sprHorizont) and (ii <> sprFlake)) then |
|
1185 | 273 |
begin |
274 |
if AltPath = ptNone then |
|
275 |
tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, true, true, true) |
|
276 |
else begin |
|
277 |
tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, true, false, true); |
|
278 |
if tmpsurf = nil then |
|
279 |
tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, true, true, true) |
|
280 |
end; |
|
281 |
if Width = 0 then Width:= tmpsurf^.w; |
|
282 |
if Height = 0 then Height:= tmpsurf^.h; |
|
283 |
Texture:= Surface2Tex(tmpsurf); |
|
284 |
if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf) |
|
285 |
end; |
|
80 | 286 |
|
4 | 287 |
AddProgress; |
567 | 288 |
|
761 | 289 |
tmpsurf:= LoadImage(Pathz[ptGraphics] + '/' + cHHFileName, true, true, true); |
290 |
HHTexture:= Surface2Tex(tmpsurf); |
|
291 |
SDL_FreeSurface(tmpsurf); |
|
4 | 292 |
|
293 |
InitHealth; |
|
294 |
||
762 | 295 |
PauseTexture:= RenderStringTex(trmsg[sidPaused], $FFFF00, fntBig); |
1023 | 296 |
ConfirmTexture:= RenderStringTex(trmsg[sidConfirm], $FFFF00, fntBig); |
281
5b483aa9f2ab
Pause support (mouse cursor is released when the game is paused)
unc0rr
parents:
208
diff
changeset
|
297 |
|
843 | 298 |
for ai:= Low(TAmmoType) to High(TAmmoType) do |
299 |
with Ammoz[ai] do |
|
300 |
begin |
|
301 |
tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(trAmmo[NameId]), $FFFFFF); |
|
302 |
NameTex:= Surface2Tex(tmpsurf); |
|
303 |
SDL_FreeSurface(tmpsurf) |
|
304 |
end; |
|
305 |
||
844 | 306 |
for i:= Low(CountTexz) to High(CountTexz) do |
307 |
begin |
|
308 |
tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), $FFFFFF); |
|
309 |
CountTexz[i]:= Surface2Tex(tmpsurf); |
|
310 |
SDL_FreeSurface(tmpsurf) |
|
311 |
end; |
|
312 |
||
4 | 313 |
{$IFDEF DUMP} |
314 |
SDL_SaveBMP_RW(LandSurface, SDL_RWFromFile('LandSurface.bmp', 'wb'), 1); |
|
315 |
SDL_SaveBMP_RW(StoreSurface, SDL_RWFromFile('StoreSurface.bmp', 'wb'), 1); |
|
316 |
{$ENDIF} |
|
317 |
end; |
|
318 |
||
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
319 |
procedure DrawFromRect(X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); |
4 | 320 |
var rr: TSDL_Rect; |
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
321 |
_l, _r, _t, _b: real; |
1916 | 322 |
VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
4 | 323 |
begin |
759 | 324 |
if SourceTexture^.h = 0 then exit; |
4 | 325 |
rr.x:= X; |
326 |
rr.y:= Y; |
|
351 | 327 |
rr.w:= r^.w; |
328 |
rr.h:= r^.h; |
|
755 | 329 |
|
1896 | 330 |
_l:= r^.x / SourceTexture^.w * SourceTexture^.rx; |
331 |
_r:= (r^.x + r^.w) / SourceTexture^.w * SourceTexture^.rx; |
|
332 |
_t:= r^.y / SourceTexture^.h * SourceTexture^.ry; |
|
333 |
_b:= (r^.y + r^.h) / SourceTexture^.h * SourceTexture^.ry; |
|
755 | 334 |
|
335 |
glBindTexture(GL_TEXTURE_2D, SourceTexture^.id); |
|
336 |
||
1916 | 337 |
VertexBuffer[0].X:= X; |
338 |
VertexBuffer[0].Y:= Y; |
|
339 |
VertexBuffer[1].X:= rr.w + X; |
|
340 |
VertexBuffer[1].Y:= Y; |
|
341 |
VertexBuffer[2].X:= rr.w + X; |
|
342 |
VertexBuffer[2].Y:= rr.h + Y; |
|
343 |
VertexBuffer[3].X:= X; |
|
344 |
VertexBuffer[3].Y:= rr.h + Y; |
|
755 | 345 |
|
1916 | 346 |
TextureBuffer[0].X:= _l; |
347 |
TextureBuffer[0].Y:= _t; |
|
348 |
TextureBuffer[1].X:= _r; |
|
349 |
TextureBuffer[1].Y:= _t; |
|
350 |
TextureBuffer[2].X:= _r; |
|
351 |
TextureBuffer[2].Y:= _b; |
|
352 |
TextureBuffer[3].X:= _l; |
|
353 |
TextureBuffer[3].Y:= _b; |
|
755 | 354 |
|
1916 | 355 |
glEnableClientState(GL_VERTEX_ARRAY); |
356 |
glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
|
755 | 357 |
|
1916 | 358 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
359 |
glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); |
|
360 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
361 |
||
362 |
glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
|
363 |
glDisableClientState(GL_VERTEX_ARRAY) |
|
762 | 364 |
end; |
365 |
||
366 |
procedure DrawTexture(X, Y: LongInt; Texture: PTexture); |
|
367 |
begin |
|
1904 | 368 |
glPushMatrix; |
369 |
glTranslatef(X, Y, 0); |
|
370 |
||
762 | 371 |
glBindTexture(GL_TEXTURE_2D, Texture^.id); |
372 |
||
1904 | 373 |
glEnableClientState(GL_VERTEX_ARRAY); |
374 |
glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
|
762 | 375 |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1908
diff
changeset
|
376 |
glVertexPointer(2, GL_FLOAT, 0, @Texture^.vb); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1908
diff
changeset
|
377 |
glTexCoordPointer(2, GL_FLOAT, 0, @Texture^.tb); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1908
diff
changeset
|
378 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb)); |
1904 | 379 |
|
380 |
glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
|
381 |
glDisableClientState(GL_VERTEX_ARRAY); |
|
382 |
||
383 |
glPopMatrix |
|
4 | 384 |
end; |
385 |
||
1251 | 386 |
procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, Frames: LongInt); |
1242 | 387 |
var ft, fb: GLfloat; |
388 |
hw: LongInt; |
|
1916 | 389 |
VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
1242 | 390 |
begin |
391 |
glPushMatrix; |
|
392 |
glTranslatef(X, Y, 0); |
|
1251 | 393 |
glScalef(Scale, Scale, 1.0); |
1242 | 394 |
|
395 |
if Dir < 0 then |
|
396 |
hw:= - 16 |
|
397 |
else |
|
398 |
hw:= 16; |
|
399 |
||
1896 | 400 |
ft:= Frame / Frames * Texture^.ry; |
401 |
fb:= (Frame + 1) / Frames * Texture^.ry; |
|
1242 | 402 |
|
403 |
glBindTexture(GL_TEXTURE_2D, Texture^.id); |
|
404 |
||
1916 | 405 |
VertexBuffer[0].X:= -hw; |
406 |
VertexBuffer[0].Y:= -16; |
|
407 |
VertexBuffer[1].X:= hw; |
|
408 |
VertexBuffer[1].Y:= -16; |
|
409 |
VertexBuffer[2].X:= hw; |
|
410 |
VertexBuffer[2].Y:= 16; |
|
411 |
VertexBuffer[3].X:= -hw; |
|
412 |
VertexBuffer[3].Y:= 16; |
|
1242 | 413 |
|
1916 | 414 |
TextureBuffer[0].X:= 0; |
415 |
TextureBuffer[0].Y:= ft; |
|
416 |
TextureBuffer[1].X:= Texture^.rx; |
|
417 |
TextureBuffer[1].Y:= ft; |
|
418 |
TextureBuffer[2].X:= Texture^.rx; |
|
419 |
TextureBuffer[2].Y:= fb; |
|
420 |
TextureBuffer[3].X:= 0; |
|
421 |
TextureBuffer[3].Y:= fb; |
|
1242 | 422 |
|
1916 | 423 |
glEnableClientState(GL_VERTEX_ARRAY); |
424 |
glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
|
1242 | 425 |
|
1916 | 426 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
427 |
glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); |
|
428 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
429 |
||
430 |
glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
|
431 |
glDisableClientState(GL_VERTEX_ARRAY); |
|
432 |
||
1242 | 433 |
|
434 |
glPopMatrix |
|
435 |
end; |
|
436 |
||
822 | 437 |
procedure DrawRotated(Sprite: TSprite; X, Y, Dir: LongInt; Angle: real); |
775 | 438 |
begin |
777 | 439 |
DrawRotatedTex(SpritesData[Sprite].Texture, |
822 | 440 |
SpritesData[Sprite].Width, |
441 |
SpritesData[Sprite].Height, |
|
442 |
X, Y, Dir, Angle) |
|
777 | 443 |
end; |
444 |
||
853 | 445 |
procedure DrawRotatedF(Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real); |
806 | 446 |
begin |
447 |
glPushMatrix; |
|
809 | 448 |
glTranslatef(X, Y, 0); |
806 | 449 |
glRotatef(Angle, 0, 0, 1); |
450 |
||
853 | 451 |
if Dir < 0 then glScalef(-1.0, 1.0, 1.0); |
452 |
||
453 |
DrawSprite(Sprite, -SpritesData[Sprite].Width div 2, -SpritesData[Sprite].Height div 2, Frame); |
|
806 | 454 |
|
455 |
glPopMatrix |
|
456 |
end; |
|
457 |
||
822 | 458 |
procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); |
1916 | 459 |
var VertexBuffer: array [0..3] of TVertex2f; |
777 | 460 |
begin |
775 | 461 |
glPushMatrix; |
462 |
glTranslatef(X, Y, 0); |
|
822 | 463 |
|
464 |
if Dir < 0 then |
|
465 |
begin |
|
466 |
hw:= - hw; |
|
467 |
glRotatef(Angle, 0, 0, -1); |
|
468 |
end else |
|
469 |
glRotatef(Angle, 0, 0, 1); |
|
470 |
||
775 | 471 |
|
777 | 472 |
glBindTexture(GL_TEXTURE_2D, Tex^.id); |
775 | 473 |
|
1916 | 474 |
VertexBuffer[0].X:= -hw; |
475 |
VertexBuffer[0].Y:= -hh; |
|
476 |
VertexBuffer[1].X:= hw; |
|
477 |
VertexBuffer[1].Y:= -hh; |
|
478 |
VertexBuffer[2].X:= hw; |
|
479 |
VertexBuffer[2].Y:= hh; |
|
480 |
VertexBuffer[3].X:= -hw; |
|
481 |
VertexBuffer[3].Y:= hh; |
|
775 | 482 |
|
1916 | 483 |
glEnableClientState(GL_VERTEX_ARRAY); |
484 |
glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
|
775 | 485 |
|
1916 | 486 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
487 |
glTexCoordPointer(2, GL_FLOAT, 0, @Tex^.tb); |
|
488 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
775 | 489 |
|
1916 | 490 |
glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
491 |
glDisableClientState(GL_VERTEX_ARRAY); |
|
775 | 492 |
|
493 |
glPopMatrix |
|
494 |
end; |
|
495 |
||
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
496 |
procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt); |
4 | 497 |
begin |
498 |
r.y:= r.y + Height * Position; |
|
499 |
r.h:= Height; |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
500 |
DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture) |
4 | 501 |
end; |
502 |
||
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
503 |
procedure DrawSprite (Sprite: TSprite; X, Y, Frame: LongInt); |
755 | 504 |
var r: TSDL_Rect; |
4 | 505 |
begin |
755 | 506 |
r.x:= 0; |
507 |
r.w:= SpritesData[Sprite].Width; |
|
508 |
r.y:= Frame * SpritesData[Sprite].Height; |
|
509 |
r.h:= SpritesData[Sprite].Height; |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
510 |
DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture) |
4 | 511 |
end; |
512 |
||
1939 | 513 |
procedure DrawSpriteClipped(Sprite: TSprite; X, Y, TopY, RightX, BottomY, LeftX: LongInt); |
514 |
var r: TSDL_Rect; |
|
515 |
begin |
|
516 |
r.x:= 0; |
|
517 |
r.y:= 0; |
|
518 |
r.w:= SpritesData[Sprite].Width; |
|
519 |
r.h:= SpritesData[Sprite].Height; |
|
520 |
||
521 |
if (X < LeftX) then |
|
522 |
r.x:= LeftX - X; |
|
523 |
if (Y < TopY) then |
|
524 |
r.y:= TopY - Y; |
|
525 |
||
526 |
if (Y + SpritesData[Sprite].Height > BottomY) then |
|
527 |
r.h:= BottomY - Y + 1; |
|
528 |
if (X + SpritesData[Sprite].Width > RightX) then |
|
529 |
r.w:= RightX - X + 1; |
|
530 |
||
531 |
dec(r.h, r.y); |
|
532 |
dec(r.w, r.x); |
|
533 |
||
534 |
DrawFromRect(X + r.x, Y + r.y, @r, SpritesData[Sprite].Texture) |
|
535 |
end; |
|
536 |
||
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
537 |
procedure DrawSprite2(Sprite: TSprite; X, Y, FrameX, FrameY: LongInt); |
43 | 538 |
var r: TSDL_Rect; |
539 |
begin |
|
540 |
r.x:= FrameX * SpritesData[Sprite].Width; |
|
541 |
r.w:= SpritesData[Sprite].Width; |
|
542 |
r.y:= FrameY * SpritesData[Sprite].Height; |
|
543 |
r.h:= SpritesData[Sprite].Height; |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
544 |
DrawFromRect(X, Y, @r, SpritesData[Sprite].Texture) |
43 | 545 |
end; |
546 |
||
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
547 |
procedure DrawSurfSprite(X, Y, Height, Frame: LongInt; Source: PTexture); |
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
548 |
var r: TSDL_Rect; |
198 | 549 |
begin |
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
550 |
r.x:= 0; |
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
551 |
r.w:= Source^.w; |
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
552 |
r.y:= Frame * Height; |
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
553 |
r.h:= Height; |
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
554 |
DrawFromRect(X, Y, @r, Source) |
198 | 555 |
end; |
556 |
||
762 | 557 |
procedure DrawCentered(X, Top: LongInt; Source: PTexture); |
95 | 558 |
begin |
762 | 559 |
DrawTexture(X - Source^.w div 2, Top, Source) |
4 | 560 |
end; |
561 |
||
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1854
diff
changeset
|
562 |
procedure DrawHedgehog(X, Y: LongInt; Dir: LongInt; Pos, Step: LongWord; Angle: real); |
1916 | 563 |
const VertexBuffer: array [0..3] of TVertex2f = ( |
564 |
(x: -16; y: -16), |
|
565 |
(x: 16; y: -16), |
|
566 |
(x: 16; y: 16), |
|
567 |
(x: -16; y: 16)); |
|
761 | 568 |
var l, r, t, b: real; |
1916 | 569 |
TextureBuffer: array [0..3] of TVertex2f; |
4 | 570 |
begin |
761 | 571 |
|
572 |
t:= Pos * 32 / HHTexture^.h; |
|
573 |
b:= (Pos + 1) * 32 / HHTexture^.h; |
|
574 |
||
575 |
if Dir = -1 then |
|
576 |
begin |
|
577 |
l:= (Step + 1) * 32 / HHTexture^.w; |
|
578 |
r:= Step * 32 / HHTexture^.w |
|
579 |
end else |
|
580 |
begin |
|
581 |
l:= Step * 32 / HHTexture^.w; |
|
582 |
r:= (Step + 1) * 32 / HHTexture^.w |
|
583 |
end; |
|
584 |
||
821
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
809
diff
changeset
|
585 |
|
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
809
diff
changeset
|
586 |
glPushMatrix(); |
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
809
diff
changeset
|
587 |
glTranslatef(X, Y, 0); |
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
809
diff
changeset
|
588 |
glRotatef(Angle, 0, 0, 1); |
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
809
diff
changeset
|
589 |
|
761 | 590 |
glBindTexture(GL_TEXTURE_2D, HHTexture^.id); |
591 |
||
1916 | 592 |
TextureBuffer[0].X:= l; |
593 |
TextureBuffer[0].Y:= t; |
|
594 |
TextureBuffer[1].X:= r; |
|
595 |
TextureBuffer[1].Y:= t; |
|
596 |
TextureBuffer[2].X:= r; |
|
597 |
TextureBuffer[2].Y:= b; |
|
598 |
TextureBuffer[3].X:= l; |
|
599 |
TextureBuffer[3].Y:= b; |
|
761 | 600 |
|
1916 | 601 |
glEnableClientState(GL_VERTEX_ARRAY); |
602 |
glEnableClientState(GL_TEXTURE_COORD_ARRAY); |
|
761 | 603 |
|
1916 | 604 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
605 |
glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer[0]); |
|
606 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
761 | 607 |
|
1916 | 608 |
glDisableClientState(GL_TEXTURE_COORD_ARRAY); |
609 |
glDisableClientState(GL_VERTEX_ARRAY); |
|
761 | 610 |
|
1854 | 611 |
|
612 |
glColor4f(1,1,1,1); |
|
821
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
809
diff
changeset
|
613 |
|
e6c0408b54ed
Use 'regular standing' and 'rope swing' hedgehog sprites
unc0rr
parents:
809
diff
changeset
|
614 |
glPopMatrix |
4 | 615 |
end; |
616 |
||
1431 | 617 |
procedure DrawFillRect(r: TSDL_Rect); |
1916 | 618 |
var VertexBuffer: array [0..3] of TVertex2f; |
1431 | 619 |
begin |
620 |
glDisable(GL_TEXTURE_2D); |
|
621 |
||
622 |
glColor4ub(0, 0, 0, 127); |
|
623 |
||
1916 | 624 |
VertexBuffer[0].X:= r.x; |
625 |
VertexBuffer[0].Y:= r.y; |
|
626 |
VertexBuffer[1].X:= r.x + r.w; |
|
627 |
VertexBuffer[1].Y:= r.y; |
|
628 |
VertexBuffer[2].X:= r.x + r.w; |
|
629 |
VertexBuffer[2].Y:= r.y + r.h; |
|
630 |
VertexBuffer[3].X:= r.x; |
|
631 |
VertexBuffer[3].Y:= r.y + r.h; |
|
1431 | 632 |
|
1916 | 633 |
glEnableClientState(GL_VERTEX_ARRAY); |
634 |
glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
|
635 |
glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
|
636 |
glDisableClientState(GL_VERTEX_ARRAY); |
|
1431 | 637 |
|
638 |
glColor4f(1, 1, 1, 1); |
|
639 |
glEnable(GL_TEXTURE_2D) |
|
640 |
end; |
|
641 |
||
4 | 642 |
procedure StoreRelease; |
643 |
var ii: TSprite; |
|
644 |
begin |
|
645 |
for ii:= Low(TSprite) to High(TSprite) do |
|
769
788efc1d649f
- Save 8 MB of memory by freeing LandSurface and not using it anymore after game initialization
unc0rr
parents:
768
diff
changeset
|
646 |
begin |
759 | 647 |
FreeTexture(SpritesData[ii].Texture); |
769
788efc1d649f
- Save 8 MB of memory by freeing LandSurface and not using it anymore after game initialization
unc0rr
parents:
768
diff
changeset
|
648 |
if SpritesData[ii].Surface <> nil then SDL_FreeSurface(SpritesData[ii].Surface) |
788efc1d649f
- Save 8 MB of memory by freeing LandSurface and not using it anymore after game initialization
unc0rr
parents:
768
diff
changeset
|
649 |
end; |
761 | 650 |
|
1806 | 651 |
FreeTexture(HHTexture) |
4 | 652 |
end; |
653 |
||
762 | 654 |
function RenderStringTex(s: string; Color: Longword; font: THWFont): PTexture; |
432 | 655 |
var w, h: LongInt; |
351 | 656 |
Result: PSDL_Surface; |
95 | 657 |
begin |
355 | 658 |
TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), w, h); |
785 | 659 |
|
762 | 660 |
Result:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2, |
661 |
32, RMask, GMask, BMask, AMask); |
|
785 | 662 |
|
107 | 663 |
TryDo(Result <> nil, 'RenderString: fail to create surface', true); |
785 | 664 |
|
95 | 665 |
WriteInRoundRect(Result, 0, 0, Color, font, s); |
785 | 666 |
|
762 | 667 |
TryDo(SDL_SetColorKey(Result, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
785 | 668 |
|
762 | 669 |
RenderStringTex:= Surface2Tex(Result); |
785 | 670 |
|
762 | 671 |
SDL_FreeSurface(Result) |
95 | 672 |
end; |
673 |
||
4 | 674 |
procedure RenderHealth(var Hedgehog: THedgehog); |
95 | 675 |
var s: shortstring; |
4 | 676 |
begin |
351 | 677 |
str(Hedgehog.Gear^.Health, s); |
762 | 678 |
if Hedgehog.HealthTagTex <> nil then FreeTexture(Hedgehog.HealthTagTex); |
679 |
Hedgehog.HealthTagTex:= RenderStringTex(s, Hedgehog.Team^.Clan^.Color, fnt16) |
|
4 | 680 |
end; |
681 |
||
518 | 682 |
function LoadImage(const filename: string; hasAlpha: boolean; critical, setTransparent: boolean): PSDL_Surface; |
30 | 683 |
var tmpsurf: PSDL_Surface; |
753 | 684 |
//Result: PSDL_Surface; |
355 | 685 |
s: shortstring; |
4 | 686 |
begin |
687 |
WriteToConsole(msgLoading + filename + '... '); |
|
355 | 688 |
s:= filename + '.' + cBitsStr + '.png'; |
689 |
tmpsurf:= IMG_Load(Str2PChar(s)); |
|
351 | 690 |
|
74 | 691 |
if tmpsurf = nil then |
351 | 692 |
begin |
355 | 693 |
s:= filename + '.png'; |
694 |
tmpsurf:= IMG_Load(Str2PChar(s)); |
|
351 | 695 |
end; |
80 | 696 |
|
697 |
if tmpsurf = nil then |
|
698 |
if critical then OutError(msgFailed, true) |
|
699 |
else begin |
|
700 |
WriteLnToConsole(msgFailed); |
|
351 | 701 |
exit(nil) |
80 | 702 |
end; |
351 | 703 |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
704 |
if setTransparent then TryDo(SDL_SetColorKey(tmpsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); |
753 | 705 |
//if hasAlpha then Result:= SDL_DisplayFormatAlpha(tmpsurf) |
706 |
// else Result:= SDL_DisplayFormat(tmpsurf); |
|
620 | 707 |
{$IFDEF DEBUGFILE}WriteLnToConsole('(' + inttostr(tmpsurf^.w) + ',' + inttostr(tmpsurf^.h) + ') ');{$ENDIF} |
351 | 708 |
WriteLnToConsole(msgOK); |
753 | 709 |
LoadImage:= tmpsurf//Result |
710 |
end; |
|
711 |
||
712 |
procedure SetupOpenGL; |
|
713 |
begin |
|
756 | 714 |
glLoadIdentity; |
753 | 715 |
glViewport(0, 0, cScreenWidth, cScreenHeight); |
754 | 716 |
glScalef(2.0 / cScreenWidth, -2.0 / cScreenHeight, 1.0); |
717 |
glTranslatef(-cScreenWidth / 2, -cScreenHeight / 2, 0); |
|
756 | 718 |
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
753 | 719 |
glMatrixMode(GL_MODELVIEW) |
4 | 720 |
end; |
721 |
||
510 | 722 |
//////////////////////////////////////////////////////////////////////////////// |
766 | 723 |
var ProgrTex: PTexture = nil; |
534 | 724 |
Step: integer = 0; |
510 | 725 |
|
726 |
procedure AddProgress; |
|
727 |
var r: TSDL_Rect; |
|
766 | 728 |
texsurf: PSDL_Surface; |
510 | 729 |
begin |
730 |
if Step = 0 then |
|
731 |
begin |
|
732 |
WriteToConsole(msgLoading + 'progress sprite: '); |
|
766 | 733 |
texsurf:= LoadImage(Pathz[ptGraphics] + '/Progress', false, true, true); |
734 |
ProgrTex:= Surface2Tex(texsurf); |
|
735 |
SDL_FreeSurface(texsurf) |
|
510 | 736 |
end; |
1045 | 737 |
|
766 | 738 |
glClear(GL_COLOR_BUFFER_BIT); |
775 | 739 |
glEnable(GL_TEXTURE_2D); |
510 | 740 |
r.x:= 0; |
766 | 741 |
r.w:= ProgrTex^.w; |
742 |
r.h:= ProgrTex^.w; |
|
743 |
r.y:= (Step mod (ProgrTex^.h div ProgrTex^.w)) * ProgrTex^.w; |
|
744 |
DrawFromRect((cScreenWidth - ProgrTex^.w) div 2, |
|
841
0700e3d3474d
Get rid if deprecated Surface parameter of Draw* calls
unc0rr
parents:
840
diff
changeset
|
745 |
(cScreenHeight - ProgrTex^.w) div 2, @r, ProgrTex); |
775 | 746 |
glDisable(GL_TEXTURE_2D); |
766 | 747 |
SDL_GL_SwapBuffers(); |
510 | 748 |
inc(Step); |
749 |
end; |
|
750 |
||
751 |
procedure FinishProgress; |
|
752 |
begin |
|
753 |
WriteLnToConsole('Freeing progress surface... '); |
|
766 | 754 |
FreeTexture(ProgrTex) |
510 | 755 |
end; |
756 |
||
4 | 757 |
end. |