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

Author Topic: Displaying Integers?  (Read 2793 times)

0 Members and 1 Guest are viewing this topic.

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Displaying Integers?
« on: March 15, 2012, 08:09:41 pm »
I've wanted to get out of the console in C++ for awhile now, and im trying to learn SFML. The problem is that the tutorials on this site are extremely limited and teach very litte. If i wanted to say, convert a normal console application that asks users to enter 2 numbers on the screen and displays the sum, how would i go about doing that? Also, if someone to link me an actual tutorial series for SFML i would be very grateful!

Mjonir

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Displaying Integers?
« Reply #1 on: March 15, 2012, 08:16:05 pm »
Well, SFML is "only" for displaying/playing/reading stuff. What's you're asking is not directly related to SFML so it's normal that's not covered in the tutorials. I'm also not sure what you mean when you say convert a console application?

I suggest you find tutorials on game design, I think that's what you really want to learn about :)

Anyway to answer your question if you want to display an integer in a window, I'd say the simplest way is using sf::Text?

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Displaying Integers?
« Reply #2 on: March 15, 2012, 08:20:46 pm »
From what i hear, C++ on the console can become a bad habit, so im trying to move away from it. If i want to say, run a complete application on a seperate window(adding, displaing and others) what would i use? Im imagining in my head running a program, it opens a different window and asks the user for input, does something with it and displays it.

Mjonir

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Displaying Integers?
« Reply #3 on: March 15, 2012, 08:28:03 pm »
Sorry I'd like to help but I really don't understand. What do you mean by "C++ on the console can become a bad habit"?

From what I understand, you want to make a calculator where the user the user enters a mathematical expression, you evaluate it and display the result?

You can retrieve the input with the Keyboard-related classes of SFML. Treating the result however is pure programming and is an issue not related to SFML at all (but I'm sure you can find pretty good tutorials about making calculators).

The only thing SFML can do for you is allow you to create a window and then simply display images in it. However the way calculations are displayed is entirely up to you, that's something you have to invent.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Displaying Integers?
« Reply #4 on: March 15, 2012, 08:30:07 pm »
HCI are not the simplest thing to program in a graphics application. It requires complicated code for very little gain (ie. just doing the same thing as in the console).

Unless you use a dedicated GUI library (see SFGUI for example), I suggest that you don't waste too much time on that.

You can display text (see sf::Text), react to key pressed (see sf::Keyboard and sf::Event), but forget about asking something to the user. Experiment with basic stuff first.
Laurent Gomila - SFML developer

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Displaying Integers?
« Reply #5 on: March 15, 2012, 08:34:11 pm »
Thanks for the replys, From what im hearing i need to use Win32 programming if i want to display varibles and create a GUI.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Displaying Integers?
« Reply #6 on: March 15, 2012, 08:47:15 pm »
Hmm... no, not really :)
Laurent Gomila - SFML developer

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Displaying Integers?
« Reply #7 on: March 18, 2012, 02:28:51 am »
I think this might help for most of the basics. I found these tutorials a while ago but haven't looked through them much.


Basic C++ Tutorials online


By  antiRTFM
http://cpptutorials.freeforums.org

Buckys



Most these are far behind what I'm use to but I look at them when I've forgotten something and need to hear words instead of read them.
I have many ideas but need the help of others to find way to make use of them.

 

anything