Changes

1,672 bytes added ,  05:36, 27 August 2008
no edit summary
Line 846: Line 846:  
Parameters:
 
Parameters:
 
borderColor A GXColor with the desired data.</source>
 
borderColor A GXColor with the desired data.</source>
 +
 
For the purpose of this guide, we will only be dealing with a 32-bit colour stream, there are several flags you can use as it is passed directly to DX, we will use DXColor. A simple call to this using our quad object may look something like this:
 
For the purpose of this guide, we will only be dealing with a 32-bit colour stream, there are several flags you can use as it is passed directly to DX, we will use DXColor. A simple call to this using our quad object may look something like this:
 +
 +
 +
<source lang="cpp">quad.SetFillColor((GXColor){0x00, 0x00, 0x00, 0xFF});</source>
 +
 +
first we pass the colour flag called GXColor then the required RGBA colours. This would make our quad object fill with the colour black and because the alpha value is set to full its solid. To understand what the values in hex are see chapter 2. Aside from the ability to set a colour, being able to set its alpha is very handy, you can create fade screens by creating a variable that holds the value 255, then, when something happens you could fade it out then fade in again. There’s a function in spritetest.cpp that accomplishes this task although I won’t go over it here, but it can be used in a similar way to the SetTransparency() function that we used on the sprites.
 +
 +
Now I’ll go through a series of Get/Set Functions that are in the Quad class, explaining what they are and how to use em.
 +
 +
'''SetRotation and GetRotation'''
 +
 +
<source lang="cpp">void wsp::Quad::SetRotation ( f32 rotation )
 +
Sets the rotation angle of the quad.
 +
Parameters:
 +
rotation The new angle of the quad. It is measured in degrees/2, so if 90 degrees is wanted, 45 degrees should be the passed parameter.</source>
 +
 +
This works in the same way as SetRotation() in Lesson 4, the value passed must by divided by two in order to get the true result. As this simply works in the same way as SetRotation in the Sprite class, simply read that description in order to learn how to use it. GetRotation() works in the same way as any other ‘Get’ function. Simply call GetRotation from the Quad class to, well, get the current angle of rotation. Examples of how both of these functions would be used:
48

edits