GUI: Icons and IconsAnimation refactoring. Switch assets to new Icon Api (#566)
* GUI: Icons and IconsAnimation refactoring. Switch assets to new Icon API. * Gui: icon and animation draw now do not accept null pointer * Format Sources * Fix no debug build * Furi: stricter checks in memmgr
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
void LfRfidAppSceneDeleteSuccess::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
auto popup = app->view_controller.get<PopupVM>();
|
||||
|
||||
popup->set_icon(0, 2, I_DolphinMafia_115x62);
|
||||
popup->set_icon(0, 2, &I_DolphinMafia_115x62);
|
||||
popup->set_text("Deleted", 83, 19, AlignLeft, AlignBottom);
|
||||
popup->set_context(app);
|
||||
popup->set_callback(LfRfidAppSceneDeleteSuccess::timeout_callback);
|
||||
|
@@ -17,7 +17,7 @@ void LfRfidAppSceneEmulate::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
} else {
|
||||
popup->set_text(string_get_cstr(data_string), 89, 43, AlignCenter, AlignTop);
|
||||
}
|
||||
popup->set_icon(0, 3, I_RFIDDolphinSend_97x61);
|
||||
popup->set_icon(0, 3, &I_RFIDDolphinSend_97x61);
|
||||
|
||||
app->view_controller.switch_to<PopupVM>();
|
||||
app->worker.start_emulate();
|
||||
|
@@ -19,7 +19,7 @@ void LfRfidAppSceneReadSuccess::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
button->set_callback(app, LfRfidAppSceneReadSuccess::more_callback);
|
||||
|
||||
auto icon = container->add<IconElement>();
|
||||
icon->set_icon(3, 12, I_RFIDBigChip_37x36);
|
||||
icon->set_icon(3, 12, &I_RFIDBigChip_37x36);
|
||||
|
||||
auto header = container->add<StringElement>();
|
||||
header->set_text(app->worker.key.get_type_text(), 89, 3, AlignCenter);
|
||||
|
@@ -4,7 +4,7 @@ void LfRfidAppSceneRead::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
auto popup = app->view_controller.get<PopupVM>();
|
||||
|
||||
popup->set_header("Reading\nLF RFID", 89, 34, AlignCenter, AlignTop);
|
||||
popup->set_icon(0, 3, I_RFIDDolphinReceive_97x61);
|
||||
popup->set_icon(0, 3, &I_RFIDDolphinReceive_97x61);
|
||||
|
||||
app->view_controller.switch_to<PopupVM>();
|
||||
app->worker.start_read();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
void LfRfidAppSceneSaveSuccess::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
auto popup = app->view_controller.get<PopupVM>();
|
||||
|
||||
popup->set_icon(32, 5, I_DolphinNice_96x59);
|
||||
popup->set_icon(32, 5, &I_DolphinNice_96x59);
|
||||
popup->set_text("Saved!", 13, 22, AlignLeft, AlignBottom);
|
||||
popup->set_context(app);
|
||||
popup->set_callback(LfRfidAppSceneSaveSuccess::timeout_callback);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
void LfRfidAppSceneWriteSuccess::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
auto popup = app->view_controller.get<PopupVM>();
|
||||
popup->set_header("Successfully\nwritten!", 94, 3, AlignCenter, AlignTop);
|
||||
popup->set_icon(0, 6, I_RFIDDolphinSuccess_108x57);
|
||||
popup->set_icon(0, 6, &I_RFIDDolphinSuccess_108x57);
|
||||
popup->set_context(app);
|
||||
popup->set_callback(LfRfidAppSceneWriteSuccess::timeout_callback);
|
||||
popup->set_timeout(1500);
|
||||
|
@@ -18,7 +18,7 @@ void LfRfidAppSceneWrite::on_enter(LfRfidApp* app, bool need_restore) {
|
||||
} else {
|
||||
popup->set_text(string_get_cstr(data_string), 89, 43, AlignCenter, AlignTop);
|
||||
}
|
||||
popup->set_icon(0, 3, I_RFIDDolphinSend_97x61);
|
||||
popup->set_icon(0, 3, &I_RFIDDolphinSend_97x61);
|
||||
|
||||
app->view_controller.switch_to<PopupVM>();
|
||||
app->worker.start_write();
|
||||
@@ -41,7 +41,7 @@ bool LfRfidAppSceneWrite::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
|
||||
case RfidWorker::WriteResult::NotWritable:
|
||||
if(!card_not_supported) {
|
||||
auto popup = app->view_controller.get<PopupVM>();
|
||||
popup->set_icon(0, 0, I_Empty_1x1);
|
||||
popup->set_icon(0, 0, NULL);
|
||||
popup->set_header("Still trying to write", 64, 7, AlignCenter, AlignTop);
|
||||
popup->set_text(
|
||||
"This card may be protected\nor does not support this\ntype of writing",
|
||||
|
@@ -7,8 +7,8 @@ IconElement::~IconElement() {
|
||||
}
|
||||
|
||||
void IconElement::draw(Canvas* canvas) {
|
||||
if(name != I_Empty_1x1) {
|
||||
canvas_draw_icon_name(canvas, x, y, name);
|
||||
if(icon != NULL) {
|
||||
canvas_draw_icon(canvas, x, y, icon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ bool IconElement::input(InputEvent* event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void IconElement::set_icon(uint8_t _x, uint8_t _y, IconName _name) {
|
||||
void IconElement::set_icon(uint8_t _x, uint8_t _y, const Icon* _icon) {
|
||||
lock_model();
|
||||
name = _name;
|
||||
icon = _icon;
|
||||
x = _x;
|
||||
y = _y;
|
||||
unlock_model(true);
|
||||
|
@@ -8,10 +8,10 @@ public:
|
||||
void draw(Canvas* canvas) final;
|
||||
bool input(InputEvent* event) final;
|
||||
|
||||
void set_icon(uint8_t x = 0, uint8_t y = 0, IconName name = I_Empty_1x1);
|
||||
void set_icon(uint8_t x = 0, uint8_t y = 0, const Icon* icon = NULL);
|
||||
|
||||
private:
|
||||
IconName name = I_Empty_1x1;
|
||||
const Icon* icon = NULL;
|
||||
uint8_t x = 0;
|
||||
uint8_t y = 0;
|
||||
};
|
||||
|
Reference in New Issue
Block a user