|
Draw a TTF font on it's side? |
nshade
Member #4,372
February 2004
|
I'm not seeing a function for this, but is there a easy way to draw text sideways, (rotated 90 degrees) is there a trick to doing it? |
Elias
Member #358
May 2000
|
Something like this should work: al_identity_transform(&t); al_rotate_transform(&t, pi / 2); al_use_transform(&t); al_draw_text(...);
-- |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Do you mean draw the text vertically or actually turn it on its side? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
nshade
Member #4,372
February 2004
|
Turn it on it's side. I would use the example above, but what on earth is t pointing at? |
nshade
Member #4,372
February 2004
|
I'm not at my main system right now, but does that transform the whole drawing surface. As in, if I was to paste bitmaps or draw primitives, they will also be transformed as well until I reset the use_transform(); |
Edgar Reynaldo
Major Reynaldo
May 2007
|
The transforms that you 'use' affect the current bitmap target only. But if that is the backbuffer, then it affects all drawing. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
nshade
Member #4,372
February 2004
|
I guess the question is, how do you set it back to normal after the text print. There doesn't seem to be a "clear" command and I have other non-rotated things being drawn to my target bitmap. (I admit my matrix math is a little weak so I don't know what an "identity" is) |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I think its in the manual. http://liballeg.org/a5docs/trunk/transformations.html#al_use_transform Quote: Call this function with an identity transformation to return to the default behaviour. However, to reset the projection transform is a little different. But you didn't alter that, so no worries. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
jmasterx
Member #11,410
October 2009
|
int GraphicsContext::drawRotatedText( const std::string& text,agui::Font* font,const agui::Color& color, int x, int y, float deg, int flags ) { int fx = font->getTextWidth(text) / 2; int fy = font->getLineHeight() / 2; m_transform.identity(); m_transform.translate(-fx,-fy); m_transform.rotate(deg); m_transform.translate(x,y); useTransform(m_transform); drawText(text,font,color,0,0,flags); resetTransform(); return fx * 2; } Agui GUI API -> https://github.com/jmasterx/Agui |
|