//----SET
void TBox::CreateBox(unsigned int m_iColor, const bool bText, const bool bSprite, const bool bLine)
{
	if (m_pTextSprite == nullptr && bText)
	{
		m_pTextSprite = GfxTextSpriteCreate();
		GfxSpriteSetFilteringEnabled(m_pTextSprite, true);
	}
	m_bIsDrawable = true;
	if (bLine)
	{
		//Line
		m_pLineSprite = GfxLineSpriteCreate();
	}
	if (bSprite)
	{
		//Image
		TGfxImage * pImage = GfxImageCreate(1, 1);
		GfxImageGetData(pImage)[0] = EGfxColor_White;
		TGfxTexture * pTexture = GfxTextureCreate(pImage);
		m_pSprite = GfxSpriteCreate(pTexture);
		GfxSpriteSetFilteringEnabled(m_pSprite, false);
		GfxSpriteSetPivot(m_pSprite, 0.5f, 0.5f);
		SetColor(m_iColor);
	}
}
示例#2
0
TGfxImage * Blur(TGfxImage * pImage, const int iSizeX, const int iSizeY)
{
	TGfxImage * pTempImage = GfxImageCreate(iSizeX, iSizeY);

	for (int y = 0; y < iSizeY; y++)
	{
		for (int x = 0; x < iSizeX; x++)
		{
			const int iIndex = y*(iSizeX) + x;
			const unsigned int iColor = GfxImageGetData(pImage)[iIndex];
			//--------
			const int iIndexLeft = iIndex - 1;
			const int iIndexRight = iIndex + 1;
			const int iIndexUp = iIndex - iSizeX;
			const int iIndexDown = iIndex + iSizeX;
			//--------
			unsigned int iColorPix = 0;
//			if (GfxImageGetData(pImage)[iIndexLeft] != iColor)iColorPix++;
//			if (GfxImageGetData(pImage)[iIndexRight] != iColor)iColorPix++;
//			if (GfxImageGetData(pImage)[iIndexUp] != iColor)iColorPix++;
//			if (GfxImageGetData(pImage)[iIndexDown] != iColor)iColorPix++;

			if (iIndexLeft >= 0)
				if (GfxImageGetData(pImage)[iIndexLeft] != iColor)iColorPix++;
			if (iIndexRight < (iSizeX*iSizeY))
				if (GfxImageGetData(pImage)[iIndexRight] != iColor)iColorPix++;
			if (iIndexUp >= 0)
				if (GfxImageGetData(pImage)[iIndexUp] != iColor)iColorPix++;
			if (iIndexDown < (iSizeX*iSizeY))
				if (GfxImageGetData(pImage)[iIndexDown] != iColor)iColorPix++;

			if ((x == 0) || (y == 0) || (x == (iSizeX-1)) || (y == (iSizeY-1)))
				GfxImageGetData(pTempImage)[iIndex] = EGfxColor_Black;
			else
			{
				if (iColorPix > 2)
					GfxImageGetData(pTempImage)[iIndex] = (GfxImageGetData(pImage)[iIndex] == EGfxColor_Black) ? EGfxColor_White : EGfxColor_Black;
				else
					GfxImageGetData(pTempImage)[iIndex] = GfxImageGetData(pImage)[iIndex];
			}
		}
	}
	GfxImageDestroy(pImage);
	return pTempImage;
}
示例#3
0
TGfxImage * Clear(TGfxImage * pImage, const int iSizeX, const int iSizeY, const int iPowerClear)
{
	TGfxImage * pTempImage = GfxImageCreate(iSizeX, iSizeY);
	for (int y = 0; y < iSizeY; y++)
	{
		for (int x = 0; x < iSizeX; x++)
		{
			const int iIndex = y*(iSizeX)+x;
			if (GfxImageGetData(pImage)[iIndex] == EGfxColor_Black)
			{
				//--------
				const int iIndexLeft = iIndex - 1;
				const int iIndexRight = iIndex + 1;
				const int iIndexUp = iIndex - iSizeX;
				const int iIndexDown = iIndex + iSizeX;
				//--------
				int iColorPix = 0;
				if (iIndex >= 0 && iIndex < (iSizeX*iSizeY))
				{
					if (iIndexLeft >= 0)
						if (GfxImageGetData(pImage)[iIndexLeft] != EGfxColor_White)iColorPix++;
					if (iIndexRight < (iSizeX*iSizeY))
						if (GfxImageGetData(pImage)[iIndexRight] != EGfxColor_White)iColorPix++;
					if (iIndexUp >= 0)
						if (GfxImageGetData(pImage)[iIndexUp] != EGfxColor_White)iColorPix++;
					if (iIndexDown < (iSizeX*iSizeY))
						if (GfxImageGetData(pImage)[iIndexDown] != EGfxColor_White)iColorPix++;
				}

				if (iColorPix > iPowerClear)
					GfxImageGetData(pTempImage)[iIndex] = EGfxColor_Black;
				else
					GfxImageGetData(pTempImage)[iIndex] = EGfxColor_White;
			}
			else
				GfxImageGetData(pTempImage)[iIndex] = EGfxColor_White;

			if ((x == 0) || (y == 0) || (x == (iSizeX-1)) || (y == (iSizeY-1)))
				GfxImageGetData(pTempImage)[iIndex] = EGfxColor_Black;
		}
	}
	GfxImageDestroy(pImage);
	return pTempImage;
}
示例#4
0
void Initialize()
{
	int sizeX = (GfxGetDisplaySizeX() / 2);
	int sizeY = (GfxGetDisplaySizeY() / 2);
	g_pLines = GfxLineSpriteCreate();
	g_pLines2 = GfxLineSpriteCreate();

	ArcheoStuffs::DrawCircle(g_pLines, TGfxVec2(0, 0), 8, GfxColor(255, 255, 0, 255), true); // Player creation

	for (int i = 0; i < g_iNbrCave; i++)
	{
		g_bCaveSearched[i] = false;
	}


	g_pImage = GfxImageCreate(1,1);
	unsigned int * pData = GfxImageGetData(g_pImage);
	*pData = EGfxColor_White;
	g_pTexture = GfxTextureCreate(g_pImage);

	g_pSpritePlayer = GfxSpriteCreate(g_pTexture);
	g_pSpriteBase = GfxSpriteCreate(g_pTexture);

	GfxSpriteSetScale(g_pSpritePlayer, 16, 16);
	GfxSpriteSetColor(g_pSpritePlayer, GfxColor(255, 255, 0, 255));
	g_TPlayerData.iPos = TGfxVec2(sizeX - 8, sizeY - 8);
	g_TPlayerData.iPosX = sizeX - 8;
	g_TPlayerData.iPosY = sizeY - 8;

	GfxSpriteSetScale(g_pSpriteBase, 32, 32);
	GfxSpriteSetColor(g_pSpriteBase, GfxColor(0, 255, 0, 255));
	GfxSpriteSetPosition(g_pSpriteBase, sizeX-16, sizeY-16);

	for (int i = 0; i < g_iNbrCave; i++)
	{
		ArcheoStuffs::CreateCave(i);
	}
	
}
示例#5
0
TGfxImage * Noise(const int iSizeX, const int iSizeY)
{
	TGfxImage * pImage = GfxImageCreate(iSizeX, iSizeY);
	
	for (int y = 0; y < iSizeY; y++)
	{
		for (int x = 0; x < iSizeX; x++)
		{
			const int iIndex = y*iSizeX + x;
			const unsigned int iColor = ((GfxMathGetRandomInteger(0, 1) == 0) ? (EGfxColor_Black) : (EGfxColor_White));
			GfxImageGetData(pImage)[iIndex] = iColor;

			if ((x == 0) || (y == 0) || (x == iSizeX - 1) || (y == iSizeY - 1))
				GfxImageGetData(pImage)[iIndex] = EGfxColor_Black;
			if ((x == 1) || (y == 1) || (x == iSizeX - 2) || (y == iSizeY - 2))
				GfxImageGetData(pImage)[iIndex] = EGfxColor_Black;
			//if ((x == (iSizeX - 1)/2) || (y == (iSizeY - 1)/2))
			//	GfxImageGetData(pImage)[iIndex] = EGfxColor_White;
		}
	}
	return pImage;
}
示例#6
0
void Initialize()
{
    g_pImage = GfxImageCreate(GfxGetDisplaySizeX() / SCALE_FACTOR, GfxGetDisplaySizeY() / SCALE_FACTOR);
}