Split sdlpp into smaller files
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#include "sdlpp_window.hpp"
|
||||
|
||||
namespace SDLPP {
|
||||
Window::Window()
|
||||
: Window( "SDL Window", 640, 480, SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED ) {}
|
||||
Window::Window( const std::string &window_name )
|
||||
: Window( window_name, 640, 480, SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED ) {}
|
||||
Window::Window( const std::string &window_name, uint32_t width,
|
||||
uint32_t height )
|
||||
: Window( window_name, width, height, SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED ) {}
|
||||
Window::Window( const std::string &window_name, uint32_t width, uint32_t height,
|
||||
uint32_t posx, uint32_t posy ) {
|
||||
window = SDL_CreateWindow( window_name.c_str(), posx, posy, width, height,
|
||||
SDL_WINDOW_SHOWN );
|
||||
if ( window == NULL ) {
|
||||
std::cerr << "SDL could not create a window! SDL_Error: "
|
||||
<< SDL_GetError() << std::endl;
|
||||
throw "Couldn't create window";
|
||||
}
|
||||
}
|
||||
void Window::setResizable( bool resizable ) {
|
||||
SDL_SetWindowResizable( window, resizable ? SDL_TRUE : SDL_FALSE );
|
||||
}
|
||||
Window::~Window() {
|
||||
SDL_DestroyWindow( window );
|
||||
}
|
||||
SDL_Window *Window::getWindowPtr() {
|
||||
return window;
|
||||
}
|
||||
} // namespace SDLPP
|
||||
Reference in New Issue
Block a user