|
1 | 1 | #pragma once |
2 | 2 |
|
| 3 | +#include <android/asset_manager.h> |
| 4 | +#include <android/configuration.h> |
3 | 5 | #include <android/native_activity.h> |
| 6 | +#include <android/window.h> |
| 7 | +#include <nitki/queue.hpp> |
| 8 | +#include <utki/debug.hpp> |
4 | 9 |
|
5 | 10 | #include "../../application.hpp" |
6 | 11 |
|
| 12 | +#include "java_functions.hxx" |
| 13 | + |
7 | 14 | namespace { |
8 | 15 | struct android_globals_wrapper final { |
9 | | - static ANativeActivity* native_activity = nullptr; |
| 16 | + static ANativeActivity* native_activity = nullptr; |
| 17 | + |
| 18 | + static void create(ANativeActivity* native_activity); |
| 19 | + static void destroy(); |
10 | 20 |
|
11 | | - // static void android_globals_wrapper:: |
| 21 | + static android_globals_wrapper& get() |
| 22 | + { |
| 23 | + utki::assert(native_activity, SL); |
| 24 | + utki::assert(native_activity->instance, SL); |
| 25 | + return |
| 26 | + } |
12 | 27 |
|
13 | | - static android_globals_wrapper& get(){ |
14 | | - utki::assert(native_activity, SL); |
15 | | - utki::assert(native_activity->instance, SL); |
16 | | - } |
| 28 | + java_functions_wrapper java_functions; |
| 29 | + |
| 30 | + nitki::queue ui_queue; |
17 | 31 |
|
18 | 32 | std::unique_ptr<ruisapp::application> app; |
| 33 | + |
| 34 | + ANativeWindow* android_window = nullptr; |
19 | 35 | }; |
20 | 36 | } // namespace |
| 37 | + |
| 38 | +namespace { |
| 39 | +inline android_globals_wrapper& get_glob() |
| 40 | +{ |
| 41 | + auto na = android_globals_wrapper::native_activity; |
| 42 | + utki::assert(na, SL); |
| 43 | + utki::assert(na->instance, SL); |
| 44 | + return *static_cast<android_globals_wrapper*>(na->instance); |
| 45 | +} |
| 46 | +} // namespace |
0 commit comments