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&)); \
static int fake_main(int argc, char** argv) { \
return aui_main(argc, argv, aui_entry);\
} \
AUI_EXPORT int 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. If there are no open windows, the event loop breaks, causing the application
to exit with the exit code returned by AUI_ENTRY
earlier, or 0
.
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/app/notes/src/main.cpp
Notes App - Note taking app that demonstrates usage of AListModel, AProperty, user data saving and loading.
},
/// [scrollarea]
AScrollArea::Builder()
.withContents(
AUI_DECLARATIVE_FOR(note, *mNotes, AVerticalLayout) {
observeChangesForDirty(note);
return notePreview(note) AUI_LET {
connect(it->clicked, [this, note] { mCurrentNote = note; });
it& mCurrentNote > [note](AView& view, const _<Note>& currentNote) {
ALOG_DEBUG(LOG_TAG) << "currentNote == note " << currentNote << " == " << note;
examples/ui/contacts/src/main.cpp
AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.
mSelectedContact = nullptr;
}
_<AView> indexedList() {
return AUI_DECLARATIVE_FOR(group, *mContacts | ranges::views::chunk_by([](const _<Contact>& lhs, const _<Contact>& rhs) {
return groupLetter(lhs->displayName) == groupLetter(rhs->displayName);
}), AVerticalLayout) {
auto firstContact = *ranges::begin(group);
auto firstLetter = groupLetter(firstContact->displayName);
ALogger::info("Test") << "Computing view for group " << AString(1, firstLetter);
examples/ui/infinite_lazy_list/src/main.cpp
Infinite Lazy List - Usage of AUI_DECLARATIVE_FOR to make an infinite lazy list.
};
});
return Vertical {
AUI_DECLARATIVE_FOR(i, *state->items, AVerticalLayout) { return Label{} & i->value; },
Centered {
_new<ASpinnerV2>() AUI_LET {
AObject::connect(it->redrawn, AObject::GENERIC_OBSERVER, [state] {
// when a spinner appears, we indicate that we need more items.
state->needMore = true;
examples/7guis/crud/src/main.cpp
7GUIs CRUD - Create/Read/Update/Delete example.
Label { "Filter prefix:" },
_new<ATextField>() AUI_WITH_STYLE { Expanding(1, 0) } && mFilterPrefix,
},
AScrollArea::Builder().withExpanding().withContents(
AUI_DECLARATIVE_FOR(i, *mUsers | FILTER_VIEW, AVerticalLayout) {
auto view = _new<ALabel>();
view & i->displayName;
connect(mSelectedUser, view, [this, &view = *view, i] {
view.setAssName("selected", mSelectedUser == i);
});
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/minesweeper/src/main.cpp
Minesweeper Game - Minesweeper game implementation driven by ass.
examples/ui/minimal_ui_xmake/src/main.cpp
Minimal UI Template XMake - Minimal UI boilerplate template XMake.
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/7guis/flight_booker/src/main.cpp
7GUIs Flight Booker - Flight Booker.
examples/7guis/cells/src/main.cpp
7GUIs Cells - Spreadsheet processor (Excel).
} AUI_WITH_STYLE { Padding(0) });
}
};
AUI_ENTRY {
_new<CellsWindow>()->show();
return 0;
}
examples/7guis/circle_drawer/src/main.cpp
7GUIs Circle Drawer - Undo, redo, dialog control.
examples/7guis/temperature_converter/src/main.cpp
7GUIs Temperature Converter - Fahrenheit to Celsius and vice versa.
private:
AProperty<int> mCelsius, mFahrenheit;
};
AUI_ENTRY {
_new<TemperatureConverterWindow>()->show();
return 0;
}
examples/7guis/counter/src/main.cpp
7GUIs Counter - Simple counter.
private:
AProperty<int> mCounter;
};
AUI_ENTRY {
_new<CounterWindow>()->show();
return 0;
}
examples/7guis/timer/src/main.cpp
7GUIs Timer - Timer example.
examples/ui/views/src/main.cpp
Views Example - All-in-one views building example.