From 4d59b94578e811405a1757b230ac6169b3fca004 Mon Sep 17 00:00:00 2001 From: Alexander Rodriguez Date: Fri, 29 Dec 2023 19:04:37 -0800 Subject: [PATCH 1/2] Edited readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8b13789..67e0782 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ +Minesweeper Implementation for the Flipper Zero. +Currently a work in progress and incomplete. From 6e1fd929e4eeaf89b7af896f3f634ae46276aff0 Mon Sep 17 00:00:00 2001 From: Alexander Rodriguez Date: Fri, 29 Dec 2023 22:38:33 -0800 Subject: [PATCH 2/2] Added header for StartScreen view This view will be used for the start screen of the game, and will be designed to be a modular and reusable component. Right now it will support an icon, frame, and text, elements and will allow the user to define their own callbacks for input, draw, and timer. --- start_screen.h | 147 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 start_screen.h diff --git a/start_screen.h b/start_screen.h new file mode 100644 index 0000000..479e13e --- /dev/null +++ b/start_screen.h @@ -0,0 +1,147 @@ +#ifndef START_SCREEN +#define START_SCREEN + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** StartScreen anonymous structure */ +typedef struct StartScreen GameStartScreen; + +/** StartScreen timer callback type + * @warning comes from GUI thread + */ +typedef (*StartScreenTimerCallback)(void* context); +typedef (*StartScreenInputCallback)(); + +/** Allocate and initalize + * + * This view is used as the starting screen of an application. + * + * @return StartScreen view instance + */ +StartScreen* start_screen_alloc(); + +/** Deinitialize and free Start Screen view + * + * @param instsance StartScreen instance + */ +void loading_free(StartScreen* instance); + +/** Reset StartScreen + * + * @param instance StartScreen instance + */ +void start_screen_reset(StartScreen* instance); + +/** Get StartScreen view + * + * @param instance StartScreen instance + * + * @return view instance that can be used for embedding + */ +View* start_screen_get_view(StartScreen* instance); + +/** Set StartScreen timer callback + * + * @param instance StartScreen instance + * @param callback StartScreenTimerCallback callback + */ +void start_screen_set_timer_callback( + StartScreen* instance, + StartScreenTimerCallback callback); + +/** Set StartScreen input callback + * + * @param instance StartScreen instance + * @param callback StartScreenInputCallback callback + */ +void start_screen_set_input_callback( + StartScreen* instance, + StartScreenInputCallback callback); + +/** Set StartScreen context + * + * @param instance StartScreen instance + * @param context context pointer, will be passed to callback + */ +void start_screen_set_context(StartScreen* instance, void* context); + +/** Add Multi String Element + * + * @param startScreen StartScreen instance + * @param x x coordinate + * @param y y coordinate + * @param horizontal Align instance + * @param vertical Align instance + * @param font Font instance + * @param[in] text The text + */ +void start_screen_add_string_multiline_element( + StartScreen* startScreen, + uint8_t x, + uint8_t y, + Align horizontal, + Align vertical, + Font font, + const char* text); + +/** Add String Element + * + * @param startScreen StartScreen instance + * @param x x coordinate + * @param y y coordinate + * @param horizontal Align instance + * @param vertical Align instance + * @param font Font instance + * @param[in] text The text + */ +void start_screen_add_string_element( + StartScreen* startScreen, + uint8_t x, + uint8_t y, + Align horizontal, + Align vertical, + Font font, + const char* text); + +/** Add Icon Element + * + * @param startScreen StartScreen instance + * @param x top left x coordinate + * @param y top left y coordinate + * @param icon Icon instance + */ +void start_screen_add_icon_element(StartScreen* startScreen, uint8_t x, uint8_t y, const Icon* icon); + +/** Add Frame Element + * + * @param startScreen StartScreen instance + * @param x top left x coordinate + * @param y top left y coordinate + * @param width frame width + * @param height frame height + * @param radius frame radius + */ +void start_screen_add_frame_element( + StartScreen* startScreen, + uint8_t x, + uint8_t y, + uint8_t width, + uint8_t height, + uint8_t radius); + +/** Additional draw callback + * + * Use this as a secondary callback to draw on the canvas. + * This callback function will happen after drawing of the established + * GUI elements in the view such as the icons, text, frame, ect. + * + */ +void start_screen_set_secondary_draw_callback(StartScreen* startScreen, ); +#ifdef __cplusplus +} +#endif