Skip to content

Commit 776aa14

Browse files
committed
ui: redesigned extra sidebar widget
1 parent 45b9503 commit 776aa14

12 files changed

+297
-333
lines changed

src/core/encoding/korean.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,7 @@ void encoding_korean_to_utf8(const uint8_t* input, char* output, int output_leng
844844
// multi-byte char
845845
// TODO narrow conversion here to fix or correctly static_cast
846846
const korean_entry key = {input[0] << 8 | input[1]};
847-
const korean_entry* entry = (korean_entry*)bsearch(
848-
&key, codepage_to_utf8, IMAGE_FONT_MULTIBYTE_KOREAN_MAX_CHARS, sizeof(korean_entry), compare_codepage);
847+
const korean_entry* entry = (korean_entry*)bsearch(&key, codepage_to_utf8, IMAGE_FONT_MULTIBYTE_KOREAN_MAX_CHARS, sizeof(korean_entry), compare_codepage);
849848
if (entry && output + 3 <= max_output) {
850849
for (int i = 0; i < 3; i++) {
851850
*output = entry->utf8[i];

src/scripts/common.js

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ var advisor_financial_window = {}
212212
var display_options_window = {}
213213
var sidebar_window_expanded = {}
214214
var sidebar_window_collapsed = {}
215+
var sidebar_window_extra = {}
215216
var info_window_booth = {}
216217

217218
//figures

src/scripts/ui.js

+32
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,38 @@ hold_festival_window = {
850850
}
851851
}
852852

853+
sidebar_window_extra = {
854+
ui : {
855+
background : inner_panel({pos:[0, 480], size:[10, 19]}),
856+
857+
speed_header: text({pos:[11, 485], text:[45, 2], font:FONT_NORMAL_WHITE_ON_DARK}),
858+
speed_current: text({pos:[65, 480 + 28], font:FONT_NORMAL_WHITE_ON_DARK}),
859+
dec_speed : arrowdown({pos:[11, 470 + 30], tiny:false}),
860+
inc_speed : arrowup({pos:[35, 470 + 30], tiny:false}),
861+
862+
unemp_header: text({pos:[11, 480 + 50], text:[68, 135], font:FONT_NORMAL_WHITE_ON_DARK}),
863+
unemp_current: text({pos:[11, 480 + 70], font:FONT_NORMAL_WHITE_ON_DARK}),
864+
865+
population_header: text({pos:[11, 480 + 90], font:FONT_NORMAL_WHITE_ON_DARK}),
866+
population_current: text({pos:[11, 480 + 110]}),
867+
868+
culture_header: text({pos:[11, 480 + 130], font:FONT_NORMAL_WHITE_ON_DARK}),
869+
culture_current: text({pos:[11, 480 + 150]}),
870+
871+
prosperity_header: text({pos:[11, 480 + 170], font:FONT_NORMAL_WHITE_ON_DARK}),
872+
prosperity_current: text({pos:[11, 480 + 190]}),
873+
874+
monument_header: text({pos:[11, 480 + 210], font:FONT_NORMAL_WHITE_ON_DARK}),
875+
monument_current: text({pos:[11, 480 + 230]}),
876+
877+
kingdom_header: text({pos:[11, 480 + 250], font:FONT_NORMAL_WHITE_ON_DARK}),
878+
kingdom_current: text({pos:[11, 480 + 270]}),
879+
}
880+
}
881+
853882
sidebar_window_collapsed = {
883+
extra_block : {pack:PACK_GENERAL, id:121, offset:1},
884+
relief_block : {pack:PACK_GENERAL, id:121, offset:5},
854885
expanded_offset_x: 42,
855886
deceleration_offset_x : 5,
856887
slide_acceleration_millis : 65,
@@ -881,6 +912,7 @@ sidebar_window_collapsed = {
881912

882913
sidebar_window_expanded = {
883914
extra_block : {pack:PACK_GENERAL, id:121, offset:2},
915+
relief_block : {pack:PACK_GENERAL, id:121, offset:4},
884916
extra_block_x : -24,
885917
expanded_offset_x: 186,
886918
deceleration_offset_x : 125,

src/widget/sidebar/common.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ int sidebar_common_get_height() {
1111
return screen_height() - TOP_MENU_HEIGHT;
1212
}
1313

14-
void sidebar_common_draw_relief(int x_offset, int y_offset, image_desc desc, bool is_collapsed) {
14+
void sidebar_common_draw_relief(vec2i offset, image_desc desc) {
1515
painter ctx = game.painter();
16-
// relief images below panel
1716

18-
int image_base = image_group(desc);
19-
int image_offset = desc.id == 121 ? 2 : 1; // GROUP_SIDE_PANEL
17+
int image_id = image_group(desc);
2018
int y_max = screen_height();
2119

22-
while (y_offset < y_max) {
23-
ImageDraw::img_generic(ctx, image_base + image_offset + image_offset + is_collapsed, x_offset, y_offset + 6);
24-
y_offset += 285;
20+
while (offset.y < y_max) {
21+
ImageDraw::img_generic(ctx, image_id, offset.x, offset.y + 6);
22+
offset.y += 285;
2523
}
2624
}

src/widget/sidebar/common.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
#define SIDEBAR_MAIN_SECTION_HEIGHT 450
77

88
int sidebar_common_get_height(void);
9-
void sidebar_common_draw_relief(int x_offset, int y_offset, image_desc desc, bool is_collapsed);
9+
void sidebar_common_draw_relief(vec2i offset, image_desc desc);
1010

src/widget/sidebar/editor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void widget_sidebar_editor_draw_background() {
141141
draw_buttons();
142142
widget_minimap_draw({x_offset + 8, MINIMAP_Y_OFFSET}, 1);
143143
draw_status();
144-
sidebar_common_draw_relief(x_offset, SIDEBAR_MAIN_SECTION_HEIGHT + TOP_MENU_HEIGHT, side_panel, 0);
144+
sidebar_common_draw_relief({ x_offset, SIDEBAR_MAIN_SECTION_HEIGHT + TOP_MENU_HEIGHT }, side_panel);
145145
}
146146

147147
void widget_sidebar_editor_draw_foreground(void) {

src/widget/sidebar/extra.cpp

-272
This file was deleted.

0 commit comments

Comments
 (0)