mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-04 03:15:59 -04:00
Merge branch 'chaining'
This commit is contained in:
commit
425b2f835f
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
libSDL2pp - C++11 bindings/wrapper for SDL2
|
libSDL2pp - C++11 bindings/wrapper for SDL2
|
||||||
Copyright (C) 2014 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
Copyright (C) 2014-2015 Dmitry Marakasov <amdmi3@amdmi3.ru>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@ -88,19 +88,22 @@ SDL_AudioDeviceID AudioDevice::Get() const {
|
|||||||
return device_id_;
|
return device_id_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDevice::Pause(bool pause_on) {
|
AudioDevice& AudioDevice::Pause(bool pause_on) {
|
||||||
SDL_PauseAudioDevice(device_id_, pause_on ? 1 : 0);
|
SDL_PauseAudioDevice(device_id_, pause_on ? 1 : 0);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_AudioStatus AudioDevice::GetStatus() const {
|
SDL_AudioStatus AudioDevice::GetStatus() const {
|
||||||
return SDL_GetAudioDeviceStatus(device_id_);
|
return SDL_GetAudioDeviceStatus(device_id_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDevice::ChangeCallback(AudioDevice::AudioCallback&& callback) {
|
AudioDevice& AudioDevice::ChangeCallback(AudioDevice::AudioCallback&& callback) {
|
||||||
// make sure callback is not called while it's being replaced
|
// make sure callback is not called while it's being replaced
|
||||||
LockHandle lock = Lock();
|
LockHandle lock = Lock();
|
||||||
|
|
||||||
callback_ = std::move(callback);
|
callback_ = std::move(callback);
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioDevice::LockHandle AudioDevice::Lock() {
|
AudioDevice::LockHandle AudioDevice::Lock() {
|
||||||
@ -108,13 +111,15 @@ AudioDevice::LockHandle AudioDevice::Lock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SDL2PP_WITH_2_0_4
|
#ifdef SDL2PP_WITH_2_0_4
|
||||||
void AudioDevice::QueueAudio(const void* data, Uint32 len) {
|
AudioDevice& AudioDevice::QueueAudio(const void* data, Uint32 len) {
|
||||||
if (SDL_QueueAudio(device_id_, data, len) == 0)
|
if (SDL_QueueAudio(device_id_, data, len) == 0)
|
||||||
throw Exception("SDL_QueueAudio failed");
|
throw Exception("SDL_QueueAudio failed");
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDevice::ClearQueuedAudio() {
|
AudioDevice& AudioDevice::ClearQueuedAudio() {
|
||||||
SDL_ClearQueuedAudio(device_id_);
|
SDL_ClearQueuedAudio(device_id_);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32 GetQueuedAudioSize() const {
|
Uint32 GetQueuedAudioSize() const {
|
||||||
|
@ -263,10 +263,12 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] pause_on Whether audio should be paused
|
/// \param[in] pause_on Whether audio should be paused
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_PauseAudioDevice
|
/// \see http://wiki.libsdl.org/SDL_PauseAudioDevice
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Pause(bool pause_on);
|
AudioDevice& Pause(bool pause_on);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get playback status
|
/// \brief Get playback status
|
||||||
@ -283,8 +285,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] callback New audio callback
|
/// \param[in] callback New audio callback
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ChangeCallback(AudioCallback&& callback);
|
AudioDevice& ChangeCallback(AudioCallback&& callback);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Lock audio device to prevent it from calling audio callback
|
/// \brief Lock audio device to prevent it from calling audio callback
|
||||||
@ -307,20 +311,24 @@ public:
|
|||||||
/// \param[in] data Data to queue for later playback
|
/// \param[in] data Data to queue for later playback
|
||||||
/// \param[in] len Data length in bytes (not samples!)
|
/// \param[in] len Data length in bytes (not samples!)
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \throws SDL2pp::Exception
|
/// \throws SDL2pp::Exception
|
||||||
///
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_QueueAudio
|
/// \see http://wiki.libsdl.org/SDL_QueueAudio
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void QueueAudio(const void* data, Uint32 len);
|
AudioDevice& QueueAudio(const void* data, Uint32 len);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Drop queued audio
|
/// \brief Drop queued audio
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_ClearQueuedAudio
|
/// \see http://wiki.libsdl.org/SDL_ClearQueuedAudio
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ClearQueuedAudio();
|
AudioDevice& ClearQueuedAudio();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get number of bytes of still-queued audio
|
/// \brief Get number of bytes of still-queued audio
|
||||||
|
@ -68,32 +68,36 @@ int Font::GetStyle() const {
|
|||||||
return TTF_GetFontStyle(font_);
|
return TTF_GetFontStyle(font_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::SetStyle(int style) {
|
Font& Font::SetStyle(int style) {
|
||||||
TTF_SetFontStyle(font_, style);
|
TTF_SetFontStyle(font_, style);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Font::GetOutline() const {
|
int Font::GetOutline() const {
|
||||||
return TTF_GetFontOutline(font_);
|
return TTF_GetFontOutline(font_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::SetOutline(int outline) {
|
Font& Font::SetOutline(int outline) {
|
||||||
TTF_SetFontOutline(font_, outline);
|
TTF_SetFontOutline(font_, outline);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Font::GetHinting() const {
|
int Font::GetHinting() const {
|
||||||
return TTF_GetFontHinting(font_);
|
return TTF_GetFontHinting(font_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::SetHinting(int hinting) {
|
Font& Font::SetHinting(int hinting) {
|
||||||
TTF_SetFontHinting(font_, hinting);
|
TTF_SetFontHinting(font_, hinting);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Font::GetKerning() const {
|
bool Font::GetKerning() const {
|
||||||
return TTF_GetFontKerning(font_);
|
return TTF_GetFontKerning(font_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::SetKerning(bool allowed) {
|
Font& Font::SetKerning(bool allowed) {
|
||||||
TTF_SetFontKerning(font_, allowed);
|
TTF_SetFontKerning(font_, allowed);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Font::GetHeight() const {
|
int Font::GetHeight() const {
|
||||||
|
@ -177,10 +177,12 @@ public:
|
|||||||
/// In this case, you should probably turn off these styles and draw your
|
/// In this case, you should probably turn off these styles and draw your
|
||||||
/// own strikethroughs and underlines.
|
/// own strikethroughs and underlines.
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC22
|
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC22
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetStyle(int style = TTF_STYLE_NORMAL);
|
Font& SetStyle(int style = TTF_STYLE_NORMAL);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the current outline size of the loaded font
|
/// \brief Get the current outline size of the loaded font
|
||||||
@ -202,10 +204,12 @@ public:
|
|||||||
/// glyphs, even if there is no change in outline size, so it may be best
|
/// glyphs, even if there is no change in outline size, so it may be best
|
||||||
/// to check the current outline size by using GetOutline() first
|
/// to check the current outline size by using GetOutline() first
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC24
|
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC24
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetOutline(int outline = 0);
|
Font& SetOutline(int outline = 0);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the current hinting setting of the loaded font
|
/// \brief Get the current hinting setting of the loaded font
|
||||||
@ -235,10 +239,12 @@ public:
|
|||||||
/// glyphs, even if there is no change in hinting, so it may be best
|
/// glyphs, even if there is no change in hinting, so it may be best
|
||||||
/// to check the current hinting by using GetHinting() first
|
/// to check the current hinting by using GetHinting() first
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC26
|
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC26
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetHinting(int hinting = TTF_HINTING_NORMAL);
|
Font& SetHinting(int hinting = TTF_HINTING_NORMAL);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the current kerning setting of the loaded font
|
/// \brief Get the current kerning setting of the loaded font
|
||||||
@ -264,10 +270,12 @@ public:
|
|||||||
/// is not working for a specific font, resulting in overlapping
|
/// is not working for a specific font, resulting in overlapping
|
||||||
/// glyphs or abnormal spacing within words.
|
/// glyphs or abnormal spacing within words.
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC28
|
/// \see https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html#SEC28
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetKerning(bool allowed = true);
|
Font& SetKerning(bool allowed = true);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the maximum pixel height of all glyphs of the loaded font
|
/// \brief Get the maximum pixel height of all glyphs of the loaded font
|
||||||
|
@ -50,16 +50,18 @@ int Point::GetX() const {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Point::SetX(int nx) {
|
Point& Point::SetX(int nx) {
|
||||||
x = nx;
|
x = nx;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Point::GetY() const {
|
int Point::GetY() const {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Point::SetY(int ny) {
|
Point& Point::SetY(int ny) {
|
||||||
y = ny;
|
y = ny;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Point::operator+(const Point& other) const {
|
Point Point::operator+(const Point& other) const {
|
||||||
|
@ -129,8 +129,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] nx New X coordinate value
|
/// \param[in] nx New X coordinate value
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetX(int nx);
|
Point& SetX(int nx);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get Y coordinate of the point
|
/// \brief Get Y coordinate of the point
|
||||||
@ -145,8 +147,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] ny New Y coordinate value
|
/// \param[in] ny New Y coordinate value
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetY(int ny);
|
Point& SetY(int ny);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get point's memberwise addition with another point
|
/// \brief Get point's memberwise addition with another point
|
||||||
|
@ -84,31 +84,34 @@ int Rect::GetX() const {
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::SetX(int nx) {
|
Rect& Rect::SetX(int nx) {
|
||||||
x = nx;
|
x = nx;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rect::GetY() const {
|
int Rect::GetY() const {
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::SetY(int ny) {
|
Rect& Rect::SetY(int ny) {
|
||||||
y = ny;
|
y = ny;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rect::GetW() const {
|
int Rect::GetW() const {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::SetW(int nw) {
|
Rect& Rect::SetW(int nw) {
|
||||||
w = nw;
|
w = nw;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rect::GetH() const {
|
int Rect::GetH() const {
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::SetH(int nh) {
|
Rect& Rect::SetH(int nh) {
|
||||||
h = nh;
|
h = nh;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,16 +119,18 @@ int Rect::GetX2() const {
|
|||||||
return x + w - 1;
|
return x + w - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::SetX2(int x2) {
|
Rect& Rect::SetX2(int x2) {
|
||||||
w = x2 - x + 1;
|
w = x2 - x + 1;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Rect::GetY2() const {
|
int Rect::GetY2() const {
|
||||||
return y + h - 1;
|
return y + h - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rect::SetY2(int y2) {
|
Rect& Rect::SetY2(int y2) {
|
||||||
h = y2 - y + 1;
|
h = y2 - y + 1;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rect::Contains(int px, int py) const {
|
bool Rect::Contains(int px, int py) const {
|
||||||
|
@ -186,8 +186,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] nx New X coordinate value
|
/// \param[in] nx New X coordinate value
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetX(int nx);
|
Rect& SetX(int nx);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get Y coordinate of the rect corner
|
/// \brief Get Y coordinate of the rect corner
|
||||||
@ -202,8 +204,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] ny New Y coordinate value
|
/// \param[in] ny New Y coordinate value
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetY(int ny);
|
Rect& SetY(int ny);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get width of the rect
|
/// \brief Get width of the rect
|
||||||
@ -218,8 +222,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] nw New width of the rect
|
/// \param[in] nw New width of the rect
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetW(int nw);
|
Rect& SetW(int nw);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get height of the rect
|
/// \brief Get height of the rect
|
||||||
@ -234,8 +240,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] nh New height of the rect
|
/// \param[in] nh New height of the rect
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetH(int nh);
|
Rect& SetH(int nh);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get X coordinate of the rect second corner
|
/// \brief Get X coordinate of the rect second corner
|
||||||
@ -250,8 +258,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] x2 New X coordinate value
|
/// \param[in] x2 New X coordinate value
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetX2(int x2);
|
Rect& SetX2(int x2);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get Y coordinate of the rect second corner
|
/// \brief Get Y coordinate of the rect second corner
|
||||||
@ -270,8 +280,10 @@ public:
|
|||||||
///
|
///
|
||||||
/// This modifies rectangle height internally
|
/// This modifies rectangle height internally
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetY2(int y2);
|
Rect& SetY2(int y2);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Check whether the rect contains given point
|
/// \brief Check whether the rect contains given point
|
||||||
|
@ -75,58 +75,69 @@ int Window::GetHeight() const {
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetTitle(const std::string& title) {
|
Window& Window::SetTitle(const std::string& title) {
|
||||||
SDL_SetWindowTitle(window_, title.c_str());
|
SDL_SetWindowTitle(window_, title.c_str());
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Window::GetTitle() const {
|
std::string Window::GetTitle() const {
|
||||||
return SDL_GetWindowTitle(window_);
|
return SDL_GetWindowTitle(window_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Maximize() {
|
Window& Window::Maximize() {
|
||||||
SDL_MaximizeWindow(window_);
|
SDL_MaximizeWindow(window_);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Minimize() {
|
Window& Window::Minimize() {
|
||||||
SDL_MinimizeWindow(window_);
|
SDL_MinimizeWindow(window_);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Hide() {
|
Window& Window::Hide() {
|
||||||
SDL_HideWindow(window_);
|
SDL_HideWindow(window_);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Restore() {
|
Window& Window::Restore() {
|
||||||
SDL_RestoreWindow(window_);
|
SDL_RestoreWindow(window_);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Raise() {
|
Window& Window::Raise() {
|
||||||
SDL_RaiseWindow(window_);
|
SDL_RaiseWindow(window_);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::Show() {
|
Window& Window::Show() {
|
||||||
SDL_ShowWindow(window_);
|
SDL_ShowWindow(window_);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetFullscreen(int flags) {
|
Window& Window::SetFullscreen(int flags) {
|
||||||
if (SDL_SetWindowFullscreen(window_, flags) != 0)
|
if (SDL_SetWindowFullscreen(window_, flags) != 0)
|
||||||
throw Exception("SDL_SetWindowFullscreen failed");
|
throw Exception("SDL_SetWindowFullscreen failed");
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetSize(int w, int h) {
|
Window& Window::SetSize(int w, int h) {
|
||||||
SDL_SetWindowSize(window_, w, h);
|
SDL_SetWindowSize(window_, w, h);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetSize(const Point& size) {
|
Window& Window::SetSize(const Point& size) {
|
||||||
SDL_SetWindowSize(window_, size.x, size.y);
|
SDL_SetWindowSize(window_, size.x, size.y);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Window::GetBrightness() const {
|
float Window::GetBrightness() const {
|
||||||
return SDL_GetWindowBrightness(window_);
|
return SDL_GetWindowBrightness(window_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetBrightness(float brightness) {
|
Window& Window::SetBrightness(float brightness) {
|
||||||
if (SDL_SetWindowBrightness(window_, brightness) != 0)
|
if (SDL_SetWindowBrightness(window_, brightness) != 0)
|
||||||
throw Exception("SDL_SetWindowBrightness failed");
|
throw Exception("SDL_SetWindowBrightness failed");
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Window::GetPosition() const {
|
Point Window::GetPosition() const {
|
||||||
@ -135,12 +146,14 @@ Point Window::GetPosition() const {
|
|||||||
return Point(x, y);
|
return Point(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetPosition(int x, int y) {
|
Window& Window::SetPosition(int x, int y) {
|
||||||
SDL_SetWindowPosition(window_, x, y);
|
SDL_SetWindowPosition(window_, x, y);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetPosition(const Point& pos) {
|
Window& Window::SetPosition(const Point& pos) {
|
||||||
SDL_SetWindowPosition(window_, pos.x, pos.y);
|
SDL_SetWindowPosition(window_, pos.x, pos.y);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Window::GetMinimumSize() const {
|
Point Window::GetMinimumSize() const {
|
||||||
@ -149,12 +162,14 @@ Point Window::GetMinimumSize() const {
|
|||||||
return Point(w, h);
|
return Point(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetMinimumSize(int w, int h) {
|
Window& Window::SetMinimumSize(int w, int h) {
|
||||||
SDL_SetWindowMinimumSize(window_, w, h);
|
SDL_SetWindowMinimumSize(window_, w, h);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetMinimumSize(const Point& size) {
|
Window& Window::SetMinimumSize(const Point& size) {
|
||||||
SDL_SetWindowMinimumSize(window_, size.x, size.y);
|
SDL_SetWindowMinimumSize(window_, size.x, size.y);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point Window::GetMaximumSize() const {
|
Point Window::GetMaximumSize() const {
|
||||||
@ -163,20 +178,23 @@ Point Window::GetMaximumSize() const {
|
|||||||
return Point(w, h);
|
return Point(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetMaximumSize(int w, int h) {
|
Window& Window::SetMaximumSize(int w, int h) {
|
||||||
SDL_SetWindowMaximumSize(window_, w, h);
|
SDL_SetWindowMaximumSize(window_, w, h);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetMaximumSize(const Point& size) {
|
Window& Window::SetMaximumSize(const Point& size) {
|
||||||
SDL_SetWindowMaximumSize(window_, size.x, size.y);
|
SDL_SetWindowMaximumSize(window_, size.x, size.y);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::GetGrab() const {
|
bool Window::GetGrab() const {
|
||||||
return SDL_GetWindowGrab(window_) == SDL_TRUE;
|
return SDL_GetWindowGrab(window_) == SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetGrab(bool grabbed) {
|
Window& Window::SetGrab(bool grabbed) {
|
||||||
SDL_SetWindowGrab(window_, grabbed ? SDL_TRUE : SDL_FALSE);
|
SDL_SetWindowGrab(window_, grabbed ? SDL_TRUE : SDL_FALSE);
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -175,10 +175,12 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] title New window title in UTF-8 encoding
|
/// \param[in] title New window title in UTF-8 encoding
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowTitle
|
/// \see http://wiki.libsdl.org/SDL_SetWindowTitle
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetTitle(const std::string& title);
|
Window& SetTitle(const std::string& title);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get window title
|
/// \brief Get window title
|
||||||
@ -193,62 +195,76 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Make a window as large as possible
|
/// \brief Make a window as large as possible
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_MaximizeWindow
|
/// \see http://wiki.libsdl.org/SDL_MaximizeWindow
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Maximize();
|
Window& Maximize();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Minimize a window to an iconic representation
|
/// \brief Minimize a window to an iconic representation
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_MinimizeWindow
|
/// \see http://wiki.libsdl.org/SDL_MinimizeWindow
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Minimize();
|
Window& Minimize();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Hide a window
|
/// \brief Hide a window
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_HideWindow
|
/// \see http://wiki.libsdl.org/SDL_HideWindow
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Hide();
|
Window& Hide();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Restore the size and position of a minimized or maximized window
|
/// \brief Restore the size and position of a minimized or maximized window
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_RestoreWindow
|
/// \see http://wiki.libsdl.org/SDL_RestoreWindow
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Restore();
|
Window& Restore();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Raise a window above other windows and set the input focus
|
/// \brief Raise a window above other windows and set the input focus
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_RaiseWindow
|
/// \see http://wiki.libsdl.org/SDL_RaiseWindow
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Raise();
|
Window& Raise();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Show a window
|
/// \brief Show a window
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_ShowWindow
|
/// \see http://wiki.libsdl.org/SDL_ShowWindow
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Show();
|
Window& Show();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set a window's fullscreen state
|
/// \brief Set a window's fullscreen state
|
||||||
///
|
///
|
||||||
/// \param[in] flags SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP or 0
|
/// \param[in] flags SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP or 0
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \throws SDL2pp::Exception
|
/// \throws SDL2pp::Exception
|
||||||
///
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowFullscreen
|
/// \see http://wiki.libsdl.org/SDL_SetWindowFullscreen
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetFullscreen(int flags);
|
Window& SetFullscreen(int flags);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the size of a window's client area
|
/// \brief Set the size of a window's client area
|
||||||
@ -256,20 +272,24 @@ public:
|
|||||||
/// \param[in] w Width of the window in pixels
|
/// \param[in] w Width of the window in pixels
|
||||||
/// \param[in] h Height of the window in pixels
|
/// \param[in] h Height of the window in pixels
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowSize
|
/// \see http://wiki.libsdl.org/SDL_SetWindowSize
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetSize(int w, int h);
|
Window& SetSize(int w, int h);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the size of a window's client area
|
/// \brief Set the size of a window's client area
|
||||||
///
|
///
|
||||||
/// \param[in] size Point representing window dimensions
|
/// \param[in] size Point representing window dimensions
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowSize
|
/// \see http://wiki.libsdl.org/SDL_SetWindowSize
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetSize(const Point& size);
|
Window& SetSize(const Point& size);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the brightness (gamma multiplier) for the display that owns a given window
|
/// \brief Get the brightness (gamma multiplier) for the display that owns a given window
|
||||||
@ -286,12 +306,14 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] brightness Brightness value to set where 0.0 is completely dark and 1.0 is normal brightness
|
/// \param[in] brightness Brightness value to set where 0.0 is completely dark and 1.0 is normal brightness
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \throws SDL2pp::Exception
|
/// \throws SDL2pp::Exception
|
||||||
///
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowBrightness
|
/// \see http://wiki.libsdl.org/SDL_SetWindowBrightness
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetBrightness(float brightness);
|
Window& SetBrightness(float brightness);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the position of a window
|
/// \brief Get the position of a window
|
||||||
@ -309,20 +331,24 @@ public:
|
|||||||
/// \param[in] x X coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
|
/// \param[in] x X coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
|
||||||
/// \param[in] y Y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
|
/// \param[in] y Y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowPosition
|
/// \see http://wiki.libsdl.org/SDL_SetWindowPosition
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetPosition(int x, int y);
|
Window& SetPosition(int x, int y);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the position of a window
|
/// \brief Set the position of a window
|
||||||
///
|
///
|
||||||
/// \param[in] pos Point representin position of the a window
|
/// \param[in] pos Point representin position of the a window
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowPosition
|
/// \see http://wiki.libsdl.org/SDL_SetWindowPosition
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetPosition(const Point& pos);
|
Window& SetPosition(const Point& pos);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the minimum size of a window's client area
|
/// \brief Get the minimum size of a window's client area
|
||||||
@ -340,20 +366,24 @@ public:
|
|||||||
/// \param[in] w Minimum width of the window in pixels
|
/// \param[in] w Minimum width of the window in pixels
|
||||||
/// \param[in] h Minimum height of the window in pixels
|
/// \param[in] h Minimum height of the window in pixels
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowMinimumSize
|
/// \see http://wiki.libsdl.org/SDL_SetWindowMinimumSize
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetMinimumSize(int w, int h);
|
Window& SetMinimumSize(int w, int h);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the minimum size of a window's client area
|
/// \brief Set the minimum size of a window's client area
|
||||||
///
|
///
|
||||||
/// \param[in] size Minimum area of the window in pixels
|
/// \param[in] size Minimum area of the window in pixels
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowMinimumSize
|
/// \see http://wiki.libsdl.org/SDL_SetWindowMinimumSize
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetMinimumSize(const Point& size);
|
Window& SetMinimumSize(const Point& size);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the maximum size of a window's client area
|
/// \brief Get the maximum size of a window's client area
|
||||||
@ -371,20 +401,24 @@ public:
|
|||||||
/// \param[in] w Maximum width of the window in pixels
|
/// \param[in] w Maximum width of the window in pixels
|
||||||
/// \param[in] h Maximum height of the window in pixels
|
/// \param[in] h Maximum height of the window in pixels
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowMaximumSize
|
/// \see http://wiki.libsdl.org/SDL_SetWindowMaximumSize
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetMaximumSize(int w, int h);
|
Window& SetMaximumSize(int w, int h);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the maximum size of a window's client area
|
/// \brief Set the maximum size of a window's client area
|
||||||
///
|
///
|
||||||
/// \param[in] size Maximum area of the window in pixels
|
/// \param[in] size Maximum area of the window in pixels
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowMaximumSize
|
/// \see http://wiki.libsdl.org/SDL_SetWindowMaximumSize
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetMaximumSize(const Point& size);
|
Window& SetMaximumSize(const Point& size);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get a window's input grab mode
|
/// \brief Get a window's input grab mode
|
||||||
@ -401,10 +435,12 @@ public:
|
|||||||
///
|
///
|
||||||
/// \param[in] grabbed True to grab input, false to release input
|
/// \param[in] grabbed True to grab input, false to release input
|
||||||
///
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
/// \see http://wiki.libsdl.org/SDL_SetWindowGrab
|
/// \see http://wiki.libsdl.org/SDL_SetWindowGrab
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SetGrab(bool grabbed);
|
Window& SetGrab(bool grabbed);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user