vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
host_chrome.h
1#pragma once
2
3#include <cstdint>
4
5namespace Vkm::Engine {
6
7class WindowManager;
8
18class HostChrome {
19 public:
23 struct ViewportRect {
24 uint32_t x = 0;
25 uint32_t y = 0;
26 uint32_t width = 0;
27 uint32_t height = 0;
28 };
29
30 public:
31 HostChrome() = default;
32 ~HostChrome() = default;
33
34 HostChrome(const HostChrome& other) = default;
35 HostChrome& operator=(const HostChrome& other) = default;
36
37 HostChrome(HostChrome && other) = default;
38 HostChrome& operator=(HostChrome && other) = default;
39
40 public:
50 void setViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
51 m_viewport = ViewportRect{x, y, width, height};
52 }
53
60 ViewportRect viewport(const WindowManager& window) const;
61
73 void setCapture(bool pointer, bool keyboard) {
74 m_capturePointer = pointer;
75 m_captureKeyboard = keyboard;
76 }
77
83 bool capturesPointer() const { return m_capturePointer; }
84
90 bool capturesKeyboard() const { return m_captureKeyboard; }
91
92 private:
93 ViewportRect m_viewport;
94 bool m_capturePointer = false;
95 bool m_captureKeyboard = false;
96};
97
98} // namespace Vkm::Engine
bool capturesKeyboard() const
Whether the host's UI owns the keyboard this frame.
Definition host_chrome.h:90
void setCapture(bool pointer, bool keyboard)
Declare that the host's own UI, not the scene, has the devices.
Definition host_chrome.h:73
bool capturesPointer() const
Whether the host's UI owns the pointer this frame.
Definition host_chrome.h:83
void setViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
Declare the rect inside the window the 3D scene renders into.
Definition host_chrome.h:50
ViewportRect viewport(const WindowManager &window) const
The declared rect, resolved against the window it sits in.
Owns the application's window, GL context, input, and frame limiting.
Definition window_manager.h:61
A rect in framebuffer pixels: the unit glViewport takes.
Definition host_chrome.h:23