7 replies to this topic
#1 Members - Reputation: 163
Posted 03 October 2012 - 11:28 AM
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?
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?
Sponsor:
#2 Members - Reputation: 123
Posted 03 October 2012 - 11:38 AM
Try to find out (or write your own) toString() & toNumber() in Python - implementation in C++ http://cottonvibes.b...ction-in-c.html
Edited by JustABeginner, 03 October 2012 - 11:43 AM.
#3 Crossbones+ - Reputation: 1373
Posted 03 October 2012 - 02:22 PM
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.)
I'm a game programmer and photo editor.
Here's Breakout:
Breakout!
If you need some photo editing done, contact me:
superman3275@gmail.com
if you want some programming help, or are recruiting for a game development team, either PM me on here or email me up there
!
Here's Breakout:
Breakout!
If you need some photo editing done, contact me:
superman3275@gmail.com
if you want some programming help, or are recruiting for a game development team, either PM me on here or email me up there
#4 Members - Reputation: 507
Posted 03 October 2012 - 02:41 PM
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)?
#5 Members - Reputation: 163
Posted 04 October 2012 - 08:53 AM
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.
#8 Members - Reputation: 507
Posted 06 October 2012 - 12:07 AM
Font.render looks like what you're after http://pygame.org/docs/ref/font.html#pygame.font.Font






