hedgewars/hwengine.dpr
changeset 753 40fc0deb388f
parent 720 97a9d67d5c3e
child 756 2b307457fd68
equal deleted inserted replaced
752:69f1dc50a1fa 753:40fc0deb388f
    21 {$ENDIF}
    21 {$ENDIF}
    22 
    22 
    23 program hwengine;
    23 program hwengine;
    24 uses
    24 uses
    25   SDLh,
    25   SDLh,
       
    26   GL,
    26   uConsts in 'uConsts.pas',
    27   uConsts in 'uConsts.pas',
    27   uGame in 'uGame.pas',
    28   uGame in 'uGame.pas',
    28   uMisc in 'uMisc.pas',
    29   uMisc in 'uMisc.pas',
    29   uStore in 'uStore.pas',
    30   uStore in 'uStore.pas',
    30   uWorld in 'uWorld.pas',
    31   uWorld in 'uWorld.pas',
    98               FinishProgress;
    99               FinishProgress;
    99               GameState:= gsGame
   100               GameState:= gsGame
   100               end;
   101               end;
   101      gsGame : begin
   102      gsGame : begin
   102               ProcessKbd;
   103               ProcessKbd;
       
   104               glClear(GL_COLOR_BUFFER_BIT);
   103               DoGameTick(Lag);
   105               DoGameTick(Lag);
   104               DrawWorld(Lag, SDLPrimSurface);
   106               DrawWorld(Lag, SDLPrimSurface);
   105               end;
   107               end;
   106    gsConsole: begin
   108    gsConsole: begin
   107               DoGameTick(Lag);
   109               DoGameTick(Lag);
   108               DrawWorld(Lag, SDLPrimSurface);
   110               glClear(GL_COLOR_BUFFER_BIT);
   109               DrawConsole(SDLPrimSurface);
   111 //              DrawWorld(Lag, SDLPrimSurface);
       
   112 //              DrawConsole(SDLPrimSurface);
   110               end;
   113               end;
   111      gsExit : begin
   114      gsExit : begin
   112               OnDestroy;
   115               OnDestroy;
   113               end;
   116               end;
   114      end;
   117      end;
   115 
   118 
   116 SDL_Flip(SDLPrimSurface);
   119 //SDL_Flip(SDLPrimSurface);
       
   120 SDL_GL_SwapBuffers();
   117 if flagMakeCapture then
   121 if flagMakeCapture then
   118    begin
   122    begin
   119    flagMakeCapture:= false;
   123    flagMakeCapture:= false;
   120    s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.bmp';
   124    s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.bmp';
   121    WriteLnToConsole('Saving ' + s);
   125    WriteLnToConsole('Saving ' + s);
   228 var s: shortstring;
   232 var s: shortstring;
   229 begin
   233 begin
   230 WriteToConsole('Init SDL... ');
   234 WriteToConsole('Init SDL... ');
   231 SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true);
   235 SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true);
   232 WriteLnToConsole(msgOK);
   236 WriteLnToConsole(msgOK);
       
   237 
   233 SDL_EnableUNICODE(1);
   238 SDL_EnableUNICODE(1);
   234 
   239 
   235 WriteToConsole('Init SDL_ttf... ');
   240 WriteToConsole('Init SDL_ttf... ');
   236 SDLTry(TTF_Init <> -1, true);
   241 SDLTry(TTF_Init <> -1, true);
   237 WriteLnToConsole(msgOK);
   242 WriteLnToConsole(msgOK);