MX 2 лет назад
Родитель
Сommit
6a22aa6853
24 измененных файлов с 395 добавлено и 23 удалено
  1. 191 0
      apps_source_code/color_guess/.clang-format
  2. 4 3
      apps_source_code/color_guess/application.fam
  3. 7 0
      apps_source_code/color_guess/changelog.md
  4. 12 0
      apps_source_code/color_guess/color_guess.c
  5. 7 3
      apps_source_code/color_guess/color_guess.h
  6. BIN
      apps_source_code/color_guess/color_guess_10px.png
  7. 20 0
      apps_source_code/color_guess/docs/README.md
  8. 3 0
      apps_source_code/color_guess/docs/changelog.md
  9. 3 3
      apps_source_code/color_guess/helpers/color_guess_haptic.c
  10. 3 3
      apps_source_code/color_guess/helpers/color_guess_haptic.h
  11. 2 2
      apps_source_code/color_guess/helpers/color_guess_led.c
  12. 2 2
      apps_source_code/color_guess/helpers/color_guess_led.h
  13. 114 0
      apps_source_code/color_guess/helpers/color_guess_storage.c
  14. 18 0
      apps_source_code/color_guess/helpers/color_guess_storage.h
  15. BIN
      apps_source_code/color_guess/icons/start_dolph_49x55.png
  16. BIN
      apps_source_code/color_guess/img/1.png
  17. BIN
      apps_source_code/color_guess/img/2.png
  18. BIN
      apps_source_code/color_guess/img/3.png
  19. BIN
      apps_source_code/color_guess/screenshots/color_guess_1.png
  20. BIN
      apps_source_code/color_guess/screenshots/color_guess_2.png
  21. BIN
      apps_source_code/color_guess/screenshots/color_guess_3.png
  22. 1 1
      apps_source_code/color_guess/views/color_guess_color_set.c
  23. 4 4
      apps_source_code/color_guess/views/color_guess_play.c
  24. 4 2
      apps_source_code/color_guess/views/color_guess_startscreen.c

+ 191 - 0
apps_source_code/color_guess/.clang-format

@@ -0,0 +1,191 @@
+---
+Language:        Cpp
+AccessModifierOffset: -4
+AlignAfterOpenBracket: AlwaysBreak
+AlignArrayOfStructures: None
+AlignConsecutiveMacros: None
+AlignConsecutiveAssignments: None
+AlignConsecutiveBitFields: None
+AlignConsecutiveDeclarations: None
+AlignEscapedNewlines: Left
+AlignOperands:   Align
+AlignTrailingComments: false
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortEnumsOnASingleLine: true
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortLambdasOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: WithoutElse
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: Yes
+AttributeMacros:
+  - __capability
+BinPackArguments: false
+BinPackParameters: false
+BraceWrapping:
+  AfterCaseLabel:  false
+  AfterClass:      false
+  AfterControlStatement: Never
+  AfterEnum:       false
+  AfterFunction:   false
+  AfterNamespace:  false
+  AfterObjCDeclaration: false
+  AfterStruct:     false
+  AfterUnion:      false
+  AfterExternBlock: false
+  BeforeCatch:     false
+  BeforeElse:      false
+  BeforeLambdaBody: false
+  BeforeWhile:     false
+  IndentBraces:    false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeConceptDeclarations: true
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakInheritanceList: BeforeColon
+BreakBeforeTernaryOperators: false
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeComma
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: false
+ColumnLimit:     99
+CommentPragmas:  '^ IWYU pragma:'
+QualifierAlignment: Leave
+CompactNamespaces: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DeriveLineEnding: true
+DerivePointerAlignment: false
+DisableFormat:   false
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: LogicalBlock
+ExperimentalAutoDetectBinPacking: false
+PackConstructorInitializers: BinPack
+BasedOnStyle:    ''
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+AllowAllConstructorInitializersOnNextLine: true
+FixNamespaceComments: false
+ForEachMacros:
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
+IfMacros:
+  - KJ_IF_MAYBE
+IncludeBlocks:   Preserve
+IncludeCategories:
+  - Regex:           '.*'
+    Priority:        1
+    SortPriority:    0
+    CaseSensitive:   false
+  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+    Priority:        3
+    SortPriority:    0
+    CaseSensitive:   false
+  - Regex:           '.*'
+    Priority:        1
+    SortPriority:    0
+    CaseSensitive:   false
+IncludeIsMainRegex: '(Test)?$'
+IncludeIsMainSourceRegex: ''
+IndentAccessModifiers: false
+IndentCaseLabels: false
+IndentCaseBlocks: false
+IndentGotoLabels: true
+IndentPPDirectives: None
+IndentExternBlock: AfterExternBlock
+IndentRequires:  false
+IndentWidth:     4
+IndentWrappedFunctionNames: true
+InsertTrailingCommas: None
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: Signature
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 4
+ObjCBreakBeforeNestedBlockParam: true
+ObjCSpaceAfterProperty: true
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 10
+PenaltyBreakBeforeFirstCallParameter: 30
+PenaltyBreakComment: 10
+PenaltyBreakFirstLessLess: 0
+PenaltyBreakOpenParenthesis: 0
+PenaltyBreakString: 10
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 100
+PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
+PPIndentWidth:   -1
+ReferenceAlignment: Pointer
+ReflowComments:  false
+RemoveBracesLLVM: false
+SeparateDefinitionBlocks: Leave
+ShortNamespaceLines: 1
+SortIncludes:    Never
+SortJavaStaticImport: Before
+SortUsingDeclarations: false
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: Never
+SpaceBeforeParensOptions:
+  AfterControlStatements: false
+  AfterForeachMacros: false
+  AfterFunctionDefinitionName: false
+  AfterFunctionDeclarationName: false
+  AfterIfMacros:   false
+  AfterOverloadedOperator: false
+  BeforeNonEmptyParentheses: false
+SpaceAroundPointerQualifiers: Default
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  Never
+SpacesInConditionalStatement: false
+SpacesInContainerLiterals: false
+SpacesInCStyleCastParentheses: false
+SpacesInLineCommentPrefix:
+  Minimum:         1
+  Maximum:         -1
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+BitFieldColonSpacing: Both
+Standard:        c++03
+StatementAttributeLikeMacros:
+  - Q_EMIT
+StatementMacros:
+  - Q_UNUSED
+  - QT_REQUIRE_VERSION
+TabWidth:        4
+UseCRLF:         false
+UseTab:          Never
+WhitespaceSensitiveMacros:
+  - STRINGIZE
+  - PP_STRINGIZE
+  - BOOST_PP_STRINGIZE
+  - NS_SWIFT_NAME
+  - CF_SWIFT_NAME
+...
+

