Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to show value of some variale using font  (Read 4527 times)

0 Members and 2 Guests are viewing this topic.

paupav

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Email
How to show value of some variale using font
« on: July 08, 2014, 02:09:19 pm »
I'm curently creating snake game, and when game ends I wanna make it show players score. So, how can I make it show actuall number?

Also I know that name of my game is horrible, I'll change it later.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How to show value of some variale using font
« Reply #1 on: July 08, 2014, 02:21:09 pm »
The problem is not how to show numbers, but how to convert a number to a string. Which is one of the most common task in all programming languages.

Google -> "C++ int to string".
Laurent Gomila - SFML developer

paupav

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Email
Re: How to show value of some variale using font
« Reply #2 on: July 08, 2014, 03:20:56 pm »

Strelok

  • Full Member
  • ***
  • Posts: 139
    • View Profile
    • GitHub
Re: How to show value of some variale using font
« Reply #3 on: July 08, 2014, 03:58:21 pm »
Mother of script kids...

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: How to show value of some variale using font
« Reply #4 on: July 08, 2014, 04:20:43 pm »
[LINK]
All that link shows is how you like to troll.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

paupav

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Email
Re: How to show value of some variale using font
« Reply #5 on: July 09, 2014, 03:50:55 pm »
[LINK]
All that link shows is how you like to troll.
That was my first week programming. I've never made program before that one. You can see updates of the code. Just scroll down.

select_this

  • Full Member
  • ***
  • Posts: 130
  • Current mood: just ate a pinecone
    • View Profile
    • darrenferrie.com
Re: How to show value of some variale using font
« Reply #6 on: July 09, 2014, 03:53:55 pm »
I'd recommend reading a good C++ book, since you seem to be lacking some of the fundamentals. It'll save you a lot of pain and frustration in the future.
Follow me on Twitter, why don'tcha? @select_this

paupav

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Email
Re: How to show value of some variale using font
« Reply #7 on: July 09, 2014, 04:05:40 pm »
I'd recommend reading a good C++ book, since you seem to be lacking some of the fundamentals. It'll save you a lot of pain and frustration in the future.
I've learned c++ using this awesome tutorial:
www.cplusplus.com/files/tutorial.pdf
but I've only read up to page 100 .

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to show value of some variale using font
« Reply #8 on: July 09, 2014, 04:30:59 pm »
Don't learn from internet tutorials, as "awesome" as you might find them (which is difficult to judge as a beginner, by the way). If you are seriously interested in learning the C++ programming language, which is a big endeavour, you won't get around a good book.

For example, the tutorial you link doesn't seem to mention a single word about the STL, the probably most important part of the C++ standard library.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

paupav

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Email
Re: How to show value of some variale using font
« Reply #9 on: July 09, 2014, 05:46:00 pm »
Don't learn from internet tutorials, as "awesome" as you might find them (which is difficult to judge as a beginner, by the way). If you are seriously interested in learning the C++ programming language, which is a big endeavour, you won't get around a good book.

For example, the tutorial you link doesn't seem to mention a single word about the STL, the probably most important part of the C++ standard library.
OK, thanks all for advice's. I'll buy some book.
Also a lot of people said me that this tutorial is much better than any other tutorial
« Last Edit: July 09, 2014, 05:53:56 pm by paupav »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How to show value of some variale using font
« Reply #10 on: July 09, 2014, 05:58:53 pm »
Don't just buy a book, buy a good one. There are also a lot of bad C++ books.

Here's a good list: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

paupav

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Email
Re: How to show value of some variale using font
« Reply #11 on: July 09, 2014, 07:18:09 pm »
Don't just buy a book, buy a good one. There are also a lot of bad C++ books.

Here's a good list: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
Thanks I'll get Tour of C++ since it is book for programmers with some knowledge. I think that it sounds like perfect book for me.