SFML community forums

Help => Graphics => Topic started by: FlatlanD on March 07, 2014, 05:11:52 pm

Title: Question about output
Post by: FlatlanD on March 07, 2014, 05:11:52 pm
Hello guys,

I need to make this thing in my program: When I press number from 1 to 9 it shows it in a current square of a table and when I press arrow key (Up,Right,Down, Left) that numbers stays in that place where it is entered and I could enter new number in a different square of  a table and then press arrow key and again that number should stay where it is entered and so on. So I want to ask you how I can do that, because I really have a problem making that.

Thanks for your help.
Title: AW: Question about output
Post by: eXpl0it3r on March 07, 2014, 06:01:15 pm
With what exactly do you have a problem?
Programming logic? SFML code? A specific code piece?

F a start read the SFML tutorials on windows and event handling, as well as the general game loop. ;)

Remember we won't be code the application for you.
Title: Re: Question about output
Post by: FlatlanD on March 07, 2014, 08:18:46 pm
I know you won't make it for me but I just want to know how to make it and what should I use. I'm having problem with that part to left number where it was entered and move to another position without moving previous entered number.
Title: AW: Question about output
Post by: eXpl0it3r on March 07, 2014, 09:38:37 pm
Can you write a simple hello world application? Have managed to get a window displaying?

Whenever I hear such very general question I have to ask myself, whether the other person has any programming experience... If not, you should first learn the basic, start with a good C++ book. ;)

If you're just stuck, then tell us specifically where you're having problems. Your statements so far were way to general to give an useful answer...
Title: Re: Question about output
Post by: FlatlanD on March 08, 2014, 09:41:20 am
I can write a hello world app. I said you a problem, I need to make a real-time input output, and make it a different positions on a screen, with a loop, not a hundred text variables and hundred times draw them, do you understand now?!
Title: Re: Question about output
Post by: eXpl0it3r on March 08, 2014, 09:53:14 am
Well I still have no idea where you're stuck, but it sounds like you're looking for some STL container, such as std::vector. Then you get one vector variable that can hold x amount of objects.
Every good C++ book will explain how to use them and you can look at a C++ reference as well. :)
Title: Re: Question about output
Post by: Cadisol87 on March 08, 2014, 11:28:55 am
Okay, currently I also don't have an idea where exactly you are stuck at.

