Loading...
Searching...
No Matches
RenderWindow.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
31
33
39
41
42#include <cstdint>
43
44
45namespace sf
46{
47class Image;
48class String;
49
55{
56public:
64 RenderWindow() = default;
65
87 const String& title,
88 std::uint32_t style = Style::Default,
89 State state = State::Windowed,
90 const ContextSettings& settings = {});
91
109 RenderWindow(VideoMode mode, const String& title, State state, const ContextSettings& settings = {});
110
127 explicit RenderWindow(WindowHandle handle, const ContextSettings& settings = {});
128
138 [[nodiscard]] Vector2u getSize() const override;
139
150 void setIcon(const Image& icon);
151 using Window::setIcon;
152
161 [[nodiscard]] bool isSrgb() const override;
162
179 [[nodiscard]] bool setActive(bool active = true) override;
180
181protected:
190 void onCreate() override;
191
199 void onResize() override;
200
201private:
203 // Member data
205 unsigned int m_defaultFrameBuffer{};
206};
207
208} // namespace sf
209
210
#define SFML_GRAPHICS_API
Class for loading, manipulating and saving images.
Definition Image.hpp:55
Base class for all render targets (window, texture, ...)
Window that can serve as a target for 2D drawing.
RenderWindow(WindowHandle handle, const ContextSettings &settings={})
Construct the window from an existing control.
bool isSrgb() const override
Tell if the window will use sRGB encoding when drawing on it.
bool setActive(bool active=true) override
Activate or deactivate the window as the current target for OpenGL rendering.
RenderWindow(VideoMode mode, const String &title, std::uint32_t style=Style::Default, State state=State::Windowed, const ContextSettings &settings={})
Construct a new window.
void onResize() override
Function called after the window has been resized.
void onCreate() override
Function called after the window has been created.
void setIcon(const Image &icon)
Change the window's icon.
RenderWindow()=default
Default constructor.
RenderWindow(VideoMode mode, const String &title, State state, const ContextSettings &settings={})
Construct a new window.
Vector2u getSize() const override
Get the size of the rendering region of the window.
Utility string class that automatically handles conversions between types and encodings.
Definition String.hpp:89
VideoMode defines a video mode (size, bpp)
Definition VideoMode.hpp:44
Window that serves as a target for OpenGL rendering.
State
Enumeration of the window states.
"platform-specific" WindowHandle
Low-level window handle type, specific to each platform.
Structure defining the settings of the OpenGL context attached to a window.