Crystal Space
Welcome, Guest. Please login or register.
November 29, 2014, 03:41:56 am

Login with username, password and session length
Search:     Advanced search
9026 Posts in 2046 Topics by 9158 Members
Latest Member: Virginiarude
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Text drawing in Crystal Space for noobs
« previous next »
Pages: [1] Print
Author Topic: Text drawing in Crystal Space for noobs  (Read 2012 times)
dominic
Newbie
*
Posts: 25


View Profile
« on: July 14, 2005, 02:59:30 am »

Hello, I'm making my first Crystal Space application and I just can't manage to find how to draw text on the screen.  I've looked in the documentation, exemples, tutorials and Google and I could not find it.

Thanks for your help.
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: July 14, 2005, 05:21:23 am »

Hello, I'm making my first Crystal Space application and I just can't manage to find how to draw text on the screen.  I've looked in the documentation, exemples, tutorials and Google and I could not find it.

Thanks for your help.

Something roughly like this:

Code:
g3d->BeginDraw (CSDRAW_2DGRAPHICS);
int fg = g2d->FindRGB (255, 0, 0);  // Red.
int bg = -1;   // Transparent.
iFontServer* fntsvr = g2d->GetFontServer ();
iFont* font = fntsvr->LoadFont (CSFONT_COURIER);
g2d->Write (font, x, y, fg, bg, "This is text");

I'll put this in the documentation.

Greetings,
Logged
dominic
Newbie
*
Posts: 25


View Profile
« Reply #2 on: July 14, 2005, 02:55:07 pm »

Thanks smiley
Logged
dominic
Newbie
*
Posts: 25


View Profile
« Reply #3 on: July 14, 2005, 09:56:23 pm »

I tried it.  Unfortunatly, if I do it before or after the iView::Draw(), the world is drawn over my text.  Strangely enough, the world must not be in the screen at all for my text to be drawn.

Thanks

=== EDITED ===
I found what was wrong.  I thought I could do just one
Code:
g3d->BeginDraw (CSDRAW_2DGRAPHICS | CSDRAW_3DGRAPHICS);
  With two separate BeginDraw(), it works.
« Last Edit: July 14, 2005, 10:22:55 pm by dominic » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.216 seconds with 15 queries.