hedgewars/uStore.pas
changeset 10266 a90a55ec5b98
parent 10262 435c82ab9058
child 10275 6c91047f59b6
equal deleted inserted replaced
10265:7e8d4cd76ce7 10266:a90a55ec5b98
    69 procedure SetTexCoordPointer(p: Pointer;n: Integer);
    69 procedure SetTexCoordPointer(p: Pointer;n: Integer);
    70 procedure SetVertexPointer(p: Pointer;n: Integer);
    70 procedure SetVertexPointer(p: Pointer;n: Integer);
    71 procedure SetColorPointer(p: Pointer;n: Integer);
    71 procedure SetColorPointer(p: Pointer;n: Integer);
    72 procedure BeginWater;
    72 procedure BeginWater;
    73 procedure EndWater;
    73 procedure EndWater;
       
    74 
       
    75 procedure updateViewLimits();
    74 
    76 
    75 implementation
    77 implementation
    76 uses uMisc, uConsole, uVariables, uUtils, uTextures, uRender, uRenderUtils,
    78 uses uMisc, uConsole, uVariables, uUtils, uTextures, uRender, uRenderUtils,
    77      uCommands, uPhysFSLayer, uDebug
    79      uCommands, uPhysFSLayer, uDebug
    78     {$IFDEF GL2}, uMatrix{$ENDIF}
    80     {$IFDEF GL2}, uMatrix{$ENDIF}
  1173     glMatrixMode(GL_MODELVIEW);
  1175     glMatrixMode(GL_MODELVIEW);
  1174 {$ENDIF}
  1176 {$ENDIF}
  1175 end;
  1177 end;
  1176 *)
  1178 *)
  1177 
  1179 
       
  1180 
       
  1181 procedure updateViewLimits();
       
  1182 var tmp: real;
       
  1183 begin
       
  1184     // cScaleFactor is 2.0 on "no zoom"
       
  1185     tmp:= cScreenWidth / cScaleFactor;
       
  1186     ViewRightX:= round(tmp); // ceil could make more sense
       
  1187     ViewLeftX:= round(-tmp); // floor could make more sense
       
  1188     tmp:= cScreenHeight / cScaleFactor;
       
  1189     ViewBottomY:= round(tmp) + cScreenHeight div 2; // ceil could make more sense
       
  1190     ViewTopY:= round(-tmp) + cScreenHeight div 2; // floor could make more sense
       
  1191 end;
       
  1192 
  1178 procedure SetScale(f: GLfloat);
  1193 procedure SetScale(f: GLfloat);
  1179 begin
  1194 begin
  1180 // leave immediately if scale factor did not change
  1195 // leave immediately if scale factor did not change
  1181     if f = cScaleFactor then
  1196     if f = cScaleFactor then
  1182         exit;
  1197         exit;
  1201         glTranslatef(0, -cScreenHeight / 2, 0);
  1216         glTranslatef(0, -cScreenHeight / 2, 0);
  1202 {$ENDIF}
  1217 {$ENDIF}
  1203         end;
  1218         end;
  1204 
  1219 
  1205     cScaleFactor:= f;
  1220     cScaleFactor:= f;
       
  1221     updateViewLimits();
  1206 
  1222 
  1207 {$IFDEF GL2}
  1223 {$IFDEF GL2}
  1208     UpdateModelviewProjection;
  1224     UpdateModelviewProjection;
  1209 {$ENDIF}
  1225 {$ENDIF}
  1210 end;
  1226 end;
  1688     i: LongInt;
  1704     i: LongInt;
  1689 begin
  1705 begin
  1690     RegisterVariable('fullscr', @chFullScr, true);
  1706     RegisterVariable('fullscr', @chFullScr, true);
  1691 
  1707 
  1692     cScaleFactor:= 2.0;
  1708     cScaleFactor:= 2.0;
       
  1709     updateViewLimits();
  1693     Step:= 0;
  1710     Step:= 0;
  1694     ProgrTex:= nil;
  1711     ProgrTex:= nil;
  1695     SupportNPOTT:= false;
  1712     SupportNPOTT:= false;
  1696 
  1713 
  1697     // init all ammo name texture pointers
  1714     // init all ammo name texture pointers