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 - Amber Crawford

Pages: [1]
1
General / Re: Trouble with window resizing
« on: September 10, 2021, 03:09:16 am »
If your sf::View moves or isn't the same size as the window, then the pixel position of your mouse doesn't match anymore with the coordinates of entities inside your world.
You should use mapPixelToCoords to convert the position of your mouse to world coordinates.
(you may think you don't use any view, but there's always a default view)

I tried this but just kept getting errors that I needed an & symbol??? how exactly would I use this, thanks.

2
General / Trouble with window resizing
« on: September 09, 2021, 09:11:46 am »
I've started playing with sfml to learn c++ but I just had a problem with my code. atm I'm just trying to get a pink square to follow the mouse, but when I resize the window (just by dragging the edge of it) the square gets messed up with positions by moving the square more than I do with my mouse (but only in the opposite direction of where I enlarged, for example: if I enlarge the window upwards then it will be all messed up in the down direction but everything horizontal will just be fine). Along with this if I fullscreen it with f11 or the button at the top of the window the square just dissapears. pastebin for game.cpp: https://pastebin.com/7kDejF2e main.cpp runs update() and render()

Pages: [1]