# Migrating from SDL 1.2 to SDL2: some problems

**URL:** <https://discourse.libsdl.org/t/migrating-from-sdl-1-2-to-sdl2-some-problems/21766>\
**Category:** SDL Development\
**Created:** [April 22, 2016, 9:18am UTC](https://discourse.libsdl.org/t/migrating-from-sdl-1-2-to-sdl2-some-problems/21766 "2016-04-22T09:18:20Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![icculus](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/icculus/32/81_2.png) [@icculus](https://discourse.libsdl.org/u/icculus)\
**Post date:** [April 27, 2016, 3:08pm UTC](https://discourse.libsdl.org/t/migrating-from-sdl-1-2-to-sdl2-some-problems/21766/3 "2016-04-27T15:08:02Z")

</div>

> fullscreen = ((screen-\>flags & SDL\_FULLSCREEN) == SDL\_FULLSCREEN);

You want this:

fullscreen = (SDL\_GetWindowFlags(screen) & SDL\_WINDOW\_FULLSCREEN) != 0;

(Note that this will work whether you used SDL\_WINDOW\_FULLSCREEN or  
SDL\_WINDOW\_FULLSCREEN\_DESKTOP, since they both set the former’s bit.

> This is another point where i’m stuck atm.  
> What if the previuos code for SDL1 uses SDL\_DOUBLEBUF or as in this case  
> SDL\_HWPALETTE?

SDL\_HWPALETTE doesn’t mean much in modern times; you can just drop it.  
Presumably you have a 32-bit display, so if you give SDL an 8-bit  
surface, it’ll just convert it to display format as appropriate and not  
force a hardware palette that would mess up other windows on the screen.

SDL\_DOUBLEBUF doesn’t mean much now either (you’re probably  
double-buffered everywhere now), but if you’re using the SDL2 Render API  
to get your surface to the screen, you can create the renderer with the  
SDL\_RENDERER\_PRESENTVSYNC to make sure there’s no tearing. If you’re  
eventually drawing with OpenGL, you can use SDL\_GL\_SetSwapInterval(1)  
after creating your GL context to the same effect.

–ryan.

---

_[View the full topic](https://discourse.libsdl.org/t/migrating-from-sdl-1-2-to-sdl2-some-problems/21766)._
