| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- // #include "../flipbip.h"
- // #include <furi.h>
- // #include <furi_hal.h>
- // #include <input/input.h>
- // #include <gui/elements.h>
- // #include <dolphin/dolphin.h>
- // #include "../helpers/flipbip_haptic.h"
- // //#include "../helpers/flipbip_speaker.h"
- // #include "../helpers/flipbip_led.h"
- // struct FlipBipScene2 {
- // View* view;
- // FlipBipScene2Callback callback;
- // void* context;
- // };
- // typedef struct {
- // int screen_text;
- // } FlipBipScene2Model;
- // char buttonText[11][14] = {
- // "",
- // "Press Up",
- // "Press Down",
- // "Press Left",
- // "Press Right",
- // "Press Ok",
- // "Release Up",
- // "Release Down",
- // "Release Left",
- // "Release Right",
- // "Release Ok",
- // };
- // void flipbip_scene_2_set_callback(
- // FlipBipScene2* instance,
- // FlipBipScene2Callback callback,
- // void* context) {
- // furi_assert(instance);
- // furi_assert(callback);
- // instance->callback = callback;
- // instance->context = context;
- // }
- // void flipbip_scene_2_draw(Canvas* canvas, FlipBipScene2Model* model) {
- // canvas_clear(canvas);
- // canvas_set_color(canvas, ColorBlack);
- // canvas_set_font(canvas, FontPrimary);
- // canvas_draw_str_aligned(canvas, 0, 10, AlignLeft, AlignTop, "Scene 2: Input Examples");
- // canvas_set_font(canvas, FontSecondary);
- // char *strInput = malloc(15);
- // strcpy(strInput, buttonText[model->screen_text]);
- // canvas_draw_str_aligned(canvas, 0, 22, AlignLeft, AlignTop, strInput);
- // free(strInput);
- // }
- // static void flipbip_scene_2_model_init(FlipBipScene2Model* const model) {
- // model->screen_text = 0;
- // }
- // bool flipbip_scene_2_input(InputEvent* event, void* context) {
- // furi_assert(context);
- // FlipBipScene2* instance = context;
- // if (event->type == InputTypeRelease) {
- // switch(event->key) {
- // case InputKeyBack:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // UNUSED(model);
- // //flipbip_stop_all_sound(instance->context);
- // instance->callback(FlipBipCustomEventScene2Back, instance->context);
- // flipbip_play_long_bump(instance->context);
- // },
- // true);
- // break;
- // case InputKeyUp:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 6;
- // flipbip_play_bad_bump(instance->context);
- // //flipbip_stop_all_sound(instance->context);
- // flipbip_led_set_rgb(instance->context, 255, 0, 255);
- // },
- // true);
- // break;
- // case InputKeyDown:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 7;
- // flipbip_play_bad_bump(instance->context);
- // //flipbip_stop_all_sound(instance->context);
- // flipbip_led_set_rgb(instance->context, 255, 255, 0);
- // },
- // true);
- // break;
- // case InputKeyLeft:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 8;
- // flipbip_play_bad_bump(instance->context);
- // //flipbip_stop_all_sound(instance->context);
- // flipbip_led_set_rgb(instance->context, 0, 255, 255);
- // },
- // true);
- // break;
- // case InputKeyRight:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 9;
- // flipbip_play_bad_bump(instance->context);
- // //flipbip_stop_all_sound(instance->context);
- // flipbip_led_set_rgb(instance->context, 255, 0, 0);
- // },
- // true);
- // break;
- // case InputKeyOk:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 10;
- // flipbip_play_bad_bump(instance->context);
- // //flipbip_stop_all_sound(instance->context);
- // flipbip_led_set_rgb(instance->context, 255, 255, 255);
- // },
- // true);
- // break;
- // case InputKeyMAX:
- // break;
- // }
- // } else if (event->type == InputTypePress) {
- // switch(event->key) {
- // case InputKeyUp:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 1;
- // flipbip_play_happy_bump(instance->context);
- // //flipbip_play_input_sound(instance->context);
- // },
- // true);
- // break;
- // case InputKeyDown:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 2;
- // flipbip_play_happy_bump(instance->context);
- // //flipbip_play_input_sound(instance->context);
- // },
- // true);
- // break;
- // case InputKeyLeft:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 3;
- // flipbip_play_happy_bump(instance->context);
- // //flipbip_play_input_sound(instance->context);
- // },
- // true);
- // break;
- // case InputKeyRight:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 4;
- // flipbip_play_happy_bump(instance->context);
- // //flipbip_play_input_sound(instance->context);
- // },
- // true);
- // break;
- // case InputKeyOk:
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // model->screen_text = 5;
- // flipbip_play_happy_bump(instance->context);
- // //flipbip_play_input_sound(instance->context);
- // },
- // true);
- // break;
- // case InputKeyBack:
- // case InputKeyMAX:
- // break;
- // }
- // }
-
- // return true;
- // }
- // void flipbip_scene_2_exit(void* context) {
- // furi_assert(context);
- // //FlipBip* app = context;
- // //flipbip_stop_all_sound(app);
- // //flipbip_led_reset(app);
- // }
- // void flipbip_scene_2_enter(void* context) {
- // furi_assert(context);
- // DOLPHIN_DEED(DolphinDeedPluginStart);
- // }
- // FlipBipScene2* flipbip_scene_2_alloc() {
- // FlipBipScene2* instance = malloc(sizeof(FlipBipScene2));
- // instance->view = view_alloc();
- // view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBipScene2Model));
- // view_set_context(instance->view, instance);
- // view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip_scene_2_draw);
- // view_set_input_callback(instance->view, flipbip_scene_2_input);
- // //view_set_enter_callback(instance->view, flipbip_scene_2_enter);
- // view_set_exit_callback(instance->view, flipbip_scene_2_exit);
- // with_view_model(
- // instance->view,
- // FlipBipScene2Model * model,
- // {
- // flipbip_scene_2_model_init(model);
- // },
- // true);
-
- // return instance;
- // }
- // void flipbip_scene_2_free(FlipBipScene2* instance) {
- // furi_assert(instance);
- // view_free(instance->view);
- // free(instance);
- // }
- // View* flipbip_scene_2_get_view(FlipBipScene2* instance) {
- // furi_assert(instance);
- // return instance->view;
- // }
|