1
Graphics / Re: MacOS Build and Windows Build has a Difference when Drawing Rectangle on Screen
« on: May 13, 2024, 11:14:23 pm »
The first thing to consider are views. Which view are you using when drawing each item? Are you changing it between draw calls? If all your draw calls are together, this should be simple to check.
Then, consider where you are getting values such as "width" and "height". They likely should be the view's width and height, not the window's.
Also, consider that you must always know whether you are using view co-ordinates or pixel positions. e.g. getting the mouse position will be in pixel positions so does not necessarily match the location of objects until converted to co-ordinates. Note that if you are converting to co-ordinates, it must know which view's co-ordinates you wish to convert to. If you don't provide a view to "mapPixelToCoords", it will use the currently active view and, if you use multiple views, this may not be the one you actually draw it with.
Then, consider where you are getting values such as "width" and "height". They likely should be the view's width and height, not the window's.
Also, consider that you must always know whether you are using view co-ordinates or pixel positions. e.g. getting the mouse position will be in pixel positions so does not necessarily match the location of objects until converted to co-ordinates. Note that if you are converting to co-ordinates, it must know which view's co-ordinates you wish to convert to. If you don't provide a view to "mapPixelToCoords", it will use the currently active view and, if you use multiple views, this may not be the one you actually draw it with.