hedgewars/uStore.pas
changeset 7049 35d762458d66
parent 7043 7c080e5ac8d0
child 7082 17b0892ac794
child 7085 953a9d896df1
equal deleted inserted replaced
7048:0a4c88935902 7049:35d762458d66
    39 procedure RenderWeaponTooltip(atype: TAmmoType);
    39 procedure RenderWeaponTooltip(atype: TAmmoType);
    40 procedure ShowWeaponTooltip(x, y: LongInt);
    40 procedure ShowWeaponTooltip(x, y: LongInt);
    41 procedure FreeWeaponTooltip;
    41 procedure FreeWeaponTooltip;
    42 procedure MakeCrossHairs;
    42 procedure MakeCrossHairs;
    43 
    43 
       
    44 procedure WarpMouse(x, y: Word); inline;
       
    45 procedure SwapBuffers; inline;
       
    46 
    44 implementation
    47 implementation
    45 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands, uDebug, uWorld;
    48 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands,
       
    49      uDebug{$IFDEF USE_CONTEXT_RESTORE}, uWorld{$ENDIF};
    46 
    50 
    47 //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    51 //type TGPUVendor = (gvUnknown, gvNVIDIA, gvATI, gvIntel, gvApple);
    48 
    52 
    49 var MaxTextureSize: LongInt;
    53 var MaxTextureSize: LongInt;
       
    54 {$IFDEF SDL13}
       
    55     SDLwindow: PSDL_Window;
       
    56     SDLGLcontext: PSDL_GLContext;
       
    57 {$ELSE}
    50     SDLPrimSurface: PSDL_Surface;
    58     SDLPrimSurface: PSDL_Surface;
    51 {$IFDEF SDL13}SDLGLcontext: PSDL_GLContext;{$ENDIF}
    59 {$ENDIF}
    52 
       
    53 //    cGPUVendor: TGPUVendor;
       
    54 
    60 
    55 function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect;
    61 function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect;
    56 var w, h: LongInt;
    62 var w, h: LongInt;
    57     tmpsurf: PSDL_Surface;
    63     tmpsurf: PSDL_Surface;
    58     clr: TSDL_Color;
    64     clr: TSDL_Color;
   792     r.w:= squaresize;
   798     r.w:= squaresize;
   793     r.h:= squaresize;
   799     r.h:= squaresize;
   794 
   800 
   795     DrawTextureFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex);
   801     DrawTextureFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex);
   796 
   802 
   797 {$IFDEF SDL13}
   803     SwapBuffers;
   798     SDL_GL_SwapWindow(SDLwindow);
       
   799 {$ELSE}
       
   800     SDL_GL_SwapBuffers();
       
   801 {$ENDIF}
       
   802     inc(Step);
   804     inc(Step);
   803 end;
   805 end;
   804 
   806 
   805 procedure FinishProgress;
   807 procedure FinishProgress;
   806 begin
   808 begin
  1122 var ai: TAmmoType;
  1124 var ai: TAmmoType;
  1123     i: LongInt;
  1125     i: LongInt;
  1124 begin
  1126 begin
  1125     RegisterVariable('fullscr', @chFullScr, true);
  1127     RegisterVariable('fullscr', @chFullScr, true);
  1126 
  1128 
  1127     SDLPrimSurface:= nil;
       
  1128 
       
  1129     cScaleFactor:= 2.0;
  1129     cScaleFactor:= 2.0;
  1130     Step:= 0;
  1130     Step:= 0;
  1131     ProgrTex:= nil;
  1131     ProgrTex:= nil;
  1132     SupportNPOTT:= false;
  1132     SupportNPOTT:= false;
  1133 //    cGPUVendor:= gvUnknown;
       
  1134 
  1133 
  1135     // init all ammo name texture pointers
  1134     // init all ammo name texture pointers
  1136     for ai:= Low(TAmmoType) to High(TAmmoType) do
  1135     for ai:= Low(TAmmoType) to High(TAmmoType) do
  1137     begin
  1136     begin
  1138         Ammoz[ai].NameTex := nil;
  1137         Ammoz[ai].NameTex := nil;
  1139     end;
  1138     end;
  1140     // init all count texture pointers
  1139     // init all count texture pointers
  1141     for i:= Low(CountTexz) to High(CountTexz) do
  1140     for i:= Low(CountTexz) to High(CountTexz) do
  1142         CountTexz[i] := nil;
  1141         CountTexz[i] := nil;
  1143 {$IFDEF SDL13}
  1142 {$IFDEF SDL13}
  1144     SDLGLcontext    := nil;
  1143     SDLwindow:= nil;
       
  1144     SDLGLcontext:= nil;
       
  1145 {$ELSE}
       
  1146     SDLPrimSurface:= nil;
  1145 {$ENDIF}
  1147 {$ENDIF}
  1146 end;
  1148 end;
  1147 
  1149 
  1148 procedure freeModule;
  1150 procedure freeModule;
  1149 begin
  1151 begin
  1154     SDL_DestroyWindow(SDLwindow);
  1156     SDL_DestroyWindow(SDLwindow);
  1155 {$ENDIF}
  1157 {$ENDIF}
  1156     SDL_Quit();
  1158     SDL_Quit();
  1157 end;
  1159 end;
  1158 
  1160 
       
  1161 procedure WarpMouse(x, y: Word); inline;
       
  1162 begin
       
  1163 {$IFDEF SDL13}
       
  1164     SDL_WarpMouseInWindow(SDLwindow, x, y);
       
  1165 {$ELSE}
       
  1166     x:= x; y:= y; // avoid hints
       
  1167 {$ENDIF}
       
  1168 end;
       
  1169 
       
  1170 procedure SwapBuffers; inline;
       
  1171 begin
       
  1172 {$IFDEF SDL13}
       
  1173     SDL_GL_SwapWindow(SDLwindow);
       
  1174 {$ELSE}
       
  1175     SDL_GL_SwapBuffers();
       
  1176 {$ENDIF}
       
  1177 end;
       
  1178 
  1159 end.
  1179 end.