Expose window flags and set fullscreen mode by default
[libs/core.git] / source / core / android / mainthread.h
1 #ifndef MSP_CORE_ANDROID_MAINTHREAD_H_
2 #define MSP_CORE_ANDROID_MAINTHREAD_H_
3
4 #include <android/native_activity.h>
5 #include <sigc++/signal.h>
6 #include <msp/fs/path.h>
7 #include "mutex.h"
8 #include "thread.h"
9
10 namespace Msp {
11 namespace Android {
12
13 class MainThread: public Thread
14 {
15 public:
16         sigc::signal<void, ANativeWindow *> signal_native_window_created;
17         sigc::signal<void, ANativeWindow *> signal_native_window_resized;
18         sigc::signal<void, ANativeWindow *> signal_native_window_destroyed;
19         sigc::signal<void, AInputQueue *> signal_input_queue_created;
20         sigc::signal<void, AInputQueue *> signal_input_queue_destroyed;
21
22 private:
23         ANativeActivity *activity;
24         AAssetManager *asset_manager;
25         FS::Path int_data_path;
26         bool starting_up;
27         Mutex startup_mutex;
28
29 public:
30         MainThread(ANativeActivity *);
31
32         void attach_to_activity(ANativeActivity *);
33         bool is_starting_up() const { return starting_up; }
34         void wait_for_app_created();
35         void resume_startup();
36
37         AAssetManager *get_asset_manager() const { return asset_manager; }
38         const FS::Path &get_internal_data_path() const { return int_data_path; }
39
40         void set_window_flags(unsigned, unsigned);
41
42 private:
43         virtual void main();
44
45         static void app_created(void *);
46         static void activity_destroyed(ANativeActivity *);
47         static void native_window_created(ANativeActivity *, ANativeWindow *);
48         static void native_window_resized(ANativeActivity *, ANativeWindow *);
49         static void native_window_destroyed(ANativeActivity *, ANativeWindow *);
50         static void input_queue_created(ANativeActivity *, AInputQueue *);
51         static void input_queue_destroyed(ANativeActivity *, AInputQueue *);
52         static void end_process(ANativeActivity *);
53 };
54
55 } // namespace Android
56 } // namespace Msp
57
58 #endif