|
13 | 13 | #define LCUI_INCLUDE_LCUI_APP_H
|
14 | 14 |
|
15 | 15 | #include "common.h"
|
16 |
| -#include <ptk.h> |
17 |
| -#include <worker.h> |
18 |
| - |
19 |
| -#define LCUI_MAX_FRAMES_PER_SEC 120 |
20 |
| -#define LCUI_MAX_FRAME_MSEC ((int)(1000.0 / LCUI_MAX_FRAMES_PER_SEC + 0.5)) |
| 16 | +#include <ptk/types.h> |
21 | 17 |
|
22 | 18 | LCUI_BEGIN_HEADER
|
23 | 19 |
|
24 |
| -// Settings |
25 |
| - |
26 |
| -typedef struct lcui_settings { |
27 |
| - int frame_rate_cap; |
28 |
| - int parallel_rendering_threads; |
29 |
| - bool paint_flashing; |
30 |
| -} lcui_settings_t; |
31 |
| - |
32 |
| -/* Initialize settings with the current global settings. */ |
33 |
| -LCUI_API void lcui_get_settings(lcui_settings_t *settings); |
34 |
| - |
35 |
| -/* Update global settings with the given input. */ |
36 |
| -LCUI_API void lcui_apply_settings(lcui_settings_t *settings); |
37 |
| - |
38 |
| -/* Reset global settings to their defaults. */ |
39 |
| -LCUI_API void lcui_reset_settings(void); |
40 |
| - |
41 |
| -// Tasks |
42 |
| - |
43 |
| -LCUI_API worker_task_t *lcui_post_task(void *data, worker_task_cb task_cb, |
44 |
| - worker_task_cb after_task_cb); |
45 |
| -LCUI_API worker_task_t *lcui_post_async_task(void *data, worker_task_cb task_cb, |
46 |
| - worker_task_cb after_task_cb); |
47 |
| - |
48 |
| -bool lcui_cancel_async_task(worker_task_t *task); |
49 |
| -bool lcui_cancel_task(worker_task_t *task); |
50 |
| - |
51 |
| -// UI |
52 |
| - |
53 |
| -typedef enum lcui_display_mode_t { |
54 |
| - LCUI_DISPLAY_MODE_DEFAULT, |
55 |
| - LCUI_DISPLAY_MODE_WINDOWED, |
56 |
| - LCUI_DISPLAY_MODE_FULLSCREEN, |
57 |
| - LCUI_DISPLAY_MODE_SEAMLESS, |
58 |
| -} lcui_display_mode_t; |
59 |
| - |
60 |
| -LCUI_API void lcui_init_ui(void); |
61 |
| -LCUI_API void lcui_destroy_ui(void); |
62 |
| -LCUI_API void lcui_update_ui(void); |
63 |
| -LCUI_API size_t lcui_render_ui(void); |
64 |
| -LCUI_API void lcui_preset_ui(void); |
65 |
| -LCUI_API void lcui_dispatch_ui_event(ptk_event_t *app_event); |
66 |
| -LCUI_API void lcui_set_ui_display_mode(lcui_display_mode_t mode); |
67 |
| - |
68 |
| -// Event |
69 |
| - |
70 |
| -LCUI_API int lcui_get_event(ptk_event_t *e); |
71 |
| -LCUI_API int lcui_process_event(ptk_event_t *e); |
72 |
| -LCUI_API int lcui_process_events(ptk_process_events_option_t option); |
73 |
| - |
74 |
| -INLINE int lcui_process_all_events(void) |
75 |
| -{ |
76 |
| - return lcui_process_events(PTK_PROCESS_EVENTS_ALL_IF_PRESENT); |
77 |
| -} |
78 |
| - |
79 |
| -// Base |
80 |
| - |
81 |
| -LCUI_API uint32_t lcui_get_fps(void); |
82 |
| - |
83 |
| -LCUI_API void lcui_set_frame_rate_cap(unsigned rate_cap); |
84 |
| - |
85 |
| -LCUI_API void lcui_init_app(void); |
86 |
| -LCUI_API void lcui_destroy_app(void); |
87 |
| - |
88 |
| -/** 初始化 LCUI 各项功能 */ |
89 |
| -LCUI_API void lcui_init(void); |
90 |
| - |
91 |
| -LCUI_API int lcui_main(void); |
92 |
| - |
93 |
| -LCUI_API int lcui_run(void); |
94 |
| - |
95 |
| -/** 获取LCUI的版本 */ |
96 |
| -LCUI_API const char *lcui_get_version(void); |
97 |
| - |
98 |
| -/** 释放LCUI占用的资源 */ |
99 |
| -LCUI_API void lcui_destroy(void); |
100 |
| - |
101 |
| -/** 退出LCUI,释放LCUI占用的资源 */ |
102 |
| -LCUI_API void lcui_quit(void); |
103 |
| - |
104 |
| -/** 退出 LCUI,并设置退出码 */ |
105 |
| -LCUI_API void lcui_exit(int code); |
| 20 | +LCUI_API uint32_t lcui_app_get_fps(void); |
| 21 | +LCUI_API void lcui_app_set_frame_rate_cap(unsigned rate_cap); |
| 22 | +LCUI_API int lcui_app_process_events(ptk_process_events_option_t option); |
| 23 | +LCUI_API void lcui_app_init(void); |
| 24 | +LCUI_API void lcui_app_destroy(void); |
106 | 25 |
|
107 | 26 | LCUI_END_HEADER
|
108 | 27 |
|
|
0 commit comments