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 - tschaei

Pages: [1]
1
I found the problem, it was some buggy code by me.

2
I'm developing a tank game right now and am using the GlobalBounds of my Sprites for collision detection. Why does the GlobalBounds' intersects-method register collisions when the two sprites don't actually overlap, but are several pixels apart from each other?

3
Graphics / [SFML 2] Sprite Vertices' Coordinates
« on: May 21, 2012, 01:53:48 am »
I'm trying to implement collision detection for rotated rectangles. I found the following for SFML 1.6:
Quote from: Laurent
The points in local coordinates are:
- (0, 0)
- (0, sprite.GetSubRect().GetHeight())
- (sprite.GetSubRect().GetWidth(), 0)
- (sprite.GetSubRect().GetWidth(), sprite.GetSubRect().GetHeight())

The points in global coordinates are:
- sprite.TransformToGlobal(px)
where px is one of the local points.

How do I get the local coordinates in SFML 2? Via getLocalBounds() or via getTextureRect()?

Edit: An additional question just came to my mind. Does changing the origin of a sprite change the way I have to calculate those local coordinates?

4
Generally, you should always include the headers you need (here the one for sf::Event) and not rely on other headers to include them automatically.

Did that now. The source of my problem was a missing semicolon after my bullet class. For some reason Visual Studio did not show the error anymore when I removed the Texture.hpp include but the program didn't actually compile like that.

5
My project setup is as follows:

A game.cpp which contains the game loop etc. It includes "Player.h", my player class, "Bullet.h" and <SFML/Graphics.hpp>. The Player.h file includes <SFML/Graphics/Sprite.hpp>, so does the "Bullet.h" (ifndef protection is in place). Now if I include <SFML/Graphics/Texture.hpp> in my "Bullet.h" Visual Studio suddenly marks my Usage of sf::Event in my gameloop as erroneous, stating that "An incomplete type is not allowed".  When I don't include <SFML/Graphics/Texture.hpp>, I don't get this error and the program compiles just fine (if I don't use sf::Texture in my Bullet class obviously). What's wrong here?

Pages: [1]