hedgewars/uStore.pas
changeset 766 cdc8f75ab7bc
parent 765 a45111da760e
child 768 2886dafa5bcf
equal deleted inserted replaced
765:a45111da760e 766:cdc8f75ab7bc
   247     {$I+}
   247     {$I+}
   248     TryDo(IOResult = 0, msgFailed, true);
   248     TryDo(IOResult = 0, msgFailed, true);
   249     WriteLnToConsole(msgOK);
   249     WriteLnToConsole(msgOK);
   250     val(s, cExplosionBorderColor, c);
   250     val(s, cExplosionBorderColor, c);
   251     TryDo(c = 0, 'Theme data corrupted', true);
   251     TryDo(c = 0, 'Theme data corrupted', true);
   252     AdjustColor(cExplosionBorderColor);
   252     cExplosionBorderColor:= SDL_MapRGB(LandSurface^.format,
       
   253                                        cExplosionBorderColor shr 16,
       
   254                                        cExplosionBorderColor shr 8,
       
   255                                        cExplosionBorderColor and $FF);
   253     end;
   256     end;
   254 
   257 
   255 begin
   258 begin
   256 for fi:= Low(THWFont) to High(THWFont) do
   259 for fi:= Low(THWFont) to High(THWFont) do
   257     with Fontz[fi] do
   260     with Fontz[fi] do
   543 WriteLnToConsole(msgOK);
   546 WriteLnToConsole(msgOK);
   544 LoadImage:= tmpsurf//Result
   547 LoadImage:= tmpsurf//Result
   545 end;
   548 end;
   546 
   549 
   547 procedure SetupOpenGL;
   550 procedure SetupOpenGL;
   548 //var aspect: real;
   551 begin
   549 begin
       
   550 //aspect:= cScreenWidth / cScreenHeight;
       
   551 
       
   552 glLoadIdentity;
   552 glLoadIdentity;
   553 glViewport(0, 0, cScreenWidth, cScreenHeight);
   553 glViewport(0, 0, cScreenWidth, cScreenHeight);
   554 glScalef(2.0 / cScreenWidth, -2.0 / cScreenHeight, 1.0);
   554 glScalef(2.0 / cScreenWidth, -2.0 / cScreenHeight, 1.0);
   555 glTranslatef(-cScreenWidth / 2, -cScreenHeight / 2, 0);
   555 glTranslatef(-cScreenWidth / 2, -cScreenHeight / 2, 0);
   556 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   556 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   557 glMatrixMode(GL_MODELVIEW)
   557 glMatrixMode(GL_MODELVIEW)
   558 end;
   558 end;
   559 
   559 
   560 ////////////////////////////////////////////////////////////////////////////////
   560 ////////////////////////////////////////////////////////////////////////////////
   561 var ProgrSurf: PSDL_Surface = nil;
   561 var ProgrTex: PTexture = nil;
   562     Step: integer = 0;
   562     Step: integer = 0;
   563 
   563 
   564 procedure AddProgress;
   564 procedure AddProgress;
   565 var r: TSDL_Rect;
   565 var r: TSDL_Rect;
       
   566     texsurf: PSDL_Surface;
   566 begin
   567 begin
   567 if Step = 0 then
   568 if Step = 0 then
   568    begin
   569    begin
   569    WriteToConsole(msgLoading + 'progress sprite: ');
   570    WriteToConsole(msgLoading + 'progress sprite: ');
   570    ProgrSurf:= LoadImage(Pathz[ptGraphics] + '/Progress', false, true, true);
   571    texsurf:= LoadImage(Pathz[ptGraphics] + '/Progress', false, true, true);
       
   572    ProgrTex:= Surface2Tex(texsurf);
       
   573    SDL_FreeSurface(texsurf)
   571    end;
   574    end;
   572 SDL_FillRect(SDLPrimSurface, nil, 0);
   575 glClear(GL_COLOR_BUFFER_BIT);
   573 r.x:= 0;
   576 r.x:= 0;
   574 r.w:= ProgrSurf^.w;
   577 r.w:= ProgrTex^.w;
   575 r.h:= ProgrSurf^.w;
   578 r.h:= ProgrTex^.w;
   576 r.y:= (Step mod (ProgrSurf^.h div ProgrSurf^.w)) * ProgrSurf^.w;
   579 r.y:= (Step mod (ProgrTex^.h div ProgrTex^.w)) * ProgrTex^.w;
   577 //DrawFromRect((cScreenWidth - ProgrSurf^.w) div 2,
   580 DrawFromRect((cScreenWidth - ProgrTex^.w) div 2,
   578 //             (cScreenHeight - ProgrSurf^.w) div 2, @r, ProgrSurf, SDLPrimSurface);
   581              (cScreenHeight - ProgrTex^.w) div 2, @r, ProgrTex, SDLPrimSurface);
   579 SDL_Flip(SDLPrimSurface);
   582 SDL_GL_SwapBuffers();
   580 inc(Step);
   583 inc(Step);
   581 end;
   584 end;
   582 
   585 
   583 procedure FinishProgress;
   586 procedure FinishProgress;
   584 begin
   587 begin
   585 WriteLnToConsole('Freeing progress surface... ');
   588 WriteLnToConsole('Freeing progress surface... ');
   586 SDL_FreeSurface(ProgrSurf)
   589 FreeTexture(ProgrTex)
   587 end;
   590 end;
   588 
   591 
   589 end.
   592 end.