Game Development Reference
In-Depth Information
Getting ready
Build and run the example
5_Puzzle
from the supplementary materials. This example,
like others in this topic, runs on Android as well as on Windows.
How to do it…
1.
We start by augmenting our
3_UIPrototype
project with a new page,
clPage_
Gallery
. This page delegates rendering and updating to the global
g_Flow
object:
class clPage_Gallery: public clGUIPage
{
public:
…
virtual void Render()
{
RenderDirect( g_Flow );
}
virtual void Update(float DT)
{
g_Flow->FFlinger->Update(DT);
}
private:
void RenderDirect( clPtr<clFlowUI> Control );
};
2.
The
RenderDirect()
method is essentially a slightly modiied version of
RenderDirect()
from the
Implementing the animated 3D image selector
recipe
in this chapter. There are only two differences—we replace wireframe quad rendering
with the
clCanvas::Rect3D()
call (to render a textured 3D rectangle) and use
textures from the
g_Gallery
object, described recently in this chapter in the
Image
gallery with Picasa downloader
recipe:
void RenderDirect( clPtr<clFlowUI> Control );
{
…
3.
The rendering order is left to right, to prevent incorrect overlapping of images:
int ImgOrder[] = { CurImg - 3, CurImg - 2, CurImg - 1,
CurImg + 3, CurImg + 2, CurImg + 1, CurImg };