+ 4 - 3
apps_source_code/color_guess/application.fam

@@ -11,8 +11,9 @@ App(
     order=10,
     order=10,
     fap_icon="color_guess_10px.png",
     fap_icon="color_guess_10px.png",
     fap_icon_assets="icons",
     fap_icon_assets="icons",
+    fap_version="1.1",
     fap_category="Games",
     fap_category="Games",
-    fap_author="Leed",
-    fap_version="1.0",
+    fap_author="Leedave",
+    fap_description="Color Guessing Game",
     fap_weburl="https://github.com/leedave/Leeds-Flipper-Zero-Applications",
     fap_weburl="https://github.com/leedave/Leeds-Flipper-Zero-Applications",
-)
+)

+ 7 - 0
apps_source_code/color_guess/changelog.md

@@ -0,0 +1,7 @@
+## v1.1
+
+Added GFX to start screen
+
+## v1.0
+
+First release to Application Catalog

+ 12 - 0
apps_source_code/color_guess/color_guess.c

@@ -25,8 +25,14 @@ ColorGuess* color_guess_app_alloc() {
     app->gui = furi_record_open(RECORD_GUI);
     app->gui = furi_record_open(RECORD_GUI);
     app->notification = furi_record_open(RECORD_NOTIFICATION);
     app->notification = furi_record_open(RECORD_NOTIFICATION);
     app->error = false;
     app->error = false;
+
+    // Set Defaults if no config exists
     app->haptic = 1;
     app->haptic = 1;
     app->led = 1;
     app->led = 1;
+    app->save_settings = 1;
+
+    // Load configs
+    color_guess_read_settings(app);
 
 
     NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
     NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
     notification_message(notification, &sequence_display_backlight_on);
     notification_message(notification, &sequence_display_backlight_on);
@@ -81,6 +87,10 @@ void color_guess_app_free(ColorGuess* app) {
 
 
     // View Dispatcher
     // View Dispatcher
     view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdMenu);
     view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdMenu);
