mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-10-24 00:13:40 -05:00
Formatting (again)
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
#include "string"
|
||||
#include <tonc.h>
|
||||
|
||||
Button_Menu::Button_Menu(int nRows, int nColumns, int nButton_width,
|
||||
int nButton_height, bool enable_cancel)
|
||||
Button_Menu::Button_Menu(
|
||||
int nRows, int nColumns, int nButton_width, int nButton_height, bool enable_cancel)
|
||||
{
|
||||
columns = nColumns;
|
||||
rows = nRows;
|
||||
@@ -62,8 +62,7 @@ int Button_Menu::button_main()
|
||||
}
|
||||
}
|
||||
else if (key_hit(KEY_LEFT) &&
|
||||
((curr_x > 0) || ((curr_x == 0) && (curr_y == rows - 1) &&
|
||||
(offset_value > 0))))
|
||||
((curr_x > 0) || ((curr_x == 0) && (curr_y == rows - 1) && (offset_value > 0))))
|
||||
{
|
||||
if (curr_x == 0 && offset_value > 0)
|
||||
{
|
||||
@@ -128,31 +127,23 @@ void Button_Menu::hide_buttons()
|
||||
|
||||
void Button_Menu::organize_buttons()
|
||||
{
|
||||
// Total space, minus the space taken up by the buttons, divided by the
|
||||
// spaces between the buttons.
|
||||
int vertical_space =
|
||||
((y_max - y_min) - (rows * button_height)) / (rows + 1);
|
||||
int horizontal_space =
|
||||
((x_max - x_min) - (columns * button_width)) / (columns + 1);
|
||||
bottom_offset = ((horizontal_space + button_width) *
|
||||
((rows * columns) - button_vector.size()) / 2);
|
||||
// Total space, minus the space taken up by the buttons, divided by the spaces between the
|
||||
// buttons.
|
||||
int vertical_space = ((y_max - y_min) - (rows * button_height)) / (rows + 1);
|
||||
int horizontal_space = ((x_max - x_min) - (columns * button_width)) / (columns + 1);
|
||||
bottom_offset =
|
||||
((horizontal_space + button_width) * ((rows * columns) - button_vector.size()) / 2);
|
||||
offset_value = (rows * columns) - button_vector.size();
|
||||
for (unsigned int i = 0; i < button_vector.size(); i++)
|
||||
{
|
||||
button_vector.at(i).set_location(
|
||||
((horizontal_space + button_width) * get_x_from_pos(i)) +
|
||||
horizontal_space + x_min +
|
||||
(get_y_from_pos(i) == (unsigned int)(rows - 1) ? bottom_offset
|
||||
: 0),
|
||||
((vertical_space + button_height) * get_y_from_pos(i)) +
|
||||
vertical_space + y_min);
|
||||
((horizontal_space + button_width) * get_x_from_pos(i)) + horizontal_space + x_min +
|
||||
(get_y_from_pos(i) == (unsigned int)(rows - 1) ? bottom_offset : 0),
|
||||
((vertical_space + button_height) * get_y_from_pos(i)) + vertical_space + y_min);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int Button_Menu::get_pos_from_xy(int nX, int nY)
|
||||
{
|
||||
return (nY * columns) + nX;
|
||||
}
|
||||
unsigned int Button_Menu::get_pos_from_xy(int nX, int nY) { return (nY * columns) + nX; }
|
||||
|
||||
unsigned int Button_Menu::get_x_from_pos(int nPos) { return (nPos % columns); }
|
||||
|
||||
@@ -164,9 +155,6 @@ void Button_Menu::set_rows_and_columns(int nRows, int nColumns)
|
||||
columns = nColumns;
|
||||
}
|
||||
|
||||
void Button_Menu::set_bottom_row_offset(int nBottom_offset)
|
||||
{
|
||||
bottom_offset = nBottom_offset;
|
||||
}
|
||||
void Button_Menu::set_bottom_row_offset(int nBottom_offset) { bottom_offset = nBottom_offset; }
|
||||
|
||||
void Button_Menu::clear_vector() { button_vector.clear(); }
|
||||
Reference in New Issue
Block a user