21
21
#include < algorithm>
22
22
#include < iomanip>
23
23
#include < limits>
24
+ #include < numeric>
24
25
25
26
#include < simplesquirrel/table.hpp>
26
27
@@ -264,10 +265,22 @@ Statistics::draw_endseq_panel(DrawingContext& context, Statistics* best_stats, c
264
265
265
266
int layer = LAYER_GUI + 50 ;
266
267
267
- int box_w = 220 +110 +110 ;
268
- int box_h = 30 +20 +20 +20 ;
269
- int box_x = static_cast <int >((static_cast <int >(context.get_width ()) - box_w) / 2 );
270
- int box_y = static_cast <int >(SCREEN_HEIGHT / 2 ) - box_h;
268
+ const std::vector<int > column_widths = {220 , 110 , 110 };
269
+ const int box_w = std::accumulate (column_widths.begin (), column_widths.end (), 0 );
270
+
271
+ constexpr int row_height = 20 ;
272
+ constexpr int padding_top = 30 ;
273
+ constexpr int padding_bottom = 10 ;
274
+
275
+ int visible_rows = 1 ;
276
+ if (m_preferences.enable_coins ) ++visible_rows;
277
+ if (m_preferences.enable_badguys ) ++visible_rows;
278
+ if (m_preferences.enable_secrets ) ++visible_rows;
279
+
280
+ const int box_h = padding_top + (visible_rows * row_height) + padding_bottom;
281
+
282
+ const int box_x = ((static_cast <int >(context.get_width ()) - box_w) / 2 ) - 10 ;
283
+ const int box_y = static_cast <int >(SCREEN_HEIGHT / 2 ) - box_h;
271
284
272
285
int bd_w = static_cast <int >(backdrop->get_width ());
273
286
int bd_h = static_cast <int >(backdrop->get_height ());
@@ -278,13 +291,13 @@ Statistics::draw_endseq_panel(DrawingContext& context, Statistics* best_stats, c
278
291
float col2_x = col1_x + 200 .0f ;
279
292
float col3_x = col2_x + 130 .0f ;
280
293
281
- float y_offset = 47 .f ;
294
+ float y_offset = 35 .f ;
282
295
if (m_preferences.enable_coins )
283
- y_offset -= 9 .f ;
296
+ y_offset -= 7 .f ;
284
297
if (m_preferences.enable_badguys )
285
- y_offset -= 9 .f ;
298
+ y_offset -= 7 .f ;
286
299
if (m_preferences.enable_secrets )
287
- y_offset -= 9 .f ;
300
+ y_offset -= 7 .f ;
288
301
289
302
float y = static_cast <float >(box_y);
290
303
0 commit comments