void PatteRunGameEngine::RenderStatus(CIwUIRect& bounds)
{
	IwGxLightingOn();
	IwGxFontSetFont(g_pFont);
	IwGxFontSetCol(0xffffffff);
	IwGxFontSetAlignmentVer(IW_GX_FONT_ALIGN_MIDDLE);
	IwGxFontSetAlignmentHor(IW_GX_FONT_ALIGN_LEFT);

	CIwRect rect((int16)(bounds.x+5), (int16)bounds.y, (int16)(bounds.w-5), (int16)bounds.h);
	IwGxFontSetRect(rect);
	sprintf(g_szStatus, "%06d", g_iDisplayedScore);
	IwGxFontDrawText(g_szStatus);
	
	IwGxFontSetAlignmentHor(IW_GX_FONT_ALIGN_RIGHT);
	IwGxFontSetFont(g_pFontSmall);

	rect.w = 80;
	rect.x = bounds.w - 85;
	IwGxFontSetRect(rect);
	sprintf(g_szStatus, "%02d | %02d", g_iGameCounter, g_iLevel+1);
	IwGxFontDrawText(g_szStatus);

	IwGxLightingOff();

	CIwSVec2 locFly(bounds.w - 85, (bounds.h - g_pTile->GetWidth()) / 2);
	Utils::AlphaRenderImage(g_pTile, locFly, 255);
}
Example #2
0
void CRenderer::RenderText( CIwGxFont * font, const CIwRect & rect, const CIwColour & color, const CIwStringS & txt, IwGxFontAlignHor hAlign, IwGxFontAlignVer vAlign )
{
	iwsfixed scale = IW_SFIXED(mDeviceParams.scale);
	iwsfixed offX  = mDeviceParams.offsetX;
	iwsfixed offY  = mDeviceParams.offsetY;

	CIwRect r;
	r.x = IW_FIXED_MUL(rect.x, scale) + offX;
	r.y = IW_FIXED_MUL(rect.y, scale) + offY;
	r.w = IW_FIXED_MUL(rect.w, scale);
	r.h = IW_FIXED_MUL(rect.h, scale);

	Flush();
	
	DefaultMaterial();

	IwGxFontClearFlags(0xffffffff);
	IwGxLightingOn();	
	IwGxFontSetFont( font );
	IwGxFontSetCol( color );
	//IwGxFontSetScale( scale );

	//Set the formatting rect - this controls where the text appears and what it is formatted against
	IwGxFontSetRect(r);
	IwGxFontSetAlignmentVer(vAlign);
	IwGxFontSetAlignmentHor(hAlign);

	//Draw the text
	IwGxFontDrawText(txt.c_str());
	IwGxLightingOff();
	IwGxFontFreeBuffers();
	Flush();

}
void PatteRunGameEngine::Render2D()
{
	std::list<CGridTile*>::iterator iter = g_pTiles.begin();
	while (iter != g_pTiles.end())
	{
		(*iter)->Render();
		iter++;
	}
	Iw2DFinishDrawing();

	if (g_iCounter < g_iLevel)
	{
	}
	else
	{
		g_pUser->Render();

		if (g_bDisplayCorrect)
		{
			IwGxLightingOn();
			IwGxFontSetFont(g_pFontHuge);
			IwGxFontSetCol(0xffffffff);
			IwGxFontSetAlignmentVer(IW_GX_FONT_ALIGN_MIDDLE);
			IwGxFontSetAlignmentHor(IW_GX_FONT_ALIGN_CENTRE);
			CIwRect rect(0, 0, Iw2DGetSurfaceWidth(), Iw2DGetSurfaceHeight());
			IwGxFontSetRect(rect);
			strcpy(g_szStatus, "CORRECT!");
			IwGxFontDrawText(g_szStatus);
		}
	}
}
void PatteRunGameEngine::RenderPause()
{
	int width = Iw2DGetSurfaceWidth();
	int height = Iw2DGetSurfaceHeight();

	int iconWidth = 40;
	int iconHeight = 40;

	CIwRect bounds(15, height - 170, width - 30, iconHeight);

	IwGxLightingOn();
	IwGxFontSetFont(g_pFont);
	IwGxFontSetCol(0xffffffff);

	CIwRect rect(0, 0, width, bounds.y);
	IwGxFontSetRect(rect);
	IwGxFontAlignHor alignH = IwGxFontGetAlignmentHor();
	IwGxFontAlignVer alignV = IwGxFontGetAlignmentVer();

	IwGxFontSetAlignmentVer(IW_GX_FONT_ALIGN_MIDDLE);
	IwGxFontSetAlignmentHor(IW_GX_FONT_ALIGN_CENTRE);
	IwGxFontDrawText("Tap the screen to resume...");
/*
	CIwTexture* pCurrLevel = g_pTextureLevel1;

	switch (g_iLevel)
	{
		case 0 :
		{
			pCurrLevel = g_pTextureLevel1;
		}
		break;
		case 1 :
		{
			pCurrLevel = g_pTextureLevel2;
		}
		break;
		case 2 :
		{
			pCurrLevel = g_pTextureLevel3;
		}
		break;
		case 3 :
		{
			pCurrLevel = g_pTextureLevel4;
		}
		break;
	}


	int totalWidth = g_pTextureLevel->GetWidth() + pCurrLevel->GetWidth() + 10;
	int totalHeight = g_pTextureLevel->GetHeight();

	CIwSVec2 locLevel((width - totalWidth) / 2, rect.h - totalHeight);
	Utils::AlphaRenderImage(g_pTextureLevel, locLevel, 255);

	locLevel.x += (int16)(g_pTextureLevel->GetWidth() + 10);
	Utils::AlphaRenderImage(pCurrLevel, locLevel, 255);

	Iw2DSetAlphaMode(IW_2D_ALPHA_HALF);
	Iw2DFillRect(CIwSVec2(10, height - 170), CIwSVec2(width - 20, 160));
	Iw2DSetAlphaMode(IW_2D_ALPHA_NONE);

	IwGxFontSetAlignmentVer(IW_GX_FONT_ALIGN_MIDDLE);
	IwGxFontSetAlignmentHor(IW_GX_FONT_ALIGN_LEFT);
	IwGxFontSetFont(g_pFontSmall);

	CIwRect fontBounds(15 + iconWidth + 10, height - 170, width - 40 - iconWidth, iconHeight);
	CIwSVec2 loc1(bounds.x + (iconWidth - g_pTextureFirefly->GetWidth()) / 2, bounds.y + (iconHeight - g_pTextureFirefly->GetHeight()) / 2);
	Utils::AlphaRenderImage(g_pTextureFirefly, loc1, 255);
	
	IwGxFontSetRect(fontBounds);
	IwGxFontDrawText("Capture firelfies to gain points");

	bounds.y += 40;
	fontBounds.y += 40;
	CIwSVec2 loc2(bounds.x + (iconWidth - g_pTextureDragon->GetWidth()) / 2, bounds.y + (iconHeight - g_pTextureDragon->GetHeight()) / 2);
	Utils::AlphaRenderImage(g_pTextureDragon, loc2, 255);
	
	IwGxFontSetRect(fontBounds);
	IwGxFontDrawText("Dragonflies capture fireflies");

	bounds.y += 40;
	fontBounds.y += 40;
	CIwSVec2 loc3(bounds.x + (iconWidth - g_pTextureMine->GetWidth()) / 2, bounds.y + (iconHeight - g_pTextureMine->GetHeight()) / 2);
	Utils::AlphaRenderImage(g_pTextureMine, loc3, 255);
	
	IwGxFontSetRect(fontBounds);
	IwGxFontDrawText("Mines take away your points");

	bounds.y += 40;
	fontBounds.y += 40;
	CIwSVec2 loc4(bounds.x + (iconWidth - g_pTextureBolt->GetWidth()) / 2, bounds.y + (iconHeight - g_pTextureBolt->GetHeight()) / 2);
	Utils::AlphaRenderImage(g_pTextureBolt, loc4, 255);
	
	IwGxFontSetRect(fontBounds);
	IwGxFontDrawText("Shake your phone to stun fireflies");
*/
	IwGxLightingOff();
}