Avara3D 0.2.0
C++ API reference
GLFWInputContext.h
1//
2// GLFWInputContext.h
3// avara3d
4//
5// Created by Morgan Davis on 4/16/2024.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_INPUT_GLFWINPUTCONTEXT_H
10#define AVARA3D_INPUT_GLFWINPUTCONTEXT_H
11
12#include <memory>
13#include <set>
14
15#include "a3d/input/DesktopInputContext.h"
16
17struct GLFWwindow;
18
19namespace a3d {
20
21 class Window;
22
23 class GLFWInputContext : public DesktopInputContext {
24
25 public:
26 // [Internal Lifecycle Functions]
27
28 GLFWInputContext();
29 ~GLFWInputContext() override;
30
31 GLFWInputContext(const InputContext& other) = delete;
32 GLFWInputContext& operator=(const InputContext& other) = delete;
33
34 // [InputContext Internal Member Functions]
35
36 void attachedToScene(Scene& scene) override;
37 void visualWorldAttachedToScene(Scene& scene) override;
38
39 // [DesktopInputContext Internal Member Functions]
40
41 void rebaseMouseMotion() override;
42
43 // [Internal Member Functions]
44
45 void glfwCursorPositionEvent(double xPos, double yPos);
46 void glfwMouseButtonEvent(int button, int action, int mods);
47 void glfwScrollEvent(double xOffset, double yOffset);
48 void glfwKeyEvent(int key, int scanCode, int action, int mods);
49
50 void detachedFromWindow(Window& window);
51
52 private:
53 // [Private Member Functions]
54
55 void window(Window* window);
56 Window* window() const;
57
58 void initMouseInput();
59
60 // [Private Member Variables]
61
62 Window* _window;
63 bool _hasMousePosition;
64 };
65
66}
67
68#endif // AVARA3D_INPUT_GLFWINPUTCONTEXT_H