Game Development Reference
In-Depth Information
new Rectangle(x * 32, y *
32, 32, 32));
}
}
}
As you can see, this method looks very similar to the
RenderWorld()
method; it
loops through every position in the game world just as that method does. The one
major difference is that we use the
DrawRectangle()
method here rather than the
DrawBitmap()
method. Using our yellow debug brush, it draws a yellow border on
any tile in the game world that is solid.
Finishing the rendering code
Now we need to add code into the
RenderScene()
method to call these methods
we just made. The following is the
RenderScene()
code:
public override void RenderScene()
{
if ((!this.IsInitialized) ||
this.IsDisposed)
{
return;
}
m_RenderTarget.BeginDraw();
m_RenderTarget.Clear(ClearColor);
RenderWorld();
#if DEBUG
RenderDebug();
#endif
RenderPlayer();