Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
IBackendSystem Class Referenceabstract

Interface for backend system implementations handling low-level events. More...

#include <i_backend_system.h>

Inheritance diagram for IBackendSystem:
[legend]

Public Member Functions

virtual ~IBackendSystem ()=default
 
virtual void initialize_listeners (std::unordered_map< SystemEvent, std::vector< BackendCallback > > *listeners)=0
 
virtual void poll_events ()=0
 Polls for new events from the backend system.
 
virtual void init_frame_timer ()=0
 Initializes the internal timer for frame time calculation.
 
virtual void update_frame_time (float time_scale)=0
 Updates the frame time based on the elapsed time since the last frame.
 
virtual float delta_time () const =0
 Retrieves the time elapsed since the last frame.
 
virtual float frames_per_second () const =0
 Retrieves the frames per second (FPS) based on the updated frame time.
 
virtual std::string get_clipboard_text ()=0
 Sets the current text to the system clipboard.
 
virtual void set_cursor_to_arrow ()=0
 Sets the cursor to the standard arrow shape.
 
virtual void set_cursor_to_hand ()=0
 Sets the cursor to the hand shape.
 
virtual void set_cursor_to_ibeam ()=0
 Sets the cursor to the I-beam shape.
 
virtual void set_cursor_to_crosshair ()=0
 Sets the cursor to the crosshair shape.
 
virtual void set_cursor_to_wait ()=0
 Sets the cursor to the wait (hourglass) shape.
 

Protected Attributes

uint64_t last_ {0}
 
double freq_ {0.0f}
 
float delta_time_ {0.0f}
 
int frame_count_ {0}
 
float fps_ {0.0f}
 
float accumulated_time_ {0.0f}
 

Detailed Description

Interface for backend system implementations handling low-level events.

Defines methods for initializing event listeners, polling events, and managing frame timing. Implementations should translate backend-specific events into engine-recognized events.

Constructor & Destructor Documentation

◆ ~IBackendSystem()

virtual IBackendSystem::~IBackendSystem ( )
virtualdefault

Member Function Documentation

◆ delta_time()

virtual float IBackendSystem::delta_time ( ) const
pure virtual

Retrieves the time elapsed since the last frame.

Returns
The delta time in seconds.

Implemented in SDLBackendSystem.

◆ frames_per_second()

virtual float IBackendSystem::frames_per_second ( ) const
pure virtual

Retrieves the frames per second (FPS) based on the updated frame time.

Returns
The current frames per second.

Implemented in SDLBackendSystem.

◆ get_clipboard_text()

virtual std::string IBackendSystem::get_clipboard_text ( )
pure virtual

Sets the current text to the system clipboard.

Parameters
textThe text to set to the clipboard.

Implemented in SDLBackendSystem.

◆ init_frame_timer()

virtual void IBackendSystem::init_frame_timer ( )
pure virtual

Initializes the internal timer for frame time calculation.

Note
This method must be called before using update_frame_time or delta_time.
Techically this keeps track of time, but it utilizes SDL's performance counter under the hood so thats why its here.

This method sets up the necessary variables to track frame time and should be called before starting the rendering loop.

Implemented in SDLBackendSystem.

◆ initialize_listeners()

virtual void IBackendSystem::initialize_listeners ( std::unordered_map< SystemEvent, std::vector< BackendCallback > > *  listeners)
pure virtual

Implemented in SDLBackendSystem.

◆ poll_events()

virtual void IBackendSystem::poll_events ( )
pure virtual

Polls for new events from the backend system.

Should invoke registered callbacks for each event type as events are received.

Implemented in SDLBackendSystem.

◆ set_cursor_to_arrow()

virtual void IBackendSystem::set_cursor_to_arrow ( )
pure virtual

Sets the cursor to the standard arrow shape.

Implemented in SDLBackendSystem.

◆ set_cursor_to_crosshair()

virtual void IBackendSystem::set_cursor_to_crosshair ( )
pure virtual

Sets the cursor to the crosshair shape.

Implemented in SDLBackendSystem.

◆ set_cursor_to_hand()

virtual void IBackendSystem::set_cursor_to_hand ( )
pure virtual

Sets the cursor to the hand shape.

Implemented in SDLBackendSystem.

◆ set_cursor_to_ibeam()

virtual void IBackendSystem::set_cursor_to_ibeam ( )
pure virtual

Sets the cursor to the I-beam shape.

Implemented in SDLBackendSystem.

◆ set_cursor_to_wait()

virtual void IBackendSystem::set_cursor_to_wait ( )
pure virtual

Sets the cursor to the wait (hourglass) shape.

Implemented in SDLBackendSystem.

◆ update_frame_time()

virtual void IBackendSystem::update_frame_time ( float  time_scale)
pure virtual

Updates the frame time based on the elapsed time since the last frame.

Parameters
time_scaleA modifier to scale the delta time, useful for implementing slow-motion or speed-up effects.

Implemented in SDLBackendSystem.

Member Data Documentation

◆ accumulated_time_

float IBackendSystem::accumulated_time_ {0.0f}
protected

◆ delta_time_

float IBackendSystem::delta_time_ {0.0f}
protected

◆ fps_

float IBackendSystem::fps_ {0.0f}
protected

◆ frame_count_

int IBackendSystem::frame_count_ {0}
protected

◆ freq_

double IBackendSystem::freq_ {0.0f}
protected

◆ last_

uint64_t IBackendSystem::last_ {0}
protected

The documentation for this class was generated from the following file: