Lugdunum  0.1.0
WindowImplAndroid.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <lug/Math/Vector.hpp>
4 #include <lug/Window/Window.hpp>
5 #include <android/input.h>
6 #include <android/native_window.h>
7 #include <android/native_activity.h>
8 #include "gestureDetector.hpp"
10 
11 namespace lug {
12 namespace Window {
13 namespace priv {
14 
16 public:
18  ~WindowImpl() = default;
19 
20  bool init(const Window::InitInfo& initInfo);
21  void close();
22  bool pollEvent(lug::Window::Event& event);
23  void setKeyRepeat(bool state);
24  void setMouseCursorVisible(bool visible);
25  void setMousePos(const Math::Vec2i& mousePosition);
26 
27  ANativeWindow* getWindow();
28 
29  LUG_WINDOW_API static std::queue<lug::Window::Event> events;
30  LUG_WINDOW_API static AInputQueue* inputQueue;
31  LUG_WINDOW_API static ANativeWindow* nativeWindow;
32  LUG_WINDOW_API static ANativeActivity* activity;
33  LUG_WINDOW_API static std::mutex androidMutex;
34  LUG_WINDOW_API static std::condition_variable cv;
35 
36 private:
37  float MapCenteredAxis(AInputEvent* event, int32_t axis);
38  int32_t HandleInput(lug::Window::Event& event, AInputEvent* androidEvent);
39 
40  Window* _parent{nullptr};
41 
45 };
46 
47 } // namespace priv
48 } // namespace Window
49 } // namespace lug
Represents an event.
Definition: Event.hpp:89
ndk_helper::DoubletapDetector doubletap_detector_
static ANativeWindow * nativeWindow
Class for window.
Definition: Window.hpp:59
ndk_helper::DragDetector drag_detector_
static std::queue< lug::Window::Event > events
static ANativeActivity * activity
#define LUG_WINDOW_API
Definition: Export.hpp:11
void close(Handle handle)
Definition: Library.inl:48
ndk_helper::PinchDetector pinch_detector_
static std::condition_variable cv