hello world

This commit is contained in:
Felix Pankratz 2022-09-16 18:33:23 +02:00
commit d03b458b68
3 changed files with 44 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# Hello World dialog
A simple beginning - displays a message with preset text.

11
application.fam Normal file
View File

@ -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,
)

30
helloworld.c Normal file
View File

@ -0,0 +1,30 @@
#include <furi.h>
#include <dialogs/dialogs.h>
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;
}