SDL 2.0 Fullscreen mode has larger viewport than windowed?

I’m working on learning SDL by creating a Link To the Past-style 2D RPG, but I’m having an odd problem where fullscreen mode displays more pixels than than windowed mode, instead of only scaling the window up. I’ve attached two images to explai what I mean.

Is there any particular reason this happens? Do I need to handle this in code or is there a settings somewhere I’m missing that is causing this?



Please note that I’m using random tiles I found on the web as I don’t have any art yet.

The fullscreen images shows ~11.25 tiles height-wise, but the windowed one only shows ~10.25 tiles. I need to know how many tiles fit on the screen so I can properly have the map stop scrolling when you reach the end, but the way it is, everything works find windowed, but on fullscreen when the character gets to the bottom of the screen, an extra row of out-of-memory tiles is drawn that doesn’t belong, which looks like this and may cause crashes:

I could change my code to work on the fullscreen version and only allow fullscreen, but that seems like a half-measure to me and I want to learn how to do it right. Is the only fix to detect the visible screen height and calculate how many tiles fit? (its hardcoded right now).

Any help is greatly appreciated!

I’ve just found I can handle this manually using SDL_GetWindowSize();

But I’m still curious as to why the window size is slightly different than what I defined when it goes fullscreen. Does SDL stretch the canvas size to avoid black bars that results in an aspect-ration mis-match? grumble