Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423124

Untitled

Sign in to follow this  
Evil Steve

48 views

Yaaaaaaaaaaaaay, fonts work. Even better than they did in TEH MMORPG!!1 because italics work, texture usage is optimised to use only what's needed, and I render less.

I also made a "render mode" for my graphics, which is really nice and simple to do because of the scene graph. You can render normally, in wireframe mode, or normally and wireframe. Here's how easy the last one is:

case WIRE_WireframeAndFill:
{
RenderSceneGraph(ESceneMgr::Get().GetContent());

DWORD dwOldFill = SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
DWORD dwOldCull = SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
DWORD dwOldZBuffer = SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
PTexture::SP pOldTex = SetTexture(0, NULL);
bool bOldTextureState = m_bDisableTextures;
m_bDisableTextures = true;

RenderSceneGraph(ESceneMgr::Get().GetContent());

m_bDisableTextures = bOldTextureState;
SetTexture(0, pOldTex);
SetRenderState(D3DRS_ZENABLE, dwOldZBuffer);
SetRenderState(D3DRS_CULLMODE, dwOldCull);
SetRenderState(D3DRS_FILLMODE, dwOldFill);
}
break;



Effectively, I just call RenderSceneGraph twice, the second time with culling, textures and the Z buffer disabled, and in wireframe mode. Nice and straightforward [smile]

And the final result of all my font shinnanigans is:
Yay!

And the game code to do that:

ESprite::SP pSprite;
pSprite = ESprite::Load(L"Test3.bmp");
pSprite->SetPos(EVector3(0, 0, 11));
pSprite->SetScale(EVector2(0.5f, 0.5f));
ESceneMgr::Get().Add(pSprite);
m_vSprites.push_back(pSprite);

pSprite = ESprite::Load(L"Alpha.dds");
pSprite->SetPos(EVector3(0, 0, 9));
pSprite->SetScale(EVector2(0.5f, 0.5f));
ESceneMgr::Get().Add(pSprite);
m_vSprites.push_back(pSprite);

EFont::SP pFont = EGraphics::Get().GetFont(L"Times New Roman", 72, EFont::Italic);
m_pText = new EText(pFont, L"Hello Woyld!");
m_pText->SetColour(EColour(1.0f, 1.0f, 0.6f, 0.0f));
ESceneMgr::Get().Add(m_pText);

ERand rand(EApp::Get().GetSystemTime());
m_xSpeed = rand.RandFloatRange(0.0f, 1.0f);
m_ySpeed = 1.0f - m_xSpeed;

EGraphics::Get().SetWireframeMode(EGraphics::WIRE_WireframeAndFill);




Wheeeeeee! Now I just need to add support for colour blending accross sprites so I can have a gradient coloured font, and then I can get to work on text alignment and wrapping and stuff, which should be a piece of piss pretty much.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!