equal
deleted
inserted
replaced
68 _l, _r, _t, _b: real; |
68 _l, _r, _t, _b: real; |
69 VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
69 VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
70 begin |
70 begin |
71 if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit; |
71 if (SourceTexture^.h = 0) or (SourceTexture^.w = 0) then exit; |
72 |
72 |
73 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
73 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
74 if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then |
74 if (abs(X) > W) and ((abs(X + W / 2) - W / 2) > cScreenWidth / cScaleFactor) then |
75 exit; |
75 exit; |
76 if (abs(Y) > H) and ((abs(Y + H / 2 - (0.5 * cScreenHeight)) - H / 2) > cScreenHeight / cScaleFactor) then |
76 if (abs(Y) > H) and ((abs(Y + H / 2 - (0.5 * cScreenHeight)) - H / 2) > cScreenHeight / cScaleFactor) then |
77 exit; |
77 exit; |
78 |
78 |
137 procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); |
137 procedure DrawRotatedTextureF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real); |
138 var ft, fb, fl, fr: GLfloat; |
138 var ft, fb, fl, fr: GLfloat; |
139 hw, nx, ny: LongInt; |
139 hw, nx, ny: LongInt; |
140 VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
140 VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; |
141 begin |
141 begin |
142 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
142 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
143 if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then |
143 if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * cScaleFactor > cScreenWidth) then |
144 exit; |
144 exit; |
145 if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then |
145 if (abs(Y) > H) and ((abs(Y + OffsetY - (0.5 * cScreenHeight)) - W / 2) * cScaleFactor > cScreenHeight) then |
146 exit; |
146 exit; |
147 |
147 |
224 end; |
224 end; |
225 |
225 |
226 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); |
226 procedure DrawRotatedTex(Tex: PTexture; hw, hh, X, Y, Dir: LongInt; Angle: real); |
227 var VertexBuffer: array [0..3] of TVertex2f; |
227 var VertexBuffer: array [0..3] of TVertex2f; |
228 begin |
228 begin |
229 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
229 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
230 if (abs(X) > 2 * hw) and ((abs(X) - hw) > cScreenWidth / cScaleFactor) then |
230 if (abs(X) > 2 * hw) and ((abs(X) - hw) > cScreenWidth / cScaleFactor) then |
231 exit; |
231 exit; |
232 if (abs(Y) > 2 * hh) and ((abs(Y - 0.5 * cScreenHeight) - hh) > cScreenHeight / cScaleFactor) then |
232 if (abs(Y) > 2 * hh) and ((abs(Y - 0.5 * cScreenHeight) - hh) > cScreenHeight / cScaleFactor) then |
233 exit; |
233 exit; |
234 |
234 |
342 end; |
342 end; |
343 |
343 |
344 procedure DrawFillRect(r: TSDL_Rect); |
344 procedure DrawFillRect(r: TSDL_Rect); |
345 var VertexBuffer: array [0..3] of TVertex2f; |
345 var VertexBuffer: array [0..3] of TVertex2f; |
346 begin |
346 begin |
347 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
347 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
348 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then |
348 if (abs(r.x) > r.w) and ((abs(r.x + r.w / 2) - r.w / 2) * cScaleFactor > cScreenWidth) then |
349 exit; |
349 exit; |
350 if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then |
350 if (abs(r.y) > r.h) and ((abs(r.y + r.h / 2 - (0.5 * cScreenHeight)) - r.h / 2) * cScaleFactor > cScreenHeight) then |
351 exit; |
351 exit; |
352 |
352 |
405 (x: 16; y: 16), |
405 (x: 16; y: 16), |
406 (x: -16; y: 16)); |
406 (x: -16; y: 16)); |
407 var l, r, t, b: real; |
407 var l, r, t, b: real; |
408 TextureBuffer: array [0..3] of TVertex2f; |
408 TextureBuffer: array [0..3] of TVertex2f; |
409 begin |
409 begin |
410 // don't draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
410 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs) |
411 if (abs(X) > 32) and ((abs(X) - 16) * cScaleFactor > cScreenWidth) then |
411 if (abs(X) > 32) and ((abs(X) - 16) * cScaleFactor > cScreenWidth) then |
412 exit; |
412 exit; |
413 if (abs(Y) > 32) and ((abs(Y - 0.5 * cScreenHeight) - 16) * cScaleFactor > cScreenHeight) then |
413 if (abs(Y) > 32) and ((abs(Y - 0.5 * cScreenHeight) - 16) * cScaleFactor > cScreenHeight) then |
414 exit; |
414 exit; |
415 |
415 |