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);
75 return _last_delta_time;
83 void setMaxFps(
const uint32_t max_fps)
85 minimum_frame_time = std::chrono::milliseconds(
static_cast<int32_t
>(1000.f / max_fps));
108 const auto& getWindows()
const
117 size_t addWindow(
const glm::ivec2& dimensions,
const std::string& title,
bool is_visible =
true);
164 const std::string
getKeyName(
const key_code_t& key)
const noexcept;
166 const std::string getScancodeName(
const key_code_t& scancode)
const noexcept;
168 key_code_t getScanCodeFromKey(
const key_code_t& key)
const noexcept;
182 std::chrono::nanoseconds _last_delta_time = {};
184 std::chrono::time_point<std::chrono::steady_clock> _start_frame;
186 std::vector<std::pair<size_t, Window*>> _windows;
188 size_t _next_window_id = 0;
The OxygenEngine device that will manage events, windows, scene, etc...
Definition device.h:18
void processEvents()
Process device events.
Window * getWindowById(const size_t id)
Get a device's registered window.
std::chrono::duration< float > minimum_frame_time
Minimum time allowed for a frame.
Definition device.h:177
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 * getWindowById(const size_t id) const
Get a device's registered window.
~Device()
Destroy the device.
size_t addWindow(const glm::ivec2 &dimensions, const std::string &title, bool is_visible=true)
Add a new window.
Window & getWindow(const size_t id=0)
Get a device's registered window.
Definition device.h:145
std::chrono::nanoseconds getDeltaTime() const noexcept
Get delta time between this frame and the last one.
Definition device.h:73
Device()
Create a device without windows.
double getTime() const
Get time since device started.
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.
const Window & getWindow(const size_t id=0) const
Get a device's registered window.
Definition device.h:154
void setSwapInterval(const int32_t interval)
Set the device's swap interval.
void removeWindow(const size_t id)
Remove a window.
Core functionality (windows, event handler, logger, ...)
Definition cursor.h:8