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 File Reference

Display and window routines for the ASW library. More...

#include <string>
#include "./color.h"
#include "./geometry.h"
#include "./types.h"
Include dependency graph for display.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  asw
 
namespace  asw::display
 

Functions

void asw::display::_init (int width, int height, int scale)
 Initialize the display module. Called by asw::core::init().
 
void asw::display::_init_opengl (int width, int height, int scale)
 Initialize the display module with OpenGL support. Called by asw::core::init().
 
void asw::display::_shutdown ()
 Shut down the display module. Called by asw::core::shutdown(). Nulls the renderer and window pointers before destroying them, so any outstanding shared_ptr asset deleters see a null renderer and become no-ops.
 
asw::Renderer * asw::display::get_renderer ()
 Get the SDL renderer.
 
asw::Window * asw::display::get_window ()
 Get the SDL window.
 
void asw::display::set_title (const std::string &title)
 Set the title of the window.
 
void asw::display::set_icon (const std::string &path)
 Set the icon to display on the window. If it does not exist, this will silently fail.
 
void asw::display::set_fullscreen (bool fullscreen)
 Set the window to fullscreen or windowed.
 
bool asw::display::is_fullscreen ()
 Check if the window is fullscreen.
 
void asw::display::set_resolution (int w, int h)
 Set the resolution of the window.
 
void asw::display::set_resizable (bool resizable)
 Set resizable flag of the window.
 
asw::Vec2< int > asw::display::get_size ()
 Get the size of the window.
 
asw::Vec2< int > asw::display::get_logical_size ()
 Get the logical size of the window. This may differ from the actual size if scaling is enabled.
 
asw::Vec2< float > asw::display::get_scale ()
 Get how many output pixels one logical pixel covers, after letterboxing. 2.0 means the game is drawn at twice its logical size.
 
void asw::display::set_render_target (const asw::Texture &texture)
 Set the render target to the window.
 
void asw::display::reset_render_target ()
 Reset the render target to the default.
 
void asw::display::clear ()
 Clear the window to black.
 
void asw::display::clear (const asw::Color &color)
 Clear to colour.
 
void asw::display::present ()
 Present the window.
 
void asw::display::set_blend_mode (asw::BlendMode mode)
 Set the blend mode used to draw primitives such as rectangles, lines and circles. Defaults to Blend, so colours with alpha are see through.
 
bool asw::display::screenshot (const std::string &path)
 Save what has been drawn this frame to a PNG file. Call after drawing and before the frame is presented, for example at the end of a scene's draw(). Works with the dummy video driver (SDL_VIDEO_DRIVER=dummy), so scripted runs can capture frames without a window on screen.
 
void asw::display::warp_mouse (float x, float y)
 Warp mouse in window.
 
void asw::display::swap_window ()
 Swap window (gl)
 

Detailed Description

Display and window routines for the ASW library.

Author
Allan Legemaate (alege.nosp@m.maat.nosp@m.e@gma.nosp@m.il.c.nosp@m.om)
Date
2023-09-20

Definition in file display.h.