Welcome! Log In Create A New Profile

Advanced

Drawing text to screen function

Posted by ClashMan 
Drawing text to screen function
February 14, 2010 10:39PM
Hey, I'm just wondering what/if there is a function to draw text to the screen at certain co-ordinates. An example of what I'm looking for follows.

draw_text("TEXT HERE", x, y, color);

Any help would be greatly appreciated.
Re: Drawing text to screen function
February 14, 2010 10:59PM
that question doesnt provide enough information for anybody to help you. are you using a GUI? do you have a console set up? did you use a GUI framework or make your own?
Re: Drawing text to screen function
February 14, 2010 11:26PM
Quote
ClashMan
Hey, I'm just wondering what/if there is a function to draw text to the screen at certain co-ordinates. An example of what I'm looking for follows.

draw_text("TEXT HERE", x, y, color);

Any help would be greatly appreciated.

You'll have to use a custom method to print text at x,y like using the TTF lib or somekind of bitmap blit of characters which I believe a couple of the homebrew graphics libs support.

I personally use SDL and TTF but that's my preference. I'd be happy to give you a simple font class if you use SDL.
Re: Drawing text to screen function
February 15, 2010 04:01AM
Depends on what libraries you are using...

If you are using GRRLIB then there is:

GRRLIB_Printf(x,y,font,color,something,text,[variables]);

It seems to work much like the regular printf function for non-graphical displays except it is used for GRRLIB graphics screens and has papameters of location, font and color. I forget what the parameter after color is for but you can look it up by googling the function.
Re: Drawing text to screen function
February 15, 2010 04:24AM
LordAshes, here is the information you are looking for: [grrlib.santo.fr]
Re: Drawing text to screen function
February 15, 2010 04:51AM
Crayon,

It wasn't me...The question was by ClashMan (how to print to the screen at a specific position). I was just suggesting a solution.

I am happily using GRRLIB_Printf in my own code...I just didn't have it handy to tell ClashMan what the exact parameters where.

However, ClashMan might find it useful so the post is still a good one.
Re: Drawing text to screen function
February 19, 2010 08:13AM
if your trying to do this in a console app, take a look at
[code.google.com]
in particular the drawString function. Remember though though the x/y in a console app are characters and not pixels
Sorry, only registered users may post in this forum.

Click here to login