0

I'm just now learning Allegro, and all the tutorials I have looked at have used a function called textout_ex to print things out to the screen.

The problem is - textout_ex is really starting to p*ss me off horribly because of how specific you must be in the info you give it.
(for example, you can only print out char* variables, and nothing else, unless its inside quotations, and you can only print out 1 set of info)

question - is there anything better to use besides textout_ex?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by firstPerson
0

Just make a wrapper function :

void print(std::string msg, int posX, int posY, int color){
 textout_ex(screen, font, msg.c_str(),posX, posY, color);
}

And use it like so :

void doo(){
 string msg = "hello 2d world!";
 print(msg,0,0,makecol(255,0,0));
}

an even better wrapper :

void print(std::string msg, Vec2d pos, int color){
 textout_ex(screen, font, msg.c_str(),pos.x, pos.y, color);
}

Where Vec2D is a class that holds the x and y position of an object.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.