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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - didii

Pages: 1 2 [3] 4 5 ... 9
31
General / Re: Why degrees?
« on: April 03, 2014, 02:37:23 am »
Well, I did search on this forum since I thought it should have been asked already, but all I got was an error message. Going into one of the subforums apparently restricts the search to that subforum, which I didn't know and didn't gave any result.

I'm sorry.

32
General / Why degrees?
« on: April 03, 2014, 02:15:49 am »
Why is SFML using degrees as a default unit instead of radians? Radians is pretty much standard in every mathematical environment and the default sin, cos and tan only accept radians. Why would users have to go through the hassle of having to take note if they are working in degrees or radians, when it can all be simplified to only using radians?

33
General / Re: Hello, I'm new to SFML
« on: March 30, 2014, 10:45:22 pm »
Please make a complete and minimal example code and use a more descriptive title if you want more people to help. There are a couple of things to note here. In any way, I think the tutorial will still help you a lot.

For the bouncing: give your object a velocity, then you can simply add another velocity or reverse the velocity when colliding.

34
General / Re: Changing screen when player is outside window.
« on: March 26, 2014, 07:23:41 pm »
Reading the documentation helps a lot ;)

To stop him after a while you can place a rectangle as large as your screen and then use sf::Rect<T>::intersects or sf::Rect<T>::contains to know whether he is off the screen. Or just do a manual check for his position.

35
General / Re: drawing and collision objects
« on: March 23, 2014, 08:22:24 pm »
Please post a minimal and complete example code if you want more help with your code for all the reasons mentioned in the link.

36
Graphics / Re: SFML-1.6 not recognising Image
« on: March 20, 2014, 11:47:25 pm »
It isn't that hard ;)

37
General / Re: Problem With Text
« on: March 18, 2014, 02:45:28 am »
There are many solutions to your problem. Just search Google for integer to string conversions. Here is a list of methods with their respective speed.

38
General / Re: How can you toggle something with pressing a key?
« on: March 13, 2014, 08:05:27 am »
You need to declare a default value for a before your loop starts. This way it's not destroyed after the loop restarts. After setting the variable to a=1 it will thus stay at 1 until you change it again.

If you need an on/off toggle, it's easier, cleaner and more efficient to use a bool. Then you can simply write
bool a = ...;
while (...) {
    if (keypressed)
        a = !a;
}
If you have more than 2 toggles, a clean way to write it could be
int a = ...;
while (...) {
    if (keypressed)
        a = (a+1)%N;
}
where N is the number of states and % is the modulus operator.


The easiest way would be to use event and change it to 1 when keypressed is triggered and to 0 if keyrelease is triggere.

If you're just interested in 0 and 1, which could be represented as boolean, theb you could use sf::Keyboard::isKeyPressed() directly, since that returns true if pressed, false otherwise. ;)
I think you are misinterpreting. He meant to toggle a value only when a key is pressed, when released it should stay that value. But it is indeed safer to use events rather than real-time input in case of a toggle.

39
Graphics / Re: Click and change fill color help!
« on: March 11, 2014, 03:10:45 pm »
The site cplusplus.com also has some nice tutorials. However, I do not recommend them as a starting point. They are very good if you need to recheck something since they are short and clear, but they do not have enough information to get you started.

40
Graphics / Re: Weird problem
« on: March 11, 2014, 02:53:22 pm »
Please make a complete and minimal example code for all the reasons mentioned in the link.

41
General / Re: My vertex line is blinking
« on: March 10, 2014, 04:26:33 am »
Couple of things to note here:
  • As The Terminator mentioned: sf::RenderWindow::clear should always be called before sf::RenderWindow::draw.
  • Your array outlines is created inside the for-loop. When the for loop ends, the scope where your vertex was created ends and the object gets destroyed.
  • You draw your vertices only once, not every frame. Read the big red box on this tutorial. It mentions how you should do it and also refers to double-buffering which is why the lines are blinking.

Please do read the tutorials as they are very useful and clear.

42
General / Re: Trouble compiling the tutorial [OSX Mavericks - Xcode]
« on: March 08, 2014, 02:06:44 am »
Can you compile any program at all? Have you tried compiling a simple "Hello, Wold" program?

43
Graphics / Re: Problem with SFML's tutorial AnimatedSprite by Foaly
« on: March 06, 2014, 03:48:00 am »
It's one of the reasons we ask for a complete and minimal example code. In many cases you'll find your own mistake and learn more from it ;)

44
Graphics / Re: Problem with SFML's tutorial AnimatedSprite by Foaly
« on: March 05, 2014, 02:12:08 pm »
Please provide us with as much information as possible (especially code).
Actually, it's preferred to give as less information possible. Just enough to demonstrate the problem: complete and minimal example code.

45
Graphics / Re: Problem with SFML's tutorial AnimatedSprite by Foaly
« on: March 03, 2014, 10:12:48 pm »
So now you have the call stack you can trace back to where the fault has started. The error you are getting has typically this syntax
vectorObj[i];
where i is equal or bigger than the size of the vector vectorObj. In your case it's in the function AnimatedSprite::getFrame. The argument given exceeds the vector dimensions. So try and keep tracing back to the point where the variable was set and see if you can find it. You need to check the size of your vector and the index for it of course. You can see these variables using the Locals or Auto's in MSVC.

I'm guessing your animation the pointer currentAnimation points to is empty.

Pages: 1 2 [3] 4 5 ... 9
anything