Dodo
0.1
Template for CPP projects
Loading...
Searching...
No Matches
include
dodo
core
App.hpp
Go to the documentation of this file.
1
//
2
// Created by nicol on 19/02/2026.
3
//
4
5
#ifndef DODO_CORE_HPP
6
#define DODO_CORE_HPP
7
8
#include <expected>
9
#include <format>
10
#include <string>
11
#include <utility>
12
13
#include "
DodoContext.hpp
"
14
#include "
GLFW/glfw3.h
"
15
16
namespace
dodo::core
{
17
18
class
App
{
19
private
:
20
GLFWwindow
*
_window
=
nullptr
;
21
public
:
22
struct
AppInfo
{
23
size_t
width
;
24
size_t
height
;
25
std::string
title
;
26
GLFWmonitor
*
monitor
=
nullptr
;
27
};
28
29
~App
();
30
31
App
(
const
App
&other) =
delete
;
32
33
App
&
operator=
(
const
App
&other) =
delete
;
34
35
App
(
App
&& other)
noexcept
;
36
37
App
&
operator=
(
App
&& other)
noexcept
;
38
39
static
auto
createApp
(
const
DodoContext
&ctx,
const
AppInfo
&appInfo) -> std::expected<App, std::string>;
40
41
bool
isRunning
()
const
{
return
!
glfwWindowShouldClose
(
_window
); };
42
43
void
pollEvents
()
const
{
glfwPollEvents
(); };
44
private
:
45
App
() =
default
;
46
47
auto
createGLFWWindow
(
const
AppInfo
&appInfo) -> std::expected<bool, std::string>;
48
};
49
50
};
51
52
#endif
// DODO_CORE_HPP
DodoContext.hpp
dodo::core::App
Definition
App.hpp:18
dodo::core::App::App
App()=default
dodo::core::App::operator=
App & operator=(const App &other)=delete
dodo::core::App::isRunning
bool isRunning() const
Definition
App.hpp:41
dodo::core::App::~App
~App()
Definition
App.cpp:38
dodo::core::App::App
App(const App &other)=delete
dodo::core::App::createApp
static auto createApp(const DodoContext &ctx, const AppInfo &appInfo) -> std::expected< App, std::string >
Definition
App.cpp:9
dodo::core::App::pollEvents
void pollEvents() const
Definition
App.hpp:43
dodo::core::App::createGLFWWindow
auto createGLFWWindow(const AppInfo &appInfo) -> std::expected< bool, std::string >
Definition
App.cpp:16
dodo::core::App::_window
GLFWwindow * _window
Definition
App.hpp:20
dodo::core::DodoContext
Definition
DodoContext.hpp:15
glfw3.h
The header of the GLFW 3 API.
GLFWmonitor
struct GLFWmonitor GLFWmonitor
Opaque monitor object.
Definition
glfw3.h:1391
GLFWwindow
struct GLFWwindow GLFWwindow
Opaque window object.
Definition
glfw3.h:1403
glfwPollEvents
GLFWAPI void glfwPollEvents(void)
Processes all pending events.
glfwWindowShouldClose
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.
dodo::core
Definition
App.cpp:7
dodo::core::App::AppInfo
Definition
App.hpp:22
dodo::core::App::AppInfo::monitor
GLFWmonitor * monitor
Definition
App.hpp:26
dodo::core::App::AppInfo::width
size_t width
Definition
App.hpp:23
dodo::core::App::AppInfo::height
size_t height
Definition
App.hpp:24
dodo::core::App::AppInfo::title
std::string title
Definition
App.hpp:25
Generated by
1.12.0