1#ifndef OE_CORE_DEVICE_H
2#define OE_CORE_DEVICE_H
8#include "event_handler.h"
38 Device(
const glm::ivec2& dimensions,
const std::string& title,
bool is_visible =
true);
73 return _last_delta_time;
81 void setMaxFps(
const int max_fps)
83 minimum_frame_time = std::chrono::milliseconds(
static_cast<int32_t
>(1000.f / max_fps));
106 const std::vector<Window*> getWindows()
const
115 int32_t
addWindow(
const glm::ivec2& dimensions,
const std::string& title,
bool is_visible =
true);
134 const std::string
getKeyName(
const key_code_t& key)
const noexcept;
136 const std::string getScancodeName(
const key_code_t& scancode)
const noexcept;
138 key_code_t getScanCodeFromKey(
const key_code_t& key)
const noexcept;
150 double _last_time_for_delta = 0.0;
151 double _last_delta_time = 0.0;
153 std::chrono::time_point<std::chrono::steady_clock> _start_frame;
155 std::vector<Window*> _windows;
The OxygenEngine device that will manage events, windows, scene, etc...
Definition device.h:18
void processEvents()
Process device events.
std::chrono::duration< float > minimum_frame_time
Minimum time allowed for a frame.
Definition device.h:147
int32_t addWindow(const glm::ivec2 &dimensions, const std::string &title, bool is_visible=true)
Add a new window.
double getDeltaTime() const noexcept
Get delta time between this frame and the last one.
Definition device.h:71
Device(const std::string &title)
Create the device with a fullscreen window.
const std::string getKeyName(const key_code_t &key) const noexcept
bool canRun() const
Check if nothing prevented the device to close.
const Window & getWindow(const int32_t id=0) const
Get a device's registered window.
~Device()
Destroy the device.
Device()
Create a device without windows.
double getTime() const
Get time since device started.
Window & getWindow(const int32_t id=0)
Get a device's registered window.
void limitFps()
Clamp FPS to avoid rendering at too high framerates.
Device(const glm::ivec2 &dimensions, const std::string &title, bool is_visible=true)
Create the device with a window.
void setSwapInterval(const int32_t interval)
Set the device's swap interval.
Core functionality (windows, event handler, logger, ...)
Definition cursor.h:8