1.8
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SDLScreen Class Reference

Screen in an SDL window. More...

Inheritance diagram for SDLScreen:
Inheritance graph
[legend]

Public Member Functions

 SDLScreen (Application &app, const Size &size=Size(800, 480), const std::string &name={})
 
 SDLScreen (const SDLScreen &)=delete
 
 SDLScreen (SDLScreen &&)=delete
 
 ~SDLScreen () override
 
void flip (const DamageArray &damage) override
 Perform a flip of the buffers. More...
 
SDLScreenoperator= (const SDLScreen &)=delete
 
SDLScreenoperator= (SDLScreen &&)=delete
 
void quit ()
 
void schedule_flip () override
 Schedule a flip to occur later. More...
 
- Public Member Functions inherited from Screen
 Screen () noexcept
 
 Screen (const Screen &)=default
 
 Screen (Screen &&) noexcept=default
 
virtual ~Screen () noexcept=default
 
void async_flip (bool async)
 Set if asynchronous buffer flips are used. More...
 
EGT_NODISCARD Rect box () const
 Bounding box for the screen. More...
 
virtual EGT_NODISCARD size_t brightness () const
 Get the current brightness of the screen. More...
 
virtual void brightness (size_t brightness)
 Set the brightness of the screen. More...
 
EGT_NODISCARD shared_cairo_t context () const
 Get the context for the screen. More...
 
EGT_NODISCARD PixelFormat format () const
 Get the format of the screen. More...
 
virtual EGT_NODISCARD bool have_planes () const
 Returns true if the screen supports planes. More...
 
virtual void high_fidelity ()
 Configure high fidelity options. More...
 
virtual uint32_t index ()
 If the screen implementation manages multiple buffers, this will return the index of the current buffer. More...
 
virtual EGT_NODISCARD bool is_composer () const
 Returns true if this is a screen used with the Microchip Graphic Composer. More...
 
virtual void low_fidelity ()
 Configure low fidelity options. More...
 
virtual EGT_NODISCARD size_t max_brightness () const
 Get the max brightness of the screen. More...
 
Screenoperator= (const Screen &)=default
 
Screenoperator= (Screen &&) noexcept=default
 
EGT_NODISCARD Size size () const
 Size of the screen. More...
 

Protected Member Functions

void key_event (EventId e, const Key &key)
 
void pointer_event (EventId e, const Pointer &pointer)
 
void sdl_draw (const DamageArray &damage)
 
- Protected Member Functions inherited from Screen
virtual void copy_to_buffer (ScreenBuffer &buffer)
 Copy the framebuffer to the current composition buffer. More...
 
void copy_to_buffer_software (ScreenBuffer &buffer)
 Copy the framebuffer to the current composition buffer. More...
 
void init (const Size &size, PixelFormat format=PixelFormat::argb8888)
 
void init (void **ptr, uint32_t count, const Size &size, PixelFormat format=PixelFormat::argb8888)
 

Static Protected Member Functions

static KeyboardCode sdl_to_egtkeys (int key)
 

Protected Attributes

Applicationm_app
 Application reference. More...
 
SDLInput m_in
 Custom input for dispatching events. More...
 
asio::io_context m_io
 Internal io context. More...
 
std::atomic< bool > m_quit {false}
 Flag to quit thread. More...
 
std::thread m_thread
 Internal thread for event processing. More...
 
- Protected Attributes inherited from Screen
bool m_async {false}
 Perform flips asynchronously if supported. More...
 
BufferArray m_buffers
 Screen buffer array. More...
 
shared_cairo_t m_cr
 Composition surface context. More...
 
PixelFormat m_format {}
 Format of the screen. More...
 
Size m_size
 Size of the screen. More...
 
shared_cairo_surface_t m_surface
 Composition surface. More...
 

Additional Inherited Members

- Public Types inherited from Screen
using DamageArray = std::vector< Rect >
 Type used for damage arrays. More...
 
- Static Public Member Functions inherited from Screen
static void damage_algorithm (Screen::DamageArray &damage, Rect rect)
 This function implements the algorithm for adding damage rectangles to a list. More...
 
- Protected Types inherited from Screen
using BufferArray = std::vector< ScreenBuffer >
 Type used for an array of ScreenBuffer objects. More...
 

Detailed Description

Screen in an SDL window.

Constructor & Destructor Documentation

◆ SDLScreen() [1/3]

SDLScreen ( Application app,
const Size size = Size(800, 480),
const std::string &  name = {} 
)
explicit
Parameters
appApplication instance this screen is associated with.
sizeSize of the screen.

◆ SDLScreen() [2/3]

SDLScreen ( const SDLScreen )
delete

◆ SDLScreen() [3/3]

SDLScreen ( SDLScreen &&  )
delete

◆ ~SDLScreen()

~SDLScreen ( )
override

Member Function Documentation

◆ flip()

void flip ( const DamageArray damage)
overridevirtual

Perform a flip of the buffers.

This iterates the buffers and puts the composition buffer into the screen buffers.

Note
This will call schedule_flip() automatically.

Reimplemented from Screen.

◆ key_event()

void key_event ( EventId  e,
const Key key 
)
protected

◆ operator=() [1/2]

SDLScreen& operator= ( const SDLScreen )
delete

◆ operator=() [2/2]

SDLScreen& operator= ( SDLScreen &&  )
delete

◆ pointer_event()

void pointer_event ( EventId  e,
const Pointer pointer 
)
protected

◆ quit()

void quit ( )
inline

◆ schedule_flip()

void schedule_flip ( )
inlineoverridevirtual

Schedule a flip to occur later.

This is needed if a flip should occur sometime in the future to the hardware.

Implements Screen.

◆ sdl_draw()

void sdl_draw ( const DamageArray damage)
protected

◆ sdl_to_egtkeys()

static KeyboardCode sdl_to_egtkeys ( int  key)
staticprotected

Member Data Documentation

◆ m_app

Application& m_app
protected

Application reference.

◆ m_in

SDLInput m_in
protected

Custom input for dispatching events.

◆ m_io

asio::io_context m_io
protected

Internal io context.

◆ m_quit

std::atomic<bool> m_quit {false}
protected

Flag to quit thread.

◆ m_thread

std::thread m_thread
protected

Internal thread for event processing.