Browse Source

Update demo09.pas

Seenkao 2 years ago
parent
commit
f64f67ec18
1 changed files with 14 additions and 8 deletions
  1. 14 8
      Zengl_SRC/demos/FreePascal/09 - Sprite Engine(Classes)/demo09.pas

+ 14 - 8
Zengl_SRC/demos/FreePascal/09 - Sprite Engine(Classes)/demo09.pas

@@ -53,9 +53,10 @@ var
 
   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 );
@@ -150,10 +151,11 @@ begin
 
   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;
@@ -168,23 +170,27 @@ begin
 
   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;