SFML community forums

Help => General => Topic started by: Syntactic Fructose on March 15, 2012, 08:09:41 pm

Title: Displaying Integers?
Post by: Syntactic Fructose 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!
Title: Displaying Integers?
Post by: Mjonir 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?
Title: Displaying Integers?
Post by: Syntactic Fructose 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.
Title: Displaying Integers?
Post by: Mjonir 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.
Title: Displaying Integers?
Post by: Laurent 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.
Title: Displaying Integers?
Post by: Syntactic Fructose 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.
Title: Displaying Integers?
Post by: Laurent on March 15, 2012, 08:47:15 pm
Hmm... no, not really :)
Title: Displaying Integers?
Post by: StormWingDelta 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

http://www.youtube.com/watch?v=tyVhn0FWWB4
By  antiRTFM
http://cpptutorials.freeforums.org

Buckys
http://www.youtube.com/watch?v=NTip15BHVZc&feature=BFa&list=PL64A904A7897A8266&lf=results_main


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.