|
5 | 5 | #include "Snake.h" |
6 | 6 |
|
7 | 7 | #include <inttypes.h> |
8 | | -#include <tt_hal.h> |
9 | 8 | #include <tt_lvgl_toolbar.h> |
10 | 9 | #include <tt_app_alertdialog.h> |
11 | 10 | #include <tt_app_selectiondialog.h> |
12 | 11 | #include <tt_preferences.h> |
| 12 | + |
13 | 13 | #include <TactilityCpp/LvglLock.h> |
14 | 14 |
|
| 15 | +#include <tactility/lvgl_module.h> |
| 16 | + |
15 | 17 | constexpr auto* TAG = "Snake"; |
16 | 18 |
|
17 | 19 | // Preferences keys for high scores (one per difficulty) |
@@ -40,8 +42,8 @@ static constexpr int32_t SELECTION_HELL = 4; |
40 | 42 | // Hell uses same size as Hard but with wall collision enabled |
41 | 43 | static const uint16_t difficultySizes[DIFFICULTY_COUNT] = { SNAKE_CELL_LARGE, SNAKE_CELL_MEDIUM, SNAKE_CELL_SMALL, SNAKE_CELL_SMALL }; |
42 | 44 |
|
43 | | -static int getToolbarHeight(UiScale uiScale) { |
44 | | - if (uiScale == UiScale::UiScaleSmallest) { |
| 45 | +static int getToolbarHeight(UiDensity density) { |
| 46 | + if (density == LVGL_UI_DENSITY_COMPACT) { |
45 | 47 | return 22; |
46 | 48 | } else { |
47 | 49 | return 40; |
@@ -201,10 +203,10 @@ void Snake::createGame(lv_obj_t* parent, uint16_t cell_size, bool wallCollision, |
201 | 203 | lv_obj_set_style_bg_opa(newGameWrapper, 0, LV_STATE_DEFAULT); |
202 | 204 |
|
203 | 205 | // Create new game button |
204 | | - auto ui_scale = tt_hal_configuration_get_ui_scale(); |
205 | | - auto toolbar_height = getToolbarHeight(ui_scale); |
| 206 | + auto ui_density = lvgl_get_ui_density(); |
| 207 | + auto toolbar_height = getToolbarHeight(ui_density); |
206 | 208 | lv_obj_t* newGameBtn = lv_btn_create(newGameWrapper); |
207 | | - if (ui_scale == UiScale::UiScaleSmallest) { |
| 209 | + if (ui_density == LVGL_UI_DENSITY_COMPACT) { |
208 | 210 | lv_obj_set_size(newGameBtn, toolbar_height - 8, toolbar_height - 8); |
209 | 211 | } else { |
210 | 212 | lv_obj_set_size(newGameBtn, toolbar_height - 6, toolbar_height - 6); |
|
0 commit comments