Skip to content
Snippets Groups Projects
Commit 225ca8ad authored by namark's avatar namark
Browse files

Some accessors for window.

parent 7e30fc3f
No related branches found
No related tags found
No related merge requests found
......@@ -7,18 +7,6 @@
namespace simple::graphical
{
int2 window::size() const noexcept
{
auto result = -int2::one();
SDL_GetWindowSize(guts().get(), &result.x(), &result.y());
return result;
}
void window::size(int2 value) const noexcept
{
SDL_SetWindowSize(guts().get(), value.x(), value.y());
}
window::window(std::string title, int2 size, flags options, int2 position)
: sdl_window_wrapper
(
......@@ -33,4 +21,57 @@ namespace simple::graphical
)
{}
int2 window::size() const noexcept
{
auto result = -int2::one();
SDL_GetWindowSize(guts().get(), &result.x(), &result.y());
return result;
}
void window::size(int2 value) const noexcept
{
SDL_SetWindowSize(guts().get(), value.x(), value.y());
}
int2 window::position() const noexcept
{
auto result = window::undefined_position;
SDL_GetWindowPosition(guts().get(), &result.x(), &result.y());
return result;
}
void window::position(int2 value) const noexcept
{
SDL_SetWindowPosition(guts().get(), value.x(), value.y());
}
#if SDL_VERSION_ATLEAST(2,0,5)
float window::opacity() const noexcept
{
float result = -1;
SDL_GetWindowOpacity(guts().get(), &result);
return result;
}
void window::opacity(float value) const noexcept
{
SDL_SetWindowOpacity(guts().get(), value);
}
#endif
void window::show() const noexcept { SDL_ShowWindow(guts().get()); }
void window::hide() const noexcept { SDL_HideWindow(guts().get()); }
void window::minimize() const noexcept
{
// SDL_PumpEvents();
SDL_MinimizeWindow(guts().get());
}
void window::restore() const noexcept
{
// SDL_PumpEvents();
SDL_RestoreWindow(guts().get());
}
} // namespace simple::graphical
......@@ -59,6 +59,18 @@ namespace simple::graphical
int2 size() const noexcept;
void size(int2 value) const noexcept;
int2 position() const noexcept;
void position(int2 value) const noexcept;
#if SDL_VERSION_ATLEAST(2,0,5)
float opacity() const noexcept;
void opacity(float value) const noexcept;
#endif
void show() const noexcept;
void hide() const noexcept;
void minimize() const noexcept;
void restore() const noexcept;
protected:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment