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.


Topics - conman420

Pages: [1]
1
Graphics / Converting from Cartesian coordinate system to SFML.
« on: August 25, 2011, 12:17:02 am »
Hi, my project is using the standard Cartesian system for position (X-axis goes right, Y-Axis goes Up) whereas SFML has an inverted Y axis.

I am trying to convert my game coordinates to SFML coordinates for drawing, it was working fine when I wasn't using views but now I have implemented that my algorithm for converting has failed completely.

Here is my current code:
Code: [Select]

sf::Vector2f BaseEntity::GameCoordsToSFML(sf::Vector2f Pos)
{
Pos.y *= -1;
return pRender->GetView().GetCenter() + Pos;
}

sf::Vector2f BaseEntity::SFMLToGameCoords(sf::Vector2f Pos)
{
Pos = Pos - pRender->GetView().GetCenter();
Pos.y *= -1;
return Pos;
}



I think I am forgetting something when converting because as soon as GetCenter() moves from the centre of the window the whole thing breaks down and it returns weird results.

I was thinking it might involve RenderWindow::ConvertCoords() but I have no idea really I have never played with views before.

2
General / SFML freezes when mouse moves (VS 2010)
« on: August 12, 2011, 04:43:13 pm »
Hi,

Whenever I run my SFML program through visual studio 2010 (this also happens in 2008) and move the mouse rapidly on top of the window the whole game locks up completely and it uses 100% of the first core on the CPU, as soon as I stop moving the mouse the problem immediately stops.

Restarting visual studio sometimes fixes it for a bit and running the .exe file directly from windows explorer always makes the problem go away but it's getting really annoying.

This also happens in a blank sfml project with just a renderwindow and nothing else so it is not my code.

I have a Razer Deathadder mouse, my theory for why this happens is that the mouse is sending events to the window faster than it can process them causing a build up of events? But that's just speculation.

I hope someone else has come across this problem it's making me feel like my games running slowly when it is just the mouse!

Specs:

Intel Dual Core 2.66Ghz
4GB Ram
Windows 7 64 bit
NVidia gtx 260

Thanks.

Update: Just did some tests printing out how many events are being processed

If Visual studio is running and I move the mouse I get 250 events per frame and it freezes. However if I run it without visual studio (directly clicking the exe) I get a maximum of 1. This is very strange, I'm going to try and figure out if these events are all mouse movement events or if something else is creeping in there that shouldn't be.

PS. Sometimes the event count reaches the thousands if I move the mouse fast enough.

Pages: [1]