Game Development Reference
In-Depth Information
Skip invisible rows at the top of the game ield:
if ( Y + j < 0 ) { continue; }
intc = Figure->GetMask( i, j );
if ( c >= 0 && c < NUM_COLORS )
{
DrawTexQuad(
(X + i) *(BlockSize + 4.0f) + 2.0f,
(Y + j) * (BlockSize + 4.0f) + 2.0f,
BlockSize, BlockSize, OfsX, OfsY,
g_Colors[c], c % NUM_BRICK_IMAGES );
}
}
}
}
DrawBorder() function is just a shortcut to Canvas :
void DrawBorder( float X1, float Y1, float X2, float Y2,
float Border )
{
Canvas->TexturedRect2D( X1, Y1, X1+Border, Y2,
LVector4( 1.0f ), MsgFrameLeft );
Canvas->TexturedRect2D( X2-Border, Y1, X2, Y2,
LVector4( 1.0f ), MsgFrameRight );
Canvas->TexturedRect2DTiled( X1+Border, Y1, X2-Border, Y2,
3, 1, LVector4( 1.0f ), MsgFrameCenter );
}
There's moreā€¦
We mentioned that control buttons are highlighted in the fragment shader. Here is how it
is done.
Pass the states of the buttons as uniforms:
uniform float b_MoveLeft;
uniform float b_Down;
uniform float b_MoveRight;
uniform float b_TurnLeft;
uniform float b_TurnRight;
uniform float b_Reset;
uniform float b_Paused;
The function to check whether a rectangle contains a speciied point, as follows:
 
Search WWH ::




Custom Search