Jump to content

  • Log In with Google      Sign In   
  • Create Account


JaMeZwHiTe

Member Since 28 Nov 2009
Offline Last Active Jun 15 2012 08:05 AM
-----

Posts I've Made

In Topic: 2D Sprite Rendering

13 January 2010 - 08:54 PM

Ah apologies with the SuperSprite name, it was the name of the sprite class my programming tutor came up with at the time when teaching us it.

Yes the Zbuffer sounds like it could be something to look at.

Is that any help at all ?


In Topic: 2D Sprite Rendering

13 January 2010 - 11:40 AM

A sample of code from my Resources function:

GameBGSprite = new SuperSprite(g_pD3D,"GameBG.png");
GameBGSprite->Show();
GameBGSprite->SetSpawnSize(1600,1200);
GameBGSprite->SetSpawnLocation(400,300);
GameBGSprite->zAxis = 0.1f;

HUD1Sprite = new SuperSprite(g_pD3D,"HUD.png");
HUD1Sprite->Show();
HUD1Sprite->SetSpawnSize(800,110);
HUD1Sprite->SetSpawnLocation(400,55);
HUD1Sprite->zAxis = 0.2f;

Target1 = new SuperSprite(g_pD3D,"Target.png"); //Targets
Target2 = new SuperSprite(g_pD3D,"Target.png");
Target3 = new SuperSprite(g_pD3D,"Target.png");
Target4 = new SuperSprite(g_pD3D,"Target2.png");

Target1->Show();
Target1->SetSpawnSize(64,64);
Target1->zAxis = 0.2f;

Target2->Show();
Target2->SetSpawnSize(64,64);
Target2->zAxis = 0.2f;

Target3->Show();
Target3->SetSpawnSize(64,64);
Target3->zAxis = 0.2f;

Target4->Show();
Target4->SetSpawnSize(64,64);
Target4->zAxis = 0.2f;

CrossHair = new SuperSprite(g_pD3D,"sprite.png");
CrossHair->SetSpawnLocation(400,300);
CrossHair->Show();
CrossHair->SetSpawnSize(64,64);
CrossHair->zAxis = 0.3f;


...and a small bit from my Render function:

switch (game_state)
{
case GS_MENU:

//Menu Background
MenuBG->Render(g_D3DSprite);

//Help Menu
HelpMenuSprite->Render(g_D3DSprite);

break;

case GS_PLAY: //Render All Game Play Stuff

UpdateText();


GameBGSprite->Render(g_D3DSprite);

Target1->Render(g_D3DSprite);
Target2->Render(g_D3DSprite);
Target3->Render(g_D3DSprite);
Target4->Render(g_D3DSprite);
CrossHair->Render(g_D3DSprite);

In Topic: Directx Text Problem

13 January 2010 - 07:23 AM

Quote:
Original post by Buckeye
Quote:
ensure you've called otherSprites->End() or otherSprites->Flush() before you draw the text.

Do you End() the other sprites before you call DrawText(NULL,..)?

If you do, post the rendering code.


Yes, ->End() and ->Flush() are called at the end of every Render loop.

Will grab the code a sec...

In Topic: Directx Text Problem

13 January 2010 - 06:59 AM

I have been able to fix the problem with your help :)

One more thing though i need to ask is about it's render order... depsite it is first drawn after the resources (sprites declared and stuff) have been done, it appears underneath some of the sprites. In other words how do i push it all the way to the top ??

Also, why is it that even when i set a render order and each own Z axis, why do some of the sprites insist of rendering and overlapping in the wrong order ??

Jamie

[Edited by - JaMeZwHiTe on January 13, 2010 1:59:58 PM]

In Topic: Directx Text Problem

10 January 2010 - 04:42 AM

Thank you Buckeye for that info. The variable and buffer are valid, when i mentioned that the text renders over the top of each other, it's just '0'. Also the project is just a 2D sprite project :)

PARTNERS