Something went wrong. Try again.
A fork of https://github.com/crosspoint-reader/crosspoint-reader
Something went wrong. Try again.
1.1 kB · 37 lines
C++
1234567891011121314151617181920212223242526272829303132333435363738#include "UiAppHost.h"
#include "UiAppHelpers.h"
namespace fui = freeink::ui;
UiAppHost::UiAppHost(const GfxRenderer& renderer) : uiTarget(makeUiTarget(renderer)), app(uiTarget, uiTarget.deviceContext()) {}
void UiAppHost::resetUi() { uiReady = false; applySharedUiTheme(app, uiTarget);}
void UiAppHost::renderUi() { app.setDevice(uiTarget.deviceContext()); app.render(); uiReady = true;}
UiAppHost::TouchRoute UiAppHost::routeTouch(const MappedInputManager& input, const bool withLongPress, const bool routeHeld) { TouchRoute result; // named apart from route() — cppcheck flags the shadow if (!uiReady) return result; result.snap = touchSnapshotFrom(input, withLongPress); if (!result.snap.touchPressed && !result.snap.touchReleased && !(routeHeld && result.snap.touchHeld)) { return result; } result.routed = true; result.event = app.route(result.snap); return result;}
fui::ActionEvent UiAppHost::route(const fui::InputSnapshot& snap) { if (!uiReady) return {}; return app.route(snap);}