I need help drawing a variable to my game screen. For instance i have a variable that is:
P = 20
and i would like to draw the value the variable contains to the screen. When i try to make a font object it simply errors and says i need to insert an integer or a string. The varible needs to update to change as well so i'm wondering how to handle this?
Drawing a variable to the screen?
Try to find out (or write your own) toString() & toNumber() in Python - implementation in C++ http://cottonvibes.b...ction-in-c.html
Use std::to_string (In C++)
int P = 7;
std::string MyString;
MyString = std::to_string(P);
MyText.SetText(MyString);
// Display MyText (MyText is a text object.)
What is this for? Is this for debugging purposes where printing to the console is enough? Is this like a game's score so it needs to be put on the screen and changed over time? Are you using any particular frameworks for drawing things (pygame, pyglet, qt)?
What is this for? Is this for debugging purposes where printing to the console is enough? Is this like a game's score so it needs to be put on the screen and changed over time? Are you using any particular frameworks for drawing things (pygame, pyglet, qt)?
To be specific, it is the nations "popularity" and yes it changes over time. I am using pygame and i have looked through the documentation and haven't found anything to draw a variable to the screen.
[sub]
[sub]You can create a class that converts variable values of any kind into font equivalents of letters, numbers, and symbols to write on the screen.[/sub]
pygame.font.init()
?[/sub][sub]You can create a class that converts variable values of any kind into font equivalents of letters, numbers, and symbols to write on the screen.[/sub]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement