1
General / Re: Can't even do the simplest thing right
« on: January 18, 2013, 06:22:27 pm »You shouldn't call Display() every shape iteration otherwise you'll only see one shape at a time. Also you then don't want the sleep call with in the loop, otherwise it will sleep every time one shape is drawn instead of between the frames.QuotePS. BONUS: just for testing and learning, is there any simple way to make them bounce off on the border of the screen?Depends on your definition of 'simple'.
SFML doesn't provide sprite.bounce() or whatever, so you'll have to do the collision checking and response on your own. Depending on what you want to achieve, this can get quite complex or be very simple.
hmm as it is now it just stacks the figures, so it doesn really clear the display in every iteration, plus the for loop does 1500 shapes and then goes back to the main loop so that would't be an issue.
I'm going to look into the sleep thing, thanks!
I'm leaving the bounce thing for another moment
I don't have much time to test and analyze this through yet I will give you some tips.
If you are going to use iostream don't use cstdio(stdio.h) and the same applies backwards, that's mixing C and C++ which isn't exactly a good practice. Also use the c-libraryname, instead of libraryname.h in order to mantain the consistency in your programming.
Check that the random values are being assigned correctly, sometimes some freaky errors can be avoided by checking the data of the values you are assigning.
Make a minimal example in order to realize what is it that makes them not move, the amount of code for a trivial problem such isn't good. Make it as small as possible while reproducing the problem.
SFML 2.0 is far better than 1.6 as it fixes many bugs and has a better graphics API with many new features for both high and low level rendering. 1.6 may be "stable", but it is actually deprecated in many aspects and hasn't been touched in two years.
Read this: http://en.sfml-dev.org/forums/index.php?topic=5559.0 and this: en.sfml-dev.org/forums/index.php?topic=10306
The recommendations of eXpl0it3r apply very well and may solve the problem though it may (unlikely) be somewhere else.
I'm following a series of tutorials that use 1.6 so I'm not quite ready to jump to 2.0 yet..