commit d03b458b68595cf9dfd126859a649480677dc130 Author: Felix Pankratz Date: Fri Sep 16 18:33:23 2022 +0200 hello world diff --git a/README.md b/README.md new file mode 100644 index 0000000..65be05b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Hello World dialog + +A simple beginning - displays a message with preset text. diff --git a/application.fam b/application.fam new file mode 100644 index 0000000..aa86a26 --- /dev/null +++ b/application.fam @@ -0,0 +1,11 @@ +App( + appid="hello_world", + name="Hello World", + apptype=FlipperAppType.PLUGIN, + entry_point="hello_world_app", + cdefines=["APP_HELLO_WORLD"], + requires=["gui"], + stack_size=1 * 1024, + icon="A_Plugins_14", + order=35, +) diff --git a/helloworld.c b/helloworld.c new file mode 100644 index 0000000..899118c --- /dev/null +++ b/helloworld.c @@ -0,0 +1,30 @@ +#include +#include + +typedef struct { + DialogsApp* dialogs; +} HelloWorld; + +int32_t hello_world_app(void* p) { + UNUSED(p); + HelloWorld* helloworld = malloc(sizeof(HelloWorld)); + helloworld->dialogs = furi_record_open(RECORD_DIALOGS); + DialogMessage* message = dialog_message_alloc(); + + const char* header_text = "Hello world"; + const char* message_text = "Panki's first C program!"; + + dialog_message_set_header(message, header_text, 63, 3, AlignCenter, AlignTop); + dialog_message_set_text(message, message_text, 0, 17, AlignLeft, AlignTop); + + dialog_message_set_icon(message, &I_DolphinCommon_56x48, 72, 17); + + dialog_message_show(helloworld->dialogs, message); + + dialog_message_free(message); + furi_record_close(RECORD_DIALOGS); + free(helloworld); + + return 0; +} +