SDL Window top and left side blocked

Started by
4 comments, last by NQ 15 years ago
Hi i just wanted to know if there is any way to make the top and the left side of the SDL window to not be blocked. My charachter can't go there, but on the right side and the bottom side he can go outside the window for as far as he wants.
Advertisement
You need to check if the x and y position of your player are within the screen resolution.
So something like if player.x < 0 then player.x = 0
We can assume that top left if zero zero. Do you think it would make sense to have a coordinate such as -1 -1 in client space?
Quote:Original post by Spkka
You need to check if the x and y position of your player are within the screen resolution.
So something like if player.x < 0 then player.x = 0


yes i know how i can block the sides but i am just confused as to why i can go over 640 and 480. (My charachter can go on forever to these directions so it takes several seconds before he comes back on screen). But at the 0 coordinates he stops immediately without me needing to block it. Well nvm i'll just have it as i have it now if this is how it's supposed to be.
The SDL coordinate system begins on the top left corner of a surface, at (0,0).

Think, inverted quadrant I of a standard Cartesian coordinate plane.

The way around this limitation is to change the size of the main surface, simply make it extend past the size of your screen.
I am not sure why this happens, but if you insert the changes I suggested in the other thread about the other problem, this problem should vanish too.
----------------------~NQ - semi-pro graphical artist and hobbyist programmer

This topic is closed to new replies.

Advertisement