Beispiel #1
0
//Function draws game graphics
void Fifteen::DrawGameArea()
{
	PaintingPainter p(gamearea.GetSize());
	
	for (int i=0; i<SIZE; i++)
	{
		for (int j=0; j<SIZE; j++)
		{
			Color colT = White();
			Color colB = DarkGray();
			if (GameArray[i][j] != 0)
			{
				if(!endOfGame)
				{
					if
					(
					 	gamearea.mouseOn &
						(gamearea.movepos.x > GetTilePosX(i)) && (gamearea.movepos.x < GetTilePosX(i) + GetTileSizeX()) &&
						(gamearea.movepos.y > GetTilePosY(j)) && (gamearea.movepos.y < GetTilePosY(j) + GetTileSizeY())
					)
					{
						if (Moveable(i,j))
						{
							colT = LightGreen();
						}
						else
						{
							colT = LightRed();
						}
						colB = Silver();
					}
					p.Rectangle(GetTilePosX(i)+1, GetTilePosY(j)+1, GetTileSizeX()-2, GetTileSizeY()-2)
					.Fill(GetTilePosX(i), GetTilePosY(j), LightGray(), GetTilePosX(i), GetTilePosY(j), GetTileSizeX(), colB, 3);
					p.DrawText(GetTilePosX(i)+3, GetTilePosY(j)+3, GetTileString(GameArray[i][j]), Arial(32).Bold(), DarkGray());
					p.DrawText(GetTilePosX(i)+1, GetTilePosY(j)+1, GetTileString(GameArray[i][j]), Arial(32).Bold(), colT);
				}
				else
				{
					p.Rectangle(GetTilePosX(i)+1, GetTilePosY(j)+1, GetTileSizeX()-2, GetTileSizeY()-2)
					.Fill(GetTilePosX(i), GetTilePosY(j), LightGray(), GetTilePosX(i), GetTilePosY(j), GetTileSizeX(), DarkGray(), 3);
					p.DrawText(GetTilePosX(i)+3, GetTilePosY(j)+3, GetTileString(GameArray[i][j]), Arial(32).Bold(), DarkGray());
					p.DrawText(GetTilePosX(i)+1, GetTilePosY(j)+1, GetTileString(GameArray[i][j]), Arial(32).Bold(), colT);
				}
			}
		}
	}
	result.SetData(points);
	gamearea = p;
}
void CWelcomePageBase::ConstructL(	MPageObserver& aObserver )
{
	CALLSTACKITEM_N(_CL("CWelcomePageBase"), _CL("ConstructL"));

	iObserver = &aObserver;
	CreateWindowL();	

	iPageRect = TRect( TPoint(0,0), MJuikLayout::ScreenSize() );
		
	iIcons = new (ELeave) CAknIconArray(KIconCount);

	Reporting().DebugLog(_L("LoadIcons"));
	JuikIcons::LoadIconsL( iIcons, KIconIds, KIconCount );

	TJuikLayoutItem l = 
		Layout().GetLayoutItemL(LG_welcome_selection_page, LI_welcome_selection_page__body_text);
		
	iMainText = new (ELeave) CEikLabel();
	iMainText->SetContainerWindowL( *this );
	iMainText->SetFont( l.Font() );
	if ( iLayoutStyle == ESelectionLayout ) 
		{
			iMainText->OverrideColorL(EColorLabelText, DarkGray());	
			//iMainText->SetLabelAlignment( ELayoutAlignCenter );
		}
	else if ( iLayoutStyle == EWelcomeLayout )
		{
			iMainText->OverrideColorL(EColorLabelText, Gray());	
			iMainText->SetLabelAlignment( ELayoutAlignCenter );
		}
	else if ( iLayoutStyle == ECongratulationsLayout )
		{
			iMainText->OverrideColorL(EColorLabelText, Gray());	
			iMainText->SetLabelAlignment( ELayoutAlignCenter );
		}
	else
		{
			ASSERT( EFalse );
		}

	iControls.Append(iMainText);

	
	l = 
		Layout().GetLayoutItemL(LG_welcome_softkeys,
								 LI_welcome__leftsoftkey);
	iLeftSoftkey = new (ELeave) CEikLabel();
	iLeftSoftkey->SetContainerWindowL( *this );
	iLeftSoftkey->SetFont( l.Font() );
	iLeftSoftkey->OverrideColorL(EColorLabelText, DarkGray());	
	iLeftSoftkey->SetTextL( _L("Continue") );
	iControls.Append(iLeftSoftkey);

	l = 
		Layout().GetLayoutItemL(LG_welcome_softkeys,
								 LI_welcome__rightsoftkey);
	iRightSoftkey = new (ELeave) CEikLabel();
	iRightSoftkey->SetContainerWindowL( *this );
	iRightSoftkey->SetFont( l.Font() );
	iRightSoftkey->OverrideColorL(EColorLabelText, DarkGray());	
	iRightSoftkey->SetTextL( _L("") );
	iControls.Append(iRightSoftkey);

	

}