opuntiaOS - an operating system targeting x86 and ARMv7
at master 833 B view raw
1#include <iostream> 2#include <libfoundation/ProcessInfo.h> 3#include <libui/App.h> 4#include <libui/AppDelegate.h> 5#include <libui/View.h> 6#include <libui/Window.h> 7#include <memory> 8 9extern "C" bool __init_app_delegate(UI::AppDelegate** res); 10 11// Libs are compiled with -ffreestanding and LLVM mangles 12// main() with this flag. Have to mark it as extern "C". 13extern "C" int main(int argc, char** argv) 14{ 15 auto process_info = LFoundation::ProcessInfo(argc, argv); 16 auto& app = std::opuntiaos::construct<UI::App>(); 17 UI::AppDelegate* app_delegate = nullptr; 18 int res = __init_app_delegate(&app_delegate); 19 if (res < 0) { 20 return res; 21 } 22 23 app.set_delegate(app_delegate); 24 app.set_state(UI::AppState::Active); 25 int status = app.run(); 26 app_delegate->application_will_terminate(); 27 return status; 28}