Add support for set/get window opacity

This commit is contained in:
Kirigaya Kazuto 2017-05-31 22:17:30 +08:00
parent 7822544701
commit d450ce8636
2 changed files with 17 additions and 2 deletions

View File

@ -1156,7 +1156,7 @@ namespace MiniEngine
_wnd.reset();
}
SDL_Window* Window::_get()
SDL_Window* Window::_get() const
{
return _wnd.get();
}
@ -1254,6 +1254,18 @@ namespace MiniEngine
return (SDL_GetWindowGrab(_get())==SDL_TRUE)?true:false;
}
int Window::setOpacity(float opacity)
{
return SDL_SetWindowOpacity(_get(),opacity);
}
float Window::getOpacity() const
{
float op=-1;
SDL_GetWindowOpacity(_get(),&op);
return op;
}
void Window::setResizable(bool resizable)
{
//SDL_SetWindowResizable(_get(), resizable?SDL_TRUE:SDL_FALSE);

View File

@ -328,6 +328,9 @@ namespace MiniEngine
void setGrab(bool);
bool getGrab();
int setOpacity(float opacity);
float getOpacity() const;
void setResizable(bool resizable);
/// Use UTF8 in Title and Message please.
@ -365,7 +368,7 @@ namespace MiniEngine
std::shared_ptr<SDL_Window> _wnd;
void _set(SDL_Window*);
void _clear();
SDL_Window* _get();
SDL_Window* _get() const;
Renderer winrnd;
};