Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Update demo09.pas
Browse files Browse the repository at this point in the history
  • Loading branch information
Seenkao authored Jun 11, 2023
1 parent 9356bd1 commit f64f67e
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Zengl_SRC/demos/FreePascal/09 - Sprite Engine(Classes)/demo09.pas
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ CMiku = class(zglCSprite2D)

TimeStart : LongWord = 0;
TimeMiku : LongWord = 0;

{$IfNDef OLD_METHODS}
newColor : LongWord;
correctColor: array[0..1] of LongWord;
{$EndIf}

// Miku
procedure CMiku.OnInit( _Texture : zglPTexture; _Layer : Integer );
Expand Down Expand Up @@ -150,10 +151,11 @@ procedure Init;

fntMain := font_LoadFromFile( dirRes + 'font.zfi' );
setFontTextScale(15, fntMain);

{$IfNDef OLD_METHODS}
newColor := Color_FindOrAdd($80A080FF - 55);
correctColor[1] := Color_FindOrAdd($7FAF7FFF);
correctColor[0] := Color_FindOrAdd($AFAFAFFF);
{$EndIf}
end;

procedure Draw;
Expand All @@ -168,23 +170,27 @@ procedure Draw;

if time <= 255 Then
begin
pr2d_Rect(0, 0, 800, 600,{$IfDef OLD_METHODS} $7FAF7F, 255,{$Else}correctColor[1],{$EndIf} PR2D_FILL);
{$IfNDef OLD_METHODS}
i := Get_Color(correctColor[1]);
pr2d_Rect(0, 0, 800, 600,{$IfDef OLD_METHODS} $7FAF7F, 255,{$Else}correctColor[1],{$EndIf} PR2D_FILL);
dec(i);
if i < $7FAF7F00 then
i := $7FAF7F00;
Correct_Color(correctColor[1], i);
dec(i);
if i < $7FAF7F00 then
i := $7FAF7F00;
Correct_Color(correctColor[1], i);
{$EndIf}
ssprite2d_Draw(texLogo, 400 - 256, 300 - 128, 512, 256, 0, time)
end
else
if time < 510 Then
begin
i := Get_Color(correctColor[0]);
pr2d_Rect( 0, 0, 800, 600,{$IfDef OLD_METHODS} $AFAFAF, 510 - time,{$Else}correctColor[0],{$EndIf} PR2D_FILL );
{$IfNDef OLD_METHODS}
i := Get_Color(correctColor[0]);
dec(i);
if i < $AFAFAF00 then
i := $AFAFAF00;
Correct_Color(correctColor[0], i);
{$EndIf}
ssprite2d_Draw( texLogo, 400 - 256, 300 - 128, 512, 256, 0, 510 - time );
end;

Expand Down

0 comments on commit f64f67e

Please sign in to comment.