mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-09-10 07:50:06 -04:00
Implement some Renderer getters
This commit is contained in:
parent
04244eadf0
commit
8aaf1815e0
@ -227,4 +227,50 @@ bool Renderer::TargetSupported() {
|
|||||||
return SDL_RenderTargetSupported(renderer_) == SDL_TRUE;
|
return SDL_RenderTargetSupported(renderer_) == SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect Renderer::GetClipRect() const {
|
||||||
|
SDL_Rect rect;
|
||||||
|
SDL_RenderGetClipRect(renderer_, &rect);
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
Point Renderer::GetLogicalSize() const {
|
||||||
|
int w, h;
|
||||||
|
SDL_RenderGetLogicalSize(renderer_, &w, &h);
|
||||||
|
return Point(w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Renderer::GetLogicalWidth() const {
|
||||||
|
int w;
|
||||||
|
SDL_RenderGetLogicalSize(renderer_, &w, nullptr);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Renderer::GetLogicalHeight() const {
|
||||||
|
int h;
|
||||||
|
SDL_RenderGetLogicalSize(renderer_, nullptr, &h);
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::GetScale(float& scalex, float& scaley) const {
|
||||||
|
SDL_RenderGetScale(renderer_, &scalex, &scaley);
|
||||||
|
}
|
||||||
|
|
||||||
|
float Renderer::GetXScale() const {
|
||||||
|
float scalex;
|
||||||
|
SDL_RenderGetScale(renderer_, &scalex, nullptr);
|
||||||
|
return scalex;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Renderer::GetYScale() const {
|
||||||
|
float scaley;
|
||||||
|
SDL_RenderGetScale(renderer_, nullptr, &scaley);
|
||||||
|
return scaley;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect Renderer::GetViewport() const {
|
||||||
|
SDL_Rect rect;
|
||||||
|
SDL_RenderGetViewport(renderer_, &rect);
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -539,6 +539,99 @@ public:
|
|||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool TargetSupported();
|
bool TargetSupported();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the clip rectangle for the current target
|
||||||
|
///
|
||||||
|
/// \returns Rect representing current clipping area
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetClipRect
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
Rect GetClipRect() const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get device independent resolution for rendering
|
||||||
|
///
|
||||||
|
/// \returns Point representing logical resolution
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetClipRect
|
||||||
|
///
|
||||||
|
/// \note If this function is called on an Renderer who never had
|
||||||
|
/// its logical size set by SetLogicalSize(), this function
|
||||||
|
/// returns {0, 0}
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
Point GetLogicalSize() const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get device independent width resolution for rendering
|
||||||
|
///
|
||||||
|
/// \returns Logical resolution width
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetClipRect
|
||||||
|
///
|
||||||
|
/// \note If this function is called on an Renderer who never had
|
||||||
|
/// its logical size set by SetLogicalSize(), this function
|
||||||
|
/// returns 0
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
int GetLogicalWidth() const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get device independent width resolution for rendering
|
||||||
|
///
|
||||||
|
/// \returns Logical resolution height
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetClipRect
|
||||||
|
///
|
||||||
|
/// \note If this function is called on an Renderer who never had
|
||||||
|
/// its logical size set by SetLogicalSize(), this function
|
||||||
|
/// returns 0
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
int GetLogicalHeight() const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the drawing scale for the current target
|
||||||
|
///
|
||||||
|
/// \param[out] Variable to be filled with the horizontal scaling factor
|
||||||
|
/// \param[out] Variable to be filled with the vertical scaling factor
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetScale
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void GetScale(float& scalex, float& scaley) const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the drawing scale for the current target
|
||||||
|
///
|
||||||
|
/// \returns Horizontal scaling factor
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetScale
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
float GetXScale() const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the drawing scale for the current target
|
||||||
|
///
|
||||||
|
/// \returns Vertical scaling factor
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetScale
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
float GetYScale() const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the drawing area for the current target
|
||||||
|
///
|
||||||
|
/// \returns Rect representing current drawing area
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_RenderGetViewport
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
Rect GetViewport() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user