2struct macrobuilder2_main_close_button_t;
3struct macrobuilder2_main_header_text_t;
4struct macrobuilder2_main_template_list_t;
5struct macrobuilder2_main_unit_grid_t;
6struct macrobuilder2_main_list_page_left_t;
7struct macrobuilder2_main_list_page_right_t;
8struct macrobuilder2_main_grid_page_left_t;
9struct macrobuilder2_main_grid_page_right_t;
10struct macrobuilder2_main_list_page_number_t;
11struct macrobuilder2_main_grid_page_number_t;
12struct macrobuilder2_main_apply_button_t;
13struct macrobuilder2_main_t;
14struct macrobuilder2_list_item_select_button_t;
15struct macrobuilder2_list_item_delete_button_t;
16struct macrobuilder2_list_item_t;
17struct macrobuilder2_grid_item_unit_icon_t;
18struct macrobuilder2_grid_item_decrease_count_t;
19struct macrobuilder2_grid_item_increase_count_t;
20struct macrobuilder2_grid_item_current_count_t;
21struct macrobuilder2_grid_item_t;
488 auto location_abs = get_absolute_location(state, *
this);
489 if(location_abs.x <= oldx && oldx <
base_data.
size.
x + location_abs.x && location_abs.y <= oldy && oldy <
base_data.
size.
y + location_abs.y) {
491 new_abs_pos.
x += int16_t(x - oldx);
492 new_abs_pos.
y += int16_t(y - oldy);
497 if(state.world.locale_get_native_rtl(state.font_collection.get_current_locale())) {
518 if(name ==
"value") {
519 return (
void*)(&
value);
542 if(name ==
"value") {
543 return (
void*)(&
value);
553 main.set_visible(state,
false);
564 on_lbutton_down(state, 0, 0, mods);
573 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
589 text::single_line_layout sl{
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
text_is_header,
text_scale * 18), 0,
text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
595 internal_layout.contents.clear();
596 internal_layout.number_of_lines = 0;
597 text::single_line_layout sl{ internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(base_data.size.x),
static_cast<int16_t
>(base_data.size.y),
text::make_font_id(state, text_is_header,
text_scale * 18), 0, text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
598 sl.add_text(state, cached_text);
601 if(internal_layout.contents.empty())
return;
603 auto linesz = state.font_collection.line_height(state, fh);
604 if(linesz == 0.0f)
return;
605 auto ycentered = (base_data.size.y - linesz) / 2;
607 for(
auto& t : internal_layout.contents) {
617 on_reset_text(state);
622 if(
values.size() == 0)
return 0;
627 bool lflip = new_page < page && page > 0;
637 state.game_state_updated.store(
true, std::memory_order::release);
640 state.ui_animation.post_update_frame(state);
644 change_page(state, page + ((amount < 0) ? 1 : -1));
651 page = std::clamp(page, 0, max_page());
652 auto fill_count = visible_items.size();
653 auto fill_start = size_t(page) * fill_count;
654 for(
size_t fill_position = 0; fill_position < fill_count; ++fill_position) {
655 if(fill_position + fill_start < values.size()) {
657 visible_items[fill_position]->flags &=
~ui::element_base::is_invisible_mask;
659 visible_items[fill_position]->set_visible(state,
false);
665 int32_t item_y_size = ptr->base_data.size.y;
666 visible_items.push_back(ptr.get());
667 add_child_to_back(std::move(ptr));
668 auto total_rows = int32_t(base_data.size.y) / item_y_size;
669 for(int32_t i = 1; i < total_rows; ++i) {
671 ptrb->base_data.position.y = int16_t(i * item_y_size);
672 visible_items.push_back(ptrb.get());
673 add_child_to_back(std::move(ptrb));
683 if(num_templates >= 8192 * 4)
684 num_templates = 8192 * 4;
685 state.ui_state.templates.resize(num_templates);
688 for(int32_t i = -1; i < int32_t(num_templates); ++i) {
692 values.push_back(-1);
697 if(
values.size() == 0)
return 0;
702 bool lflip = new_page < page && page > 0;
712 state.game_state_updated.store(
true, std::memory_order::release);
715 state.ui_animation.post_update_frame(state);
719 change_page(state, page + ((amount < 0) ? 1 : -1));
726 page = std::clamp(page, 0, max_page());
727 auto fill_count = visible_items.size();
728 auto fill_start = size_t(page) * fill_count;
729 for(
size_t fill_position = 0; fill_position < fill_count; ++fill_position) {
730 if(fill_position + fill_start < values.size()) {
732 visible_items[fill_position]->flags &=
~ui::element_base::is_invisible_mask;
734 visible_items[fill_position]->set_visible(state,
false);
740 int32_t item_y_size = ptr->base_data.size.y;
741 int32_t item_x_size = ptr->base_data.size.x;
742 visible_items.push_back(ptr.get());
743 add_child_to_back(std::move(ptr));
744 auto total_rows = int32_t(base_data.size.y) / item_y_size;
745 auto total_columns = int32_t(base_data.size.x) / item_x_size;
746 for(int32_t i = 0; i < total_rows; ++i) {
747 for(int32_t j = (i == 0 ? 1 : 0); j < total_columns; ++j) {
749 ptrb->base_data.position.y = int16_t(i * item_y_size);
750 ptrb->base_data.position.x = int16_t(j * item_x_size);
751 visible_items.push_back(ptrb.get());
752 add_child_to_back(std::move(ptrb));
757 dcon::unit_type_id
id{ dcon::unit_type_id::value_base_t(i) };
758 if(state.military_definitions.unit_base_definitions[
id].is_land) {
759 values.push_back(
id);
762 while((values.size() % visible_items.size()) != 0) {
763 values.push_back(dcon::unit_type_id{});
766 dcon::unit_type_id
id{ dcon::unit_type_id::value_base_t(i) };
767 if(!state.military_definitions.unit_base_definitions[
id].is_land) {
768 values.push_back(
id);
778 main.template_list->change_page(state,
main.template_list->page - 1);
786 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse, disabled,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
791 if(
main.template_list->values.size() >
main.template_list->visible_items.size()) {
792 element_base::flags &= ~element_base::is_invisible_mask;
794 element_base::flags |= element_base::is_invisible_mask;
807 main.template_list->change_page(state,
main.template_list->page + 1);
815 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse, disabled,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
820 if(
main.template_list->values.size() >
main.template_list->visible_items.size()) {
821 element_base::flags &= ~element_base::is_invisible_mask;
823 element_base::flags |= element_base::is_invisible_mask;
836 main.unit_grid->change_page(state,
main.unit_grid->page - 1);
844 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse, disabled,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
849 if(
main.unit_grid->values.size() >
main.unit_grid->visible_items.size()) {
850 element_base::flags &= ~element_base::is_invisible_mask;
852 element_base::flags |= element_base::is_invisible_mask;
865 main.unit_grid->change_page(state,
main.unit_grid->page + 1);
873 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse, disabled,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
878 if(
main.unit_grid->values.size() >
main.unit_grid->visible_items.size()) {
879 element_base::flags &= ~element_base::is_invisible_mask;
881 element_base::flags |= element_base::is_invisible_mask;
894 text::single_line_layout sl{
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
text_is_header,
text_scale * 18), 0,
text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
901 if(internal_layout.contents.empty())
return;
903 auto linesz = state.font_collection.line_height(state, fh);
904 if(linesz == 0.0f)
return;
905 auto ycentered = (base_data.size.y - linesz) / 2;
907 for(
auto& t : internal_layout.contents) {
914 if(
main.template_list->values.size() >
main.template_list->visible_items.size()) {
915 set_text(state, std::to_string(
main.template_list->page + 1) +
"/" + std::to_string(1 +
main.template_list->max_page()));
930 text::single_line_layout sl{
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
text_is_header,
text_scale * 18), 0,
text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
937 if(internal_layout.contents.empty())
return;
939 auto linesz = state.font_collection.line_height(state, fh);
940 if(linesz == 0.0f)
return;
941 auto ycentered = (base_data.size.y - linesz) / 2;
943 for(
auto& t : internal_layout.contents) {
950 if(
main.unit_grid->values.size() >
main.unit_grid->visible_items.size()) {
951 set_text(state, std::to_string(
main.unit_grid->page + 1) +
"/" + std::to_string(1 +
main.unit_grid->max_page()));
966 if(state.ui_state.current_template < 0 || state.ui_state.current_template >= int32_t(state.ui_state.templates.size()))
969 auto const& t = state.ui_state.templates[state.ui_state.current_template];
973 dcon::unit_type_id
id{ dcon::unit_type_id::value_base_t(i) };
974 if(!state.military_definitions.unit_base_definitions[
id].is_land && t.amounts[i] > 0) {
979 const auto template_province = state.map_state.selected_province;
981 std::vector<dcon::province_id> provinces;
982 state.fill_vector_of_connected_provinces(state.map_state.selected_province, is_land, provinces);
983 if(provinces.empty())
987 std::array<uint8_t, sys::macro_builder_template::max_types> current_distribution;
988 current_distribution.fill(0);
989 state.build_up_to_template_land(
991 state.map_state.selected_province,
997 std::memcpy(rem_to_build, t.amounts,
sizeof(rem_to_build));
999 std::sort(provinces.begin(), provinces.end(), [&state](
auto const a,
auto const b) {
1000 auto ab = state.world.province_get_province_naval_construction_as_province(a);
1001 auto bb = state.world.province_get_province_naval_construction_as_province(b);
1002 int32_t asz = int32_t(ab.end() - ab.begin());
1003 int32_t bsz = int32_t(bb.end() - bb.begin());
1005 return a.index() < b.index();
1009 dcon::unit_type_id utid = dcon::unit_type_id(i);
1010 if(rem_to_build[i] > 0
1011 && is_land == state.military_definitions.unit_base_definitions[utid].is_land
1012 && (state.military_definitions.unit_base_definitions[utid].active || state.world.nation_get_active_unit(state.local_player_nation, utid))) {
1013 for(
const auto prov : provinces) {
1015 if(port_level >= state.military_definitions.unit_base_definitions[utid].min_port_level
1019 if(rem_to_build[i] == 0)
1024 std::sort(provinces.begin(), provinces.end(), [&state](
auto const a,
auto const b) {
1025 auto ab = state.world.province_get_province_naval_construction_as_province(a);
1026 auto bb = state.world.province_get_province_naval_construction_as_province(b);
1027 int32_t asz = int32_t(ab.end() - ab.begin());
1028 int32_t bsz = int32_t(bb.end() - bb.begin());
1030 return a.index() < b.index();
1036 state.game_state_updated.store(
true, std::memory_order::release);
1048 text::single_line_layout sl{
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
text_is_header,
text_scale * 18), 0,
text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
1054 internal_layout.contents.clear();
1055 internal_layout.number_of_lines = 0;
1056 text::single_line_layout sl{ internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(base_data.size.x),
static_cast<int16_t
>(base_data.size.y),
text::make_font_id(state, text_is_header,
text_scale * 18), 0, text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
1057 sl.add_text(state, cached_text);
1060 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse, disabled,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1061 if(internal_layout.contents.empty())
return;
1063 auto linesz = state.font_collection.line_height(state, fh);
1064 if(linesz == 0.0f)
return;
1065 auto ycentered = (base_data.size.y - linesz) / 2;
1067 for(
auto& t : internal_layout.contents) {
1074 disabled = (state.ui_state.current_template == -1 || state.map_state.selected_province == dcon::province_id{} || state.world.province_get_nation_from_province_ownership(state.map_state.selected_province) != state.local_player_nation || state.world.province_get_nation_from_province_control(state.map_state.selected_province) != state.local_player_nation);
1078 on_reset_text(state);
1083 state.ui_state.drag_target =
this;
1090 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1097 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"macrobuilder2::main"));
1098 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
1099 std::vector<sys::aui_pending_bytes> pending_children;
1100 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
1101 base_data.position.x = win_data.x_pos;
1102 base_data.position.y = win_data.y_pos;
1103 base_data.size.x = win_data.x_size;
1104 base_data.size.y = win_data.y_size;
1105 base_data.flags =
uint8_t(win_data.orientation);
1106 texture_key = win_data.texture;
1107 auto name_key = state.lookup_key(
"macrobuilder2::main");
1108 for(
auto ex : state.ui_defs.extensions) {
1109 if(name_key && ex.window == name_key) {
1112 this->add_child_to_back(std::move(ch_res));
1116 while(!pending_children.empty()) {
1117 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
1118 pending_children.pop_back();
1119 if(child_data.name ==
"close_button") {
1120 auto cptr = std::make_unique<macrobuilder2_main_close_button_t>();
1121 cptr->parent =
this;
1122 close_button = cptr.get();
1123 cptr->base_data.position.x = child_data.x_pos;
1124 cptr->base_data.position.y = child_data.y_pos;
1125 cptr->base_data.size.x = child_data.x_size;
1126 cptr->base_data.size.y = child_data.y_size;
1127 cptr->texture_key = child_data.texture;
1128 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
1129 cptr->on_create(state);
1130 this->add_child_to_back(std::move(cptr));
1133 if(child_data.name ==
"header_text") {
1134 auto cptr = std::make_unique<macrobuilder2_main_header_text_t>();
1135 cptr->parent =
this;
1136 header_text = cptr.get();
1137 cptr->base_data.position.x = child_data.x_pos;
1138 cptr->base_data.position.y = child_data.y_pos;
1139 cptr->base_data.size.x = child_data.x_size;
1140 cptr->base_data.size.y = child_data.y_size;
1141 cptr->text_key = state.lookup_key(child_data.text_key);
1142 cptr->text_scale = child_data.text_scale;
1143 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
1144 cptr->text_alignment = child_data.text_alignment;
1145 cptr->text_color = child_data.text_color;
1146 cptr->on_create(state);
1147 this->add_child_to_back(std::move(cptr));
1150 if(child_data.name ==
"template_list") {
1151 auto cptr = std::make_unique<macrobuilder2_main_template_list_t>();
1152 cptr->parent =
this;
1153 template_list = cptr.get();
1154 cptr->base_data.position.x = child_data.x_pos;
1155 cptr->base_data.position.y = child_data.y_pos;
1156 cptr->base_data.size.x = child_data.x_size;
1157 cptr->base_data.size.y = child_data.y_size;
1158 cptr->on_create(state);
1159 this->add_child_to_back(std::move(cptr));
1162 if(child_data.name ==
"unit_grid") {
1163 auto cptr = std::make_unique<macrobuilder2_main_unit_grid_t>();
1164 cptr->parent =
this;
1165 unit_grid = cptr.get();
1166 cptr->base_data.position.x = child_data.x_pos;
1167 cptr->base_data.position.y = child_data.y_pos;
1168 cptr->base_data.size.x = child_data.x_size;
1169 cptr->base_data.size.y = child_data.y_size;
1170 cptr->on_create(state);
1171 this->add_child_to_back(std::move(cptr));
1174 if(child_data.name ==
"list_page_left") {
1175 auto cptr = std::make_unique<macrobuilder2_main_list_page_left_t>();
1176 cptr->parent =
this;
1177 list_page_left = cptr.get();
1178 cptr->base_data.position.x = child_data.x_pos;
1179 cptr->base_data.position.y = child_data.y_pos;
1180 cptr->base_data.size.x = child_data.x_size;
1181 cptr->base_data.size.y = child_data.y_size;
1183 cptr->texture_key = child_data.texture;
1184 cptr->on_create(state);
1185 this->add_child_to_back(std::move(cptr));
1188 if(child_data.name ==
"list_page_right") {
1189 auto cptr = std::make_unique<macrobuilder2_main_list_page_right_t>();
1190 cptr->parent =
this;
1191 list_page_right = cptr.get();
1192 cptr->base_data.position.x = child_data.x_pos;
1193 cptr->base_data.position.y = child_data.y_pos;
1194 cptr->base_data.size.x = child_data.x_size;
1195 cptr->base_data.size.y = child_data.y_size;
1197 cptr->texture_key = child_data.texture;
1198 cptr->on_create(state);
1199 this->add_child_to_back(std::move(cptr));
1202 if(child_data.name ==
"grid_page_left") {
1203 auto cptr = std::make_unique<macrobuilder2_main_grid_page_left_t>();
1204 cptr->parent =
this;
1205 grid_page_left = cptr.get();
1206 cptr->base_data.position.x = child_data.x_pos;
1207 cptr->base_data.position.y = child_data.y_pos;
1208 cptr->base_data.size.x = child_data.x_size;
1209 cptr->base_data.size.y = child_data.y_size;
1211 cptr->texture_key = child_data.texture;
1212 cptr->on_create(state);
1213 this->add_child_to_back(std::move(cptr));
1216 if(child_data.name ==
"grid_page_right") {
1217 auto cptr = std::make_unique<macrobuilder2_main_grid_page_right_t>();
1218 cptr->parent =
this;
1219 grid_page_right = cptr.get();
1220 cptr->base_data.position.x = child_data.x_pos;
1221 cptr->base_data.position.y = child_data.y_pos;
1222 cptr->base_data.size.x = child_data.x_size;
1223 cptr->base_data.size.y = child_data.y_size;
1225 cptr->texture_key = child_data.texture;
1226 cptr->on_create(state);
1227 this->add_child_to_back(std::move(cptr));
1230 if(child_data.name ==
"list_page_number") {
1231 auto cptr = std::make_unique<macrobuilder2_main_list_page_number_t>();
1232 cptr->parent =
this;
1233 list_page_number = cptr.get();
1234 cptr->base_data.position.x = child_data.x_pos;
1235 cptr->base_data.position.y = child_data.y_pos;
1236 cptr->base_data.size.x = child_data.x_size;
1237 cptr->base_data.size.y = child_data.y_size;
1238 cptr->text_scale = child_data.text_scale;
1239 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
1240 cptr->text_alignment = child_data.text_alignment;
1241 cptr->text_color = child_data.text_color;
1242 cptr->on_create(state);
1243 this->add_child_to_back(std::move(cptr));
1246 if(child_data.name ==
"grid_page_number") {
1247 auto cptr = std::make_unique<macrobuilder2_main_grid_page_number_t>();
1248 cptr->parent =
this;
1249 grid_page_number = cptr.get();
1250 cptr->base_data.position.x = child_data.x_pos;
1251 cptr->base_data.position.y = child_data.y_pos;
1252 cptr->base_data.size.x = child_data.x_size;
1253 cptr->base_data.size.y = child_data.y_size;
1254 cptr->text_scale = child_data.text_scale;
1255 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
1256 cptr->text_alignment = child_data.text_alignment;
1257 cptr->text_color = child_data.text_color;
1258 cptr->on_create(state);
1259 this->add_child_to_back(std::move(cptr));
1262 if(child_data.name ==
"apply_button") {
1263 auto cptr = std::make_unique<macrobuilder2_main_apply_button_t>();
1264 cptr->parent =
this;
1265 apply_button = cptr.get();
1266 cptr->base_data.position.x = child_data.x_pos;
1267 cptr->base_data.position.y = child_data.y_pos;
1268 cptr->base_data.size.x = child_data.x_size;
1269 cptr->base_data.size.y = child_data.y_size;
1270 cptr->texture_key = child_data.texture;
1271 cptr->text_key = state.lookup_key(child_data.text_key);
1272 cptr->text_scale = child_data.text_scale;
1273 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
1274 cptr->text_alignment = child_data.text_alignment;
1275 cptr->text_color = child_data.text_color;
1276 cptr->on_create(state);
1277 this->add_child_to_back(std::move(cptr));
1285 auto ptr = std::make_unique<macrobuilder2_main_t>();
1286 ptr->on_create(state);
1294 state.ui_state.current_template = list_item.
value;
1295 state.game_state_updated.store(
true, std::memory_order::release);
1307 text::single_line_layout sl{
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
text_is_header,
text_scale * 18), 0,
text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
1315 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, alt_background_texture, alt_texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1317 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1318 if(internal_layout.contents.empty())
return;
1320 auto linesz = state.font_collection.line_height(state, fh);
1321 if(linesz == 0.0f)
return;
1322 auto ycentered = (base_data.size.y - linesz) / 2;
1324 for(
auto& t : internal_layout.contents) {
1332 if(list_item.
value == state.ui_state.current_template) {
1339 if(list_item.
value == -1) {
1343 if(list_item.
value >= int32_t(state.ui_state.templates.size()))
1346 std::string accumulated;
1348 auto amount = state.ui_state.templates[list_item.
value].amounts[i];
1352 accumulated += std::to_string(amount);
1353 accumulated +=
"@*" + std::string(i < 10 ?
"0" :
"") + std::to_string(i);
1355 set_text(state, accumulated);
1367 if(list_item.
value != -1) {
1368 if(list_item.
value == state.ui_state.current_template) {
1369 state.ui_state.current_template = -1;
1371 state.ui_state.templates.erase(state.ui_state.templates.begin() + list_item.
value);
1372 main.template_list->values.pop_back();
1373 state.game_state_updated.store(
true, std::memory_order::release);
1385 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1391 if(list_item.
value != -1) {
1392 element_base::flags &= ~element_base::is_invisible_mask;
1394 element_base::flags |= element_base::is_invisible_mask;
1408 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"macrobuilder2::list_item"));
1409 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
1410 std::vector<sys::aui_pending_bytes> pending_children;
1411 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
1412 base_data.position.x = win_data.x_pos;
1413 base_data.position.y = win_data.y_pos;
1414 base_data.size.x = win_data.x_size;
1415 base_data.size.y = win_data.y_size;
1416 base_data.flags =
uint8_t(win_data.orientation);
1417 auto name_key = state.lookup_key(
"macrobuilder2::list_item");
1418 for(
auto ex : state.ui_defs.extensions) {
1419 if(name_key && ex.window == name_key) {
1422 this->add_child_to_back(std::move(ch_res));
1426 while(!pending_children.empty()) {
1427 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
1428 pending_children.pop_back();
1429 if(child_data.name ==
"select_button") {
1430 auto cptr = std::make_unique<macrobuilder2_list_item_select_button_t>();
1431 cptr->parent =
this;
1432 select_button = cptr.get();
1433 cptr->base_data.position.x = child_data.x_pos;
1434 cptr->base_data.position.y = child_data.y_pos;
1435 cptr->base_data.size.x = child_data.x_size;
1436 cptr->base_data.size.y = child_data.y_size;
1437 cptr->texture_key = child_data.texture;
1438 cptr->alt_texture_key = child_data.alt_texture;
1439 cptr->text_scale = child_data.text_scale;
1440 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
1441 cptr->text_alignment = child_data.text_alignment;
1442 cptr->text_color = child_data.text_color;
1443 cptr->on_create(state);
1444 this->add_child_to_back(std::move(cptr));
1447 if(child_data.name ==
"delete_button") {
1448 auto cptr = std::make_unique<macrobuilder2_list_item_delete_button_t>();
1449 cptr->parent =
this;
1450 delete_button = cptr.get();
1451 cptr->base_data.position.x = child_data.x_pos;
1452 cptr->base_data.position.y = child_data.y_pos;
1453 cptr->base_data.size.x = child_data.x_size;
1454 cptr->base_data.size.y = child_data.y_size;
1456 cptr->texture_key = child_data.texture;
1457 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
1458 cptr->on_create(state);
1459 this->add_child_to_back(std::move(cptr));
1467 auto ptr = std::make_unique<macrobuilder2_list_item_t>();
1468 ptr->on_create(state);
1481 text::add_line(state, contents, state.military_definitions.unit_base_definitions[grid_item.
value].name);
1483 auto utid = grid_item.
value;
1484 auto is_land = state.military_definitions.unit_base_definitions[utid].is_land;
1486 float reconnaissance_or_fire_range = 0.f;
1487 float siege_or_torpedo_attack = 0.f;
1488 float attack_or_gun_power = 0.f;
1489 float defence_or_hull = 0.f;
1490 float discipline_or_evasion = std::numeric_limits<float>::max();
1491 float support = 0.f;
1492 float supply_consumption = 0.f;
1493 float maximum_speed = std::numeric_limits<float>::max();
1494 float maneuver = std::numeric_limits<float>::max();
1495 int32_t supply_consumption_score = 0;
1496 bool warn_overseas =
false;
1497 bool warn_culture =
false;
1498 bool warn_active =
false;
1502 if(!state.military_definitions.unit_base_definitions[utid].active && !state.world.nation_get_active_unit(state.local_player_nation, utid))
1504 if(state.military_definitions.unit_base_definitions[utid].primary_culture)
1505 warn_culture =
true;
1506 if(!state.military_definitions.unit_base_definitions[utid].can_build_overseas)
1507 warn_overseas =
true;
1509 reconnaissance_or_fire_range += state.world.nation_get_unit_stats(state.local_player_nation, utid).reconnaissance_or_fire_range;
1510 siege_or_torpedo_attack += state.world.nation_get_unit_stats(state.local_player_nation, utid).siege_or_torpedo_attack;
1511 attack_or_gun_power += state.world.nation_get_unit_stats(state.local_player_nation, utid).attack_or_gun_power;
1512 defence_or_hull += state.world.nation_get_unit_stats(state.local_player_nation, utid).defence_or_hull ;
1513 discipline_or_evasion += std::min(discipline_or_evasion, state.world.nation_get_unit_stats(state.local_player_nation, utid).discipline_or_evasion);
1514 supply_consumption += state.world.nation_get_unit_stats(state.local_player_nation, utid).supply_consumption;
1515 maximum_speed = std::min(maximum_speed, state.world.nation_get_unit_stats(state.local_player_nation, utid).maximum_speed);
1517 support += state.world.nation_get_unit_stats(state.local_player_nation, utid).support ;
1518 maneuver += std::min(maneuver, state.military_definitions.unit_base_definitions[utid].maneuver);
1520 supply_consumption_score += state.military_definitions.unit_base_definitions[utid].supply_consumption_score;
1531 if(maximum_speed == std::numeric_limits<float>::max()) maximum_speed = 0.f;
1532 if(discipline_or_evasion == std::numeric_limits<float>::max()) discipline_or_evasion = 0.f;
1533 if(maneuver == std::numeric_limits<float>::max()) maneuver = 0.f;
1535 if(reconnaissance_or_fire_range > 0.f) {
1538 if(siege_or_torpedo_attack > 0.f) {
1553 if(siege_or_torpedo_attack > 0.f) {
1558 if(discipline_or_evasion > 0.f) {
1567 if(background_gid) {
1568 auto& gfx_def = state.ui_defs.gfx[background_gid];
1569 if(gfx_def.primary_texture_handle) {
1571 ogl::render_bordered_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
false), gfx_def.type_dependent,
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_texture_handle(state, gfx_def.primary_texture_handle, gfx_def.is_partially_transparent()), base_data.get_rotation(), gfx_def.is_vertically_flipped(), state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1572 }
else if(gfx_def.number_of_frames > 1) {
1573 ogl::render_subsprite(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
false), frame, gfx_def.number_of_frames,
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_texture_handle(state, gfx_def.primary_texture_handle, gfx_def.is_partially_transparent()), base_data.get_rotation(), gfx_def.is_vertically_flipped(), state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1575 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_texture_handle(state, gfx_def.primary_texture_handle, gfx_def.is_partially_transparent()), base_data.get_rotation(), gfx_def.is_vertically_flipped(), state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1584 if(!grid_item.
value)
1586 frame = state.military_definitions.unit_base_definitions[grid_item.
value].icon - 1;
1590 if(
auto it = state.ui_state.gfx_by_name.find(state.lookup_key(gfx_key)); it != state.ui_state.gfx_by_name.end()) {
1591 background_gid = it->second;
1603 if(state.ui_state.current_template != -1) {
1604 auto& v = state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()];
1605 v =
uint8_t(std::clamp(v - 10, 0, 255));
1607 state.game_state_updated.store(
true, std::memory_order::release);
1612 if(state.ui_state.current_template != -1) {
1613 auto& v = state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()];
1614 v =
uint8_t(std::clamp(v - 1, 0, 255));
1616 state.game_state_updated.store(
true, std::memory_order::release);
1624 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse, disabled,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1630 if(!grid_item.
value)
1633 if(state.ui_state.current_template == -1 || state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()] == 0) {
1651 if(state.ui_state.current_template != -1) {
1652 auto& v = state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()];
1653 v =
uint8_t(std::clamp(v + 10, 0, 255));
1655 state.ui_state.templates.emplace_back();
1656 state.ui_state.current_template = int32_t(state.ui_state.templates.size() - 1);
1657 main.template_list->values.push_back(int32_t(state.ui_state.templates.size() - 1));
1658 auto& v = state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()];
1659 v =
uint8_t(std::clamp(v + 10, 0, 255));
1660 main.template_list->page =
main.template_list->max_page();
1662 bool is_land = state.military_definitions.unit_base_definitions[grid_item.
value].is_land;
1664 dcon::unit_type_id
id{ dcon::unit_type_id::value_base_t(i) };
1665 if(is_land != state.military_definitions.unit_base_definitions[
id].is_land) {
1666 state.ui_state.templates[state.ui_state.current_template].amounts[i] = 0;
1669 state.game_state_updated.store(
true, std::memory_order::release);
1674 if(state.ui_state.current_template != -1) {
1675 auto& v = state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()];
1676 v =
uint8_t(std::clamp(v + 1, 0, 255));
1678 state.ui_state.templates.emplace_back();
1679 state.ui_state.current_template = int32_t(state.ui_state.templates.size() - 1);
1680 main.template_list->values.push_back(int32_t(state.ui_state.templates.size() - 1));
1681 auto& v = state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()];
1682 v =
uint8_t(std::clamp(v + 1, 0, 255));
1683 main.template_list->page =
main.template_list->max_page();
1685 bool is_land = state.military_definitions.unit_base_definitions[grid_item.
value].is_land;
1687 dcon::unit_type_id
id{ dcon::unit_type_id::value_base_t(i) };
1688 if(is_land != state.military_definitions.unit_base_definitions[
id].is_land) {
1689 state.ui_state.templates[state.ui_state.current_template].amounts[i] = 0;
1692 state.game_state_updated.store(
true, std::memory_order::release);
1700 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse, disabled,
true),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1717 text::single_line_layout sl{
internal_layout,
text::layout_parameters{ 0, 0,
static_cast<int16_t
>(
base_data.
size.
x),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
text_is_header,
text_scale * 18), 0,
text_alignment,
text::text_color::black,
true,
true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ?
text::layout_base::rtl_status::rtl :
text::layout_base::rtl_status::ltr };
1724 if(internal_layout.contents.empty())
return;
1726 auto linesz = state.font_collection.line_height(state, fh);
1727 if(linesz == 0.0f)
return;
1728 auto ycentered = (base_data.size.y - linesz) / 2;
1730 for(
auto& t : internal_layout.contents) {
1738 if(!grid_item.
value)
1740 if(state.ui_state.current_template != -1) {
1741 auto& v = state.ui_state.templates[state.ui_state.current_template].amounts[grid_item.
value.index()];
1742 set_text(state, std::to_string(v));
1744 set_text(state,
"0");
1759 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1765 flags |= element_base::is_invisible_mask;
1770 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"macrobuilder2::grid_item"));
1771 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
1772 std::vector<sys::aui_pending_bytes> pending_children;
1773 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
1774 base_data.position.x = win_data.x_pos;
1775 base_data.position.y = win_data.y_pos;
1776 base_data.size.x = win_data.x_size;
1777 base_data.size.y = win_data.y_size;
1778 base_data.flags =
uint8_t(win_data.orientation);
1779 texture_key = win_data.texture;
1781 auto name_key = state.lookup_key(
"macrobuilder2::grid_item");
1782 for(
auto ex : state.ui_defs.extensions) {
1783 if(name_key && ex.window == name_key) {
1786 this->add_child_to_back(std::move(ch_res));
1790 while(!pending_children.empty()) {
1791 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
1792 pending_children.pop_back();
1793 if(child_data.name ==
"unit_icon") {
1794 auto cptr = std::make_unique<macrobuilder2_grid_item_unit_icon_t>();
1795 cptr->parent =
this;
1796 unit_icon = cptr.get();
1797 cptr->base_data.position.x = child_data.x_pos;
1798 cptr->base_data.position.y = child_data.y_pos;
1799 cptr->base_data.size.x = child_data.x_size;
1800 cptr->base_data.size.y = child_data.y_size;
1801 cptr->gfx_key = child_data.texture;
1802 cptr->on_create(state);
1803 this->add_child_to_back(std::move(cptr));
1806 if(child_data.name ==
"decrease_count") {
1807 auto cptr = std::make_unique<macrobuilder2_grid_item_decrease_count_t>();
1808 cptr->parent =
this;
1809 decrease_count = cptr.get();
1810 cptr->base_data.position.x = child_data.x_pos;
1811 cptr->base_data.position.y = child_data.y_pos;
1812 cptr->base_data.size.x = child_data.x_size;
1813 cptr->base_data.size.y = child_data.y_size;
1814 cptr->texture_key = child_data.texture;
1815 cptr->on_create(state);
1816 this->add_child_to_back(std::move(cptr));
1819 if(child_data.name ==
"increase_count") {
1820 auto cptr = std::make_unique<macrobuilder2_grid_item_increase_count_t>();
1821 cptr->parent =
this;
1822 increase_count = cptr.get();
1823 cptr->base_data.position.x = child_data.x_pos;
1824 cptr->base_data.position.y = child_data.y_pos;
1825 cptr->base_data.size.x = child_data.x_size;
1826 cptr->base_data.size.y = child_data.y_size;
1827 cptr->texture_key = child_data.texture;
1828 cptr->on_create(state);
1829 this->add_child_to_back(std::move(cptr));
1832 if(child_data.name ==
"current_count") {
1833 auto cptr = std::make_unique<macrobuilder2_grid_item_current_count_t>();
1834 cptr->parent =
this;
1835 current_count = cptr.get();
1836 cptr->base_data.position.x = child_data.x_pos;
1837 cptr->base_data.position.y = child_data.y_pos;
1838 cptr->base_data.size.x = child_data.x_size;
1839 cptr->base_data.size.y = child_data.y_size;
1840 cptr->text_scale = child_data.text_scale;
1841 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
1842 cptr->text_alignment = child_data.text_alignment;
1843 cptr->text_color = child_data.text_color;
1844 cptr->on_create(state);
1845 this->add_child_to_back(std::move(cptr));
1853 auto ptr = std::make_unique<macrobuilder2_grid_item_t>();
1854 ptr->on_create(state);
void impl_on_update(sys::state &state) noexcept override
static constexpr uint8_t wants_update_when_hidden_mask
int main(int argc, char *argv[])
aui_element_data read_child_bytes(char const *bytes, size_t size)
aui_window_data read_window_bytes(char const *bytes, size_t size, std::vector< sys::aui_pending_bytes > &children_out)
std::unique_ptr< ui::element_base > make_macrobuilder2_list_item(sys::state &state)
std::unique_ptr< ui::element_base > make_macrobuilder2_main(sys::state &state)
std::unique_ptr< ui::element_base > make_macrobuilder2_grid_item(sys::state &state)
void start_naval_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::unit_type_id type, dcon::province_id template_province)
bool can_start_naval_unit_construction(sys::state &state, dcon::nation_id source, dcon::province_id location, dcon::unit_type_id type, dcon::province_id template_province)
GLuint get_late_load_texture_handle(sys::state &state, dcon::texture_id &id, std::string_view asset_name)
void render_bordered_rect(sys::state const &state, color_modification enabled, float border_size, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
void render_subsprite(sys::state const &state, color_modification enabled, int frame, int total_frames, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
void render_textured_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
void write_file(directory const &dir, native_string_view file_name, char const *file_data, uint32_t file_size)
directory get_or_create_templates_directory()
std::optional< file > open_file(directory const &dir, native_string_view file_name)
file_contents view_contents(file const &f)
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
audio_instance & get_click_sound(sys::state &state)
std::string format_float(float num, size_t digits)
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
void add_line_break_to_layout(sys::state &state, columnar_layout &dest)
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
uint16_t make_font_id(sys::state &state, bool as_header, float target_line_size)
std::string format_percentage(float num, size_t digits)
int32_t ui_height(sys::state const &state)
int32_t ui_width(sys::state const &state)
void render_text_chunk(sys::state &state, text::text_chunk t, float x, float baseline_y, uint16_t font_id, ogl::color3f text_color, ogl::color_modification cmod)
xy_pair get_absolute_location(sys::state &state, element_base const &node)
ogl::color3f get_text_color(sys::state &state, text::text_color text_color)
ogl::color_modification get_color_modification(bool is_under_mouse, bool is_disabled, bool is_interactable)
std::unique_ptr< element_base > make_element_immediate(sys::state &state, dcon::gui_def_id id)
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
text::text_color text_color
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
text::alignment text_alignment
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_reset_text(sys::state &state) noexcept override
text::layout internal_layout
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
dcon::texture_id background_texture
std::string_view texture_key
void render(sys::state &state, int32_t x, int32_t y) noexcept override
std::string_view texture_key
void on_update(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
dcon::texture_id background_texture
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
macrobuilder2_grid_item_decrease_count_t * decrease_count
dcon::texture_id background_texture
void render(sys::state &state, int32_t x, int32_t y) noexcept override
macrobuilder2_grid_item_unit_icon_t * unit_icon
void on_create(sys::state &state) noexcept override
std::string_view texture_key
void * get_by_name(sys::state &state, std::string_view name) noexcept override
macrobuilder2_grid_item_increase_count_t * increase_count
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
macrobuilder2_grid_item_current_count_t * current_count
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
dcon::gfx_object_id background_gid
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
macrobuilder2_list_item_delete_button_t * delete_button
void on_create(sys::state &state) noexcept override
macrobuilder2_list_item_select_button_t * select_button
void on_update(sys::state &state) noexcept override
void * get_by_name(sys::state &state, std::string_view name) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
std::string_view texture_key
dcon::texture_id background_texture
text::layout internal_layout
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::text_color text_color
void on_reset_text(sys::state &state) noexcept override
text::alignment text_alignment
dcon::text_key tooltip_key
ui::message_result on_key_down(sys::state &state, sys::virtual_key key, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
std::string_view texture_key
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
dcon::texture_id background_texture
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
dcon::texture_id background_texture
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
std::string_view texture_key
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout internal_layout
void on_reset_text(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
text::alignment text_alignment
text::text_color text_color
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
dcon::texture_id background_texture
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
std::string_view texture_key
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout internal_layout
text::text_color text_color
void on_create(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
text::alignment text_alignment
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
std::string_view texture_key
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
dcon::texture_id background_texture
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout internal_layout
void set_text(sys::state &state, std::string const &new_text)
text::text_color text_color
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
text::alignment text_alignment
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
std::string_view texture_key
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
dcon::texture_id background_texture
std::string_view texture_key
macrobuilder2_main_grid_page_left_t * grid_page_left
dcon::texture_id background_texture
void on_update(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
macrobuilder2_main_template_list_t * template_list
macrobuilder2_main_apply_button_t * apply_button
macrobuilder2_main_grid_page_number_t * grid_page_number
void on_drag(sys::state &state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
macrobuilder2_main_unit_grid_t * unit_grid
macrobuilder2_main_close_button_t * close_button
macrobuilder2_main_list_page_number_t * list_page_number
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
macrobuilder2_main_grid_page_right_t * grid_page_right
macrobuilder2_main_header_text_t * header_text
macrobuilder2_main_list_page_right_t * list_page_right
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
macrobuilder2_main_list_page_left_t * list_page_left
std::vector< int32_t > values
void change_page(sys::state &state, int32_t new_page)
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
std::vector< ui::element_base * > visible_items
void on_update(sys::state &state) noexcept override
ui::message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
void change_page(sys::state &state, int32_t new_page)
std::vector< dcon::unit_type_id > values
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
std::vector< ui::element_base * > visible_items
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
static constexpr uint32_t max_types
Holds important data about the game world, state, and other data regarding windowing,...
std::vector< text_chunk > contents