AUI_ENTRY#
Application entry point.
| Header: | #include <AUI/Platform/Entry.h> |
| CMake: | aui_link(my_target PUBLIC aui::core) |
Definition#
#define AUI_ENTRY \
AUI_EXPORT int aui_entry(const AStringVector& args); \
AUI_EXPORT int aui_main(int argc, char** argv, int(*aui_entry)(const AStringVector&)); \
[[maybe_unused]] static int _fake_aui_entry(const AStringVector& args)
Detailed Description#
Entry point of any AUI application.
Native entry point varies platform to platform (i.e. Windows requires int main entry point for console applications
and WinMain for graphical applications; entry point of an Android application is located in Java code). AUI_ENTRY
unifies your entry point, effectively supporting every platform.
AUI_ENTRY of a graphical application should be non-blocking since on mobile platforms application's event loop is
located outsize of the entry point. On desktop platforms, an event loop is created outside AUI_ENTRY in order to
unify the mobile and desktop behaviour. The event loop runs as long as the application is held (by open windows or
by AApplication::hold()), then the application exits with the exit code returned by AUI_ENTRY earlier (or the one
passed to AApplication::quit()). If nothing holds the application, it exits right after AUI_ENTRY returns, so
AUI_ENTRY is perfectly fine for CLI applications, even if they link to aui::views.
AUI_ENTRY is called every time the application's executable is launched. That includes a user trying to launch an
already running application. By default, every launch is an independent process (multi instance). To make the
application single instanced, call AApplication::requestSingleInstanceLock() in the beginning of AUI_ENTRY. See
Application lifetime & instancing for details.
Application arguments (int argc, char** argv) are forwarded to AUI_ENTRY as AStringVector args.
Minimal entrypoint of an UI application:
Minimal entrypoint of a console application:
|
Prototype of AUI_ENTRY function you are actually implementing:
AUI_EXPORT int aui_entry(const AStringVector& args);
Examples#
examples/7guis/cells/src/main.cpp
7GUIs Cells — Spreadsheet processor (Excel).
} AUI_OVERRIDE_STYLE { Padding(0) });
}
};
AUI_ENTRY {
_new<CellsWindow>()->show();
return 0;
}
examples/7guis/flight_booker/src/main.cpp
7GUIs Flight Booker — Flight Booker.
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer — Undo, redo, dialog control.
examples/7guis/timer/src/main.cpp
7GUIs Timer — Timer example.
examples/7guis/crud/src/main.cpp
7GUIs CRUD — Create/Read/Update/Delete example.
examples/7guis/counter/src/main.cpp
7GUIs Counter — Simple counter.
AProperty<int> mCounter;
};
/// [counter]
AUI_ENTRY {
_new<CounterWindow>()->show();
return 0;
}
examples/7guis/temperature_converter/src/main.cpp
7GUIs Temperature Converter — Fahrenheit to Celsius and vice versa.
AProperty<int> mCelsius, mFahrenheit;
};
/// [window]
AUI_ENTRY {
_new<TemperatureConverterWindow>()->show();
return 0;
}
examples/basic/hello_world/src/main.cpp
Console Hello World Example — Basic CLI Hello World application.
#include <AUI/Logging/ALogger.h>
static constexpr auto LOG_TAG = "MyApp";
AUI_ENTRY {
ALogger::info(LOG_TAG) << "Hello world!";
return 0;
}
examples/app/minesweeper/src/main.cpp
Minesweeper Game — Minesweeper game implementation driven by ass.
examples/app/fractal/src/main.cpp
Fractal Example — Fractal viewer application demonstrating usage of custom shaders.
examples/app/game_of_life/src/main.cpp
Game of Life — Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.
examples/app/notes/src/main.cpp
Notes App — Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
examples/ui/minimal_ui_assets_xmake/src/main.cpp
Minimal UI Template XMake with Assets — Minimal UI boilerplate template XMake with AUI Assets.
examples/ui/minimal_ui_xmake/src/main.cpp
Minimal UI Template XMake — Minimal UI boilerplate template XMake.
examples/ui/contacts/src/main.cpp
AUI Contacts — Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
examples/ui/opengl_simple/src/main.cpp
OpenGL Example — Demonstrates how to integrate custom OpenGL rendering with AUI Framework.
GLuint mVertexBufferObject {};
};
} // namespace
AUI_ENTRY {
// ask aui to provide opengl context for us. (no fallback to software rendering)
ARenderingContextOptions::set({
.initializationOrder = {
ARenderingContextOptions::OpenGL{},
},
examples/ui/views/src/main.cpp
Views Example — All-in-one views building example.
examples/ui/infinite_lazy_list/src/main.cpp
Infinite Lazy List — Usage of AUI_DECLARATIVE_FOR to make an infinite lazy list.
},
};
}
AUI_ENTRY {
auto window = _new<AWindow>("Infinite Lazy List", 200_dp, 300_dp);
window->setContents(Stacked { AScrollArea::Builder().withContents(myLazyList(_new<State>())) });
window->show();
return 0;
examples/ui/embedded_sdl/src/main.cpp
SDL3 — This code demonstrates how to integrate the AUI Framework with SDL3 to create a window with OpenGL rendering.