View Single Post
Old 11 September 2016, 11:50   #61
TroyWilkins
Registered User
 
TroyWilkins's Avatar
 
Join Date: Jan 2015
Location: Melbourne, Australia
Posts: 548
Quote:
Originally Posted by Zetr0 View Post
How I would write this, as if I was explaining it to a student I would initially write is thus -

Code:
void main( void )
{
    int ppoints[ 9 ];
    
    ppoints[ 0 ] = 0;             // since these are assigns 
    ppoints[ 3 ] = 0;             // and do not change in the code
    ppoints[ 4 ] = 200;             // its worthless to repeat the assign
    ppoints[ 7 ] = 200;             // better to assign then first 
    ppoints[ 8 ] = 0;              // and take only those that change into the loop
                                          // = 100 less commands ;)

    for (int candy=0 ; candy < 201; candy +=10 )
    {
        ppoints[ 1 ] = candy;
        ppoints[ 2 ] = (200 - candy);
        ppoints[ 5 ] = (200 - candy);
        ppoints[ 6 ] = candy;
        ppoints[ 9 ] = candy;
        PolyDraw( &rastPort, 5, ppoints);
    }
}
Have a look at that, obviously there are better / quicker ways - but since this is your first foray in C/C++ we should keep it simple to begin =)
Ahh, yes, of course, thank you, good thinking.

Now, I'm almost at my wits end, I can't work out what I';m doing wrong with PolyDraw, I keep getting:
Code:
argument type incorrect; expecting "WORD *", found "int *"
I'm sure it's something silly, but I'm stuck as to what I'm doing wrong, or what to do about it.
TroyWilkins is offline  
 
Page generated in 0.07106 seconds with 11 queries