26 procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); |
26 procedure flipSurface(Surface: PSDL_Surface; Vertical: Boolean); |
27 |
27 |
28 procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL |
28 procedure copyRotatedSurface(src, dest: PSDL_Surface); // this is necessary since width/height are read only in SDL |
29 procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); inline; |
29 procedure copyToXY(src, dest: PSDL_Surface; destX, destY: LongInt); inline; |
30 procedure copyToXYFromRect(src, dest: PSDL_Surface; srcX, srcY, srcW, srcH, destX, destY: LongInt); |
30 procedure copyToXYFromRect(src, dest: PSDL_Surface; srcX, srcY, srcW, srcH, destX, destY: LongInt); |
|
31 |
|
32 function GetSurfaceFrameCoordinateX(Surface: PSDL_Surface; Frame, frameWidth, frameHeight: LongInt): LongInt; |
|
33 function GetSurfaceFrameCoordinateY(Surface: PSDL_Surface; Frame, frameHeight: LongInt): LongInt; |
31 |
34 |
32 procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); inline; |
35 procedure DrawSprite2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt); inline; |
33 procedure DrawSpriteFrame2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt; frame: LongInt); |
36 procedure DrawSpriteFrame2Surf(sprite: TSprite; dest: PSDL_Surface; x,y: LongInt; frame: LongInt); |
34 procedure DrawLine2Surf(dest: PSDL_Surface; x0,y0,x1,y1:LongInt; r,g,b: byte); |
37 procedure DrawLine2Surf(dest: PSDL_Surface; x0,y0,x1,y1:LongInt; r,g,b: byte); |
35 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); |
38 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); |
75 (* |
78 (* |
76 function WriteInRoundRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect; |
79 function WriteInRoundRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect; |
77 begin |
80 begin |
78 WriteInRoundRect:= WriteInRoundRect(Surface, X, Y, Color, Font, s, 0); |
81 WriteInRoundRect:= WriteInRoundRect(Surface, X, Y, Color, Font, s, 0); |
79 end;*) |
82 end;*) |
|
83 |
|
84 function GetSurfaceFrameCoordinateX(Surface: PSDL_Surface; Frame, frameWidth, frameHeight: LongInt): LongInt; |
|
85 var nx, ny: LongInt; |
|
86 begin |
|
87 nx:= Surface^.w div frameWidth; // number of horizontal frames |
|
88 if nx = 0 then nx:= 1; // one frame is minimum |
|
89 ny:= Surface^.h div frameHeight; // number of vertical frames |
|
90 if ny = 0 then ny:= 1; |
|
91 GetSurfaceFrameCoordinateX:= (Frame div ny) * frameWidth; |
|
92 end; |
|
93 |
|
94 function GetSurfaceFrameCoordinateY(Surface: PSDL_Surface; Frame, frameHeight: LongInt): LongInt; |
|
95 var ny: LongInt; |
|
96 begin |
|
97 ny:= Surface^.h div frameHeight; // number of vertical frames |
|
98 if ny = 0 then ny:= 1; // one frame is minimum |
|
99 GetSurfaceFrameCoordinateY:= (Frame mod ny) * frameHeight; |
|
100 end; |
80 |
101 |
81 function IsTooDarkToRead(TextColor: LongWord): boolean; inline; |
102 function IsTooDarkToRead(TextColor: LongWord): boolean; inline; |
82 var clr: TSDL_Color; |
103 var clr: TSDL_Color; |
83 begin |
104 begin |
84 clr.r:= (TextColor shr 16) and $FF; |
105 clr.r:= (TextColor shr 16) and $FF; |