apps: Use os::Timer instead of os::EventLoop::register_timer
This commit is contained in:
parent
a9c339939a
commit
7f6863c093
@ -1,3 +1,4 @@
|
||||
#include <os/Timer.h>
|
||||
#include <time.h>
|
||||
#include <ui/App.h>
|
||||
#include <ui/Label.h>
|
||||
@ -14,8 +15,6 @@ void update_time()
|
||||
|
||||
g_label->set_text(StringView { buf });
|
||||
|
||||
os::EventLoop::the().register_timer(1000, update_time);
|
||||
|
||||
ui::App::the().main_window()->draw();
|
||||
}
|
||||
|
||||
@ -38,5 +37,7 @@ Result<int> luna_main(int argc, char** argv)
|
||||
|
||||
update_time();
|
||||
|
||||
auto timer = TRY(os::Timer::create_repeating(1000, update_time));
|
||||
|
||||
return app.run();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <luna/Heap.h>
|
||||
#include <os/ArgumentParser.h>
|
||||
#include <os/Timer.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
@ -105,7 +106,6 @@ static void update()
|
||||
{
|
||||
next_generation();
|
||||
draw_cells();
|
||||
os::EventLoop::the().register_timer(100, update);
|
||||
}
|
||||
|
||||
Result<int> luna_main(int argc, char** argv)
|
||||
@ -119,7 +119,9 @@ Result<int> luna_main(int argc, char** argv)
|
||||
|
||||
TRY(fill_cells());
|
||||
|
||||
os::EventLoop::the().register_timer(100, update);
|
||||
update();
|
||||
|
||||
auto timer = TRY(os::Timer::create_repeating(100, update));
|
||||
|
||||
return app.run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user