74 function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture; |
74 function RenderHelpWindow(caption, subcaption, description, extra: ansistring; extracolor: LongInt; iconsurf: PSDL_Surface; iconrect: PSDL_Rect): PTexture; |
75 procedure RenderWeaponTooltip(atype: TAmmoType); |
75 procedure RenderWeaponTooltip(atype: TAmmoType); |
76 procedure ShowWeaponTooltip(x, y: LongInt); |
76 procedure ShowWeaponTooltip(x, y: LongInt); |
77 procedure FreeWeaponTooltip; |
77 procedure FreeWeaponTooltip; |
78 procedure Tint(r, g, b, a: Byte); inline; |
78 procedure Tint(r, g, b, a: Byte); inline; |
79 procedure Tint(c: Longword); inline; |
|
80 |
79 |
81 implementation |
80 implementation |
82 uses uMisc, uConsole, uLand, uLocale, uWorld{$IFDEF IPHONEOS}, PascalExports{$ENDIF}; |
81 uses uMisc, uConsole, uLand, uLocale, uWorld{$IFDEF IPHONEOS}, PascalExports{$ENDIF}; |
83 |
82 |
84 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); |
83 type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple); |
86 var HHTexture: PTexture; |
85 var HHTexture: PTexture; |
87 MaxTextureSize: LongInt; |
86 MaxTextureSize: LongInt; |
88 cGPUVendor: TGPUVendor; |
87 cGPUVendor: TGPUVendor; |
89 lastTint: Longword; |
88 lastTint: Longword; |
90 |
89 |
91 {$IFNDEF IPHONEOS} |
|
92 procedure Tint(r, g, b, a: Byte); inline; |
|
93 begin |
|
94 Tint((a shl 24) or (r shl 16) or (g shl 8) or b); |
|
95 end; |
|
96 |
|
97 procedure Tint(c: Longword); inline; |
|
98 begin |
|
99 if c = lastTint then |
|
100 exit; |
|
101 glColor4ubv(@c); |
|
102 lastTint:= c; |
|
103 end; |
|
104 {$ELSE} |
|
105 procedure Tint(r, g, b, a: Byte); inline; |
90 procedure Tint(r, g, b, a: Byte); inline; |
106 var nc: Longword; |
91 var nc: Longword; |
107 begin |
92 begin |
108 nc:= (a shl 24) or (b shl 16) or (g shl 8) or r; |
93 nc:= (a shl 24) or (b shl 16) or (g shl 8) or r; |
109 if nc = lastTint then |
94 if nc = lastTint then |
110 exit; |
95 exit; |
111 glColor4ub(r, g, b, a); |
96 glColor4ub(r, g, b, a); |
112 lastTint:= nc; |
97 lastTint:= nc; |
113 end; |
98 end; |
114 |
|
115 procedure Tint(c: Longword); inline; |
|
116 begin |
|
117 if c = lastTint then |
|
118 exit; |
|
119 Tint((c shr 16) and $FF, (c shr 8) and $FF, c and $FF, (c shr 24) and $FF); |
|
120 lastTint:= c; |
|
121 end; |
|
122 {$ENDIF} |
|
123 |
99 |
124 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); |
100 procedure DrawRoundRect(rect: PSDL_Rect; BorderColor, FillColor: Longword; Surface: PSDL_Surface; Clear: boolean); |
125 var r: TSDL_Rect; |
101 var r: TSDL_Rect; |
126 begin |
102 begin |
127 r:= rect^; |
103 r:= rect^; |
797 procedure DrawFillRect(r: TSDL_Rect); |
773 procedure DrawFillRect(r: TSDL_Rect); |
798 var VertexBuffer: array [0..3] of TVertex2f; |
774 var VertexBuffer: array [0..3] of TVertex2f; |
799 begin |
775 begin |
800 glDisable(GL_TEXTURE_2D); |
776 glDisable(GL_TEXTURE_2D); |
801 |
777 |
802 Tint($80000000); |
778 Tint($00, $00, $00, $80); |
803 |
779 |
804 VertexBuffer[0].X:= r.x; |
780 VertexBuffer[0].X:= r.x; |
805 VertexBuffer[0].Y:= r.y; |
781 VertexBuffer[0].Y:= r.y; |
806 VertexBuffer[1].X:= r.x + r.w; |
782 VertexBuffer[1].X:= r.x + r.w; |
807 VertexBuffer[1].Y:= r.y; |
783 VertexBuffer[1].Y:= r.y; |
813 glEnableClientState(GL_VERTEX_ARRAY); |
789 glEnableClientState(GL_VERTEX_ARRAY); |
814 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
790 glVertexPointer(2, GL_FLOAT, 0, @VertexBuffer[0]); |
815 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
791 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(VertexBuffer)); |
816 glDisableClientState(GL_VERTEX_ARRAY); |
792 glDisableClientState(GL_VERTEX_ARRAY); |
817 |
793 |
818 Tint($FFFFFFFF); |
794 Tint($FF, $FF, $FF, $FF); |
819 glEnable(GL_TEXTURE_2D) |
795 glEnable(GL_TEXTURE_2D) |
820 end; |
796 end; |
821 |
797 |
822 procedure StoreRelease; |
798 procedure StoreRelease; |
823 var ii: TSprite; |
799 var ii: TSprite; |