D2DFontX 1.0 Released Today!

Started by
3 comments, last by Paul C Skertich 8 years, 11 months ago

D2DFontX is a very simple D2D1 wrapper for D3D11. Include and Library files must point to Windows SDK and NOT DirectX SDK. It's in a debug release but you can help it become in Release State by pointing out what can be better. Any questions just ask.

If you don't have GitHub then you would have to download it. Then head over to the repository and download it from there.

https://github.com/SICGames/D2DFontX

Please read the ReadMe.txt first it should point you in the right direction.

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX
Advertisement


void D2DFontX::RenderText(std::wstring text) {
	//Create our string
	std::wostringstream printString;
	printString << text;
	Text = printString.str(); // (std::wstring D2DFontX::Text)

	//Draw the Text
	TextRenderTarget->DrawTextW(
		Text.c_str(),
		wcslen(Text.c_str()),


... What.

That bit is probablly unnecessary code. Committing a change now :D

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX


void D2DFontX::RenderText(std::wstring text) {
	//Create our string
	std::wostringstream printString;
	printString << text;
	Text = printString.str(); // (std::wstring D2DFontX::Text)

	//Draw the Text
	TextRenderTarget->DrawTextW(
		Text.c_str(),
		wcslen(Text.c_str()),

... What.

That whole thing was stored inside a global decaration std::wstring. No longer needed and I don't know why it was there in the first place.

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

New functions help to translate, scale, rotate, skew and to set the the world matrix.


//-- Global Declaration.
D2DFontX *fontX;

bool InitFontX(IDXGISwapChain *d3d11swapchain, HWND windowhandle) {
     FontSettings fontSettings = FontSettings(L"Impact",16.0f, FONTCOLOR(1,1,1,1), DWRITE_FONT_WEIGHT::DWRITE_FONT_WEIGHT_NORMAL, 
     DWRITE_FONT_STYLE::DWRITE_FONT_STYLE_NORMAL);
     fontX = new D2DFontX(d3d11swapchain, fontSettings, windowhandle);
     if(fontX) {

       D2D1::Matrix3x2F myWorld;
       fontX->Translate(100,100); 
       myWorld = fontX->getTranslationMatrix();
       fontX->setWorldTransform(myWorld);
        return true;
         }
return false;
}

void renderFontX(std::wstring text) {
if(fontX) {
             fontX->RenderText(text);
          }
}

Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

This topic is closed to new replies.

Advertisement