Пример #1
0
void TBox::SetCutOut(const int iIndex)
{
	int iNumberWidth = (GfxSpriteGetTextureSizeX(m_pSprite) / int(m_fRay_W));

	int iTileX = iIndex % iNumberWidth;
	int iTileY = iIndex / iNumberWidth;

	GfxSpriteSetCutout(m_pSprite, iTileX * (int)m_fRay_W, iTileY * (int)m_fRay_H, (int)m_fRay_W, (int)m_fRay_H);
}
Пример #2
0
void TLemmings::Spawn(TGfxVec2 tPosition)
{
	m_tLemmingSprite = GfxSpriteCreate(tMainTexture);
	GfxSpriteSetCutout(m_tLemmingSprite, 0, 0, 16, 16);
	GfxSpriteSetFilteringEnabled(m_tLemmingSprite, false);
	GfxSpriteSetPosition(m_tLemmingSprite, tPosition.x, tPosition.y);
	m_tPosition = tPosition;

	g_iLemmingsCpt++;
}
Пример #3
0
TGfxSprite * CreateTile(const TGfxTexture * g_pTexture, const int iPosX, const int iPosY, const int iTileX, const int iTileY)
{

	TGfxSprite * pSprite = GfxSpriteCreate(g_pTexture);    // On crée pSprite et on y met la la variable de la texture chargée 
	GfxSpriteSetScale(pSprite, float(SCALE), float(SCALE));    // On choisis la taille du sprite appellé pSprite 
	GfxSpriteSetFilteringEnabled(pSprite, false);             // On désactive le filtering ( à laisse )
	GfxSpriteSetCutout(pSprite, iPosX * TILE_SIZE, iPosY * TILE_SIZE, TILE_SIZE, TILE_SIZE);    // On choisis ce qui sera affiché sur un sprite, ici on choisis la taille et la position du sprite dans la texture
	GfxSpriteSetPosition(pSprite, float(SCALE) * TILE_SIZE * iTileX, float(SCALE) * TILE_SIZE * iTileY);     // On choisis où l'afficher 

	return pSprite;  // toujours mettre le return à la fin car ça sort de la fonction.
}
Пример #4
0
void TBox::CreateSpriteBox(TGfxTexture * pTexture, const int iTextureSize, int iTileX, int iTileY, int iTextureSizeY)
{
	iTextureSizeY = (iTextureSizeY != 0) ? iTextureSizeY : iTextureSize;

	m_bIsDrawable = true;
	m_pSprite = GfxSpriteCreate(pTexture);
	GfxSpriteSetFilteringEnabled(m_pSprite, false);
	GfxSpriteSetCutout(m_pSprite, iTileX*iTextureSize, iTileY*iTextureSizeY, iTextureSize, iTextureSizeY);
	GfxSpriteSetPivot(m_pSprite, iTextureSize / 2.0f, iTextureSizeY / 2.0f);
	SetBox(TGfxVec2(0.0f, 0.0f), (float)iTextureSize, (float)iTextureSizeY);
}
Пример #5
0
void TPlayer::Initialize(int x, int y, int TILE_SIZE, int SCALE)
{
	TGfxTexture * pTexture = GfxTextureLoad("gfx/tileset.tga");
	m_pSpritePlayer = GfxSpriteCreate(pTexture);
	GfxSpriteSetScale(m_pSpritePlayer, float(SCALE), float(SCALE));
	GfxSpriteSetFilteringEnabled(m_pSpritePlayer, false);
	GfxSpriteSetCutout(m_pSpritePlayer, x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE);
	GfxSpriteSetPosition(m_pSpritePlayer, 
		((GfxGetDisplaySizeX() / 2) - ((GfxSpriteGetSizeX(m_pSpritePlayer)*(GfxSpriteGetScaleX(m_pSpritePlayer)) / 2))), 
		((GfxGetDisplaySizeY() / 2) - ((GfxSpriteGetSizeY(m_pSpritePlayer)*(GfxSpriteGetScaleY(m_pSpritePlayer)) / 2))));
}      
Пример #6
0
void TLemmings::ChangeColor(const int Color) // 0 = Grey, 1 = Red, 2 = Green
{
	m_iColor = Color;
	
	GfxSpriteDestroy(m_tLemmingSprite);

	m_tLemmingSprite = GfxSpriteCreate(tMainTexture);
	GfxSpriteSetCutout(m_tLemmingSprite, m_iColor * 16, 0, 16, 16);
	GfxSpriteSetFilteringEnabled(m_tLemmingSprite, false);
	GfxSpriteSetPosition(m_tLemmingSprite, m_tPosition.x, m_tPosition.y);
}
Пример #7
0
TGfxSprite * CreateTile(const TGfxTexture * g_pTexture, const int g_iPosX, const int g_iPosY, const int iTileX, const int iTileY)
{

    TGfxSprite * pSprite = GfxSpriteCreate(g_pTexture);
    GfxSpriteSetScale(pSprite, float(SCALE), float(SCALE));
    GfxSpriteSetFilteringEnabled(pSprite, false);
    GfxSpriteSetCutout(pSprite, g_iPosX * TILE_SIZE, g_iPosY * TILE_SIZE, TILE_SIZE, TILE_SIZE);
    GfxSpriteSetPosition(pSprite, float(SCALE) * TILE_SIZE * iTileX, float(SCALE) * TILE_SIZE * iTileY);
    GfxSpriteSetPivot(pSprite, TILE_SIZE / 2, TILE_SIZE / 2); // Change le point de collision de tout les tile créés comme ça

    return pSprite;  // toujours mettre le return à la fin car ça sort de la fonction.
}
Пример #8
0
void TBox::SetTile(const int g_iTextureSize ,const int iTileX, const int iTileY)
{
	GfxSpriteSetCutout(m_pSprite, iTileX*g_iTextureSize, iTileY*g_iTextureSize, g_iTextureSize, g_iTextureSize);
}