Skip to content

Instantly share code, notes, and snippets.

@Twinklebear
Created July 24, 2012 02:28
Show Gist options
  • Save Twinklebear/3167636 to your computer and use it in GitHub Desktop.
Save Twinklebear/3167636 to your computer and use it in GitHub Desktop.
//Variable declaration in the class
static std::unique_ptr<SDL_Window, void (*)(SDL_Window*)> mWindow;
//Assignment of a value to the variable
//I create a unique pointer of the same type with the data I want and then swap it with the member variable
std::unique_ptr<SDL_Window, void (*)(SDL_Window*)> win(SDL_CreateWindow(title.c_str(), 100, 100,
SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE), SDL_DestroyWindow);
std::swap(win, mWindow);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment