[Solved] TorqueX.2D - Drawing Fonts
by AWannaBe · in Torque X 2D · 08/02/2011 (3:47 pm) · 2 replies
I've been trying to pick back up the TorqueX engine and move forward on some old projects and I've run in to a stumbling block of sorts.
I am currently struggling with the concept of writing a string using a SpriteFont to the screen.
I've been going through the TorqueCore code and it seems as though the GarageGames.Torque.GFX.FontRenderer class is what I might want to utilize.
If it is however I'm failing to see the most appropriate method of utilizing this class to render SpriteFonts to the screen.
The application is something that would be unrelated to a GUI.
Does anyone have any ideas on the best implementation? Something via a TorqueComponent perhaps?
I've tried a few different scenarios I've yet to achieve a result which renders a font to the screen.
It's been a few days now and it's either the coding from other work projects or the awesomely delicious break-beer which is causing me to have a dead hamster in my brain wheel.
I am currently struggling with the concept of writing a string using a SpriteFont to the screen.
I've been going through the TorqueCore code and it seems as though the GarageGames.Torque.GFX.FontRenderer class is what I might want to utilize.
If it is however I'm failing to see the most appropriate method of utilizing this class to render SpriteFonts to the screen.
The application is something that would be unrelated to a GUI.
Does anyone have any ideas on the best implementation? Something via a TorqueComponent perhaps?
I've tried a few different scenarios I've yet to achieve a result which renders a font to the screen.
It's been a few days now and it's either the coding from other work projects or the awesomely delicious break-beer which is causing me to have a dead hamster in my brain wheel.
About the author
http://www.pdxmodgames.com
Recent Threads
#2
@Aaron There are quite a few scenarios where someone might want to not use the GUI/GUIText. One of which is when you want to combine or write a SpriteFont directly onto a texture.
I did find that the proposed DrawTextOnTexture helper method can only be called in specific places within the game code otherwise you will write back essentially a blank texture to the screen.
08/07/2011 (1:04 pm)
I believe I found more or less what I was looking for with this thread.@Aaron There are quite a few scenarios where someone might want to not use the GUI/GUIText. One of which is when you want to combine or write a SpriteFont directly onto a texture.
I did find that the proposed DrawTextOnTexture helper method can only be called in specific places within the game code otherwise you will write back essentially a blank texture to the screen.
Torque 3D Owner Aaron Scovel
I think you can use SpriteBatch and SpriteFont with the XNA framework. Update DrawString in your Draw method.
Were "batch" is defined as SpriteBatch and "font" defined as SpriteFont
Good Luck :-) Check out the App Hub, they have lots of examples.