44 * SPDX-License-Identifier: MIT
55 */
66#include " app.h"
7- #include " hal/hal.h"
87#include " apps/app_installer.h"
8+ #include " hal/hal.h"
99#include < mooncake.h>
1010#include < mooncake_log.h>
1111#include < string>
@@ -19,57 +19,51 @@ using namespace mooncake;
1919
2020static const std::string _tag = " app" ;
2121
22- void app::Init (InitCallback_t callback)
23- {
24- mclog::tagInfo (_tag, " init" );
22+ void app::Init (InitCallback_t callback) {
23+ mclog::tagInfo (_tag, " init" );
2524
26- mclog::tagInfo (_tag, " hal injection" );
27- if (callback.onHalInjection ) {
28- callback.onHalInjection ();
29- }
25+ mclog::tagInfo (_tag, " hal injection" );
26+ if (callback.onHalInjection ) {
27+ callback.onHalInjection ();
28+ }
3029
31- GetMooncake ();
30+ GetMooncake ();
3231
33- on_startup_anim ();
34- on_install_apps ();
32+ on_startup_anim ();
33+ on_install_apps ();
3534}
3635
37- void app::Update ()
38- {
39- GetMooncake ().update ();
36+ void app::Update () {
37+ GetMooncake ().update ();
4038
4139#if defined(PLATFORM_BUILD_DESKTOP)
42- // Handle SDL events on desktop platform
43- SDL_Event event;
44- while (SDL_PollEvent (&event)) {
45- // SDL events are handled by LVGL SDL driver automatically
46- // We just need to poll them
47- if (event.type == SDL_QUIT ) {
48- // Handle window close event if needed
49- }
40+ // Handle SDL events on desktop platform
41+ SDL_Event event;
42+ while (SDL_PollEvent (&event)) {
43+ // SDL events are handled by LVGL SDL driver automatically
44+ // We just need to poll them
45+ if (event.type == SDL_QUIT ) {
46+ // Handle window close event if needed
5047 }
51-
48+ }
49+
5250#if defined(_WIN32) || defined(WIN32)
53- // Windows-specific: Add small delay to prevent high CPU usage
54- // LVGL timer handler runs in separate thread on Windows
55- SDL_Delay (5 );
51+ // Windows-specific: Add small delay to prevent high CPU usage
52+ // LVGL timer handler runs in separate thread on Windows
53+ SDL_Delay (5 );
5654#endif
5755#endif
5856
5957#if defined(__APPLE__) && defined(__MACH__)
60- // 'nextEventMatchingMask should only be called from the Main Thread!'
61- auto time_till_next = lv_timer_handler ();
62- std::this_thread::sleep_for (std::chrono::milliseconds (time_till_next));
58+ // 'nextEventMatchingMask should only be called from the Main Thread!'
59+ auto time_till_next = lv_timer_handler ();
60+ std::this_thread::sleep_for (std::chrono::milliseconds (time_till_next));
6361#endif
6462}
6563
66- bool app::IsDone ()
67- {
68- return false ;
69- }
64+ bool app::IsDone () { return false ; }
7065
71- void app::Destroy ()
72- {
73- DestroyMooncake ();
74- hal::Destroy ();
66+ void app::Destroy () {
67+ DestroyMooncake ();
68+ hal::Destroy ();
7569}
0 commit comments