MiniEngine/sdl_engine_window.hpp
Kiritow 39c4d04d03 [New] Widget added.
[Update] SDL Engine updated.
2017-01-08 09:41:47 +08:00

56 lines
908 B
C++

Window::Window(int winw,int winh)
{
pimpl=new impl;
SDL_Window* wnd=SDL_CreateWindow("Engine",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,winw,winh,SDL_WINDOW_SHOWN);
pimpl->set(wnd);
}
Window::Window(const Window& inc)
{
pimpl=new impl;
*pimpl=*(inc.pimpl);
}
Window& Window::operator = (const Window& inc)
{
*pimpl=*(inc.pimpl);
return *this;
}
Window::Window(Window&& inc)
{
pimpl=inc.pimpl;
inc.pimpl=nullptr;
}
Window& Window::operator = (Window&& inc)
{
*pimpl=*(inc.pimpl);
inc.pimpl=nullptr;
return *this;
}
Window::~Window()
{
delete pimpl;
}
Renderer Window::getRenderer() const
{
return pimpl->rnd;
}
Rect Window::getSize()
{
int w,h;
SDL_GetWindowSize(pimpl->getRawWindow(),&w,&h);
Rect rect(0,0,w,h);
return rect;
}
void Window::setSize(Rect rect)
{
SDL_SetWindowSize(pimpl->getRawWindow(),rect.w,rect.h);
}