Skip to content

Commit

Permalink
Add App custom gameloop support (e.g. App::setup_main_loop, App::do_m…
Browse files Browse the repository at this point in the history
…ain_loop_step, App::teardown_main_loop)
  • Loading branch information
adamkewley committed Jul 4, 2024
1 parent 9cb56f8 commit e61dad1
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 171 deletions.
5 changes: 4 additions & 1 deletion apps/hellotriangle/hellotriangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ namespace
int main(int, char**)
{
osc::App app;
app.show<HelloTriangleScreen>();
app.setup_main_loop<HelloTriangleScreen>();
ScopeGuard guard{[&app](){ app.teardown_main_loop(); }};
while (app.do_main_loop_step()) {
}
return 0;
}
3 changes: 2 additions & 1 deletion src/oscar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ add_library(oscar STATIC
Platform/App.cpp
Platform/App.h
Platform/AppClock.h
Platform/AppMainLoopStatus.h
Platform/AppMetadata.cpp
Platform/AppMetadata.h
Platform/AppSettings.cpp
Expand Down Expand Up @@ -426,7 +427,7 @@ add_library(oscar STATIC
UI.h
Utils.h
Variant.h
)
)

target_include_directories(oscar PUBLIC

Expand Down
1 change: 1 addition & 0 deletions src/oscar/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <oscar/Platform/App.h>
#include <oscar/Platform/AppClock.h>
#include <oscar/Platform/AppMainLoopStatus.h>
#include <oscar/Platform/AppMetadata.h>
#include <oscar/Platform/AppSettings.h>
#include <oscar/Platform/FilesystemResourceLoader.h>
Expand Down
Loading

0 comments on commit e61dad1

Please sign in to comment.