Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions Apps/Brainfuck/main/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <lvgl_window_manager/window_manager.h>

#include <tactility/check.h>

#include <memory>

extern "C" {
Expand All @@ -19,25 +21,30 @@ int main(int argc, char* argv[]) {
auto ctx = std::make_unique<Context>();
ctx->appInstanceId = app_instance_id;

struct TaskEventGroup event_group {};
task_event_group_construct(&event_group);

struct AppEventSubscription sub {};
sub.app_instance_id = app_instance_id;
app_event_subscribe(&sub);
check(app_event_subscribe(&sub, &event_group) == ERROR_NONE);

WindowId window = window_manager_create(app_instance_id, brainfuckCreateWidgets, ctx.get());

bool should_close = false;
while (!should_close) {
task_event_group_wait_any(&event_group, nullptr, portMAX_DELAY);

struct AppEvent event;
if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) {
break;
}
if (event.type == APP_EVENT_CLOSE) {
should_close = true;
while (app_event_poll(&sub, &event) == ERROR_NONE) {
if (event.type == APP_EVENT_CLOSE) {
should_close = true;
}
if (should_close) break;
}
}

window_manager_remove(window);
app_event_unsubscribe(&sub);
check(app_event_unsubscribe(&sub) == ERROR_NONE);
task_event_group_destruct(&event_group);
brainfuckTeardown(ctx.get());

return 0;
Expand Down
4 changes: 2 additions & 2 deletions Apps/Brainfuck/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=tactility.brainfuck
app.version.name=0.9.0
app.version.code=9
app.version.name=0.10.0
app.version.code=10
app.name=Brainfuck interpreter
app.description=Brainfuck esoteric language interpreter
23 changes: 15 additions & 8 deletions Apps/Breakout/main/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <lvgl_window_manager/window_manager.h>

#include <tactility/check.h>

#include <memory>

extern "C" {
Expand All @@ -19,25 +21,30 @@ int main(int argc, char* argv[]) {
auto ctx = std::make_unique<Context>();
ctx->appInstanceId = app_instance_id;

struct TaskEventGroup event_group {};
task_event_group_construct(&event_group);

struct AppEventSubscription sub {};
sub.app_instance_id = app_instance_id;
app_event_subscribe(&sub);
check(app_event_subscribe(&sub, &event_group) == ERROR_NONE);

WindowId window = window_manager_create(app_instance_id, breakoutCreateWidgets, ctx.get());

bool should_close = false;
while (!should_close) {
task_event_group_wait_any(&event_group, nullptr, portMAX_DELAY);

struct AppEvent event;
if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) {
break;
}
if (event.type == APP_EVENT_CLOSE) {
should_close = true;
while (app_event_poll(&sub, &event) == ERROR_NONE) {
if (event.type == APP_EVENT_CLOSE) {
should_close = true;
}
if (should_close) break;
}
}

window_manager_remove(window);
app_event_unsubscribe(&sub);
check(app_event_unsubscribe(&sub) == ERROR_NONE);
task_event_group_destruct(&event_group);
breakoutTeardown(ctx.get());

return 0;
Expand Down
4 changes: 2 additions & 2 deletions Apps/Breakout/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=tactility.breakout
app.version.name=0.10.0
app.version.code=10
app.version.name=0.13.0
app.version.code=13
app.name=Breakout
app.description=Classic brick-breaking arcade game
23 changes: 15 additions & 8 deletions Apps/Calculator/main/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <lvgl_window_manager/window_manager.h>

#include <tactility/check.h>

extern "C" {

int main(int argc, char* argv[]) {
Expand All @@ -14,25 +16,30 @@ int main(int argc, char* argv[]) {
Context ctx {};
ctx.appInstanceId = app_instance_id;

struct TaskEventGroup event_group {};
task_event_group_construct(&event_group);

struct AppEventSubscription sub {};
sub.app_instance_id = app_instance_id;
app_event_subscribe(&sub);
check(app_event_subscribe(&sub, &event_group) == ERROR_NONE);

WindowId window = window_manager_create(app_instance_id, calculatorCreateWidgets, &ctx);

bool should_close = false;
while (!should_close) {
task_event_group_wait_any(&event_group, nullptr, portMAX_DELAY);

struct AppEvent event;
if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) {
break;
}
if (event.type == APP_EVENT_CLOSE) {
should_close = true;
while (app_event_poll(&sub, &event) == ERROR_NONE) {
if (event.type == APP_EVENT_CLOSE) {
should_close = true;
}
if (should_close) break;
}
}

window_manager_remove(window);
app_event_unsubscribe(&sub);
check(app_event_unsubscribe(&sub) == ERROR_NONE);
task_event_group_destruct(&event_group);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions Apps/Calculator/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=tactility.calculator
app.version.name=0.10.0
app.version.code=10
app.version.name=0.11.0
app.version.code=11
app.name=Calculator
43 changes: 25 additions & 18 deletions Apps/Diceware/main/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <lvgl_window_manager/window_manager.h>

#include <tactility/check.h>

extern "C" {

int main(int argc, char* argv[]) {
Expand All @@ -14,35 +16,40 @@ int main(int argc, char* argv[]) {
Context ctx {};
ctx.appInstanceId = app_instance_id;

struct TaskEventGroup event_group {};
task_event_group_construct(&event_group);

struct AppEventSubscription sub {};
sub.app_instance_id = app_instance_id;
app_event_subscribe(&sub);
check(app_event_subscribe(&sub, &event_group) == ERROR_NONE);

WindowId window = window_manager_create(app_instance_id, dicewareCreateWidgets, &ctx);

bool should_close = false;
while (!should_close) {
task_event_group_wait_any(&event_group, nullptr, portMAX_DELAY);

struct AppEvent event;
if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) {
break;
}
switch (event.type) {
case APP_EVENT_CLOSE:
should_close = true;
break;
case APP_EVENT_RESULT:
if (event.result.launch_id == ctx.pendingHelpDialogId) {
ctx.pendingHelpDialogId = 0;
}
app_manager_stop(event.result.launch_id);
break;
default:
break;
while (app_event_poll(&sub, &event) == ERROR_NONE) {
switch (event.type) {
case APP_EVENT_CLOSE:
should_close = true;
break;
case APP_EVENT_RESULT:
if (event.result.launch_id == ctx.pendingHelpDialogId) {
ctx.pendingHelpDialogId = 0;
}
app_manager_stop(event.result.launch_id);
break;
default:
break;
}
if (should_close) break;
}
}

window_manager_remove(window);
app_event_unsubscribe(&sub);
check(app_event_unsubscribe(&sub) == ERROR_NONE);
task_event_group_destruct(&event_group);
dicewareTeardown(&ctx);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions Apps/Diceware/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=tactility.diceware
app.version.name=0.11.0
app.version.code=11
app.version.name=0.12.0
app.version.code=12
app.name=Diceware
79 changes: 43 additions & 36 deletions Apps/EpubReader/main/Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <lvgl/lvgl.h>
#include <lvgl_window_manager/window_manager.h>

#include <tactility/check.h>

extern "C" {

int main(int argc, char* argv[]) {
Expand All @@ -18,60 +20,65 @@ int main(int argc, char* argv[]) {
ctx.launchFilePath_ = argv[0];
}

struct TaskEventGroup event_group {};
task_event_group_construct(&event_group);

struct AppEventSubscription sub {};
sub.app_instance_id = app_instance_id;
app_event_subscribe(&sub);
check(app_event_subscribe(&sub, &event_group) == ERROR_NONE);

WindowId window = window_manager_create(app_instance_id, epubReaderCreateWidgets, &ctx);

bool should_close = false;
while (!should_close) {
task_event_group_wait_any(&event_group, nullptr, portMAX_DELAY);

struct AppEvent event;
if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) {
break;
}
switch (event.type) {
case APP_EVENT_CLOSE:
should_close = true;
break;

case APP_EVENT_RESULT: {
uint32_t launch_id = event.result.launch_id;

if (launch_id == ctx.psramAlertId_) {
// PSRAM alert closed - this app cannot run without PSRAM, close self.
ctx.psramAlertId_ = 0;
app_manager_stop(launch_id);
while (app_event_poll(&sub, &event) == ERROR_NONE) {
switch (event.type) {
case APP_EVENT_CLOSE:
should_close = true;
} else if (launch_id == ctx.tocDialogId_) {
ctx.tocDialogId_ = 0;
int32_t selection = event.result.result;
if (selection >= 0 && ctx.epub_) {
const auto& toc = ctx.epub_->getToc();
const auto& spine = ctx.epub_->getSpine();
if (selection < (int32_t)toc.size()) {
for (size_t i = 0; i < spine.size(); ++i) {
if (spine[i].href == toc[(size_t)selection].href) {
lvgl_lock();
loadChapter(&ctx, (int)i, 0);
lvgl_unlock();
break;
break;

case APP_EVENT_RESULT: {
uint32_t launch_id = event.result.launch_id;

if (launch_id == ctx.psramAlertId_) {
// PSRAM alert closed - this app cannot run without PSRAM, close self.
ctx.psramAlertId_ = 0;
app_manager_stop(launch_id);
should_close = true;
} else if (launch_id == ctx.tocDialogId_) {
ctx.tocDialogId_ = 0;
int32_t selection = event.result.result;
if (selection >= 0 && ctx.epub_) {
const auto& toc = ctx.epub_->getToc();
const auto& spine = ctx.epub_->getSpine();
if (selection < (int32_t)toc.size()) {
for (size_t i = 0; i < spine.size(); ++i) {
if (spine[i].href == toc[(size_t)selection].href) {
lvgl_lock();
loadChapter(&ctx, (int)i, 0);
lvgl_unlock();
break;
}
}
}
}
app_manager_stop(launch_id);
}
app_manager_stop(launch_id);
break;
}
break;
}

default:
break;
default:
break;
}
if (should_close) break;
}
}

window_manager_remove(window);
app_event_unsubscribe(&sub);
check(app_event_unsubscribe(&sub) == ERROR_NONE);
task_event_group_destruct(&event_group);
epubReaderTeardown(&ctx);

return 0;
Expand Down
4 changes: 2 additions & 2 deletions Apps/EpubReader/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32s3,esp32p4
app.id=tactility.epubreader
app.version.name=0.8.0
app.version.code=8
app.version.name=0.9.0
app.version.code=9
app.name=Epub Reader
app.description=Epub and text file reader. Requires PSRAM!
Loading
Loading