+    view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdStartscreen);
+    view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdColorSet);
+    view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdPlay);
+    view_dispatcher_remove_view(app->view_dispatcher, ColorGuessViewIdSettings);
     submenu_free(app->submenu);
     submenu_free(app->submenu);
 
 
     view_dispatcher_free(app->view_dispatcher);
     view_dispatcher_free(app->view_dispatcher);
@@ -116,6 +126,8 @@ int32_t color_guess_app(void* p) {
 
 
     view_dispatcher_run(app->view_dispatcher);
     view_dispatcher_run(app->view_dispatcher);
 
 
+    color_guess_save_settings(app);
+
     furi_hal_power_suppress_charge_exit();
     furi_hal_power_suppress_charge_exit();
 
 
     color_guess_app_free(app);
     color_guess_app_free(app);

+ 7 - 3
apps_source_code/color_guess/color_guess.h

@@ -15,6 +15,9 @@
 #include "views/color_guess_color_set.h"
 #include "views/color_guess_color_set.h"
 #include "views/color_guess_play.h"
 #include "views/color_guess_play.h"
 #include "views/color_guess_startscreen.h"
 #include "views/color_guess_startscreen.h"
+#include "helpers/color_guess_storage.h"
+
+#define TAG "Color_Guess"
 
 
 typedef struct {
 typedef struct {
     Gui* gui;
     Gui* gui;
@@ -29,9 +32,10 @@ typedef struct {
     ColorGuessStartscreen* color_guess_startscreen;
     ColorGuessStartscreen* color_guess_startscreen;
     Submenu* color_guess_settings;
     Submenu* color_guess_settings;
     bool error;
     bool error;
-    int haptic;
-    //int speaker;
-    int led;
+    uint32_t haptic;
+    //uint32_t speaker;
+    uint32_t led;
+    uint32_t save_settings;
 } ColorGuess;
 } ColorGuess;
 
 
 typedef enum {
 typedef enum {

BIN
apps_source_code/color_guess/color_guess_10px.png


+ 20 - 0
apps_source_code/color_guess/docs/README.md

@@ -0,0 +1,20 @@
+## Color Guessing Game 
+
+Targeted at Web Developers, Graphical Designers and other nerds. 
+This app will let your devices LED glow in a random color. Your job is to guess the Hex Code of the color.
+
+## Features
+- 3 Difficulties
+- Optional haptic feedback helps you guess
+- Percentage calculation to show how close you are
+- Practice mode that lets you define colors yourself
+
+## How HEX color codes work
+
+Example #FF44CC 
+- Each digit is a number from 0 - F
+- One digit represents 0 - 15, two digits represent 0 - 255
+- Each colors intensity is defined by two digits (black to full color)
+- The first color is red (example: FF)
+- The second color is green (example: 44)
+- The third color is blue (example: CC)

+ 3 - 0
apps_source_code/color_guess/docs/changelog.md

@@ -0,0 +1,3 @@
+## v1.0
+
+First release to Application Catalog

+ 3 - 3
apps_source_code/color_guess/helpers/color_guess_haptic.c

@@ -1,7 +1,7 @@
 #include "color_guess_haptic.h"
 #include "color_guess_haptic.h"
 #include "../color_guess.h"
 #include "../color_guess.h"
 
 
-void play_happy_bump(void* context) {
+void color_guess_play_happy_bump(void* context) {
     ColorGuess* app = context;
     ColorGuess* app = context;
     if(app->haptic != 1) {
     if(app->haptic != 1) {
         return;
         return;
@@ -11,7 +11,7 @@ void play_happy_bump(void* context) {
     notification_message(app->notification, &sequence_reset_vibro);
     notification_message(app->notification, &sequence_reset_vibro);
 }
 }
 
 
-void play_bad_bump(void* context) {
+void color_guess_play_bad_bump(void* context) {
     ColorGuess* app = context;
     ColorGuess* app = context;
     if(app->haptic != 1) {
     if(app->haptic != 1) {
         return;
         return;
@@ -21,7 +21,7 @@ void play_bad_bump(void* context) {
     notification_message(app->notification, &sequence_reset_vibro);
     notification_message(app->notification, &sequence_reset_vibro);
 }
 }
 
 
-void play_long_bump(void* context) {
+void color_guess_play_long_bump(void* context) {
     ColorGuess* app = context;
     ColorGuess* app = context;
     if(app->haptic != 1) {
     if(app->haptic != 1) {
         return;
         return;

+ 3 - 3
apps_source_code/color_guess/helpers/color_guess_haptic.h

@@ -1,7 +1,7 @@
 #include <notification/notification_messages.h>
 #include <notification/notification_messages.h>
 
 
-void play_happy_bump(void* context);
+void color_guess_play_happy_bump(void* context);
 
 
-void play_bad_bump(void* context);
+void color_guess_play_bad_bump(void* context);
 
 
-void play_long_bump(void* context);
+void color_guess_play_long_bump(void* context);

+ 2 - 2
apps_source_code/color_guess/helpers/color_guess_led.c

@@ -1,7 +1,7 @@
 #include "color_guess_led.h"
 #include "color_guess_led.h"
 #include "../color_guess.h"
 #include "../color_guess.h"
 
 
-void led_set_rgb(void* context, int red, int green, int blue) {
+void color_guess_led_set_rgb(void* context, int red, int green, int blue) {
     ColorGuess* app = context;
     ColorGuess* app = context;
     if(app->led != 1) {
     if(app->led != 1) {
         return;
         return;
@@ -28,7 +28,7 @@ void led_set_rgb(void* context, int red, int green, int blue) {
         0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
         0, FuriFlagWaitAny, 10); //Delay, prevent removal from RAM before LED value set
 }
 }
 
 
-void led_reset(void* context) {
+void color_guess_led_reset(void* context) {
     ColorGuess* app = context;
     ColorGuess* app = context;
     notification_message(app->notification, &sequence_reset_red);
     notification_message(app->notification, &sequence_reset_red);
     notification_message(app->notification, &sequence_reset_green);
     notification_message(app->notification, &sequence_reset_green);

+ 2 - 2
apps_source_code/color_guess/helpers/color_guess_led.h

@@ -1,5 +1,5 @@
 
 
 
 
-void led_set_rgb(void* context, int red, int green, int blue);
+void color_guess_led_set_rgb(void* context, int red, int green, int blue);
 
 
-void led_reset(void* context);
+void color_guess_led_reset(void* context);

+ 114 - 0
apps_source_code/color_guess/helpers/color_guess_storage.c

@@ -0,0 +1,114 @@
+#include "color_guess_storage.h"
+
+static Storage* color_guess_open_storage() {
+    return furi_record_open(RECORD_STORAGE);
+}
+
+static void color_guess_close_storage() {
+    furi_record_close(RECORD_STORAGE);
+}
+
+static void color_guess_close_config_file(FlipperFormat* file) {
+    if(file == NULL) return;
+    flipper_format_file_close(file);
+    flipper_format_free(file);
+}
+
+void color_guess_save_settings(void* context) {
+    ColorGuess* app = context;
+    if(app->save_settings == 0) {
+        return;
+    }
+
+    FURI_LOG_D(TAG, "Saving Settings");
+    Storage* storage = color_guess_open_storage();
+    FlipperFormat* fff_file = flipper_format_file_alloc(storage);
+
+    // Overwrite wont work, so delete first
+    if(storage_file_exists(storage, COLOR_GUESS_SETTINGS_SAVE_PATH)) {
+        storage_simply_remove(storage, COLOR_GUESS_SETTINGS_SAVE_PATH);
+    }
+
+    // Open File, create if not exists
+    if(!storage_common_stat(storage, COLOR_GUESS_SETTINGS_SAVE_PATH, NULL) == FSE_OK) {
+        FURI_LOG_D(
+            TAG, "Config file %s is not found. Will create new.", COLOR_GUESS_SETTINGS_SAVE_PATH);
+        if(storage_common_stat(storage, CONFIG_FILE_DIRECTORY_PATH, NULL) == FSE_NOT_EXIST) {
+            FURI_LOG_D(
+                TAG, "Directory %s doesn't exist. Will create new.", CONFIG_FILE_DIRECTORY_PATH);
+            if(!storage_simply_mkdir(storage, CONFIG_FILE_DIRECTORY_PATH)) {
+                FURI_LOG_E(TAG, "Error creating directory %s", CONFIG_FILE_DIRECTORY_PATH);
+            }
+        }
+    }
+
+    if(!flipper_format_file_open_new(fff_file, COLOR_GUESS_SETTINGS_SAVE_PATH)) {
+        //totp_close_config_file(fff_file);
+        FURI_LOG_E(TAG, "Error creating new file %s", COLOR_GUESS_SETTINGS_SAVE_PATH);
+        color_guess_close_storage();
+        return;
+    }
+
+    // Store Settings
+    flipper_format_write_header_cstr(
+        fff_file, COLOR_GUESS_SETTINGS_HEADER, COLOR_GUESS_SETTINGS_FILE_VERSION);
+    flipper_format_write_uint32(fff_file, COLOR_GUESS_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
+    flipper_format_write_uint32(fff_file, COLOR_GUESS_SETTINGS_KEY_LED, &app->led, 1);
+    flipper_format_write_uint32(
+        fff_file, COLOR_GUESS_SETTINGS_KEY_SAVE_SETTINGS, &app->save_settings, 1);
+
+    if(!flipper_format_rewind(fff_file)) {
+        color_guess_close_config_file(fff_file);
+        FURI_LOG_E(TAG, "Rewind error");
+        color_guess_close_storage();
+        return;
+    }
+
+    color_guess_close_config_file(fff_file);
+    color_guess_close_storage();
+}
+
+void color_guess_read_settings(void* context) {
+    ColorGuess* app = context;
+    Storage* storage = color_guess_open_storage();
+    FlipperFormat* fff_file = flipper_format_file_alloc(storage);
+
+    if(storage_common_stat(storage, COLOR_GUESS_SETTINGS_SAVE_PATH, NULL) != FSE_OK) {
+        color_guess_close_config_file(fff_file);
+        color_guess_close_storage();
+        return;
+    }
+    uint32_t file_version;
+    FuriString* temp_str = furi_string_alloc();
+
+    if(!flipper_format_file_open_existing(fff_file, COLOR_GUESS_SETTINGS_SAVE_PATH)) {
+        FURI_LOG_E(TAG, "Cannot open file %s", COLOR_GUESS_SETTINGS_SAVE_PATH);
+        color_guess_close_config_file(fff_file);
+        color_guess_close_storage();
+        return;
+    }
+
+    if(!flipper_format_read_header(fff_file, temp_str, &file_version)) {
+        FURI_LOG_E(TAG, "Missing Header Data");
+        color_guess_close_config_file(fff_file);
+        color_guess_close_storage();
+        return;
+    }
+
+    if(file_version < COLOR_GUESS_SETTINGS_FILE_VERSION) {
+        FURI_LOG_I(TAG, "old config version, will be removed.");
+        color_guess_close_config_file(fff_file);
+        color_guess_close_storage();
+        return;
+    }
+
+    flipper_format_read_uint32(fff_file, COLOR_GUESS_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
+    flipper_format_read_uint32(fff_file, COLOR_GUESS_SETTINGS_KEY_LED, &app->led, 1);
+    flipper_format_read_uint32(
+        fff_file, COLOR_GUESS_SETTINGS_KEY_SAVE_SETTINGS, &app->save_settings, 1);
+
+    flipper_format_rewind(fff_file);
+
+    color_guess_close_config_file(fff_file);
+    color_guess_close_storage();
+}

+ 18 - 0
apps_source_code/color_guess/helpers/color_guess_storage.h

@@ -0,0 +1,18 @@
+#include <stdlib.h>
+#include <string.h>
+#include <storage/storage.h>
+#include <flipper_format/flipper_format_i.h>
+#include "../color_guess.h"
+
+#define COLOR_GUESS_SETTINGS_FILE_VERSION 1
+#define CONFIG_FILE_DIRECTORY_PATH EXT_PATH("apps_data/color_guess")
+#define COLOR_GUESS_SETTINGS_SAVE_PATH CONFIG_FILE_DIRECTORY_PATH "/color_guess.conf"
+#define COLOR_GUESS_SETTINGS_SAVE_PATH_TMP COLOR_GUESS_SETTINGS_SAVE_PATH ".tmp"
+#define COLOR_GUESS_SETTINGS_HEADER "Color Guess Config File"
+#define COLOR_GUESS_SETTINGS_KEY_HAPTIC "Haptic"
+#define COLOR_GUESS_SETTINGS_KEY_LED "Led"
+#define COLOR_GUESS_SETTINGS_KEY_SPEAKER "Speaker"
+#define COLOR_GUESS_SETTINGS_KEY_SAVE_SETTINGS "SaveSettings"
+
+void color_guess_save_settings(void* context);
+void color_guess_read_settings(void* context);

BIN
apps_source_code/color_guess/icons/start_dolph_49x55.png


BIN
apps_source_code/color_guess/img/1.png


BIN
apps_source_code/color_guess/img/2.png


BIN
apps_source_code/color_guess/img/3.png


BIN
apps_source_code/color_guess/screenshots/color_guess_1.png


BIN
apps_source_code/color_guess/screenshots/color_guess_2.png


BIN
apps_source_code/color_guess/screenshots/color_guess_3.png


+ 1 - 1
apps_source_code/color_guess/views/color_guess_color_set.c

@@ -62,7 +62,7 @@ static void color_guess_color_set_model_init(ColorGuessColorSetModel* const mode
 void color_guess_color_set_set_led(void* context, ColorGuessColorSetModel* model) {
 void color_guess_color_set_set_led(void* context, ColorGuessColorSetModel* model) {
     furi_assert(context);
     furi_assert(context);
     ColorGuess* app = context;
     ColorGuess* app = context;
-    led_set_rgb(
+    color_guess_led_set_rgb(
         app,
         app,
         (model->digit[0] * 16) + model->digit[1],
         (model->digit[0] * 16) + model->digit[1],
         (model->digit[2] * 16) + model->digit[3],
         (model->digit[2] * 16) + model->digit[3],

+ 4 - 4
apps_source_code/color_guess/views/color_guess_play.c

@@ -43,11 +43,11 @@ void color_guess_play_set_callback(
 void play_haptic(void* context, ColorGuessPlayModel* model) {
 void play_haptic(void* context, ColorGuessPlayModel* model) {
     ColorGuess* app = context;
     ColorGuess* app = context;
     if(model->success == 1) {
     if(model->success == 1) {
-        play_long_bump(app);
+        color_guess_play_long_bump(app);
     } else if(model->closeness > model->prev_closeness) {
     } else if(model->closeness > model->prev_closeness) {
-        play_happy_bump(app);
+        color_guess_play_happy_bump(app);
     } else if(model->closeness < model->prev_closeness) {
     } else if(model->closeness < model->prev_closeness) {
-        play_bad_bump(app);
+        color_guess_play_bad_bump(app);
     }
     }
 }
 }
 
 
@@ -70,7 +70,7 @@ void color_guess_play_new_round(void* context, ColorGuessPlayModel* model) {
         model->color = colorsHard[rand() % ARR_SIZE(colorsHard)];
         model->color = colorsHard[rand() % ARR_SIZE(colorsHard)];
     }
     }
 
 
-    led_set_rgb(
+    color_guess_led_set_rgb(
         app, ((model->color >> 16) & 0xFF), ((model->color >> 8) & 0xFF), ((model->color) & 0xFF));
         app, ((model->color >> 16) & 0xFF), ((model->color >> 8) & 0xFF), ((model->color) & 0xFF));
 }
 }
 
 

+ 4 - 2
apps_source_code/color_guess/views/color_guess_startscreen.c

@@ -4,6 +4,7 @@
 #include <input/input.h>
 #include <input/input.h>
 #include <gui/elements.h>
 #include <gui/elements.h>
 #include <dolphin/dolphin.h>
 #include <dolphin/dolphin.h>
+#include "color_guess_icons.h"
 
 
 struct ColorGuessStartscreen {
 struct ColorGuessStartscreen {
     View* view;
     View* view;
@@ -30,10 +31,11 @@ void color_guess_startscreen_draw(Canvas* canvas, ColorGuessStartscreenModel* mo
     canvas_clear(canvas);
     canvas_clear(canvas);
     canvas_set_color(canvas, ColorBlack);
     canvas_set_color(canvas, ColorBlack);
     canvas_set_font(canvas, FontPrimary);
     canvas_set_font(canvas, FontPrimary);
+    canvas_draw_icon(canvas, 0, 9, &I_start_dolph_49x55);
     canvas_draw_str_aligned(canvas, 64, 10, AlignCenter, AlignTop, "Color Guess");
     canvas_draw_str_aligned(canvas, 64, 10, AlignCenter, AlignTop, "Color Guess");
     canvas_set_font(canvas, FontSecondary);
     canvas_set_font(canvas, FontSecondary);
-    canvas_draw_str_aligned(canvas, 64, 22, AlignCenter, AlignTop, "Guess the color");
-    canvas_draw_str_aligned(canvas, 64, 32, AlignCenter, AlignTop, "on Flipper's LED");
+    canvas_draw_str_aligned(canvas, 54, 22, AlignLeft, AlignTop, "Guess the color");
+    canvas_draw_str_aligned(canvas, 54, 32, AlignLeft, AlignTop, "on Flipper's LED");
     elements_button_center(canvas, "Start");
     elements_button_center(canvas, "Start");
 }
 }