From 2d37f79254cc1a29020def26ac22f55ad9175c5c Mon Sep 17 00:00:00 2001 From: sparky4 Date: Wed, 16 Dec 2015 10:35:38 -0600 Subject: [PATCH] ww --- 16/xw/modex/demo01.c | 53 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/16/xw/modex/demo01.c b/16/xw/modex/demo01.c index 9ec316f6..a53f87a2 100755 --- a/16/xw/modex/demo01.c +++ b/16/xw/modex/demo01.c @@ -29,15 +29,15 @@ procedure sxInit( var S: TSprite ); var I: word; begin - S.X := Random( 320 ); /* Initialize position with random values */ - S.Y := Random( 240 ); - S.DX := Random( 7 )-3; /* Initialize speed with random values */ - S.DY := Random( 7 )-3; - S.W := 16; /* Size is fixed in this program */ - S.H := 16; + S.X = Random( 320 ); /* Initialize position with random values */ + S.Y = Random( 240 ); + S.DX = Random( 7 )-3; /* Initialize speed with random values */ + S.DY = Random( 7 )-3; + S.W = 16; /* Size is fixed in this program */ + S.H = 16; /* The image is a square with a hole inside */ FillChar( S.Image, SizeOf(S.Image), Random(15)+1 ); - for I:=5 to 12 do FillChar( S.Image[ I, 5 ], 8, 0 ); + for I=5 to 12 do FillChar( S.Image[ I, 5 ], 8, 0 ); } /* Moves a sprite */ @@ -47,20 +47,20 @@ begin Inc( S.Y, S.DY ); /* Check sprite position, change delta if needed */ if( S.X > 320 ) then begin - S.X := 320; - S.DX := -S.DX; + S.X = 320; + S.DX = -S.DX; } if( S.X < -16 ) then begin - S.X := -16; - S.DX := -S.DX; + S.X = -16; + S.DX = -S.DX; } if( S.Y > 240 ) then begin - S.Y := 240; - S.DY := -S.DY; + S.Y = 240; + S.DY = -S.DY; } if( S.Y < -16 ) then begin - S.Y := -16; - S.DY := -S.DY; + S.Y = -16; + S.DY = -S.DY; } /* Draw the sprite, note the Page offset added to the */ /* Y coordinate of the image */ @@ -92,21 +92,22 @@ void main() } /* Compute and set palette */ - for I:=1 to 192 do with Palette[I+63] do begin - R := 0; - G := 0; - B := 0; - if( I < 64 ) then - R := I shr 1+31 + for(i=1;i<= 192;Palette[i+63]) + { + short R = 0; + short G = 0; + short B = 0; + if( i < 64 ) + R = i shr 1+31 else if( i < 128 ) - G := (I-64) shr 1+31 + G = (i-64) shr 1+31 else - B := (I-128) shr 1+31; + B = (i-128) shr 1+31; } mxSetPalette( @Palette[64], 64, 192 ); /* Main loop */ - Page := 240; + short Page = 240; while(!kbhit()) { /* Set clip region to current page */ @@ -115,12 +116,12 @@ void main() /* Restore background */ mxBitBlt( 0, 480, 320, 240, 0, Page ); /* Draw sprites */ - for I:=1 to MAX_SPRITE do sxMove( S[I] ); + for(i=1; i <= MAX_SPRITE; sxMove( S[i] )); /* Print message */ mxOutStr( 4, Page+4, 'Some sprites moving...' ); /* Flip page */ mxStartLine( Page ); - Page := 240-Page; + Page = 240-Page; /* Animate palette */ mxSetPalette( @Palette[64], 64, 192 ); mxRotatePalette( @Palette[64], 192, 3 ); -- 2.39.5