ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
display.h
Go to the documentation of this file.
1
8
9#ifndef ASW_DISPLAY_H
10#define ASW_DISPLAY_H
11
12#include <string>
13
14#include "./color.h"
15#include "./geometry.h"
16#include "./types.h"
17
18namespace asw::display {
19
26void _init(int width, int height, int scale);
27
34void _init_opengl(int width, int height, int scale);
35
40void _shutdown();
41
47
53
58void set_title(const std::string& title);
59
65void set_icon(const std::string& path);
66
74void set_fullscreen(bool fullscreen);
75
83bool is_fullscreen();
84
90void set_resolution(int w, int h);
91
96void set_resizable(bool resizable);
97
103
110
117
120void set_render_target(const asw::Texture& texture);
121
125
128void clear();
129
134void clear(const asw::Color& color);
135
138void present();
139
147
158bool screenshot(const std::string& path);
159
165void warp_mouse(float x, float y);
166
169void swap_window();
170
171} // namespace asw::display
172
173#endif // ASW_DISPLAY_H
A 2D vector in space.
Definition geometry.h:27
Common geometry types.
void set_icon(const std::string &path)
Set the icon to display on the window. If it does not exist, this will silently fail.
Definition display.cpp:154
bool screenshot(const std::string &path)
Save what has been drawn this frame to a PNG file. Call after drawing and before the frame is present...
Definition display.cpp:288
asw::Vec2< float > get_scale()
Get how many output pixels one logical pixel covers, after letterboxing. 2.0 means the game is drawn ...
Definition display.cpp:207
void set_fullscreen(bool fullscreen)
Set the window to fullscreen or windowed.
Definition display.cpp:166
asw::Vec2< int > get_logical_size()
Get the logical size of the window. This may differ from the actual size if scaling is enabled.
Definition display.cpp:198
void _init_opengl(int width, int height, int scale)
Initialize the display module with OpenGL support. Called by asw::core::init().
Definition display.cpp:91
void set_blend_mode(asw::BlendMode mode)
Set the blend mode used to draw primitives such as rectangles, lines and circles. Defaults to Blend,...
Definition display.cpp:273
bool is_fullscreen()
Check if the window is fullscreen.
Definition display.cpp:172
void reset_render_target()
Reset the render target to the default.
Definition display.cpp:233
asw::Vec2< int > get_size()
Get the size of the window.
Definition display.cpp:191
void swap_window()
Swap window (gl)
Definition display.cpp:283
void present()
Present the window.
Definition display.cpp:264
void set_render_target(const asw::Texture &texture)
Set the render target to the window.
Definition display.cpp:224
void clear()
Clear the window to black.
Definition display.cpp:242
void _shutdown()
Shut down the display module. Called by asw::core::shutdown(). Nulls the renderer and window pointers...
Definition display.cpp:116
void warp_mouse(float x, float y)
Warp mouse in window.
Definition display.cpp:278
asw::Renderer * get_renderer()
Get the SDL renderer.
Definition display.cpp:139
asw::Window * get_window()
Get the SDL window.
Definition display.cpp:144
void _init(int width, int height, int scale)
Initialize the display module. Called by asw::core::init().
Definition display.cpp:59
void set_title(const std::string &title)
Set the title of the window.
Definition display.cpp:149
void set_resolution(int w, int h)
Set the resolution of the window.
Definition display.cpp:181
void set_resizable(bool resizable)
Set resizable flag of the window.
Definition display.cpp:186
std::shared_ptr< SDL_Texture > Texture
Alias for a shared pointer to an SDL_Texture.
Definition types.h:76
BlendMode
Mappings from SDL_BLENDMODE to ASW BlendMode.
Definition types.h:26
SDL_Window Window
Alias for a shared pointer to an SDL_Window.
Definition types.h:91
SDL_Renderer Renderer
Alias for a shared pointer to an SDL_Renderer.
Definition types.h:88
RGBA color struct with 8-bit channels.
Definition color.h:18
Types used throughout the ASW library.