I think you might wanna do something like that (yeah, I know my paint skills are awesome ;) ):
(http://i.imgur.com/7a5kDGj.png)

With the blue square you can select a field and enter a number. You can move the blue square with the arrow keys.
Is that what you want to achieve?
Title: Re: Question about output
Post by: FlatlanD on March 08, 2014, 10:08:13 pm
Okay, currently I also don't have an idea where exactly you are stuck at.

I think you might wanna do something like that (yeah, I know my paint skills are awesome ;) ):
(http://i.imgur.com/7a5kDGj.png)

With the blue square you can select a field and enter a number. You can move the blue square with the arrow keys.
Is that what you want to achieve?

Yes, this is what I meant. So how I can do that? What should I use?
Title: Re: Question about output
Post by: Cadisol87 on March 09, 2014, 02:57:02 pm
What do you mean with 'what should I use' ?

You have to ask more precisely.

For example, you could ask:
Should I use a image as background or should I create it with rectangle shapes?
Or
Should I use vectors to store the rectangle shapes or should I create them separately?

But if you only ask 'what should I use' I (and probably the others) won't be able to help you, because we don't exactly know were you're stuck at.

Title: Re: Question about output
Post by: FlatlanD on March 09, 2014, 04:54:48 pm
I don't ask about how to create a table, square or something else, like I ahve written before, I'm asking how to make a real-time input output, read above ^
Title: Re: Question about output
Post by: Nexus on March 09, 2014, 05:05:40 pm
I'm asking how to make a real-time input output, read above ^
You were asked to clarify your question five times (3x eXpl0it3r, 2x Cardisol87), but you still repeat the same "real-time input output". Of course nobody understands what you mean.

Seriously, take the time to formulate a meaningful question if you expect to get an answer that helps you. Otherwise you're just wasting your own and our time.
Title: Re: Question about output
Post by: FlatlanD on March 09, 2014, 06:18:07 pm
Cadisol87 have said what i need in his post with table very clearly. What else you don't understand? I think that everything is said very clearly.
Title: Re: Question about output
Post by: Cadisol87 on March 09, 2014, 07:39:45 pm
Cadisol87 have said what i need in his post with table very clearly. What else you don't understand? I think that everything is said very clearly.

Yeah, we know what you want to do, but not what your problem is.

For real-time input you can use Events. (http://www.sfml-dev.org/tutorials/2.1/window-events.php)
And output shouldn't be the problem. But if it is, read this. (http://www.sfml-dev.org/tutorials/2.1/graphics-draw.php)
Title: Re: Question about output
Post by: FlatlanD on March 09, 2014, 08:15:10 pm
....... I know how to input and output and what use to do that, I'm just asking, do I need to make a lot of text variables, for exemple if I need to inut and output 100 times, so I need to create 100 text variables or is there a way to do that with some kind array that is drawable or something similar? Do you understand know? If not then be specific and say which part you don't get.
Title: AW: Re: Question about output
Post by: eXpl0it3r on March 09, 2014, 08:19:51 pm
That was already answered:

It sounds like you're looking for some STL container, such as std::vector. Then you get one vector variable that can hold x amount of objects.
Every good C++ book will explain how to use them and you can look at a C++ reference as well. :)

To me it seems you lack quite a bit on programming/C++ knowledge. You really might want to brush that up first.
Title: Re: Question about output
Post by: FlatlanD on March 09, 2014, 09:08:27 pm
To me it seems you are a bit big headed, if person have a question that means he has a lack of knowledge? Then I don't from which planet you are, asking a question is not always when you don't know something, if you think like that I guess your thoughts a really narrow. That's not some kind of an angry insult, no that's not, I'm glad that you answered, I will try to use that when I have a free time, but just it's an advice from me, don't act so big headed and omniscient. Have a good day.
Title: Re: Question about output
Post by: binary1248 on March 09, 2014, 09:48:37 pm
if person have a question that means he has a lack of knowledge?
Unless it is a rhetorical question, yes that is the general implication, else there would be no purpose asking a question in the first place don't you think? If you didn't lack any knowledge, why wouldn't you be able to solve the problem on your own? That being said, some knowledge that you indeed lack is the knowledge that can be acquired by reading the SFML documentation. Every feature that SFML provides is listed there, so asking us what SFML is capable of (if this is what you are even asking) just shows that you didn't bother reading it before posting here.

Also, judging by your questions, eXpl0it3r assumed that your C++ knowledge is also... lacking... I would also assume the same. As a programmer the first thing you learn is that the most important part of development is modelling what it is you are trying to do in terms of the target programming language. You seem to fail at this already. If you can't break big problems down into smaller more manageable pieces then you should take a step back and start with that first. Without that ability, you will not be able to code anything without starting a thread like this for everything you are trying to do.

Software development is like building a house. You plan out how to build it and get all the bits and pieces you need to do it. Putting it together is part of building it and if you don't know how to lay bricks you don't need to ask the brickmakers how they would go about building a house because they wouldn't be able to tell you would they? SFML provides the bricks, C++ the cement, you are the architect and really shouldn't ask anyone else how to build what you want.

Until now, you haven't provided any code, the only picture was made by someone else and it's not like your initial description of your problem has anything specific to do with SFML. This question could be asked on any other forum completely unrelated to SFML and you would probably get the same kinds of replies.

We can only provide constructive criticism here, and we try our best to make the most out of what is provided. You haven't provided much to work with, so the only thing we can say has been said. If you don't want to acknowledge the feedback provided here then you can pay someone to get things done for you because that is the only option that is left.
Title: Re: Question about output
Post by: Aster on March 09, 2014, 09:52:27 pm
How polite of you, calling someone "big headed" for suggesting you might have a lack of knowledge in the field.
You obviously aren't fluent in a modern programming language, or else you would be aware of the existence of lists or vectors. That's okay, though. We're all here to help, or be helped.

If you want actual realtime input (and skip the event queue stuff), you could create a thread that waits for a new event, and then calls a specified callback function to do stuff with it.

Another method is using a message bus. Tank wrote a wonderful article on the topic. (http://stefan.boxbox.org/2013/04/02/game-development-design-3-message-bus/)

If this stuff seems a bit complicated, fear not, we all started head first in the big world of programming. You might want to take a look at the tutorials (http://sfml-dev.org/tutorials/2.1/), or if you aren't familiar with C++, you can start with this website (http://learncpp.com).
Title: Re: Question about output
Post by: Hapax on March 13, 2014, 08:24:11 pm
I'm asking how to make a real-time input output
I know how to input and output
Is there any wonder that people don't understand what you're asking? Even your subject is "about output" but, as you said, you know how to do that.
Which part, from input (receiving key presses) to output (displaying the results) through processing (deciding what the results are after based on key presses), are you having a problem with?
If it's storing the numbers, you can use a std::vector as eXpl0it3r already mentioned.
If it's storing text objects, you can use a std::vector as eXpl0it3r already mentioned.