コード例 #1
0
ファイル: main.cpp プロジェクト: ShadowswordPL/fifteen
//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;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: ShadowswordPL/fifteen
//Function moves clicked tiles
void Fifteen::ClickTile()
{	
	if (gamearea.newClick)
	{
		int x = gamearea.clickpos.x / GetTileSizeX();
		int y = gamearea.clickpos.y / GetTileSizeY();	
		MoveTile(x,y);
		gamearea.newClick = false;
	}
}
コード例 #3
0
bool FdoRasterDataModel::Equals (FdoRasterDataModel* pModel)
{
    // If one model is NULL then equal only if both are NULL.
    // this would not usually be NULL but check just in case. 
    if ( !this || !pModel ) 
        return (this == NULL) == (pModel == NULL);

    return 
        (GetDataModelType() == pModel->GetDataModelType()) &&
        (GetBitsPerPixel() == pModel->GetBitsPerPixel()) &&
        (GetOrganization() == pModel->GetOrganization()) &&
        (GetTileSizeX() == pModel->GetTileSizeX()) &&
        (GetTileSizeY() == pModel->GetTileSizeY()) &&
        (GetDataType() == pModel->GetDataType());
}
コード例 #4
0
ファイル: main.cpp プロジェクト: ShadowswordPL/fifteen
//Get tile position
int Fifteen::GetTilePosX(int x)
{
	return x*GetTileSizeX();
}