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

Pages: [1]
1
General / Re: Confused About Performance
« on: February 06, 2014, 05:05:36 pm »
I really doubt that it could be the bottleneck, but stringstream is slow as heck.

2
General / Re: What are scenes as described by this article?
« on: February 01, 2014, 10:59:04 am »
I'd go with the term "game state," rather than "scene." You may want to give 'SFML Game Development' a read since it provides an in-depth explanation of how to create and manage game states.

3
General / Re: Correct mouse position after moving view?
« on: January 31, 2014, 11:07:20 pm »
Well... now I feel dumb. Can't believe I was thinking that I was doing something incorrectly from the coding point of view rather than doing simple mathematics!

But I decided to limit myself to just positive coordinates. Since my game is going to be data-driven, negative positions inside a JSON file would make a really ugly sight, I presume. :p


4
General / Re: Correct mouse position after moving view?
« on: January 31, 2014, 09:01:38 pm »
I tried your code and it works perfectly. How far are we supposed to move the view to notice the problem? I moved it up to 15000, 13000.

Oh. Sorry. I am moving it to the left.
Here's how it looks:
http://i.imgur.com/icSpNmx.png

Notice the cursor and where the object spawned. Hm... strangely enough, it does seem to work okay if moving to the right. I wonder if I am perhaps not handling negative values correctly... but if that were the case, the objects would snap to the left of the cursor and not to the right.

Or are we not allowed to use negative coords in general? If not, maybe I should just limit myself to positive values and be done with (actually, that would be one heck of a way to avoid cryptic algorithms)


5
General / Correct mouse position after moving view?
« on: January 31, 2014, 08:01:53 pm »
How do I retrieve the correct mouse position after moving view?

At the moment, I am doing it this way:
pixelPos = Mouse::getPosition(window);
coordPos = window.mapPixelToCoords(pixelPos);

I tried passing the currently used view as the second parameter to the 'mapPixelToCoords' method, but it didn't help. I am trying to snap objects to a 48x48 grid, but the farther I move the view, the more mouse input deviates from the expected.

What am I doing wrong?

http://pastebin.com/6tGSwLQz

Pages: [1]
anything