28#include <SFML/Graphics/RenderWindow.hpp>
29#include <SFML/Graphics/Drawable.hpp>
30#include <SFML/Graphics/Image.hpp>
31#include <SFML/Graphics/GraphicsContext.hpp>
51 Create(Mode, Title, WindowStyle, Params);
76bool RenderWindow::Activate(
bool Active)
110 const unsigned int Width =
GetWidth();
117 priv::GraphicsContext Ctx;
120 std::vector<Uint8> Pixels(Width * Height * 4);
121 Uint8* PixelsPtr = &Pixels[0];
122 GLCheck(glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, PixelsPtr));
125 unsigned int Pitch = Width * 4;
126 for (
unsigned int y = 0; y < Height / 2; ++y)
127 std::swap_ranges(PixelsPtr + y * Pitch, PixelsPtr + (y + 1) * Pitch, PixelsPtr + (Height - y - 1) * Pitch);
130 return Image(Width, Height, PixelsPtr);
153 return sf::Vector2f(Left + WindowX * (Right - Left) /
GetWidth(),
154 Top + WindowY * (Bottom - Top) /
GetHeight());
161void RenderWindow::OnCreate()
static const Color White
White predefined color.
Image is the low-level class for loading and manipulating images.
const View & GetView() const
Get the current view.
void Initialize()
Called by the derived class when it's ready to be initialized.
sf::Vector2f ConvertCoords(unsigned int WindowX, unsigned int WindowY, const View *TargetView=NULL) const
Convert a point in window coordinates into view coordinates.
virtual unsigned int GetHeight() const
Get the height of the rendering region of the window.
virtual unsigned int GetWidth() const
Get the width of the rendering region of the window.
RenderWindow()
Default constructor.
Image Capture() const
Save the content of the window to an image.
virtual ~RenderWindow()
Destructor.
T x
X coordinate of the vector.
T y
Y coordinate of the vector.
VideoMode defines a video mode (width, height, bpp, frequency) and provides static functions for gett...
This class defines a view (position, size, etc.) ; you can consider it as a 2D camera.
const sf::Vector2f & GetHalfSize() const
Get the half-size of the view.
const sf::Vector2f & GetCenter() const
Get the center of the view.
unsigned int GetWidth() const
Get the width of the rendering region of the window.
bool SetActive(bool Active=true) const
Activate of deactivate the window as the current target for rendering.
void Create(VideoMode Mode, const std::string &Title, unsigned long WindowStyle=Style::Resize|Style::Close, const WindowSettings &Params=WindowSettings())
Create (or recreate) the window.
unsigned int GetHeight() const
Get the height of the rendering region of the window.
Structure defining the creation settings of windows.