|
QuasarEngine
Cross-platform 3D engine and editor
|
Contains all the engine code. More...
Namespaces | |
| namespace | ImGuiTheme |
| The look of the ImGui interface. | |
| namespace | Input |
| Functions that read the current state of the keyboard and the mouse, as an alternative to events. | |
Classes | |
| class | Application |
| The application: it creates the window, owns the layers and runs the main loop. More... | |
| struct | ApplicationSpecification |
| Settings used to create the application. More... | |
| class | Event |
| Base class of all events. More... | |
| class | EventDispatcher |
| Calls a handler only when an event has the type that the handler expects. More... | |
| class | EventOf |
| Base class of each event class, which gives the event its type and its categories. More... | |
| class | ImGuiLayer |
| Overlay that starts Dear ImGui with its GLFW and OpenGL backends, and wraps each frame. More... | |
| class | KeyPressedEvent |
| Sent when a key is pressed, and again at regular intervals while it is held down. More... | |
| class | KeyReleasedEvent |
| Sent when a key is released. More... | |
| class | KeyTypedEvent |
| Sent when the user types a character, for text input. More... | |
| class | Layer |
| Part of an application that is updated, rendered and receives events. More... | |
| class | LayerStack |
| Owns the layers of an application and keeps them in order, from the bottom to the top. More... | |
| class | Log |
| The loggers for the engine and the application. More... | |
| struct | LogMessage |
| A log message kept by MemoryLogSink. More... | |
| class | MemoryLogSink |
| Log sink that keeps the most recent messages in memory, so that the console can display them. More... | |
| class | MouseButtonPressedEvent |
| Sent when a mouse button is pressed. More... | |
| class | MouseButtonReleasedEvent |
| Sent when a mouse button is released. More... | |
| class | MouseMovedEvent |
| Sent when the cursor moves over the window. More... | |
| class | MouseScrolledEvent |
| Sent when the mouse wheel or the touchpad scrolls. More... | |
| class | PlatformDetection |
| Tells at compile time which platform and build type the engine is built for. More... | |
| class | ScopedTimer |
| Measures the time between its creation and the end of its scope, then logs it as an engine info message. More... | |
| class | Timer |
| High-resolution (steady) timer that measures the time elapsed since it was created or last reset. More... | |
| class | Timestep |
| Time elapsed between two frames, in seconds. More... | |
| class | UUID |
| Permanent identifier for entities, assets and any object that must keep the same identity across sessions. More... | |
| class | Window |
| Application window. More... | |
| class | WindowCloseEvent |
| Sent when the user asks to close the window, for example with the close button. More... | |
| class | WindowFocusEvent |
| Sent when the window gains or loses the keyboard focus. More... | |
| class | WindowMinimizeEvent |
| Sent when the window is minimized, or restored after being minimized. More... | |
| class | WindowResizeEvent |
| Sent when the size of the drawing area of the window changes. More... | |
| struct | WindowSpecification |
| Settings used to create a window. More... | |
Concepts | |
| concept | EventClass |
| An event class: a class derived from Event that gives its type with GetStaticType(). | |
Typedefs | |
| template<typename T> | |
| using | Scope = std::unique_ptr<T> |
| Pointer with a single owner. Alias of std::unique_ptr. | |
| template<typename T> | |
| using | Ref = std::shared_ptr<T> |
| Pointer with shared ownership: the object is destroyed with its last Ref. Alias of std::shared_ptr. | |
Enumerations | |
| enum class | Key : std::uint16_t { Space = 32 , Apostrophe = 39 , Comma = 44 , Minus = 45 , Period = 46 , Slash = 47 , Digit0 = 48 , Digit1 = 49 , Digit2 = 50 , Digit3 = 51 , Digit4 = 52 , Digit5 = 53 , Digit6 = 54 , Digit7 = 55 , Digit8 = 56 , Digit9 = 57 , Semicolon = 59 , Equal = 61 , A = 65 , B = 66 , C = 67 , D = 68 , E = 69 , F = 70 , G = 71 , H = 72 , I = 73 , J = 74 , K = 75 , L = 76 , M = 77 , N = 78 , O = 79 , P = 80 , Q = 81 , R = 82 , S = 83 , T = 84 , U = 85 , V = 86 , W = 87 , X = 88 , Y = 89 , Z = 90 , LeftBracket = 91 , Backslash = 92 , RightBracket = 93 , GraveAccent = 96 , World1 = 161 , World2 = 162 , Escape = 256 , Enter = 257 , Tab = 258 , Backspace = 259 , Insert = 260 , Delete = 261 , Right = 262 , Left = 263 , Down = 264 , Up = 265 , PageUp = 266 , PageDown = 267 , Home = 268 , End = 269 , CapsLock = 280 , ScrollLock = 281 , NumLock = 282 , PrintScreen = 283 , Pause = 284 , F1 = 290 , F2 = 291 , F3 = 292 , F4 = 293 , F5 = 294 , F6 = 295 , F7 = 296 , F8 = 297 , F9 = 298 , F10 = 299 , F11 = 300 , F12 = 301 , F13 = 302 , F14 = 303 , F15 = 304 , F16 = 305 , F17 = 306 , F18 = 307 , F19 = 308 , F20 = 309 , F21 = 310 , F22 = 311 , F23 = 312 , F24 = 313 , F25 = 314 , Keypad0 = 320 , Keypad1 = 321 , Keypad2 = 322 , Keypad3 = 323 , Keypad4 = 324 , Keypad5 = 325 , Keypad6 = 326 , Keypad7 = 327 , Keypad8 = 328 , Keypad9 = 329 , KeypadDecimal = 330 , KeypadDivide = 331 , KeypadMultiply = 332 , KeypadSubtract = 333 , KeypadAdd = 334 , KeypadEnter = 335 , KeypadEqual = 336 , LeftShift = 340 , LeftControl = 341 , LeftAlt = 342 , LeftSuper = 343 , RightShift = 344 , RightControl = 345 , RightAlt = 346 , RightSuper = 347 , Menu = 348 } |
| Physical key of the keyboard. More... | |
| enum class | LogLevel : std::uint8_t { Trace , Debug , Info , Warning , Error , Critical } |
| Severity of a log message. More... | |
| enum class | MouseButton : std::uint8_t { Left = 0 , Right = 1 , Middle = 2 , Button3 = 3 , Button4 = 4 , Button5 = 5 , Button6 = 6 , Button7 = 7 } |
| Button of the mouse. More... | |
| enum class | EventType : std::uint8_t { WindowClose , WindowResize , WindowFocus , WindowMinimize , KeyPressed , KeyReleased , KeyTyped , MouseButtonPressed , MouseButtonReleased , MouseMoved , MouseScrolled } |
| Type of an event. Each event class has exactly one type. More... | |
| enum class | EventCategory : std::uint8_t { None = 0 , Window = Bit(0) , Input = Bit(1) , Keyboard = Bit(2) , Mouse = Bit(3) } |
| Categories of an event. An event can belong to several categories, combined with the | operator. More... | |
Functions | |
| template<typename T, typename... Args> | |
| Scope< T > | CreateScope (Args &&... args) |
| Creates an object owned by a Scope. Same as std::make_unique. | |
| template<typename T, typename... Args> | |
| Ref< T > | CreateRef (Args &&... args) |
| Creates an object owned by a Ref. Same as std::make_shared. | |
| constexpr std::uint32_t | Bit (std::uint32_t index) |
| Returns a value where only the bit at the given index is set, for example Bit(3) is 8. | |
| Scope< Application > | CreateApplication (std::vector< std::string > arguments) |
| Creates the application of the program. | |
| std::string | format_as (UUID uuid) |
| Lets the log macros print a UUID with {}, using UUID::ToString(). | |
| constexpr EventCategory | operator| (EventCategory left, EventCategory right) |
| Combines two sets of categories. | |
| constexpr EventCategory | operator& (EventCategory left, EventCategory right) |
| Keeps only the categories found in both sets. | |
| constexpr const char * | GetEventTypeName (EventType type) |
| Returns the name of an event type, for example "KeyPressed". | |
| std::string | format_as (const Event &event) |
| Lets the log macros print an event with {}, using Event::ToString(). | |
| std::optional< std::string > | ReadTextFile (const std::filesystem::path &path) |
| Reads a whole text file. | |
| std::optional< std::vector< std::byte > > | ReadBinaryFile (const std::filesystem::path &path) |
| Reads a whole binary file, byte for byte. | |
| bool | WriteTextFile (const std::filesystem::path &path, std::string_view text) |
| Writes a whole text file, replacing its content if it already exists. | |
| bool | WriteBinaryFile (const std::filesystem::path &path, std::span< const std::byte > data) |
| Writes a whole binary file, byte for byte, replacing its content if it already exists. | |
| bool | CreateDirectories (const std::filesystem::path &path) |
| Creates a directory and its missing parents. | |
| std::string | NormalizePath (const std::filesystem::path &path) |
| Converts a path to the form stored in engine files, the same on every platform. | |
| std::optional< std::string > | MakeRelativePath (const std::filesystem::path &path, const std::filesystem::path &root) |
| Makes a path relative to a root folder, in the form stored in engine files. | |
| std::optional< std::filesystem::path > | GetUserConfigDirectory () |
| Returns the folder where the engine stores the settings of the current user, such as the list of recent projects. | |
| const char * | GetVersionString () |
| Returns the version of the Quasar engine as a string. | |
Contains all the engine code.
|
strong |
Physical key of the keyboard.
A key code identifies the position of a key on the keyboard, not the character printed on it. The names follow the US QWERTY layout: Key::W is the key at the position of W on a QWERTY keyboard, which is Z on a French AZERTY keyboard. Movement bound to W, A, S and D is therefore at the same place on every layout. On AZERTY, the digits of the top row are typed with Shift, but their key codes do not change.
The values are the same as the GLFW key tokens, so a GLFW key converts with static_cast<Key>(key). GLFW reports the keys it does not know as GLFW_KEY_UNKNOWN (-1), which has no Key value: ignore them.
| Enumerator | |
|---|---|
| Space | Space bar. |
| Apostrophe | Apostrophe key on QWERTY. |
| Comma | Comma key on QWERTY, semicolon on AZERTY. |
| Minus | Minus key on QWERTY, closing parenthesis on AZERTY. |
| Period | Period key on QWERTY, colon on AZERTY. |
| Slash | Slash key on QWERTY, exclamation mark on AZERTY. |
| Digit0 | 0 key of the top row. |
| Digit1 | 1 key of the top row. |
| Digit2 | 2 key of the top row. |
| Digit3 | 3 key of the top row. |
| Digit4 | 4 key of the top row. |
| Digit5 | 5 key of the top row. |
| Digit6 | 6 key of the top row. |
| Digit7 | 7 key of the top row. |
| Digit8 | 8 key of the top row. |
| Digit9 | 9 key of the top row. |
| Semicolon | Semicolon key on QWERTY, M on AZERTY. |
| Equal | Equal key. |
| A | A key on QWERTY, Q on AZERTY. |
| B | B key. |
| C | C key. |
| D | D key. |
| E | E key. |
| F | F key. |
| G | G key. |
| H | H key. |
| I | I key. |
| J | J key. |
| K | K key. |
| L | L key. |
| M | M key on QWERTY, comma on AZERTY. |
| N | N key. |
| O | O key. |
| P | P key. |
| Q | Q key on QWERTY, A on AZERTY. |
| R | R key. |
| S | S key. |
| T | T key. |
| U | U key. |
| V | V key. |
| W | W key on QWERTY, Z on AZERTY. |
| X | X key. |
| Y | Y key. |
| Z | Z key on QWERTY, W on AZERTY. |
| LeftBracket | Left bracket key on QWERTY, circumflex accent on AZERTY. |
| Backslash | Backslash key on QWERTY, asterisk on AZERTY. |
| RightBracket | Right bracket key on QWERTY, dollar sign on AZERTY. |
| GraveAccent | Key on the left of 1 in the top row. |
| World1 | Extra key found on some non-US keyboards. |
| World2 | Extra key found on some non-US keyboards. |
| Escape | Escape key. |
| Enter | Enter key of the main keyboard. |
| Tab | Tab key. |
| Backspace | Backspace key. |
| Insert | Insert key. |
| Delete | Delete key. |
| Right | Right arrow key. |
| Left | Left arrow key. |
| Down | Down arrow key. |
| Up | Up arrow key. |
| PageUp | Page Up key. |
| PageDown | Page Down key. |
| Home | Home key. |
| End | End key. |
| CapsLock | Caps Lock key. |
| ScrollLock | Scroll Lock key. |
| NumLock | Num Lock key. |
| PrintScreen | Print Screen key. |
| Pause | Pause key. |
| F1 | F1 key. |
| F2 | F2 key. |
| F3 | F3 key. |
| F4 | F4 key. |
| F5 | F5 key. |
| F6 | F6 key. |
| F7 | F7 key. |
| F8 | F8 key. |
| F9 | F9 key. |
| F10 | F10 key. |
| F11 | F11 key. |
| F12 | F12 key. |
| F13 | F13 key. |
| F14 | F14 key. |
| F15 | F15 key. |
| F16 | F16 key. |
| F17 | F17 key. |
| F18 | F18 key. |
| F19 | F19 key. |
| F20 | F20 key. |
| F21 | F21 key. |
| F22 | F22 key. |
| F23 | F23 key. |
| F24 | F24 key. |
| F25 | F25 key. |
| Keypad0 | 0 key of the numeric keypad. |
| Keypad1 | 1 key of the numeric keypad. |
| Keypad2 | 2 key of the numeric keypad. |
| Keypad3 | 3 key of the numeric keypad. |
| Keypad4 | 4 key of the numeric keypad. |
| Keypad5 | 5 key of the numeric keypad. |
| Keypad6 | 6 key of the numeric keypad. |
| Keypad7 | 7 key of the numeric keypad. |
| Keypad8 | 8 key of the numeric keypad. |
| Keypad9 | 9 key of the numeric keypad. |
| KeypadDecimal | Decimal point key of the numeric keypad. |
| KeypadDivide | Divide key of the numeric keypad. |
| KeypadMultiply | Multiply key of the numeric keypad. |
| KeypadSubtract | Subtract key of the numeric keypad. |
| KeypadAdd | Add key of the numeric keypad. |
| KeypadEnter | Enter key of the numeric keypad. |
| KeypadEqual | Equal key of the numeric keypad. |
| LeftShift | Left Shift key. |
| LeftControl | Left Control key. |
| LeftAlt | Left Alt key. |
| LeftSuper | Left Windows key, or left Super key on Linux. |
| RightShift | Right Shift key. |
| RightControl | Right Control key. |
| RightAlt | Right Alt key, which is Alt Gr on AZERTY. |
| RightSuper | Right Windows key, or right Super key on Linux. |
| Menu | Menu key, next to the right Windows key. |
|
strong |
Severity of a log message.
|
strong |
Button of the mouse.
The values are the same as the GLFW mouse button tokens, so a GLFW button converts with static_cast<MouseButton>(button).
|
strong |
Type of an event. Each event class has exactly one type.
|
strong |
|
constexpr |
Returns a value where only the bit at the given index is set, for example Bit(3) is 8.
It is used to build flags that are combined with the | operator. An index of 32 or more is checked by an assertion, and does not compile when the value is computed at compile time.
| index | Index of the bit to set, from 0 to 31. |
| Scope< Application > Quasar::CreateApplication | ( | std::vector< std::string > | arguments | ) |
Creates the application of the program.
Each program built on the engine defines this function.
The engine defines main() in the Quasar::EntryPoint library, which the program links to. main() starts the logging, calls this function, runs the application, destroys it, then stops the logging. The program never defines main() itself:
| arguments | The command-line arguments, without the name of the program. |
| std::optional< std::string > Quasar::ReadTextFile | ( | const std::filesystem::path & | path | ) |
Reads a whole text file.
The content is returned exactly as stored, so line endings are the same on every platform. A UTF-8 byte order mark at the start of the file is removed. An empty file gives an empty string.
| path | Path of the file to read. |
| std::optional< std::vector< std::byte > > Quasar::ReadBinaryFile | ( | const std::filesystem::path & | path | ) |
Reads a whole binary file, byte for byte.
An empty file gives an empty vector.
| path | Path of the file to read. |
| bool Quasar::WriteTextFile | ( | const std::filesystem::path & | path, |
| std::string_view | text ) |
Writes a whole text file, replacing its content if it already exists.
The text is written exactly as given, so line endings are the same on every platform. The missing parent directories are created.
| path | Path of the file to write. |
| text | Content of the file. |
| bool Quasar::WriteBinaryFile | ( | const std::filesystem::path & | path, |
| std::span< const std::byte > | data ) |
Writes a whole binary file, byte for byte, replacing its content if it already exists.
The missing parent directories are created.
| path | Path of the file to write. |
| data | Content of the file. |
| bool Quasar::CreateDirectories | ( | const std::filesystem::path & | path | ) |
Creates a directory and its missing parents.
| path | Path of the directory to create. |
| std::string Quasar::NormalizePath | ( | const std::filesystem::path & | path | ) |
Converts a path to the form stored in engine files, the same on every platform.
Both / and \\endiskip are read as separators and the result always uses /. Redundant parts are removed: ., .. after a directory name, repeated separators and the separator at the end.
The case of the letters is kept: on Linux, Assets and assets are different directories.
| path | The path to convert. It is not read from the disk, so the file does not need to exist. |
| std::optional< std::string > Quasar::MakeRelativePath | ( | const std::filesystem::path & | path, |
| const std::filesystem::path & | root ) |
Makes a path relative to a root folder, in the form stored in engine files.
Relative paths are first made absolute from the current directory. The paths are not read from the disk. Nothing is logged when the path is outside the root: the caller knows what the path is for, so it can report a clearer error.
| path | The path to convert, for example C:/Projects/Game/Assets/cube.obj. |
| root | The root folder, for example C:/Projects/Game. |
| std::optional< std::filesystem::path > Quasar::GetUserConfigDirectory | ( | ) |
Returns the folder where the engine stores the settings of the current user, such as the list of recent projects.
The folder is created if it does not exist yet.
The folder is named QuasarEngine and is placed in the folder that the system gives for application settings:
| const char * Quasar::GetVersionString | ( | ) |
Returns the version of the Quasar engine as a string.