Untitled

posted in DruinkJournal
Published March 29, 2007
Advertisement
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.
Previous Entry Untitled
Next Entry Untitled
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement