2struct budgetwindow_main_close_button_t;
3struct budgetwindow_main_title_t;
4struct budgetwindow_main_income_label_t;
5struct budgetwindow_main_income_amount_t;
6struct budgetwindow_main_income_page_left_t;
7struct budgetwindow_main_income_page_right_t;
8struct budgetwindow_main_income_page_number_t;
9struct budgetwindow_main_income_table_t;
10struct budgetwindow_main_expenses_page_left_t;
11struct budgetwindow_main_expenses_page_number_t;
12struct budgetwindow_main_expenses_page_right_t;
13struct budgetwindow_main_expenses_label_t;
14struct budgetwindow_main_expenses_amount_t;
15struct budgetwindow_main_expenses_table_t;
16struct budgetwindow_main_admin_eff1_t;
17struct budgetwindow_main_admin_eff2_t;
18struct budgetwindow_main_admin_eff_amount_t;
19struct budgetwindow_main_welfare_label_t;
20struct budgetwindow_main_chart_max_a_t;
21struct budgetwindow_main_chart_min_t;
22struct budgetwindow_main_chart_max_b_t;
23struct budgetwindow_main_chart_poplabel_t;
24struct budgetwindow_main_chart_needslabel_t;
25struct budgetwindow_main_welfare_chart_poor_t;
26struct budgetwindow_main_welfare_chart_middle_t;
27struct budgetwindow_main_welfare_chart_rich_t;
28struct budgetwindow_main_hover_poor_t;
29struct budgetwindow_main_hover_middle_t;
30struct budgetwindow_main_hover_rich_t;
31struct budgetwindow_main_debt_label_t;
32struct budgetwindow_main_debt_enable_t;
33struct budgetwindow_main_total_debt_label_t;
34struct budgetwindow_main_max_debt_label_t;
35struct budgetwindow_main_total_debt_amount_t;
36struct budgetwindow_main_max_debt_amount_t;
37struct budgetwindow_main_debt_chart_t;
38struct budgetwindow_main_debt_overlay_t;
39struct budgetwindow_main_t;
40struct budgetwindow_section_header_label_t;
41struct budgetwindow_section_header_llbutton_t;
42struct budgetwindow_section_header_lbutton_t;
43struct budgetwindow_section_header_rbutton_t;
44struct budgetwindow_section_header_rrbutton_t;
45struct budgetwindow_section_header_setting_amount_t;
46struct budgetwindow_section_header_expand_button_t;
47struct budgetwindow_section_header_total_amount_t;
48struct budgetwindow_section_header_min_setting_t;
49struct budgetwindow_section_header_max_setting_t;
50struct budgetwindow_section_header_t;
51struct budgetwindow_neutral_spacer_t;
52struct budgetwindow_top_spacer_t;
53struct budgetwindow_bottom_spacer_t;
277 std::pair<std::string, float>
value;
323 std::vector<std::unique_ptr<budgetwindow_main_income_table_row_t>>
row_pool;
324 std::vector<std::unique_ptr<budgetwindow_main_income_table_header_t>>
header_pool;
330 std::vector<std::variant<std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option>>
values;
354 void add_value(std::pair<std::string, float>
const& v);
534 std::pair<std::string, float>
value;
580 std::vector<std::unique_ptr<budgetwindow_main_expenses_table_row_t>>
row_pool;
581 std::vector<std::unique_ptr<budgetwindow_main_expenses_table_header_t>>
header_pool;
587 std::vector<std::variant<std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option>>
values;
611 void add_value(std::pair<std::string, float>
const& v);
1587 auto location_abs = get_absolute_location(state, *
this);
1588 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) {
1590 new_abs_pos.
x += int16_t(x - oldx);
1591 new_abs_pos.
y += int16_t(y - oldy);
1596 if(state.world.locale_get_native_rtl(state.font_collection.get_current_locale())) {
1630 if(name ==
"section_type") {
1680 parent->set_visible(state,
false);
1689 on_lbutton_down(state, 0, 0, mods);
1698 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()));
1714 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 * 16), 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 };
1720 internal_layout.contents.clear();
1721 internal_layout.number_of_lines = 0;
1722 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 * 16), 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 };
1723 sl.add_text(state, cached_text);
1726 if(internal_layout.contents.empty())
return;
1728 auto linesz = state.font_collection.line_height(state, fh);
1729 if(linesz == 0.0f)
return;
1730 auto ycentered = (base_data.size.y - linesz) / 2;
1732 for(
auto& t : internal_layout.contents) {
1742 on_reset_text(state);
1751 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 * 16), 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 };
1757 internal_layout.contents.clear();
1758 internal_layout.number_of_lines = 0;
1759 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 * 16), 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 };
1760 sl.add_text(state, cached_text);
1763 if(internal_layout.contents.empty())
return;
1765 auto linesz = state.font_collection.line_height(state, fh);
1766 if(linesz == 0.0f)
return;
1767 auto ycentered = (base_data.size.y - linesz) / 2;
1769 for(
auto& t : internal_layout.contents) {
1779 on_reset_text(state);
1788 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 * 16), 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 };
1795 if(internal_layout.contents.empty())
return;
1797 auto linesz = state.font_collection.line_height(state, fh);
1798 if(linesz == 0.0f)
return;
1799 auto ycentered = (base_data.size.y - linesz) / 2;
1801 for(
auto& t : internal_layout.contents) {
1827 main.income_table->change_page(state,
main.income_table->page - 1);
1835 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()));
1840 set_visible(state,
main.income_table->max_page() > 0);
1851 main.income_table->change_page(state,
main.income_table->page + 1);
1859 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()));
1864 set_visible(state,
main.income_table->max_page() > 0);
1876 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 * 16), 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 };
1883 if(internal_layout.contents.empty())
return;
1885 auto linesz = state.font_collection.line_height(state, fh);
1886 if(linesz == 0.0f)
return;
1887 auto ycentered = (base_data.size.y - linesz) / 2;
1889 for(
auto& t : internal_layout.contents) {
1896 if(
main.income_table->max_page() > 0) {
1897 set_text(state, std::to_string(
main.income_table->page + 1) +
"/" + std::to_string(
main.income_table->max_page() + 1));
1899 set_text(state,
"");
1910 item_name_internal_layout.contents.clear();
1911 item_name_internal_layout.number_of_lines = 0;
1912 text::single_line_layout sl{ item_name_internal_layout,
text::layout_parameters{ 0, 0, int16_t(item_name_column_width - 24 - 16),
static_cast<int16_t
>(base_data.size.y),
text::make_font_id(state,
false, 1.0f * 16), 0,
budgetwindow_main_income_table_row_t::item_name_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 };
1913 sl.add_text(state, item_name_cached_text);
1917 item_value_internal_layout.contents.clear();
1918 item_value_internal_layout.number_of_lines = 0;
1919 text::single_line_layout sl{ item_value_internal_layout,
text::layout_parameters{ 0, 0, int16_t(item_value_column_width - 24 - 16),
static_cast<int16_t
>(base_data.size.y),
text::make_font_id(state,
false, 1.0f * 16), 0,
budgetwindow_main_income_table_row_t::item_value_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 };
1920 sl.add_text(state, item_value_cached_text);
1925 auto linesz = state.font_collection.line_height(state, fh);
1926 auto ycentered = (base_data.size.y - linesz) / 2;
1927 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) -
ui::get_absolute_location(state, *
this).
x;
1928 ogl::render_textured_rect(state,
ui::get_color_modification(
false,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state,
budgetwindow_main_income_table_row_t::row_background_texture,
budgetwindow_main_income_table_row_t::row_texture_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1929 bool col_um_lead_space = rel_mouse_x >= lead_space_column_start && rel_mouse_x < (lead_space_column_start + lead_space_column_width);
1930 bool col_um_item_name = rel_mouse_x >= item_name_column_start && rel_mouse_x < (item_name_column_start + item_name_column_width);
1931 if(col_um_item_name) {
1934if(item_name_sort_direction > 0) {
1935 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_name,
false,
true),
float(x + item_name_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1937if(item_name_sort_direction < 0) {
1938 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_name,
false,
true),
float(x + item_name_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1940 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
1942 for(
auto& t : item_name_internal_layout.contents) {
1946 bool col_um_item_value = rel_mouse_x >= item_value_column_start && rel_mouse_x < (item_value_column_start + item_value_column_width);
1947 if(col_um_item_value) {
1950if(item_value_sort_direction > 0) {
1951 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_value,
false,
true),
float(x + item_value_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1953if(item_value_sort_direction < 0) {
1954 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_value,
false,
true),
float(x + item_value_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1956 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
1958 for(
auto& t : item_value_internal_layout.contents) {
1965 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
1967 auto old_direction = item_name_sort_direction;
1968 item_name_sort_direction = 0;
1969 item_value_sort_direction = 0;
1970 item_name_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
1973 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
1975 auto old_direction = item_value_sort_direction;
1976 item_name_sort_direction = 0;
1977 item_value_sort_direction = 0;
1978 item_value_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
1985 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
1987 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
1989 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
1993 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
1995 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
1997 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
2001 subrect.size = base_data.size;
2004 on_reset_text(state);
2008 auto linesz = state.font_collection.line_height(state, fh);
2009 auto ycentered = (base_data.size.y - linesz) / 2;
2010 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) -
ui::get_absolute_location(state, *
this).
x;
2012 ogl::render_textured_rect(state,
ui::get_color_modification(
false,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, alt_row_background_texture, alt_row_texture_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2014 ogl::render_textured_rect(state,
ui::get_color_modification(
false,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, row_background_texture, row_texture_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2016 if(
this == state.ui_state.under_mouse) {
2021 if(col_um_item_name &&
this != state.ui_state.under_mouse) {
2024 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
2026 for(
auto& t : item_name_internal_layout.contents) {
2031 if(col_um_item_value &&
this != state.ui_state.under_mouse) {
2034 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
2036 for(
auto& t : item_value_internal_layout.contents) {
2062 subrect.size = base_data.size;
2070 set_item_name_text(state, value.first);
2080 text::single_line_layout sl{
item_name_internal_layout,
text::layout_parameters{ 0, 0, int16_t(
budgetwindow_main_income_table_header_t::item_name_column_width - 16),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
false, 1.0f * 16), 0,
item_name_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 };
2092 text::single_line_layout sl{
item_value_internal_layout,
text::layout_parameters{ 0, 0, int16_t(
budgetwindow_main_income_table_header_t::item_value_column_width - 16),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
false, 1.0f * 16), 0,
item_value_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 };
2099 size_t section_header_pool_used = 0;
2100 size_t neutral_spacer_pool_used = 0;
2101 size_t bottom_spacer_pool_used = 0;
2102 size_t top_spacer_pool_used = 0;
2103 size_t row_pool_used = 0;
2104 size_t header_pool_used = 0;
2105 int16_t vert_used = 0;
2112 if(std::holds_alternative<section_header_option>(
values[i])) {
2119 ++section_header_pool_used;
2122 if(std::holds_alternative<neutral_spacer_option>(
values[i])) {
2128 ++neutral_spacer_pool_used;
2131 if(std::holds_alternative<bottom_spacer_option>(
values[i])) {
2137 ++bottom_spacer_pool_used;
2140 if(std::holds_alternative<top_spacer_option>(
values[i])) {
2144 top_spacer_pool[top_spacer_pool_used]->base_data.position.y = vert_used;
2146 ++top_spacer_pool_used;
2149 if(std::holds_alternative<value_option>(
values[i])) {
2153 row_pool[row_pool_used]->value = std::get<value_option>(
values[i]).value;
2154 row_pool[row_pool_used]->alternate_row = alt_bg;
2155 row_pool[row_pool_used]->base_data.position.y = vert_used;
2156 vert_used +=
row_pool[row_pool_used]->base_data.size.y;
2160 if(std::holds_alternative<std::monostate>(
values[i])) {
2164 header_pool[header_pool_used]->base_data.position.y = vert_used;
2165 vert_used +=
header_pool[header_pool_used]->base_data.size.y;
2172 bool lflip = new_page < page && page > 0;
2182 state.game_state_updated.store(
true, std::memory_order::release);
2183 if(rflip || lflip) {
2184 state.ui_animation.post_update_frame(state);
2202 if(
values.empty() || !std::holds_alternative<value_option>(
values.back())) {
2207 values.emplace_back(std::monostate{});
2213 values.emplace_back(std::monostate{});
2272 auto cptr = std::make_unique<budgetwindow_main_income_table_row_t>();
2273 cptr->parent =
this;
2274 cptr->base_data.position.x = 0;
2275 cptr->base_data.position.y = 0;
2276 cptr->base_data.size.y = int16_t(
row_height * 8);
2278 cptr->on_create(state);
2282 auto cptr = std::make_unique<budgetwindow_main_income_table_header_t>();
2283 cptr->parent =
this;
2284 cptr->base_data.position.x = 0;
2285 cptr->base_data.position.y = 0;
2286 cptr->base_data.size.y = int16_t(
row_height * 8);
2288 cptr->on_create(state);
2292 bool work_to_do =
false;
2295 if(!work_to_do)
return;
2297 std::vector<std::pair<std::string, float>> val_temp;
2299 while(i <
values.size()) {
2300 if(std::holds_alternative<value_option>(
values[i])) {
2303 if(std::holds_alternative<value_option>(
values[i])) val_temp.push_back(std::get<value_option>(
values[i]).value);
2305 }
while(i <
values.size() && (std::holds_alternative<value_option>(
values[i]) || std::holds_alternative<std::monostate>(
values[i])));
2307 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](
const std::pair<std::string, float>& a,
const std::pair<std::string, float>& b){
2310 result = int8_t(std::clamp(a.first.compare(b.first), -1, 1));
2312 return result == budgetwindow_main_income_table_header_t::item_name_sort_direction;
2316 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](
const std::pair<std::string, float>& a,
const std::pair<std::string, float>& b){
2319 if(a.second == b.second)
2322 result = (a.second < b.second) ? -1 : 1;
2324 return result == budgetwindow_main_income_table_header_t::item_value_sort_direction;
2327 while(start_pos < i) {
2328 if(std::holds_alternative<value_option>(
values[start_pos])) {
2329 std::get<value_option>(
values[start_pos]).value = val_temp.back();
2330 val_temp.pop_back();
2345 change_page(state, page + ((amount < 0) ? 1 : -1));
2354 add_insert_top_spacer(state);
2356 auto type_totals = state.world.pop_type_make_vectorizable_float_buffer();
2357 auto all_totals = 0.0f;
2359 for(
auto p : state.world.nation_get_province_ownership(state.local_player_nation)) {
2361 if(state.world.province_get_nation_from_province_ownership(
province) == state.world.province_get_nation_from_province_control(
province)) {
2362 for(
auto pl :
province.get_pop_location()) {
2364 all_totals += pl.get_pop().get_savings();
2365 type_totals.set(pl.get_pop().get_poptype(), type_totals.get(pl.get_pop().get_poptype()) + pl.get_pop().get_savings());
2371 for(
auto pt : state.world.in_pop_type) {
2372 if(type_totals.get(pt) > 0.0f && all_totals > 0.0f) {
2373 add_value(std::pair<std::string, float>(
text::produce_simple_string(state, pt.get_name()), total * type_totals.get(pt) / all_totals));
2376 add_insert_bottom_spacer(state);
2378 add_insert_neutral_spacer(state);
2382 add_insert_top_spacer(state);
2385 auto type_totals = state.world.pop_type_make_vectorizable_float_buffer();
2386 auto all_totals = 0.0f;
2388 for(
auto p : state.world.nation_get_province_ownership(state.local_player_nation)) {
2390 if(state.world.province_get_nation_from_province_ownership(
province) == state.world.province_get_nation_from_province_control(
province)) {
2391 for(
auto pl :
province.get_pop_location()) {
2393 all_totals += pl.get_pop().get_savings();
2394 type_totals.set(pl.get_pop().get_poptype(), type_totals.get(pl.get_pop().get_poptype()) + pl.get_pop().get_savings());
2400 for(
auto pt : state.world.in_pop_type) {
2401 if(type_totals.get(pt) > 0.0f && all_totals > 0.0f) {
2402 add_value(std::pair<std::string, float>(
text::produce_simple_string(state, pt.get_name()), total * type_totals.get(pt) / all_totals));
2405 add_insert_bottom_spacer(state);
2407 add_insert_neutral_spacer(state);
2411 add_insert_top_spacer(state);
2413 auto type_totals = state.world.pop_type_make_vectorizable_float_buffer();
2414 auto all_totals = 0.0f;
2416 for(
auto p : state.world.nation_get_province_ownership(state.local_player_nation)) {
2418 if(state.world.province_get_nation_from_province_ownership(
province) == state.world.province_get_nation_from_province_control(
province)) {
2419 for(
auto pl :
province.get_pop_location()) {
2421 all_totals += pl.get_pop().get_savings();
2422 type_totals.set(pl.get_pop().get_poptype(), type_totals.get(pl.get_pop().get_poptype()) + pl.get_pop().get_savings());
2428 for(
auto pt : state.world.in_pop_type) {
2429 if(type_totals.get(pt) > 0.0f && all_totals > 0.0f) {
2430 add_value(std::pair<std::string, float>(
text::produce_simple_string(state, pt.get_name()), total * type_totals.get(pt) / all_totals));
2433 add_insert_bottom_spacer(state);
2435 add_insert_neutral_spacer(state);
2439 add_insert_top_spacer(state);
2441 for(
auto& item : totals) {
2442 add_value(std::pair<std::string, float>(
2444 state.world.national_identity_get_name(
2445 state.world.nation_get_identity_from_identity_holder(item.trade_partner)
2452 state.world.commodity_get_name(item.commodity)
2459 add_insert_bottom_spacer(state);
2461 add_insert_neutral_spacer(state);
2465 add_insert_top_spacer(state);
2467 for(
auto& item : totals) {
2468 add_value(std::pair<std::string, float>(
2470 state.world.national_identity_get_name(
2471 state.world.nation_get_identity_from_identity_holder(item.trade_partner)
2478 state.world.commodity_get_name(item.commodity)
2485 add_insert_bottom_spacer(state);
2487 add_insert_neutral_spacer(state);
2491 add_insert_top_spacer(state);
2494 for(
auto n : state.world.nation_get_overlord_as_ruler(state.local_player_nation)) {
2498 add_insert_bottom_spacer(state);
2500 add_insert_neutral_spacer(state);
2504 add_insert_top_spacer(state);
2505 for(
auto poid : state.world.nation_get_province_ownership_as_nation(state.local_player_nation)) {
2506 auto prov = poid.get_province();
2508 float amount = 0.0f;
2509 state.world.for_each_commodity([&](dcon::commodity_id c) {
2510 if(state.world.commodity_get_money_rgo(c)) {
2511 amount += province::rgo_production_quantity(state, prov.id, c) * state.world.commodity_get_cost(c);
2516 add_value(std::pair<std::string, float>(
text::produce_simple_string(state, state.world.province_get_name(prov)), amount * state.defines.gold_to_cash_rate));
2519 add_insert_bottom_spacer(state);
2522 impl_apply_sort(state);
2523 impl_change_page(state, page);
2533 main.expenses_table->change_page(state,
main.expenses_table->page - 1);
2541 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()));
2546 set_visible(state,
main.expenses_table->max_page() > 0);
2558 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 * 16), 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 };
2565 if(internal_layout.contents.empty())
return;
2567 auto linesz = state.font_collection.line_height(state, fh);
2568 if(linesz == 0.0f)
return;
2569 auto ycentered = (base_data.size.y - linesz) / 2;
2571 for(
auto& t : internal_layout.contents) {
2578 if(
main.expenses_table->max_page() > 0) {
2579 set_text(state, std::to_string(
main.expenses_table->page + 1) +
"/" + std::to_string(
main.expenses_table->max_page() + 1));
2581 set_text(state,
"");
2593 main.expenses_table->change_page(state,
main.expenses_table->page + 1);
2601 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()));
2606 set_visible(state,
main.expenses_table->max_page() > 0);
2618 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 * 16), 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 };
2624 internal_layout.contents.clear();
2625 internal_layout.number_of_lines = 0;
2626 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 * 16), 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 };
2627 sl.add_text(state, cached_text);
2630 if(internal_layout.contents.empty())
return;
2632 auto linesz = state.font_collection.line_height(state, fh);
2633 if(linesz == 0.0f)
return;
2634 auto ycentered = (base_data.size.y - linesz) / 2;
2636 for(
auto& t : internal_layout.contents) {
2646 on_reset_text(state);
2655 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 * 16), 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 };
2662 if(internal_layout.contents.empty())
return;
2664 auto linesz = state.font_collection.line_height(state, fh);
2665 if(linesz == 0.0f)
return;
2666 auto ycentered = (base_data.size.y - linesz) / 2;
2668 for(
auto& t : internal_layout.contents) {
2677 total +=
economy::estimate_social_spending(state, state.local_player_nation) * float(state.world.nation_get_social_spending(state.local_player_nation)) / 100.0f;
2681 total +=
economy::estimate_domestic_investment(state, state.local_player_nation) * float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) / 10000.0f;
2685 total +=
economy::estimate_land_spending(state, state.local_player_nation) * float(state.world.nation_get_land_spending(state.local_player_nation)) / 100.0f;
2686 total +=
economy::estimate_naval_spending(state, state.local_player_nation) * float(state.world.nation_get_naval_spending(state.local_player_nation)) / 100.0f;
2699 item_name_internal_layout.contents.clear();
2700 item_name_internal_layout.number_of_lines = 0;
2701 text::single_line_layout sl{ item_name_internal_layout,
text::layout_parameters{ 0, 0, int16_t(item_name_column_width - 24 - 16),
static_cast<int16_t
>(base_data.size.y),
text::make_font_id(state,
false, 1.0f * 16), 0,
budgetwindow_main_expenses_table_row_t::item_name_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 };
2702 sl.add_text(state, item_name_cached_text);
2706 item_value_internal_layout.contents.clear();
2707 item_value_internal_layout.number_of_lines = 0;
2708 text::single_line_layout sl{ item_value_internal_layout,
text::layout_parameters{ 0, 0, int16_t(item_value_column_width - 24 - 16),
static_cast<int16_t
>(base_data.size.y),
text::make_font_id(state,
false, 1.0f * 16), 0,
budgetwindow_main_expenses_table_row_t::item_value_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 };
2709 sl.add_text(state, item_value_cached_text);
2714 auto linesz = state.font_collection.line_height(state, fh);
2715 auto ycentered = (base_data.size.y - linesz) / 2;
2716 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) -
ui::get_absolute_location(state, *
this).
x;
2717 ogl::render_textured_rect(state,
ui::get_color_modification(
false,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state,
budgetwindow_main_expenses_table_row_t::row_background_texture,
budgetwindow_main_expenses_table_row_t::row_texture_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2718 bool col_um_lead_space = rel_mouse_x >= lead_space_column_start && rel_mouse_x < (lead_space_column_start + lead_space_column_width);
2719 bool col_um_item_name = rel_mouse_x >= item_name_column_start && rel_mouse_x < (item_name_column_start + item_name_column_width);
2720 if(col_um_item_name) {
2723if(item_name_sort_direction > 0) {
2724 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_name,
false,
true),
float(x + item_name_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2726if(item_name_sort_direction < 0) {
2727 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_name,
false,
true),
float(x + item_name_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2729 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
2731 for(
auto& t : item_name_internal_layout.contents) {
2735 bool col_um_item_value = rel_mouse_x >= item_value_column_start && rel_mouse_x < (item_value_column_start + item_value_column_width);
2736 if(col_um_item_value) {
2739if(item_value_sort_direction > 0) {
2740 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_value,
false,
true),
float(x + item_value_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2742if(item_value_sort_direction < 0) {
2743 ogl::render_textured_rect(state,
ui::get_color_modification(
this == state.ui_state.under_mouse && col_um_item_value,
false,
true),
float(x + item_value_column_start + 8),
float(y + base_data.size.y / 2 - 8),
float(16),
float(16),
ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2745 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
2747 for(
auto& t : item_value_internal_layout.contents) {
2754 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
2756 auto old_direction = item_name_sort_direction;
2757 item_name_sort_direction = 0;
2758 item_value_sort_direction = 0;
2759 item_name_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
2762 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
2764 auto old_direction = item_value_sort_direction;
2765 item_name_sort_direction = 0;
2766 item_value_sort_direction = 0;
2767 item_value_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
2774 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
2776 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
2778 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
2782 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
2784 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
2786 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
2790 subrect.size = base_data.size;
2793 on_reset_text(state);
2797 auto linesz = state.font_collection.line_height(state, fh);
2798 auto ycentered = (base_data.size.y - linesz) / 2;
2799 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) -
ui::get_absolute_location(state, *
this).
x;
2801 ogl::render_textured_rect(state,
ui::get_color_modification(
false,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, alt_row_background_texture, alt_row_texture_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2803 ogl::render_textured_rect(state,
ui::get_color_modification(
false,
false,
false),
float(x),
float(y),
float(base_data.size.x),
float(base_data.size.y),
ogl::get_late_load_texture_handle(state, row_background_texture, row_texture_key),
ui::rotation::upright,
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2805 if(
this == state.ui_state.under_mouse) {
2810 if(col_um_item_name &&
this != state.ui_state.under_mouse) {
2813 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
2815 for(
auto& t : item_name_internal_layout.contents) {
2820 if(col_um_item_value &&
this != state.ui_state.under_mouse) {
2823 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
2825 for(
auto& t : item_value_internal_layout.contents) {
2851 subrect.size = base_data.size;
2859 set_item_name_text(state, value.first);
2869 text::single_line_layout sl{
item_name_internal_layout,
text::layout_parameters{ 0, 0, int16_t(
budgetwindow_main_expenses_table_header_t::item_name_column_width - 16),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
false, 1.0f * 16), 0,
item_name_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 };
2881 text::single_line_layout sl{
item_value_internal_layout,
text::layout_parameters{ 0, 0, int16_t(
budgetwindow_main_expenses_table_header_t::item_value_column_width - 16),
static_cast<int16_t
>(
base_data.
size.
y),
text::make_font_id(state,
false, 1.0f * 16), 0,
item_value_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 };
2888 size_t section_header_pool_used = 0;
2889 size_t neutral_spacer_pool_used = 0;
2890 size_t bottom_spacer_pool_used = 0;
2891 size_t top_spacer_pool_used = 0;
2892 size_t row_pool_used = 0;
2893 size_t header_pool_used = 0;
2894 int16_t vert_used = 0;
2901 if(std::holds_alternative<section_header_option>(
values[i])) {
2908 ++section_header_pool_used;
2911 if(std::holds_alternative<neutral_spacer_option>(
values[i])) {
2917 ++neutral_spacer_pool_used;
2920 if(std::holds_alternative<bottom_spacer_option>(
values[i])) {
2926 ++bottom_spacer_pool_used;
2929 if(std::holds_alternative<top_spacer_option>(
values[i])) {
2933 top_spacer_pool[top_spacer_pool_used]->base_data.position.y = vert_used;
2935 ++top_spacer_pool_used;
2938 if(std::holds_alternative<value_option>(
values[i])) {
2942 row_pool[row_pool_used]->value = std::get<value_option>(
values[i]).value;
2943 row_pool[row_pool_used]->alternate_row = alt_bg;
2944 row_pool[row_pool_used]->base_data.position.y = vert_used;
2945 vert_used +=
row_pool[row_pool_used]->base_data.size.y;
2949 if(std::holds_alternative<std::monostate>(
values[i])) {
2953 header_pool[header_pool_used]->base_data.position.y = vert_used;
2954 vert_used +=
header_pool[header_pool_used]->base_data.size.y;
2961 bool lflip = new_page < page && page > 0;
2971 state.game_state_updated.store(
true, std::memory_order::release);
2972 if(rflip || lflip) {
2973 state.ui_animation.post_update_frame(state);
2991 if(
values.empty() || !std::holds_alternative<value_option>(
values.back())) {
2996 values.emplace_back(std::monostate{});
3002 values.emplace_back(std::monostate{});
3061 auto cptr = std::make_unique<budgetwindow_main_expenses_table_row_t>();
3062 cptr->parent =
this;
3063 cptr->base_data.position.x = 0;
3064 cptr->base_data.position.y = 0;
3065 cptr->base_data.size.y = int16_t(
row_height * 8);
3067 cptr->on_create(state);
3071 auto cptr = std::make_unique<budgetwindow_main_expenses_table_header_t>();
3072 cptr->parent =
this;
3073 cptr->base_data.position.x = 0;
3074 cptr->base_data.position.y = 0;
3075 cptr->base_data.size.y = int16_t(
row_height * 8);
3077 cptr->on_create(state);
3081 bool work_to_do =
false;
3084 if(!work_to_do)
return;
3086 std::vector<std::pair<std::string, float>> val_temp;
3088 while(i <
values.size()) {
3089 if(std::holds_alternative<value_option>(
values[i])) {
3092 if(std::holds_alternative<value_option>(
values[i])) val_temp.push_back(std::get<value_option>(
values[i]).value);
3094 }
while(i <
values.size() && (std::holds_alternative<value_option>(
values[i]) || std::holds_alternative<std::monostate>(
values[i])));
3096 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](
const std::pair<std::string, float>& a,
const std::pair<std::string, float>& b){
3099 result = int8_t(std::clamp(a.first.compare(b.first), -1, 1));
3101 return result == budgetwindow_main_expenses_table_header_t::item_name_sort_direction;
3105 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](
const std::pair<std::string, float>& a,
const std::pair<std::string, float>& b){
3108 if(a.second == b.second)
3111 result = (a.second < b.second) ? -1 : 1;
3113 return result == budgetwindow_main_expenses_table_header_t::item_value_sort_direction;
3116 while(start_pos < i) {
3117 if(std::holds_alternative<value_option>(
values[start_pos])) {
3118 std::get<value_option>(
values[start_pos]).value = val_temp.back();
3119 val_temp.pop_back();
3134 change_page(state, page + ((amount < 0) ? 1 : -1));
3145 add_insert_neutral_spacer(state);
3149 add_insert_top_spacer(state);
3150 auto fraction = float(state.world.nation_get_land_spending(state.local_player_nation)) / 100.0f;
3151 auto goods = state.world.commodity_make_vectorizable_float_buffer();
3153 uint32_t total_commodities = state.world.commodity_size();
3154 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](
auto soid) {
3155 auto local_state = state.world.state_ownership_get_state(soid);
3156 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3157 for(uint32_t i = 1; i < total_commodities; ++i) {
3158 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3159 goods.set(cid, goods.get(cid) + state.world.market_get_army_demand(market, cid)
3160 * economy::price(state, market, cid)
3161 * state.world.market_get_demand_satisfaction(market, cid));
3164 for(
auto c : state.world.in_commodity) {
3165 if(goods.get(c) > 0.0f) {
3166 add_value(std::pair<std::string, float>(
text::produce_simple_string(state, state.world.commodity_get_name(c)), goods.get(c) * fraction));
3169 add_insert_bottom_spacer(state);
3171 add_insert_neutral_spacer(state);
3175 add_insert_top_spacer(state);
3176 auto fraction = float(state.world.nation_get_naval_spending(state.local_player_nation)) / 100.0f;
3177 auto goods = state.world.commodity_make_vectorizable_float_buffer();
3179 uint32_t total_commodities = state.world.commodity_size();
3180 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](
auto soid) {
3181 auto local_state = state.world.state_ownership_get_state(soid);
3182 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3183 for(uint32_t i = 1; i < total_commodities; ++i) {
3184 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3185 goods.set(cid, goods.get(cid) + state.world.market_get_navy_demand(market, cid)
3186 * economy::price(state, market, cid)
3187 * state.world.market_get_demand_satisfaction(market, cid));
3190 for(
auto c :
state.world.in_commodity) {
3191 if(
goods.get(c) > 0.0f) {
3195 add_insert_bottom_spacer(state);
3197 add_insert_neutral_spacer(state);
3199 add_insert_section_header(state, budget_categories::admin);
3200 if(budget_categories::expanded[budget_categories::admin]) {
3201 add_insert_top_spacer(state);
3202 auto fraction = float(
state.world.nation_get_administrative_spending(
state.local_player_nation)) / 100.0f;
3204 state.world.nation_for_each_state_ownership(
state.local_player_nation, [&](
auto soid) {
3205 auto local_state = state.world.state_ownership_get_state(soid);
3206 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3208 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3209 auto adj_pop_of_type =
3210 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3212 if(adj_pop_of_type <= 0)
3215 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3217 total += adj_pop_of_type * state.world.market_get_life_needs_costs(market, pt);
3219 auto en_type = culture::income_type(state.world.pop_type_get_everyday_needs_income_type(pt));
3221 total += adj_pop_of_type * state.world.market_get_everyday_needs_costs(market, pt);
3223 auto lx_type = culture::income_type(state.world.pop_type_get_luxury_needs_income_type(pt));
3225 total += adj_pop_of_type * state.world.market_get_luxury_needs_costs(market, pt);
3232 add_insert_bottom_spacer(state);
3234 add_insert_neutral_spacer(state);
3236 add_insert_section_header(state, budget_categories::education);
3237 if(budget_categories::expanded[budget_categories::education]) {
3238 add_insert_top_spacer(state);
3239 auto fraction = float(
state.world.nation_get_education_spending(
state.local_player_nation)) / 100.0f;
3241 state.world.nation_for_each_state_ownership(
state.local_player_nation, [&](
auto soid) {
3242 auto local_state = state.world.state_ownership_get_state(soid);
3243 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3245 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3246 auto adj_pop_of_type =
3247 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3249 if(adj_pop_of_type <= 0)
3252 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3254 total += adj_pop_of_type * state.world.market_get_life_needs_costs(market, pt);
3256 auto en_type = culture::income_type(state.world.pop_type_get_everyday_needs_income_type(pt));
3258 total += adj_pop_of_type * state.world.market_get_everyday_needs_costs(market, pt);
3260 auto lx_type = culture::income_type(state.world.pop_type_get_luxury_needs_income_type(pt));
3262 total += adj_pop_of_type * state.world.market_get_luxury_needs_costs(market, pt);
3269 add_insert_bottom_spacer(state);
3271 add_insert_neutral_spacer(state);
3273 add_insert_section_header(state, budget_categories::social);
3274 if(budget_categories::expanded[budget_categories::social]) {
3275 add_insert_top_spacer(state);
3276 auto const p_level =
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::pension_level);
3277 auto const unemp_level =
state.world.nation_get_modifier_values(
state.local_player_nation, sys::national_mod_offsets::unemployment_benefit);
3278 auto fraction = float(
state.world.nation_get_social_spending(
state.local_player_nation)) / 100.0f;
3280 state.world.nation_for_each_state_ownership(
state.local_player_nation, [&](
auto soid) {
3281 auto local_state = state.world.state_ownership_get_state(soid);
3282 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3285 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3286 auto adj_pop_of_type =
3287 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt))
3288 / state.defines.alice_needs_scaling_factor;
3289 if(adj_pop_of_type <= 0)
3292 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3293 if(ln_type == culture::income_type::administration || ln_type == culture::income_type::education || ln_type == culture::income_type::military) {
3296 total += adj_pop_of_type * p_level * state.world.market_get_life_needs_costs(market, pt);
3297 if(state.world.pop_type_get_has_unemployment(pt)) {
3298 auto emp = state.world.state_instance_get_demographics(local_state, demographics::to_employment_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3300 (adj_pop_of_type - emp)
3302 * state.world.market_get_life_needs_costs(market, pt);
3310 add_insert_bottom_spacer(state);
3312 add_insert_neutral_spacer(state);
3314 add_insert_section_header(state, budget_categories::military);
3315 if(budget_categories::expanded[budget_categories::military]) {
3316 add_insert_top_spacer(state);
3317 auto fraction = float(
state.world.nation_get_military_spending(
state.local_player_nation)) / 100.0f;
3319 state.world.nation_for_each_state_ownership(
state.local_player_nation, [&](
auto soid) {
3320 auto local_state = state.world.state_ownership_get_state(soid);
3321 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3323 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3324 auto adj_pop_of_type =
3325 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3327 if(adj_pop_of_type <= 0)
3330 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3332 total += adj_pop_of_type * state.world.market_get_life_needs_costs(market, pt);
3334 auto en_type = culture::income_type(state.world.pop_type_get_everyday_needs_income_type(pt));
3336 total += adj_pop_of_type * state.world.market_get_everyday_needs_costs(market, pt);
3338 auto lx_type = culture::income_type(state.world.pop_type_get_luxury_needs_income_type(pt));
3340 total += adj_pop_of_type * state.world.market_get_luxury_needs_costs(market, pt);
3347 add_insert_bottom_spacer(state);
3349 add_insert_neutral_spacer(state);
3351 add_insert_section_header(state, budget_categories::domestic_investment);
3352 if(budget_categories::expanded[budget_categories::domestic_investment]) {
3353 add_insert_top_spacer(state);
3354 auto cap_total = 0.f;
3355 auto aristo_total = 0.f;
3356 state.world.nation_for_each_state_ownership(
state.local_player_nation, [&](
auto soid) {
3357 auto local_state = state.world.state_ownership_get_state(soid);
3358 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3359 auto adj_pop_of_type_capis = (state.world.state_instance_get_demographics(
3360 local_state, demographics::to_key(state, state.culture_definitions.capitalists))
3361 ) / state.defines.alice_needs_scaling_factor;
3362 auto adj_pop_of_type_arist = (state.world.state_instance_get_demographics(
3363 local_state, demographics::to_key(state, state.culture_definitions.aristocrat))
3364 ) / state.defines.alice_needs_scaling_factor;
3366 state.world.market_get_life_needs_costs(market, state.culture_definitions.aristocrat)
3367 + state.world.market_get_everyday_needs_costs(market, state.culture_definitions.aristocrat)
3368 + state.world.market_get_luxury_needs_costs(market, state.culture_definitions.aristocrat);
3370 state.world.market_get_life_needs_costs(market, state.culture_definitions.capitalists)
3371 + state.world.market_get_everyday_needs_costs(market, state.culture_definitions.capitalists)
3372 + state.world.market_get_luxury_needs_costs(market, state.culture_definitions.capitalists);
3374 cap_total += state.defines.alice_domestic_investment_multiplier * ( adj_pop_of_type_capis * capis_costs );
3375 aristo_total += state.defines.alice_domestic_investment_multiplier * (adj_pop_of_type_arist * arist_costs );
3377 add_value(std::pair<std::string, float>(
text::produce_simple_string(state,
state.world.pop_type_get_name(
state.culture_definitions.capitalists)), cap_total *
float(
state.world.nation_get_domestic_investment_spending(
state.local_player_nation)) / 100.0f));
3378 add_value(std::pair<std::string, float>(
text::produce_simple_string(state,
state.world.pop_type_get_name(
state.culture_definitions.aristocrat)), aristo_total *
float(
state.world.nation_get_domestic_investment_spending(
state.local_player_nation)) / 100.0f));
3379 add_insert_bottom_spacer(state);
3381 add_insert_neutral_spacer(state);
3383 add_insert_section_header(state, budget_categories::overseas_spending);
3384 if(budget_categories::expanded[budget_categories::overseas_spending]) {
3385 add_insert_top_spacer(state);
3387 auto capital_state =
state.world.province_get_state_membership(capital);
3388 auto market =
state.world.state_instance_get_market_from_local_market(capital_state);
3390 auto overseas_factor =
state.defines.province_overseas_penalty * float(
state.world.nation_get_owned_province_count(
state.local_player_nation) -
state.world.nation_get_central_province_count(
state.local_player_nation));
3393 if(overseas_factor > 0) {
3394 for(
uint32_t i = 1; i < total_commodities; ++i) {
3395 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3397 if(
state.world.commodity_get_overseas_penalty(cid) && (
state.world.commodity_get_is_available_from_start(cid) ||
state.world.nation_get_unlocked_commodities(
state.local_player_nation, cid))) {
3399 overseas_factor *
economy::price(state, market, cid) *
state.world.market_get_demand_satisfaction(market, cid) * float(
state.world.nation_get_overseas_spending(
state.local_player_nation)) / 100.0f;
3404 add_insert_bottom_spacer(state);
3406 add_insert_neutral_spacer(state);
3408 add_insert_section_header(state, budget_categories::diplomatic_expenses);
3409 if(budget_categories::expanded[budget_categories::diplomatic_expenses]) {
3410 add_insert_top_spacer(state);
3414 add_insert_bottom_spacer(state);
3416 add_insert_neutral_spacer(state);
3418 add_insert_section_header(state, budget_categories::debt_payment);
3419 if(budget_categories::expanded[budget_categories::debt_payment]) {
3422 add_insert_neutral_spacer(state);
3424 add_insert_section_header(state, budget_categories::stockpile);
3425 if(budget_categories::expanded[budget_categories::stockpile]) {
3426 add_insert_top_spacer(state);
3430 auto capital_state =
state.world.province_get_state_membership(capital);
3431 auto market =
state.world.state_instance_get_market_from_local_market(capital_state);
3433 for(
uint32_t i = 1; i < total_commodities; ++i) {
3434 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3436 state.world.nation_get_stockpile_targets(
state.local_player_nation, cid)
3437 -
state.world.nation_get_stockpiles(
state.local_player_nation, cid);
3439 if(difference > 0 &&
state.world.nation_get_drawing_on_stockpiles(
state.local_player_nation, cid) ==
false) {
3440 auto amount = difference *
economy::price(state, market, cid) *
state.world.market_get_demand_satisfaction(market, cid);
3446 add_insert_bottom_spacer(state);
3449 impl_apply_sort(state);
3450 impl_change_page(state, page);
3452void budgetwindow_main_expenses_table_t::on_create(
sys::state& state)
noexcept {
3456void budgetwindow_main_admin_eff1_t::set_text(
sys::state& state, std::string
const& new_text) {
3457 if(new_text != cached_text) {
3458 cached_text = new_text;
3459 internal_layout.contents.clear();
3460 internal_layout.number_of_lines = 0;
3461 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 * 16), 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 };
3462 sl.add_text(state, cached_text);
3465void budgetwindow_main_admin_eff1_t::on_reset_text(
sys::state& state)
noexcept {
3467 internal_layout.contents.clear();
3468 internal_layout.number_of_lines = 0;
3469 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 * 16), 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 };
3470 sl.add_text(state, cached_text);
3472void budgetwindow_main_admin_eff1_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3473 if(internal_layout.contents.empty())
return;
3475 auto linesz = state.font_collection.line_height(state, fh);
3476 if(linesz == 0.0f)
return;
3477 auto ycentered = (base_data.size.y - linesz) / 2;
3479 for(
auto& t : internal_layout.contents) {
3483void budgetwindow_main_admin_eff1_t::on_update(
sys::state& state)
noexcept {
3488void budgetwindow_main_admin_eff1_t::on_create(
sys::state& state)
noexcept {
3489 on_reset_text(state);
3493void budgetwindow_main_admin_eff2_t::set_text(
sys::state& state, std::string
const& new_text) {
3494 if(new_text != cached_text) {
3495 cached_text = new_text;
3496 internal_layout.contents.clear();
3497 internal_layout.number_of_lines = 0;
3498 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 * 16), 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 };
3499 sl.add_text(state, cached_text);
3502void budgetwindow_main_admin_eff2_t::on_reset_text(
sys::state& state)
noexcept {
3504 internal_layout.contents.clear();
3505 internal_layout.number_of_lines = 0;
3506 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 * 16), 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 };
3507 sl.add_text(state, cached_text);
3509void budgetwindow_main_admin_eff2_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3510 if(internal_layout.contents.empty())
return;
3512 auto linesz = state.font_collection.line_height(state, fh);
3513 if(linesz == 0.0f)
return;
3514 auto ycentered = (base_data.size.y - linesz) / 2;
3516 for(
auto& t : internal_layout.contents) {
3520void budgetwindow_main_admin_eff2_t::on_update(
sys::state& state)
noexcept {
3525void budgetwindow_main_admin_eff2_t::on_create(
sys::state& state)
noexcept {
3526 on_reset_text(state);
3533 auto n = state.local_player_nation;
3538 text::fp_percentage{ 1.0f + state.world.nation_get_modifier_values(n, sys::national_mod_offsets::administrative_efficiency_modifier) });
3546 auto non_colonial = state.world.nation_get_non_colonial_population(n);
3547 auto total = non_colonial > 0.0f ? state.world.nation_get_non_colonial_bureaucrats(n) / non_colonial : 0.0f;
3556 float issue_sum = 0.0f;
3557 for(
auto i : state.culture_definitions.social_issues) {
3558 issue_sum = issue_sum + state.world.issue_option_get_administrative_multiplier(state.world.nation_get_issues(n, i));
3560 auto from_issues = issue_sum * state.defines.bureaucracy_percentage_increment;
3572void budgetwindow_main_admin_eff_amount_t::set_text(
sys::state& state, std::string
const& new_text) {
3573 if(new_text != cached_text) {
3574 cached_text = new_text;
3575 internal_layout.contents.clear();
3576 internal_layout.number_of_lines = 0;
3577 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 * 16), 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 };
3578 sl.add_text(state, cached_text);
3581void budgetwindow_main_admin_eff_amount_t::on_reset_text(
sys::state& state)
noexcept {
3583void budgetwindow_main_admin_eff_amount_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3584 if(internal_layout.contents.empty())
return;
3586 auto linesz = state.font_collection.line_height(state, fh);
3587 if(linesz == 0.0f)
return;
3588 auto ycentered = (base_data.size.y - linesz) / 2;
3590 for(
auto& t : internal_layout.contents) {
3594void budgetwindow_main_admin_eff_amount_t::on_update(
sys::state& state)
noexcept {
3597 set_text(state,
text::format_percentage(state.world.nation_get_administrative_efficiency(state.local_player_nation)));
3600void budgetwindow_main_admin_eff_amount_t::on_create(
sys::state& state)
noexcept {
3604void budgetwindow_main_welfare_label_t::set_text(
sys::state& state, std::string
const& new_text) {
3605 if(new_text != cached_text) {
3606 cached_text = new_text;
3607 internal_layout.contents.clear();
3608 internal_layout.number_of_lines = 0;
3609 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 * 16), 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 };
3610 sl.add_text(state, cached_text);
3613void budgetwindow_main_welfare_label_t::on_reset_text(
sys::state& state)
noexcept {
3615 internal_layout.contents.clear();
3616 internal_layout.number_of_lines = 0;
3617 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 * 16), 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 };
3618 sl.add_text(state, cached_text);
3620void budgetwindow_main_welfare_label_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3621 if(internal_layout.contents.empty())
return;
3623 auto linesz = state.font_collection.line_height(state, fh);
3624 if(linesz == 0.0f)
return;
3625 auto ycentered = (base_data.size.y - linesz) / 2;
3627 for(
auto& t : internal_layout.contents) {
3631void budgetwindow_main_welfare_label_t::on_update(
sys::state& state)
noexcept {
3636void budgetwindow_main_welfare_label_t::on_create(
sys::state& state)
noexcept {
3637 on_reset_text(state);
3641void budgetwindow_main_chart_max_a_t::set_text(
sys::state& state, std::string
const& new_text) {
3642 if(new_text != cached_text) {
3643 cached_text = new_text;
3644 internal_layout.contents.clear();
3645 internal_layout.number_of_lines = 0;
3646 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 * 16), 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 };
3647 sl.add_text(state, cached_text);
3650void budgetwindow_main_chart_max_a_t::on_reset_text(
sys::state& state)
noexcept {
3652 internal_layout.contents.clear();
3653 internal_layout.number_of_lines = 0;
3654 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 * 16), 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 };
3655 sl.add_text(state, cached_text);
3657void budgetwindow_main_chart_max_a_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3658 if(internal_layout.contents.empty())
return;
3660 auto linesz = state.font_collection.line_height(state, fh);
3661 if(linesz == 0.0f)
return;
3662 auto ycentered = (base_data.size.y - linesz) / 2;
3664 for(
auto& t : internal_layout.contents) {
3668void budgetwindow_main_chart_max_a_t::on_update(
sys::state& state)
noexcept {
3673void budgetwindow_main_chart_max_a_t::on_create(
sys::state& state)
noexcept {
3674 on_reset_text(state);
3678void budgetwindow_main_chart_min_t::set_text(
sys::state& state, std::string
const& new_text) {
3679 if(new_text != cached_text) {
3680 cached_text = new_text;
3681 internal_layout.contents.clear();
3682 internal_layout.number_of_lines = 0;
3683 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 * 16), 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 };
3684 sl.add_text(state, cached_text);
3687void budgetwindow_main_chart_min_t::on_reset_text(
sys::state& state)
noexcept {
3689 internal_layout.contents.clear();
3690 internal_layout.number_of_lines = 0;
3691 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 * 16), 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 };
3692 sl.add_text(state, cached_text);
3694void budgetwindow_main_chart_min_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3695 if(internal_layout.contents.empty())
return;
3697 auto linesz = state.font_collection.line_height(state, fh);
3698 if(linesz == 0.0f)
return;
3699 auto ycentered = (base_data.size.y - linesz) / 2;
3701 for(
auto& t : internal_layout.contents) {
3705void budgetwindow_main_chart_min_t::on_update(
sys::state& state)
noexcept {
3710void budgetwindow_main_chart_min_t::on_create(
sys::state& state)
noexcept {
3711 on_reset_text(state);
3715void budgetwindow_main_chart_max_b_t::set_text(
sys::state& state, std::string
const& new_text) {
3716 if(new_text != cached_text) {
3717 cached_text = new_text;
3718 internal_layout.contents.clear();
3719 internal_layout.number_of_lines = 0;
3720 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 * 16), 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 };
3721 sl.add_text(state, cached_text);
3724void budgetwindow_main_chart_max_b_t::on_reset_text(
sys::state& state)
noexcept {
3726 internal_layout.contents.clear();
3727 internal_layout.number_of_lines = 0;
3728 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 * 16), 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 };
3729 sl.add_text(state, cached_text);
3731void budgetwindow_main_chart_max_b_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3732 if(internal_layout.contents.empty())
return;
3734 auto linesz = state.font_collection.line_height(state, fh);
3735 if(linesz == 0.0f)
return;
3736 auto ycentered = (base_data.size.y - linesz) / 2;
3738 for(
auto& t : internal_layout.contents) {
3742void budgetwindow_main_chart_max_b_t::on_update(
sys::state& state)
noexcept {
3747void budgetwindow_main_chart_max_b_t::on_create(
sys::state& state)
noexcept {
3748 on_reset_text(state);
3752void budgetwindow_main_chart_poplabel_t::set_text(
sys::state& state, std::string
const& new_text) {
3753 if(new_text != cached_text) {
3754 cached_text = new_text;
3755 internal_layout.contents.clear();
3756 internal_layout.number_of_lines = 0;
3757 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 * 16), 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 };
3758 sl.add_text(state, cached_text);
3761void budgetwindow_main_chart_poplabel_t::on_reset_text(
sys::state& state)
noexcept {
3763 internal_layout.contents.clear();
3764 internal_layout.number_of_lines = 0;
3765 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 * 16), 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 };
3766 sl.add_text(state, cached_text);
3768void budgetwindow_main_chart_poplabel_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3769 if(internal_layout.contents.empty())
return;
3771 auto linesz = state.font_collection.line_height(state, fh);
3772 if(linesz == 0.0f)
return;
3773 auto ycentered = (base_data.size.y - linesz) / 2;
3775 for(
auto& t : internal_layout.contents) {
3779void budgetwindow_main_chart_poplabel_t::on_update(
sys::state& state)
noexcept {
3784void budgetwindow_main_chart_poplabel_t::on_create(
sys::state& state)
noexcept {
3785 on_reset_text(state);
3789void budgetwindow_main_chart_needslabel_t::set_text(
sys::state& state, std::string
const& new_text) {
3790 if(new_text != cached_text) {
3791 cached_text = new_text;
3792 internal_layout.contents.clear();
3793 internal_layout.number_of_lines = 0;
3794 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 * 16), 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 };
3795 sl.add_text(state, cached_text);
3798void budgetwindow_main_chart_needslabel_t::on_reset_text(
sys::state& state)
noexcept {
3800 internal_layout.contents.clear();
3801 internal_layout.number_of_lines = 0;
3802 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 * 16), 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 };
3803 sl.add_text(state, cached_text);
3805void budgetwindow_main_chart_needslabel_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3806 if(internal_layout.contents.empty())
return;
3808 auto linesz = state.font_collection.line_height(state, fh);
3809 if(linesz == 0.0f)
return;
3810 auto ycentered = (base_data.size.y - linesz) / 2;
3812 for(
auto& t : internal_layout.contents) {
3816void budgetwindow_main_chart_needslabel_t::on_update(
sys::state& state)
noexcept {
3821void budgetwindow_main_chart_needslabel_t::on_create(
sys::state& state)
noexcept {
3822 on_reset_text(state);
3832void budgetwindow_main_welfare_chart_poor_t::set_data_points(
sys::state& state, std::vector<float>
const&
datapoints,
float min,
float max) {
3834 float y_height = max - min;
3835 std::vector<float> scaled_datapoints = std::vector<float>(32);
3836 if(y_height == 0.f) {
3837 for(
size_t i = 0; i < 32; i++) {
3838 scaled_datapoints[i] = .5f;
3841 for(
size_t i = 0; i < 32; i++) {
3842 scaled_datapoints[i] = (
datapoints[i] - min) / y_height;
3845 lines.set_y(scaled_datapoints.data());
3847void budgetwindow_main_welfare_chart_poor_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3848 ogl::render_linegraph(state,
ogl::color_modification::none,
float(x),
float(y), base_data.size.x, base_data.size.y, line_color.r, line_color.g, line_color.b, line_color.a, lines);
3850void budgetwindow_main_welfare_chart_poor_t::on_update(
sys::state& state)
noexcept {
3855 for(
auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3857 for(
auto pop_loc : prov.get_province().get_pop_location()) {
3858 auto pop_id = pop_loc.get_pop();
3859 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3868 float integral = 0.f;
3869 float total_area = 0.f;
3872 float cutoff = (float)i / 32 + 0.01f;
3875 for(
auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3877 for(
auto pop_loc : prov.get_province().get_pop_location()) {
3878 auto pop_id = pop_loc.get_pop();
3879 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3887 if(total / 3.f >= cutoff)
3890 integral += total / 3.f * pop_size;
3891 total_area += pop_size;
3897 set_data_points(state,
datapoints, min, max);
3900void budgetwindow_main_welfare_chart_poor_t::on_create(
sys::state& state)
noexcept {
3910void budgetwindow_main_welfare_chart_middle_t::set_data_points(
sys::state& state, std::vector<float>
const&
datapoints,
float min,
float max) {
3912 float y_height = max - min;
3913 std::vector<float> scaled_datapoints = std::vector<float>(32);
3914 if(y_height == 0.f) {
3915 for(
size_t i = 0; i < 32; i++) {
3916 scaled_datapoints[i] = .5f;
3919 for(
size_t i = 0; i < 32; i++) {
3920 scaled_datapoints[i] = (
datapoints[i] - min) / y_height;
3923 lines.set_y(scaled_datapoints.data());
3925void budgetwindow_main_welfare_chart_middle_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
3926 ogl::render_linegraph(state,
ogl::color_modification::none,
float(x),
float(y), base_data.size.x, base_data.size.y, line_color.r, line_color.g, line_color.b, line_color.a, lines);
3928void budgetwindow_main_welfare_chart_middle_t::on_update(
sys::state& state)
noexcept {
3933 for(
auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3935 for(
auto pop_loc : prov.get_province().get_pop_location()) {
3936 auto pop_id = pop_loc.get_pop();
3937 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3946 float integral = 0.f;
3947 float total_area = 0.f;
3950 float cutoff = (float)i / 32 + 0.01f;
3953 for(
auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3955 for(
auto pop_loc : prov.get_province().get_pop_location()) {
3956 auto pop_id = pop_loc.get_pop();
3957 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3965 if(total / 3.f >= cutoff)
3968 integral += total / 3.f * pop_size;
3969 total_area += pop_size;
3975 set_data_points(state,
datapoints, min, max);
3978void budgetwindow_main_welfare_chart_middle_t::on_create(
sys::state& state)
noexcept {
3988void budgetwindow_main_welfare_chart_rich_t::set_data_points(
sys::state& state, std::vector<float>
const&
datapoints,
float min,
float max) {
3990 float y_height = max - min;
3991 std::vector<float> scaled_datapoints = std::vector<float>(32);
3992 if(y_height == 0.f) {
3993 for(
size_t i = 0; i < 32; i++) {
3994 scaled_datapoints[i] = .5f;
3997 for(
size_t i = 0; i < 32; i++) {
3998 scaled_datapoints[i] = (
datapoints[i] - min) / y_height;
4001 lines.set_y(scaled_datapoints.data());
4003void budgetwindow_main_welfare_chart_rich_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4004 ogl::render_linegraph(state,
ogl::color_modification::none,
float(x),
float(y), base_data.size.x, base_data.size.y, line_color.r, line_color.g, line_color.b, line_color.a, lines);
4006void budgetwindow_main_welfare_chart_rich_t::on_update(
sys::state& state)
noexcept {
4011 for(
auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
4013 for(
auto pop_loc : prov.get_province().get_pop_location()) {
4014 auto pop_id = pop_loc.get_pop();
4015 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
4024 float integral = 0.f;
4025 float total_area = 0.f;
4028 float cutoff = (float)i / 32 + 0.01f;
4031 for(
auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
4033 for(
auto pop_loc : prov.get_province().get_pop_location()) {
4034 auto pop_id = pop_loc.get_pop();
4035 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
4043 if(total / 3.f >= cutoff)
4046 integral += total / 3.f * pop_size;
4047 total_area += pop_size;
4053 set_data_points(state,
datapoints, min, max);
4056void budgetwindow_main_welfare_chart_rich_t::on_create(
sys::state& state)
noexcept {
4060void budgetwindow_main_hover_poor_t::on_hover(
sys::state& state)
noexcept {
4063 main.welfare_chart_middle->line_color.a = 0.2f;
4064 main.welfare_chart_rich->line_color.a = 0.2f;
4067void budgetwindow_main_hover_poor_t::on_hover_end(
sys::state& state)
noexcept {
4070 main.welfare_chart_middle->line_color.a = 1.0f;
4071 main.welfare_chart_rich->line_color.a = 1.0f;
4080void budgetwindow_main_hover_poor_t::set_text(
sys::state& state, std::string
const& new_text) {
4081 if(new_text != cached_text) {
4082 cached_text = new_text;
4083 internal_layout.contents.clear();
4084 internal_layout.number_of_lines = 0;
4085 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 * 16), 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 };
4086 sl.add_text(state, cached_text);
4089void budgetwindow_main_hover_poor_t::on_reset_text(
sys::state& state)
noexcept {
4091 internal_layout.contents.clear();
4092 internal_layout.number_of_lines = 0;
4093 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 * 16), 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 };
4094 sl.add_text(state, cached_text);
4096void budgetwindow_main_hover_poor_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4097 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()));
4098 if(internal_layout.contents.empty())
return;
4100 auto linesz = state.font_collection.line_height(state, fh);
4101 if(linesz == 0.0f)
return;
4102 auto ycentered = (base_data.size.y - linesz) / 2;
4104 for(
auto& t : internal_layout.contents) {
4108void budgetwindow_main_hover_poor_t::on_update(
sys::state& state)
noexcept {
4113void budgetwindow_main_hover_poor_t::on_create(
sys::state& state)
noexcept {
4114 on_reset_text(state);
4118void budgetwindow_main_hover_middle_t::on_hover(
sys::state& state)
noexcept {
4121 main.welfare_chart_poor->line_color.a = 0.2f;
4122 main.welfare_chart_rich->line_color.a = 0.2f;
4125void budgetwindow_main_hover_middle_t::on_hover_end(
sys::state& state)
noexcept {
4128 main.welfare_chart_poor->line_color.a = 1.0f;
4129 main.welfare_chart_rich->line_color.a = 1.0f;
4138void budgetwindow_main_hover_middle_t::set_text(
sys::state& state, std::string
const& new_text) {
4139 if(new_text != cached_text) {
4140 cached_text = new_text;
4141 internal_layout.contents.clear();
4142 internal_layout.number_of_lines = 0;
4143 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 * 16), 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 };
4144 sl.add_text(state, cached_text);
4147void budgetwindow_main_hover_middle_t::on_reset_text(
sys::state& state)
noexcept {
4149 internal_layout.contents.clear();
4150 internal_layout.number_of_lines = 0;
4151 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 * 16), 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 };
4152 sl.add_text(state, cached_text);
4154void budgetwindow_main_hover_middle_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4155 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()));
4156 if(internal_layout.contents.empty())
return;
4158 auto linesz = state.font_collection.line_height(state, fh);
4159 if(linesz == 0.0f)
return;
4160 auto ycentered = (base_data.size.y - linesz) / 2;
4162 for(
auto& t : internal_layout.contents) {
4166void budgetwindow_main_hover_middle_t::on_update(
sys::state& state)
noexcept {
4171void budgetwindow_main_hover_middle_t::on_create(
sys::state& state)
noexcept {
4172 on_reset_text(state);
4176void budgetwindow_main_hover_rich_t::on_hover(
sys::state& state)
noexcept {
4179 main.welfare_chart_poor->line_color.a = 0.2f;
4180 main.welfare_chart_middle->line_color.a = 0.2f;
4183void budgetwindow_main_hover_rich_t::on_hover_end(
sys::state& state)
noexcept {
4186 main.welfare_chart_poor->line_color.a = 1.0f;
4187 main.welfare_chart_middle->line_color.a = 1.0f;
4196void budgetwindow_main_hover_rich_t::set_text(
sys::state& state, std::string
const& new_text) {
4197 if(new_text != cached_text) {
4198 cached_text = new_text;
4199 internal_layout.contents.clear();
4200 internal_layout.number_of_lines = 0;
4201 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 * 16), 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 };
4202 sl.add_text(state, cached_text);
4205void budgetwindow_main_hover_rich_t::on_reset_text(
sys::state& state)
noexcept {
4207 internal_layout.contents.clear();
4208 internal_layout.number_of_lines = 0;
4209 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 * 16), 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 };
4210 sl.add_text(state, cached_text);
4212void budgetwindow_main_hover_rich_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4213 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()));
4214 if(internal_layout.contents.empty())
return;
4216 auto linesz = state.font_collection.line_height(state, fh);
4217 if(linesz == 0.0f)
return;
4218 auto ycentered = (base_data.size.y - linesz) / 2;
4220 for(
auto& t : internal_layout.contents) {
4224void budgetwindow_main_hover_rich_t::on_update(
sys::state& state)
noexcept {
4229void budgetwindow_main_hover_rich_t::on_create(
sys::state& state)
noexcept {
4230 on_reset_text(state);
4234void budgetwindow_main_debt_label_t::set_text(
sys::state& state, std::string
const& new_text) {
4235 if(new_text != cached_text) {
4236 cached_text = new_text;
4237 internal_layout.contents.clear();
4238 internal_layout.number_of_lines = 0;
4239 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 * 16), 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 };
4240 sl.add_text(state, cached_text);
4243void budgetwindow_main_debt_label_t::on_reset_text(
sys::state& state)
noexcept {
4245 internal_layout.contents.clear();
4246 internal_layout.number_of_lines = 0;
4247 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 * 16), 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 };
4248 sl.add_text(state, cached_text);
4250void budgetwindow_main_debt_label_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4251 if(internal_layout.contents.empty())
return;
4253 auto linesz = state.font_collection.line_height(state, fh);
4254 if(linesz == 0.0f)
return;
4255 auto ycentered = (base_data.size.y - linesz) / 2;
4257 for(
auto& t : internal_layout.contents) {
4261void budgetwindow_main_debt_label_t::on_update(
sys::state& state)
noexcept {
4266void budgetwindow_main_debt_label_t::on_create(
sys::state& state)
noexcept {
4267 on_reset_text(state);
4276 command::enable_debt(state, state.local_player_nation, !state.world.nation_get_is_debt_spending(state.local_player_nation));
4286 auto last_br = state.world.nation_get_bankrupt_until(state.local_player_nation);
4287 if(last_br && state.current_date < last_br) {
4298void budgetwindow_main_debt_enable_t::set_text(
sys::state& state, std::string
const& new_text) {
4299 if(new_text != cached_text) {
4300 cached_text = new_text;
4301 internal_layout.contents.clear();
4302 internal_layout.number_of_lines = 0;
4303 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 * 16), 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 };
4304 sl.add_text(state, cached_text);
4307void budgetwindow_main_debt_enable_t::on_reset_text(
sys::state& state)
noexcept {
4309 internal_layout.contents.clear();
4310 internal_layout.number_of_lines = 0;
4311 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 * 16), 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 };
4312 sl.add_text(state, cached_text);
4314void budgetwindow_main_debt_enable_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4316 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, alt_background_texture, alt_texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4318 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()));
4319 if(internal_layout.contents.empty())
return;
4321 auto linesz = state.font_collection.line_height(state, fh);
4322 if(linesz == 0.0f)
return;
4323 auto ycentered = (base_data.size.y - linesz) / 2;
4325 for(
auto& t : internal_layout.contents) {
4329void budgetwindow_main_debt_enable_t::on_update(
sys::state& state)
noexcept {
4332 is_active = state.world.nation_get_is_debt_spending(state.local_player_nation);
4334 auto last_br = state.world.nation_get_bankrupt_until(state.local_player_nation);
4335 if(last_br && state.current_date < last_br)
4341void budgetwindow_main_debt_enable_t::on_create(
sys::state& state)
noexcept {
4342 on_reset_text(state);
4346void budgetwindow_main_total_debt_label_t::set_text(
sys::state& state, std::string
const& new_text) {
4347 if(new_text != cached_text) {
4348 cached_text = new_text;
4349 internal_layout.contents.clear();
4350 internal_layout.number_of_lines = 0;
4351 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 * 16), 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 };
4352 sl.add_text(state, cached_text);
4355void budgetwindow_main_total_debt_label_t::on_reset_text(
sys::state& state)
noexcept {
4357 internal_layout.contents.clear();
4358 internal_layout.number_of_lines = 0;
4359 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 * 16), 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 };
4360 sl.add_text(state, cached_text);
4362void budgetwindow_main_total_debt_label_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4363 if(internal_layout.contents.empty())
return;
4365 auto linesz = state.font_collection.line_height(state, fh);
4366 if(linesz == 0.0f)
return;
4367 auto ycentered = (base_data.size.y - linesz) / 2;
4369 for(
auto& t : internal_layout.contents) {
4373void budgetwindow_main_total_debt_label_t::on_update(
sys::state& state)
noexcept {
4378void budgetwindow_main_total_debt_label_t::on_create(
sys::state& state)
noexcept {
4379 on_reset_text(state);
4383void budgetwindow_main_max_debt_label_t::set_text(
sys::state& state, std::string
const& new_text) {
4384 if(new_text != cached_text) {
4385 cached_text = new_text;
4386 internal_layout.contents.clear();
4387 internal_layout.number_of_lines = 0;
4388 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 * 16), 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 };
4389 sl.add_text(state, cached_text);
4392void budgetwindow_main_max_debt_label_t::on_reset_text(
sys::state& state)
noexcept {
4394 internal_layout.contents.clear();
4395 internal_layout.number_of_lines = 0;
4396 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 * 16), 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 };
4397 sl.add_text(state, cached_text);
4399void budgetwindow_main_max_debt_label_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4400 if(internal_layout.contents.empty())
return;
4402 auto linesz = state.font_collection.line_height(state, fh);
4403 if(linesz == 0.0f)
return;
4404 auto ycentered = (base_data.size.y - linesz) / 2;
4406 for(
auto& t : internal_layout.contents) {
4410void budgetwindow_main_max_debt_label_t::on_update(
sys::state& state)
noexcept {
4415void budgetwindow_main_max_debt_label_t::on_create(
sys::state& state)
noexcept {
4416 on_reset_text(state);
4420void budgetwindow_main_total_debt_amount_t::set_text(
sys::state& state, std::string
const& new_text) {
4421 if(new_text != cached_text) {
4422 cached_text = new_text;
4423 internal_layout.contents.clear();
4424 internal_layout.number_of_lines = 0;
4425 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 * 16), 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 };
4426 sl.add_text(state, cached_text);
4429void budgetwindow_main_total_debt_amount_t::on_reset_text(
sys::state& state)
noexcept {
4431void budgetwindow_main_total_debt_amount_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4432 if(internal_layout.contents.empty())
return;
4434 auto linesz = state.font_collection.line_height(state, fh);
4435 if(linesz == 0.0f)
return;
4436 auto ycentered = (base_data.size.y - linesz) / 2;
4438 for(
auto& t : internal_layout.contents) {
4442void budgetwindow_main_total_debt_amount_t::on_update(
sys::state& state)
noexcept {
4445 auto amount = state.world.nation_get_local_loan(state.local_player_nation);
4449void budgetwindow_main_total_debt_amount_t::on_create(
sys::state& state)
noexcept {
4450 on_reset_text(state);
4454void budgetwindow_main_max_debt_amount_t::set_text(
sys::state& state, std::string
const& new_text) {
4455 if(new_text != cached_text) {
4456 cached_text = new_text;
4457 internal_layout.contents.clear();
4458 internal_layout.number_of_lines = 0;
4459 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 * 16), 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 };
4460 sl.add_text(state, cached_text);
4463void budgetwindow_main_max_debt_amount_t::on_reset_text(
sys::state& state)
noexcept {
4465void budgetwindow_main_max_debt_amount_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4466 if(internal_layout.contents.empty())
return;
4468 auto linesz = state.font_collection.line_height(state, fh);
4469 if(linesz == 0.0f)
return;
4470 auto ycentered = (base_data.size.y - linesz) / 2;
4472 for(
auto& t : internal_layout.contents) {
4476void budgetwindow_main_max_debt_amount_t::on_update(
sys::state& state)
noexcept {
4483void budgetwindow_main_max_debt_amount_t::on_create(
sys::state& state)
noexcept {
4484 on_reset_text(state);
4494void budgetwindow_main_debt_chart_t::update_chart(
sys::state& state) {
4495 std::sort(graph_content.begin(), graph_content.end(), [](
auto const& a,
auto const& b) { return a.amount > b.amount; });
4497 for(
auto& e : graph_content) { total += e.amount; }
4499 for(int32_t k = 0; k < 200; k++) {
4500 data_texture.data[k * 3] =
uint8_t(0);
4501 data_texture.data[k * 3 + 1] =
uint8_t(0);
4502 data_texture.data[k * 3 + 2] =
uint8_t(0);
4504 data_texture.data_updated =
true;
4508 float offset = 0.0f;
4509 for(int32_t k = 0; k < 200; k++) {
4510 if(graph_content[index].amount + offset < (
float(k) + 0.5f) * total /
float(200)) {
4511 offset += graph_content[index].amount;
4514 data_texture.data[k * 3] =
uint8_t(graph_content[index].color.r * 255.0f);
4515 data_texture.data[k * 3 + 1] =
uint8_t(graph_content[index].color.g * 255.0f);
4516 data_texture.data[k * 3 + 2] =
uint8_t(graph_content[index].color.b * 255.0f);
4518 data_texture.data_updated =
true;
4522 float temp_total = 0.0f;
4523 for(
auto& p : graph_content) { temp_total += p.amount; }
4524 float temp_offset = temp_total * float(x) / float(base_data.size.x);
4525 int32_t temp_index = 0;
4526 for(
auto& p : graph_content) {
if(temp_offset <= p.amount)
break; temp_offset -= p.amount; ++temp_index; }
4527 if(temp_index < int32_t(graph_content.size())) {
4528 auto& selected_key = graph_content[temp_index].key;
4538void budgetwindow_main_debt_chart_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4541void budgetwindow_main_debt_chart_t::on_update(
sys::state& state)
noexcept {
4544 graph_content.clear();
4547 set_visible(state, interest);
4551 auto t = state.world.nation_get_local_loan(state.local_player_nation);
4557 }
else if(t <= 2000.0f) {
4559 }
else if(t <= 4000.0f) {
4562 float total_share = 0.0f;
4563 float share = 10.0f;
4564 for(
auto n : state.nations_by_rank) {
4565 if(state.world.nation_get_is_great_power(n) && n != state.local_player_nation) {
4566 auto c = state.world.nation_get_color(n);
4568 total_share += share;
4576 for(
auto& i : graph_content) {
4577 i.amount *= i.amount * t / total_share;
4580 update_chart(state);
4583void budgetwindow_main_debt_chart_t::on_create(
sys::state& state)
noexcept {
4593void budgetwindow_main_debt_overlay_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4594 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()));
4596void budgetwindow_main_debt_overlay_t::on_update(
sys::state& state)
noexcept {
4602void budgetwindow_main_debt_overlay_t::on_create(
sys::state& state)
noexcept {
4607 state.ui_state.drag_target =
this;
4613void budgetwindow_main_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
4614 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()));
4621 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"budgetwindow::main"));
4622 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
4623 std::vector<sys::aui_pending_bytes> pending_children;
4624 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
4625 base_data.position.x = win_data.x_pos;
4626 base_data.position.y = win_data.y_pos;
4627 base_data.size.x = win_data.x_size;
4628 base_data.size.y = win_data.y_size;
4629 base_data.flags =
uint8_t(win_data.orientation);
4630 texture_key = win_data.texture;
4631 auto name_key = state.lookup_key(
"budgetwindow::main");
4632 for(
auto ex : state.ui_defs.extensions) {
4633 if(name_key && ex.window == name_key) {
4636 this->add_child_to_back(std::move(ch_res));
4640 while(!pending_children.empty()) {
4641 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
4642 pending_children.pop_back();
4643 if(child_data.name ==
"close_button") {
4644 auto cptr = std::make_unique<budgetwindow_main_close_button_t>();
4645 cptr->parent =
this;
4646 close_button = cptr.get();
4647 cptr->base_data.position.x = child_data.x_pos;
4648 cptr->base_data.position.y = child_data.y_pos;
4649 cptr->base_data.size.x = child_data.x_size;
4650 cptr->base_data.size.y = child_data.y_size;
4651 cptr->texture_key = child_data.texture;
4652 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
4653 cptr->on_create(state);
4654 this->add_child_to_back(std::move(cptr));
4657 if(child_data.name ==
"title") {
4658 auto cptr = std::make_unique<budgetwindow_main_title_t>();
4659 cptr->parent =
this;
4661 cptr->base_data.position.x = child_data.x_pos;
4662 cptr->base_data.position.y = child_data.y_pos;
4663 cptr->base_data.size.x = child_data.x_size;
4664 cptr->base_data.size.y = child_data.y_size;
4665 cptr->text_key = state.lookup_key(child_data.text_key);
4666 cptr->text_scale = child_data.text_scale;
4668 cptr->text_alignment = child_data.text_alignment;
4669 cptr->text_color = child_data.text_color;
4670 cptr->on_create(state);
4671 this->add_child_to_back(std::move(cptr));
4674 if(child_data.name ==
"income_label") {
4675 auto cptr = std::make_unique<budgetwindow_main_income_label_t>();
4676 cptr->parent =
this;
4677 income_label = cptr.get();
4678 cptr->base_data.position.x = child_data.x_pos;
4679 cptr->base_data.position.y = child_data.y_pos;
4680 cptr->base_data.size.x = child_data.x_size;
4681 cptr->base_data.size.y = child_data.y_size;
4682 cptr->text_key = state.lookup_key(child_data.text_key);
4683 cptr->text_scale = child_data.text_scale;
4685 cptr->text_alignment = child_data.text_alignment;
4686 cptr->text_color = child_data.text_color;
4687 cptr->on_create(state);
4688 this->add_child_to_back(std::move(cptr));
4691 if(child_data.name ==
"income_amount") {
4692 auto cptr = std::make_unique<budgetwindow_main_income_amount_t>();
4693 cptr->parent =
this;
4694 income_amount = cptr.get();
4695 cptr->base_data.position.x = child_data.x_pos;
4696 cptr->base_data.position.y = child_data.y_pos;
4697 cptr->base_data.size.x = child_data.x_size;
4698 cptr->base_data.size.y = child_data.y_size;
4699 cptr->text_scale = child_data.text_scale;
4701 cptr->text_alignment = child_data.text_alignment;
4702 cptr->text_color = child_data.text_color;
4703 cptr->on_create(state);
4704 this->add_child_to_back(std::move(cptr));
4707 if(child_data.name ==
"income_page_left") {
4708 auto cptr = std::make_unique<budgetwindow_main_income_page_left_t>();
4709 cptr->parent =
this;
4710 income_page_left = cptr.get();
4711 cptr->base_data.position.x = child_data.x_pos;
4712 cptr->base_data.position.y = child_data.y_pos;
4713 cptr->base_data.size.x = child_data.x_size;
4714 cptr->base_data.size.y = child_data.y_size;
4716 cptr->texture_key = child_data.texture;
4717 cptr->on_create(state);
4718 this->add_child_to_back(std::move(cptr));
4721 if(child_data.name ==
"income_page_right") {
4722 auto cptr = std::make_unique<budgetwindow_main_income_page_right_t>();
4723 cptr->parent =
this;
4724 income_page_right = cptr.get();
4725 cptr->base_data.position.x = child_data.x_pos;
4726 cptr->base_data.position.y = child_data.y_pos;
4727 cptr->base_data.size.x = child_data.x_size;
4728 cptr->base_data.size.y = child_data.y_size;
4730 cptr->texture_key = child_data.texture;
4731 cptr->on_create(state);
4732 this->add_child_to_back(std::move(cptr));
4735 if(child_data.name ==
"income_page_number") {
4736 auto cptr = std::make_unique<budgetwindow_main_income_page_number_t>();
4737 cptr->parent =
this;
4738 income_page_number = cptr.get();
4739 cptr->base_data.position.x = child_data.x_pos;
4740 cptr->base_data.position.y = child_data.y_pos;
4741 cptr->base_data.size.x = child_data.x_size;
4742 cptr->base_data.size.y = child_data.y_size;
4743 cptr->text_scale = child_data.text_scale;
4745 cptr->text_alignment = child_data.text_alignment;
4746 cptr->text_color = child_data.text_color;
4747 cptr->on_create(state);
4748 this->add_child_to_back(std::move(cptr));
4751 if(child_data.name ==
"income_table") {
4752 auto cptr = std::make_unique<budgetwindow_main_income_table_t>();
4753 cptr->parent =
this;
4754 income_table = cptr.get();
4755 cptr->base_data.position.x = child_data.x_pos;
4756 cptr->base_data.position.y = child_data.y_pos;
4757 cptr->base_data.size.x = child_data.x_size;
4758 cptr->base_data.size.y = child_data.y_size;
4759 int16_t col_sz_used = 0;
4760 budgetwindow_main_income_table_header_t::lead_space_column_start = col_sz_used;
4761 budgetwindow_main_income_table_header_t::lead_space_column_width = child_data.table_columns[0].width;
4762 col_sz_used += child_data.table_columns[0].width;
4763 budgetwindow_main_income_table_header_t::item_name_text_color = child_data.table_columns[1].header_text_color;
4764 budgetwindow_main_income_table_header_t::item_name_text_key = state.lookup_key(child_data.table_columns[1].header_key);
4765 budgetwindow_main_income_table_row_t::item_name_default_text_color = child_data.table_columns[1].cell_text_color;
4766 budgetwindow_main_income_table_row_t::item_name_text_alignment = child_data.table_columns[1].text_alignment;
4767 budgetwindow_main_income_table_header_t::item_name_column_start = col_sz_used;
4768 budgetwindow_main_income_table_header_t::item_name_column_width = child_data.table_columns[1].width;
4769 col_sz_used += child_data.table_columns[1].width;
4770 budgetwindow_main_income_table_header_t::item_value_text_color = child_data.table_columns[2].header_text_color;
4771 budgetwindow_main_income_table_header_t::item_value_text_key = state.lookup_key(child_data.table_columns[2].header_key);
4772 budgetwindow_main_income_table_row_t::item_value_default_text_color = child_data.table_columns[2].cell_text_color;
4773 budgetwindow_main_income_table_row_t::item_value_text_alignment = child_data.table_columns[2].text_alignment;
4774 budgetwindow_main_income_table_header_t::item_value_column_start = col_sz_used;
4775 budgetwindow_main_income_table_header_t::item_value_column_width = child_data.table_columns[2].width;
4776 col_sz_used += child_data.table_columns[2].width;
4777 budgetwindow_main_income_table_header_t::ascending_icon_key = child_data.ascending_sort_icon;
4778 budgetwindow_main_income_table_header_t::descending_icon_key = child_data.descending_sort_icon;
4779 budgetwindow_main_income_table_row_t::row_texture_key = child_data.row_background_a;
4780 budgetwindow_main_income_table_row_t::alt_row_texture_key = child_data.row_background_b;
4781 budgetwindow_main_income_table_t::row_height = child_data.row_height;
4782 budgetwindow_main_income_table_t::table_divider_color = child_data.table_divider_color;
4783 budgetwindow_main_income_table_t::table_highlight_color = child_data.table_highlight_color;
4784 cptr->on_create(state);
4785 this->add_child_to_back(std::move(cptr));
4788 if(child_data.name ==
"expenses_page_left") {
4789 auto cptr = std::make_unique<budgetwindow_main_expenses_page_left_t>();
4790 cptr->parent =
this;
4791 expenses_page_left = cptr.get();
4792 cptr->base_data.position.x = child_data.x_pos;
4793 cptr->base_data.position.y = child_data.y_pos;
4794 cptr->base_data.size.x = child_data.x_size;
4795 cptr->base_data.size.y = child_data.y_size;
4797 cptr->texture_key = child_data.texture;
4798 cptr->on_create(state);
4799 this->add_child_to_back(std::move(cptr));
4802 if(child_data.name ==
"expenses_page_number") {
4803 auto cptr = std::make_unique<budgetwindow_main_expenses_page_number_t>();
4804 cptr->parent =
this;
4805 expenses_page_number = cptr.get();
4806 cptr->base_data.position.x = child_data.x_pos;
4807 cptr->base_data.position.y = child_data.y_pos;
4808 cptr->base_data.size.x = child_data.x_size;
4809 cptr->base_data.size.y = child_data.y_size;
4810 cptr->text_scale = child_data.text_scale;
4812 cptr->text_alignment = child_data.text_alignment;
4813 cptr->text_color = child_data.text_color;
4814 cptr->on_create(state);
4815 this->add_child_to_back(std::move(cptr));
4818 if(child_data.name ==
"expenses_page_right") {
4819 auto cptr = std::make_unique<budgetwindow_main_expenses_page_right_t>();
4820 cptr->parent =
this;
4821 expenses_page_right = cptr.get();
4822 cptr->base_data.position.x = child_data.x_pos;
4823 cptr->base_data.position.y = child_data.y_pos;
4824 cptr->base_data.size.x = child_data.x_size;
4825 cptr->base_data.size.y = child_data.y_size;
4827 cptr->texture_key = child_data.texture;
4828 cptr->on_create(state);
4829 this->add_child_to_back(std::move(cptr));
4832 if(child_data.name ==
"expenses_label") {
4833 auto cptr = std::make_unique<budgetwindow_main_expenses_label_t>();
4834 cptr->parent =
this;
4835 expenses_label = cptr.get();
4836 cptr->base_data.position.x = child_data.x_pos;
4837 cptr->base_data.position.y = child_data.y_pos;
4838 cptr->base_data.size.x = child_data.x_size;
4839 cptr->base_data.size.y = child_data.y_size;
4840 cptr->text_key = state.lookup_key(child_data.text_key);
4841 cptr->text_scale = child_data.text_scale;
4843 cptr->text_alignment = child_data.text_alignment;
4844 cptr->text_color = child_data.text_color;
4845 cptr->on_create(state);
4846 this->add_child_to_back(std::move(cptr));
4849 if(child_data.name ==
"expenses_amount") {
4850 auto cptr = std::make_unique<budgetwindow_main_expenses_amount_t>();
4851 cptr->parent =
this;
4852 expenses_amount = cptr.get();
4853 cptr->base_data.position.x = child_data.x_pos;
4854 cptr->base_data.position.y = child_data.y_pos;
4855 cptr->base_data.size.x = child_data.x_size;
4856 cptr->base_data.size.y = child_data.y_size;
4857 cptr->text_scale = child_data.text_scale;
4859 cptr->text_alignment = child_data.text_alignment;
4860 cptr->text_color = child_data.text_color;
4861 cptr->on_create(state);
4862 this->add_child_to_back(std::move(cptr));
4865 if(child_data.name ==
"expenses_table") {
4866 auto cptr = std::make_unique<budgetwindow_main_expenses_table_t>();
4867 cptr->parent =
this;
4868 expenses_table = cptr.get();
4869 cptr->base_data.position.x = child_data.x_pos;
4870 cptr->base_data.position.y = child_data.y_pos;
4871 cptr->base_data.size.x = child_data.x_size;
4872 cptr->base_data.size.y = child_data.y_size;
4873 int16_t col_sz_used = 0;
4874 budgetwindow_main_expenses_table_header_t::lead_space_column_start = col_sz_used;
4875 budgetwindow_main_expenses_table_header_t::lead_space_column_width = child_data.table_columns[0].width;
4876 col_sz_used += child_data.table_columns[0].width;
4877 budgetwindow_main_expenses_table_header_t::item_name_text_color = child_data.table_columns[1].header_text_color;
4878 budgetwindow_main_expenses_table_header_t::item_name_text_key = state.lookup_key(child_data.table_columns[1].header_key);
4879 budgetwindow_main_expenses_table_row_t::item_name_default_text_color = child_data.table_columns[1].cell_text_color;
4880 budgetwindow_main_expenses_table_row_t::item_name_text_alignment = child_data.table_columns[1].text_alignment;
4881 budgetwindow_main_expenses_table_header_t::item_name_column_start = col_sz_used;
4882 budgetwindow_main_expenses_table_header_t::item_name_column_width = child_data.table_columns[1].width;
4883 col_sz_used += child_data.table_columns[1].width;
4884 budgetwindow_main_expenses_table_header_t::item_value_text_color = child_data.table_columns[2].header_text_color;
4885 budgetwindow_main_expenses_table_header_t::item_value_text_key = state.lookup_key(child_data.table_columns[2].header_key);
4886 budgetwindow_main_expenses_table_row_t::item_value_default_text_color = child_data.table_columns[2].cell_text_color;
4887 budgetwindow_main_expenses_table_row_t::item_value_text_alignment = child_data.table_columns[2].text_alignment;
4888 budgetwindow_main_expenses_table_header_t::item_value_column_start = col_sz_used;
4889 budgetwindow_main_expenses_table_header_t::item_value_column_width = child_data.table_columns[2].width;
4890 col_sz_used += child_data.table_columns[2].width;
4891 budgetwindow_main_expenses_table_header_t::ascending_icon_key = child_data.ascending_sort_icon;
4892 budgetwindow_main_expenses_table_header_t::descending_icon_key = child_data.descending_sort_icon;
4893 budgetwindow_main_expenses_table_row_t::row_texture_key = child_data.row_background_a;
4894 budgetwindow_main_expenses_table_row_t::alt_row_texture_key = child_data.row_background_b;
4895 budgetwindow_main_expenses_table_t::row_height = child_data.row_height;
4896 budgetwindow_main_expenses_table_t::table_divider_color = child_data.table_divider_color;
4897 budgetwindow_main_expenses_table_t::table_highlight_color = child_data.table_highlight_color;
4898 cptr->on_create(state);
4899 this->add_child_to_back(std::move(cptr));
4902 if(child_data.name ==
"admin_eff1") {
4903 auto cptr = std::make_unique<budgetwindow_main_admin_eff1_t>();
4904 cptr->parent =
this;
4905 admin_eff1 = cptr.get();
4906 cptr->base_data.position.x = child_data.x_pos;
4907 cptr->base_data.position.y = child_data.y_pos;
4908 cptr->base_data.size.x = child_data.x_size;
4909 cptr->base_data.size.y = child_data.y_size;
4910 cptr->text_key = state.lookup_key(child_data.text_key);
4911 cptr->text_scale = child_data.text_scale;
4913 cptr->text_alignment = child_data.text_alignment;
4914 cptr->text_color = child_data.text_color;
4915 cptr->on_create(state);
4916 this->add_child_to_back(std::move(cptr));
4919 if(child_data.name ==
"admin_eff2") {
4920 auto cptr = std::make_unique<budgetwindow_main_admin_eff2_t>();
4921 cptr->parent =
this;
4922 admin_eff2 = cptr.get();
4923 cptr->base_data.position.x = child_data.x_pos;
4924 cptr->base_data.position.y = child_data.y_pos;
4925 cptr->base_data.size.x = child_data.x_size;
4926 cptr->base_data.size.y = child_data.y_size;
4927 cptr->text_key = state.lookup_key(child_data.text_key);
4928 cptr->text_scale = child_data.text_scale;
4930 cptr->text_alignment = child_data.text_alignment;
4931 cptr->text_color = child_data.text_color;
4932 cptr->on_create(state);
4933 this->add_child_to_back(std::move(cptr));
4936 if(child_data.name ==
"admin_eff_amount") {
4937 auto cptr = std::make_unique<budgetwindow_main_admin_eff_amount_t>();
4938 cptr->parent =
this;
4939 admin_eff_amount = cptr.get();
4940 cptr->base_data.position.x = child_data.x_pos;
4941 cptr->base_data.position.y = child_data.y_pos;
4942 cptr->base_data.size.x = child_data.x_size;
4943 cptr->base_data.size.y = child_data.y_size;
4944 cptr->text_scale = child_data.text_scale;
4946 cptr->text_alignment = child_data.text_alignment;
4947 cptr->text_color = child_data.text_color;
4948 cptr->on_create(state);
4949 this->add_child_to_back(std::move(cptr));
4952 if(child_data.name ==
"welfare_label") {
4953 auto cptr = std::make_unique<budgetwindow_main_welfare_label_t>();
4954 cptr->parent =
this;
4955 welfare_label = cptr.get();
4956 cptr->base_data.position.x = child_data.x_pos;
4957 cptr->base_data.position.y = child_data.y_pos;
4958 cptr->base_data.size.x = child_data.x_size;
4959 cptr->base_data.size.y = child_data.y_size;
4960 cptr->text_key = state.lookup_key(child_data.text_key);
4961 cptr->text_scale = child_data.text_scale;
4963 cptr->text_alignment = child_data.text_alignment;
4964 cptr->text_color = child_data.text_color;
4965 cptr->on_create(state);
4966 this->add_child_to_back(std::move(cptr));
4969 if(child_data.name ==
"chart_max_a") {
4970 auto cptr = std::make_unique<budgetwindow_main_chart_max_a_t>();
4971 cptr->parent =
this;
4972 chart_max_a = cptr.get();
4973 cptr->base_data.position.x = child_data.x_pos;
4974 cptr->base_data.position.y = child_data.y_pos;
4975 cptr->base_data.size.x = child_data.x_size;
4976 cptr->base_data.size.y = child_data.y_size;
4977 cptr->text_key = state.lookup_key(child_data.text_key);
4978 cptr->text_scale = child_data.text_scale;
4980 cptr->text_alignment = child_data.text_alignment;
4981 cptr->text_color = child_data.text_color;
4982 cptr->on_create(state);
4983 this->add_child_to_back(std::move(cptr));
4986 if(child_data.name ==
"chart_min") {
4987 auto cptr = std::make_unique<budgetwindow_main_chart_min_t>();
4988 cptr->parent =
this;
4989 chart_min = cptr.get();
4990 cptr->base_data.position.x = child_data.x_pos;
4991 cptr->base_data.position.y = child_data.y_pos;
4992 cptr->base_data.size.x = child_data.x_size;
4993 cptr->base_data.size.y = child_data.y_size;
4994 cptr->text_key = state.lookup_key(child_data.text_key);
4995 cptr->text_scale = child_data.text_scale;
4997 cptr->text_alignment = child_data.text_alignment;
4998 cptr->text_color = child_data.text_color;
4999 cptr->on_create(state);
5000 this->add_child_to_back(std::move(cptr));
5003 if(child_data.name ==
"chart_max_b") {
5004 auto cptr = std::make_unique<budgetwindow_main_chart_max_b_t>();
5005 cptr->parent =
this;
5006 chart_max_b = cptr.get();
5007 cptr->base_data.position.x = child_data.x_pos;
5008 cptr->base_data.position.y = child_data.y_pos;
5009 cptr->base_data.size.x = child_data.x_size;
5010 cptr->base_data.size.y = child_data.y_size;
5011 cptr->text_key = state.lookup_key(child_data.text_key);
5012 cptr->text_scale = child_data.text_scale;
5014 cptr->text_alignment = child_data.text_alignment;
5015 cptr->text_color = child_data.text_color;
5016 cptr->on_create(state);
5017 this->add_child_to_back(std::move(cptr));
5020 if(child_data.name ==
"chart_poplabel") {
5021 auto cptr = std::make_unique<budgetwindow_main_chart_poplabel_t>();
5022 cptr->parent =
this;
5023 chart_poplabel = cptr.get();
5024 cptr->base_data.position.x = child_data.x_pos;
5025 cptr->base_data.position.y = child_data.y_pos;
5026 cptr->base_data.size.x = child_data.x_size;
5027 cptr->base_data.size.y = child_data.y_size;
5028 cptr->text_key = state.lookup_key(child_data.text_key);
5029 cptr->text_scale = child_data.text_scale;
5031 cptr->text_alignment = child_data.text_alignment;
5032 cptr->text_color = child_data.text_color;
5033 cptr->on_create(state);
5034 this->add_child_to_back(std::move(cptr));
5037 if(child_data.name ==
"chart_needslabel") {
5038 auto cptr = std::make_unique<budgetwindow_main_chart_needslabel_t>();
5039 cptr->parent =
this;
5040 chart_needslabel = cptr.get();
5041 cptr->base_data.position.x = child_data.x_pos;
5042 cptr->base_data.position.y = child_data.y_pos;
5043 cptr->base_data.size.x = child_data.x_size;
5044 cptr->base_data.size.y = child_data.y_size;
5045 cptr->text_key = state.lookup_key(child_data.text_key);
5046 cptr->text_scale = child_data.text_scale;
5048 cptr->text_alignment = child_data.text_alignment;
5049 cptr->text_color = child_data.text_color;
5050 cptr->on_create(state);
5051 this->add_child_to_back(std::move(cptr));
5054 if(child_data.name ==
"welfare_chart_poor") {
5055 auto cptr = std::make_unique<budgetwindow_main_welfare_chart_poor_t>();
5056 cptr->parent =
this;
5057 welfare_chart_poor = cptr.get();
5058 cptr->base_data.position.x = child_data.x_pos;
5059 cptr->base_data.position.y = child_data.y_pos;
5060 cptr->base_data.size.x = child_data.x_size;
5061 cptr->base_data.size.y = child_data.y_size;
5062 cptr->line_color = child_data.table_highlight_color;
5063 cptr->on_create(state);
5064 this->add_child_to_back(std::move(cptr));
5067 if(child_data.name ==
"welfare_chart_middle") {
5068 auto cptr = std::make_unique<budgetwindow_main_welfare_chart_middle_t>();
5069 cptr->parent =
this;
5070 welfare_chart_middle = cptr.get();
5071 cptr->base_data.position.x = child_data.x_pos;
5072 cptr->base_data.position.y = child_data.y_pos;
5073 cptr->base_data.size.x = child_data.x_size;
5074 cptr->base_data.size.y = child_data.y_size;
5075 cptr->line_color = child_data.table_highlight_color;
5076 cptr->on_create(state);
5077 this->add_child_to_back(std::move(cptr));
5080 if(child_data.name ==
"welfare_chart_rich") {
5081 auto cptr = std::make_unique<budgetwindow_main_welfare_chart_rich_t>();
5082 cptr->parent =
this;
5083 welfare_chart_rich = cptr.get();
5084 cptr->base_data.position.x = child_data.x_pos;
5085 cptr->base_data.position.y = child_data.y_pos;
5086 cptr->base_data.size.x = child_data.x_size;
5087 cptr->base_data.size.y = child_data.y_size;
5088 cptr->line_color = child_data.table_highlight_color;
5089 cptr->on_create(state);
5090 this->add_child_to_back(std::move(cptr));
5093 if(child_data.name ==
"hover_poor") {
5094 auto cptr = std::make_unique<budgetwindow_main_hover_poor_t>();
5095 cptr->parent =
this;
5096 hover_poor = cptr.get();
5097 cptr->base_data.position.x = child_data.x_pos;
5098 cptr->base_data.position.y = child_data.y_pos;
5099 cptr->base_data.size.x = child_data.x_size;
5100 cptr->base_data.size.y = child_data.y_size;
5101 cptr->texture_key = child_data.texture;
5102 cptr->text_key = state.lookup_key(child_data.text_key);
5103 cptr->text_scale = child_data.text_scale;
5105 cptr->text_alignment = child_data.text_alignment;
5106 cptr->text_color = child_data.text_color;
5107 cptr->on_create(state);
5108 this->add_child_to_back(std::move(cptr));
5111 if(child_data.name ==
"hover_middle") {
5112 auto cptr = std::make_unique<budgetwindow_main_hover_middle_t>();
5113 cptr->parent =
this;
5114 hover_middle = cptr.get();
5115 cptr->base_data.position.x = child_data.x_pos;
5116 cptr->base_data.position.y = child_data.y_pos;
5117 cptr->base_data.size.x = child_data.x_size;
5118 cptr->base_data.size.y = child_data.y_size;
5119 cptr->texture_key = child_data.texture;
5120 cptr->text_key = state.lookup_key(child_data.text_key);
5121 cptr->text_scale = child_data.text_scale;
5123 cptr->text_alignment = child_data.text_alignment;
5124 cptr->text_color = child_data.text_color;
5125 cptr->on_create(state);
5126 this->add_child_to_back(std::move(cptr));
5129 if(child_data.name ==
"hover_rich") {
5130 auto cptr = std::make_unique<budgetwindow_main_hover_rich_t>();
5131 cptr->parent =
this;
5132 hover_rich = cptr.get();
5133 cptr->base_data.position.x = child_data.x_pos;
5134 cptr->base_data.position.y = child_data.y_pos;
5135 cptr->base_data.size.x = child_data.x_size;
5136 cptr->base_data.size.y = child_data.y_size;
5137 cptr->texture_key = child_data.texture;
5138 cptr->text_key = state.lookup_key(child_data.text_key);
5139 cptr->text_scale = child_data.text_scale;
5141 cptr->text_alignment = child_data.text_alignment;
5142 cptr->text_color = child_data.text_color;
5143 cptr->on_create(state);
5144 this->add_child_to_back(std::move(cptr));
5147 if(child_data.name ==
"debt_label") {
5148 auto cptr = std::make_unique<budgetwindow_main_debt_label_t>();
5149 cptr->parent =
this;
5150 debt_label = cptr.get();
5151 cptr->base_data.position.x = child_data.x_pos;
5152 cptr->base_data.position.y = child_data.y_pos;
5153 cptr->base_data.size.x = child_data.x_size;
5154 cptr->base_data.size.y = child_data.y_size;
5155 cptr->text_key = state.lookup_key(child_data.text_key);
5156 cptr->text_scale = child_data.text_scale;
5158 cptr->text_alignment = child_data.text_alignment;
5159 cptr->text_color = child_data.text_color;
5160 cptr->on_create(state);
5161 this->add_child_to_back(std::move(cptr));
5164 if(child_data.name ==
"debt_enable") {
5165 auto cptr = std::make_unique<budgetwindow_main_debt_enable_t>();
5166 cptr->parent =
this;
5167 debt_enable = cptr.get();
5168 cptr->base_data.position.x = child_data.x_pos;
5169 cptr->base_data.position.y = child_data.y_pos;
5170 cptr->base_data.size.x = child_data.x_size;
5171 cptr->base_data.size.y = child_data.y_size;
5172 cptr->texture_key = child_data.texture;
5173 cptr->alt_texture_key = child_data.alt_texture;
5174 cptr->text_key = state.lookup_key(child_data.text_key);
5175 cptr->text_scale = child_data.text_scale;
5177 cptr->text_alignment = child_data.text_alignment;
5178 cptr->text_color = child_data.text_color;
5179 cptr->on_create(state);
5180 this->add_child_to_back(std::move(cptr));
5183 if(child_data.name ==
"total_debt_label") {
5184 auto cptr = std::make_unique<budgetwindow_main_total_debt_label_t>();
5185 cptr->parent =
this;
5186 total_debt_label = cptr.get();
5187 cptr->base_data.position.x = child_data.x_pos;
5188 cptr->base_data.position.y = child_data.y_pos;
5189 cptr->base_data.size.x = child_data.x_size;
5190 cptr->base_data.size.y = child_data.y_size;
5191 cptr->text_key = state.lookup_key(child_data.text_key);
5192 cptr->text_scale = child_data.text_scale;
5194 cptr->text_alignment = child_data.text_alignment;
5195 cptr->text_color = child_data.text_color;
5196 cptr->on_create(state);
5197 this->add_child_to_back(std::move(cptr));
5200 if(child_data.name ==
"max_debt_label") {
5201 auto cptr = std::make_unique<budgetwindow_main_max_debt_label_t>();
5202 cptr->parent =
this;
5203 max_debt_label = cptr.get();
5204 cptr->base_data.position.x = child_data.x_pos;
5205 cptr->base_data.position.y = child_data.y_pos;
5206 cptr->base_data.size.x = child_data.x_size;
5207 cptr->base_data.size.y = child_data.y_size;
5208 cptr->text_key = state.lookup_key(child_data.text_key);
5209 cptr->text_scale = child_data.text_scale;
5211 cptr->text_alignment = child_data.text_alignment;
5212 cptr->text_color = child_data.text_color;
5213 cptr->on_create(state);
5214 this->add_child_to_back(std::move(cptr));
5217 if(child_data.name ==
"total_debt_amount") {
5218 auto cptr = std::make_unique<budgetwindow_main_total_debt_amount_t>();
5219 cptr->parent =
this;
5220 total_debt_amount = cptr.get();
5221 cptr->base_data.position.x = child_data.x_pos;
5222 cptr->base_data.position.y = child_data.y_pos;
5223 cptr->base_data.size.x = child_data.x_size;
5224 cptr->base_data.size.y = child_data.y_size;
5225 cptr->text_key = state.lookup_key(child_data.text_key);
5226 cptr->text_scale = child_data.text_scale;
5228 cptr->text_alignment = child_data.text_alignment;
5229 cptr->text_color = child_data.text_color;
5230 cptr->on_create(state);
5231 this->add_child_to_back(std::move(cptr));
5234 if(child_data.name ==
"max_debt_amount") {
5235 auto cptr = std::make_unique<budgetwindow_main_max_debt_amount_t>();
5236 cptr->parent =
this;
5237 max_debt_amount = cptr.get();
5238 cptr->base_data.position.x = child_data.x_pos;
5239 cptr->base_data.position.y = child_data.y_pos;
5240 cptr->base_data.size.x = child_data.x_size;
5241 cptr->base_data.size.y = child_data.y_size;
5242 cptr->text_key = state.lookup_key(child_data.text_key);
5243 cptr->text_scale = child_data.text_scale;
5245 cptr->text_alignment = child_data.text_alignment;
5246 cptr->text_color = child_data.text_color;
5247 cptr->on_create(state);
5248 this->add_child_to_back(std::move(cptr));
5251 if(child_data.name ==
"debt_chart") {
5252 auto cptr = std::make_unique<budgetwindow_main_debt_chart_t>();
5253 cptr->parent =
this;
5254 debt_chart = cptr.get();
5255 cptr->base_data.position.x = child_data.x_pos;
5256 cptr->base_data.position.y = child_data.y_pos;
5257 cptr->base_data.size.x = child_data.x_size;
5258 cptr->base_data.size.y = child_data.y_size;
5260 cptr->on_create(state);
5261 this->add_child_to_back(std::move(cptr));
5264 if(child_data.name ==
"debt_overlay") {
5265 auto cptr = std::make_unique<budgetwindow_main_debt_overlay_t>();
5266 cptr->parent =
this;
5267 debt_overlay = cptr.get();
5268 cptr->base_data.position.x = child_data.x_pos;
5269 cptr->base_data.position.y = child_data.y_pos;
5270 cptr->base_data.size.x = child_data.x_size;
5271 cptr->base_data.size.y = child_data.y_size;
5273 cptr->texture_key = child_data.texture;
5274 cptr->on_create(state);
5275 this->add_child_to_back(std::move(cptr));
5283 auto ptr = std::make_unique<budgetwindow_main_t>();
5284 ptr->on_create(state);
5287void budgetwindow_section_header_label_t::set_text(
sys::state& state, std::string
const& new_text) {
5288 if(new_text != cached_text) {
5289 cached_text = new_text;
5290 internal_layout.contents.clear();
5291 internal_layout.number_of_lines = 0;
5292 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 * 16), 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 };
5293 sl.add_text(state, cached_text);
5296void budgetwindow_section_header_label_t::on_reset_text(
sys::state& state)
noexcept {
5298void budgetwindow_section_header_label_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5299 if(internal_layout.contents.empty())
return;
5301 auto linesz = state.font_collection.line_height(state, fh);
5302 if(linesz == 0.0f)
return;
5303 auto ycentered = (base_data.size.y - linesz) / 2;
5305 for(
auto& t : internal_layout.contents) {
5309void budgetwindow_section_header_label_t::on_update(
sys::state& state)
noexcept {
5313 case budget_categories::diplomatic_income: set_text(state,
text::produce_simple_string(state,
"alice_budget_diplo_income"));
break;
5317 case budget_categories::tariffs_import: set_text(state,
text::produce_simple_string(state,
"alice_budget_tariffs_import"));
break;
5318 case budget_categories::tariffs_export: set_text(state,
text::produce_simple_string(state,
"alice_budget_tariffs_export"));
break;
5320 case budget_categories::diplomatic_expenses: set_text(state,
text::produce_simple_string(state,
"alice_budget_diplo_expenses"));
break;
5325 case budget_categories::domestic_investment: set_text(state,
text::produce_simple_string(state,
"alice_budget_domestic_investment"));
break;
5326 case budget_categories::overseas_spending: set_text(state,
text::produce_simple_string(state,
"alice_budget_overseas_maintanance"));
break;
5333 default: set_text(state,
"");
break;
5337void budgetwindow_section_header_label_t::on_create(
sys::state& state)
noexcept {
5347 case budget_categories::diplomatic_income:
break;
5353 case budget_categories::gold:
break;
5354 case budget_categories::diplomatic_expenses:
break;
5361 case budget_categories::subsidies:
break;
5365 case budget_categories::debt_payment:
break;
5366 case budget_categories::stockpile:
break;
5379void budgetwindow_section_header_llbutton_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5380 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()));
5382void budgetwindow_section_header_llbutton_t::on_update(
sys::state& state)
noexcept {
5386 case budget_categories::diplomatic_income: set_visible(state,
false);
break;
5387 case budget_categories::poor_tax: set_visible(state,
true);
break;
5388 case budget_categories::middle_tax: set_visible(state,
true);
break;
5389 case budget_categories::rich_tax: set_visible(state,
true);
break;
5390 case budget_categories::tariffs_import: set_visible(state,
true);
break;
5391 case budget_categories::tariffs_export: set_visible(state,
true);
break;
5392 case budget_categories::gold: set_visible(state,
false);
break;
5393 case budget_categories::diplomatic_expenses: set_visible(state,
false);
break;
5394 case budget_categories::social: set_visible(state,
true);
break;
5395 case budget_categories::military: set_visible(state,
true);
break;
5396 case budget_categories::education: set_visible(state,
true);
break;
5397 case budget_categories::admin: set_visible(state,
true);
break;
5398 case budget_categories::domestic_investment: set_visible(state,
true);
break;
5399 case budget_categories::overseas_spending: set_visible(state,
true);
break;
5400 case budget_categories::subsidies: set_visible(state,
false);
break;
5401 case budget_categories::construction: set_visible(state,
true);
break;
5402 case budget_categories::army_upkeep: set_visible(state,
true);
break;
5403 case budget_categories::navy_upkeep: set_visible(state,
true);
break;
5404 case budget_categories::debt_payment: set_visible(state,
false);
break;
5405 case budget_categories::stockpile: set_visible(state,
false);
break;
5406 default: set_visible(state,
false);
break;
5410void budgetwindow_section_header_llbutton_t::on_create(
sys::state& state)
noexcept {
5421 case budget_categories::diplomatic_income:
break;
5422 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) - 1, 0, 100));
break;
5423 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) - 1, 0, 100));
break;
5424 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) - 1, 0, 100));
break;
5425 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) - 1, 0, 100));
break;
5426 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) - 1, 0, 100));
break;
5427 case budget_categories::gold:
break;
5428 case budget_categories::diplomatic_expenses:
break;
5429 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) - 1, 0, 100));
break;
5430 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) - 1, 0, 100));
break;
5431 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) - 1, 0, 100));
break;
5432 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) - 1, 0, 100));
break;
5433 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) - 1, 0, 100));
break;
5434 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) - 1, 0, 100));
break;
5435 case budget_categories::subsidies:
break;
5436 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) - 1, 0, 100));
break;
5437 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) - 1, 0, 100));
break;
5438 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) - 1, 0, 100));
break;
5439 case budget_categories::debt_payment:
break;
5440 case budget_categories::stockpile:
break;
5450 case budget_categories::diplomatic_income:
break;
5451 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) - 10, 0, 100));
break;
5452 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) - 10, 0, 100));
break;
5453 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) - 10, 0, 100));
break;
5454 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) - 10, 0, 100));
break;
5455 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) - 10, 0, 100));
break;
5456 case budget_categories::gold:
break;
5457 case budget_categories::diplomatic_expenses:
break;
5458 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) - 10, 0, 100));
break;
5459 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) - 10, 0, 100));
break;
5460 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) - 10, 0, 100));
break;
5461 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) - 10, 0, 100));
break;
5462 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) - 10, 0, 100));
break;
5463 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) - 10, 0, 100));
break;
5464 case budget_categories::subsidies:
break;
5465 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) - 10, 0, 100));
break;
5466 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) - 10, 0, 100));
break;
5467 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) - 10, 0, 100));
break;
5468 case budget_categories::debt_payment:
break;
5469 case budget_categories::stockpile:
break;
5482void budgetwindow_section_header_lbutton_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5483 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()));
5485void budgetwindow_section_header_lbutton_t::on_update(
sys::state& state)
noexcept {
5489 case budget_categories::diplomatic_income: set_visible(state,
false);
break;
5490 case budget_categories::poor_tax: set_visible(state,
true);
break;
5491 case budget_categories::middle_tax: set_visible(state,
true);
break;
5492 case budget_categories::rich_tax: set_visible(state,
true);
break;
5493 case budget_categories::tariffs_import: set_visible(state,
true);
break;
5494 case budget_categories::tariffs_export: set_visible(state,
true);
break;
5495 case budget_categories::gold: set_visible(state,
false);
break;
5496 case budget_categories::diplomatic_expenses: set_visible(state,
false);
break;
5497 case budget_categories::social: set_visible(state,
true);
break;
5498 case budget_categories::military: set_visible(state,
true);
break;
5499 case budget_categories::education: set_visible(state,
true);
break;
5500 case budget_categories::admin: set_visible(state,
true);
break;
5501 case budget_categories::domestic_investment: set_visible(state,
true);
break;
5502 case budget_categories::overseas_spending: set_visible(state,
true);
break;
5503 case budget_categories::subsidies: set_visible(state,
false);
break;
5504 case budget_categories::construction: set_visible(state,
true);
break;
5505 case budget_categories::army_upkeep: set_visible(state,
true);
break;
5506 case budget_categories::navy_upkeep: set_visible(state,
true);
break;
5507 case budget_categories::debt_payment: set_visible(state,
false);
break;
5508 case budget_categories::stockpile: set_visible(state,
false);
break;
5509 default: set_visible(state,
false);
break;
5513void budgetwindow_section_header_lbutton_t::on_create(
sys::state& state)
noexcept {
5524 case budget_categories::diplomatic_income:
break;
5525 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) + 1, 0, 100));
break;
5526 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) + 1, 0, 100));
break;
5527 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) + 1, 0, 100));
break;
5528 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) + 1, 0, 100));
break;
5529 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) + 1, 0, 100));
break;
5530 case budget_categories::gold:
break;
5531 case budget_categories::diplomatic_expenses:
break;
5532 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) + 1, 0, 100));
break;
5533 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) + 1, 0, 100));
break;
5534 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) + 1, 0, 100));
break;
5535 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) + 1, 0, 100));
break;
5536 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) + 1, 0, 100));
break;
5537 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) + 1, 0, 100));
break;
5538 case budget_categories::subsidies:
break;
5539 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) + 1, 0, 100));
break;
5540 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) + 1, 0, 100));
break;
5541 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) + 1, 0, 100));
break;
5542 case budget_categories::debt_payment:
break;
5543 case budget_categories::stockpile:
break;
5553 case budget_categories::diplomatic_income:
break;
5554 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) + 10, 0, 100));
break;
5555 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) + 10, 0, 100));
break;
5556 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) + 10, 0, 100));
break;
5557 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) + 10, 0, 100));
break;
5558 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) + 10, 0, 100));
break;
5559 case budget_categories::gold:
break;
5560 case budget_categories::diplomatic_expenses:
break;
5561 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) + 10, 0, 100));
break;
5562 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) + 10, 0, 100));
break;
5563 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) + 10, 0, 100));
break;
5564 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) + 10, 0, 100));
break;
5565 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) + 10, 0, 100));
break;
5566 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) + 10, 0, 100));
break;
5567 case budget_categories::subsidies:
break;
5568 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) + 10, 0, 100));
break;
5569 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) + 10, 0, 100));
break;
5570 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) + 10, 0, 100));
break;
5571 case budget_categories::debt_payment:
break;
5572 case budget_categories::stockpile:
break;
5585void budgetwindow_section_header_rbutton_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5586 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()));
5588void budgetwindow_section_header_rbutton_t::on_update(
sys::state& state)
noexcept {
5592 case budget_categories::diplomatic_income: set_visible(state,
false);
break;
5593 case budget_categories::poor_tax: set_visible(state,
true);
break;
5594 case budget_categories::middle_tax: set_visible(state,
true);
break;
5595 case budget_categories::rich_tax: set_visible(state,
true);
break;
5596 case budget_categories::tariffs_import: set_visible(state,
true);
break;
5597 case budget_categories::tariffs_export: set_visible(state,
true);
break;
5598 case budget_categories::gold: set_visible(state,
false);
break;
5599 case budget_categories::diplomatic_expenses: set_visible(state,
false);
break;
5600 case budget_categories::social: set_visible(state,
true);
break;
5601 case budget_categories::military: set_visible(state,
true);
break;
5602 case budget_categories::education: set_visible(state,
true);
break;
5603 case budget_categories::admin: set_visible(state,
true);
break;
5604 case budget_categories::domestic_investment: set_visible(state,
true);
break;
5605 case budget_categories::overseas_spending: set_visible(state,
true);
break;
5606 case budget_categories::subsidies: set_visible(state,
false);
break;
5607 case budget_categories::construction: set_visible(state,
true);
break;
5608 case budget_categories::army_upkeep: set_visible(state,
true);
break;
5609 case budget_categories::navy_upkeep: set_visible(state,
true);
break;
5610 case budget_categories::debt_payment: set_visible(state,
false);
break;
5611 case budget_categories::stockpile: set_visible(state,
false);
break;
5612 default: set_visible(state,
false);
break;
5616void budgetwindow_section_header_rbutton_t::on_create(
sys::state& state)
noexcept {
5626 case budget_categories::diplomatic_income:
break;
5632 case budget_categories::gold:
break;
5633 case budget_categories::diplomatic_expenses:
break;
5640 case budget_categories::subsidies:
break;
5644 case budget_categories::debt_payment:
break;
5645 case budget_categories::stockpile:
break;
5658void budgetwindow_section_header_rrbutton_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5659 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()));
5661void budgetwindow_section_header_rrbutton_t::on_update(
sys::state& state)
noexcept {
5665 case budget_categories::diplomatic_income: set_visible(state,
false);
break;
5666 case budget_categories::poor_tax: set_visible(state,
true);
break;
5667 case budget_categories::middle_tax: set_visible(state,
true);
break;
5668 case budget_categories::rich_tax: set_visible(state,
true);
break;
5669 case budget_categories::tariffs_import: set_visible(state,
true);
break;
5670 case budget_categories::tariffs_export: set_visible(state,
true);
break;
5671 case budget_categories::gold: set_visible(state,
false);
break;
5672 case budget_categories::diplomatic_expenses: set_visible(state,
false);
break;
5673 case budget_categories::social: set_visible(state,
true);
break;
5674 case budget_categories::military: set_visible(state,
true);
break;
5675 case budget_categories::education: set_visible(state,
true);
break;
5676 case budget_categories::admin: set_visible(state,
true);
break;
5677 case budget_categories::domestic_investment: set_visible(state,
true);
break;
5678 case budget_categories::overseas_spending: set_visible(state,
true);
break;
5679 case budget_categories::subsidies: set_visible(state,
false);
break;
5680 case budget_categories::construction: set_visible(state,
true);
break;
5681 case budget_categories::army_upkeep: set_visible(state,
true);
break;
5682 case budget_categories::navy_upkeep: set_visible(state,
true);
break;
5683 case budget_categories::debt_payment: set_visible(state,
false);
break;
5684 case budget_categories::stockpile: set_visible(state,
false);
break;
5685 default: set_visible(state,
false);
break;
5689void budgetwindow_section_header_rrbutton_t::on_create(
sys::state& state)
noexcept {
5693void budgetwindow_section_header_setting_amount_t::set_text(
sys::state& state, std::string
const& new_text) {
5694 if(new_text != cached_text) {
5695 cached_text = new_text;
5696 internal_layout.contents.clear();
5697 internal_layout.number_of_lines = 0;
5698 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 * 16), 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 };
5699 sl.add_text(state, cached_text);
5702void budgetwindow_section_header_setting_amount_t::on_reset_text(
sys::state& state)
noexcept {
5704void budgetwindow_section_header_setting_amount_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5705 if(internal_layout.contents.empty())
return;
5707 auto linesz = state.font_collection.line_height(state, fh);
5708 if(linesz == 0.0f)
return;
5709 auto ycentered = (base_data.size.y - linesz) / 2;
5711 for(
auto& t : internal_layout.contents) {
5715void budgetwindow_section_header_setting_amount_t::on_update(
sys::state& state)
noexcept {
5719 case budget_categories::diplomatic_income: set_text(state,
"");
break;
5720 case budget_categories::poor_tax: set_text(state, std::to_string(state.world.nation_get_poor_tax(state.local_player_nation)));
break;
5721 case budget_categories::middle_tax: set_text(state, std::to_string(state.world.nation_get_middle_tax(state.local_player_nation)));
break;
5722 case budget_categories::rich_tax: set_text(state, std::to_string(state.world.nation_get_rich_tax(state.local_player_nation)));
break;
5723 case budget_categories::tariffs_import: set_text(state, std::to_string(state.world.nation_get_tariffs_import(state.local_player_nation)));
break;
5724 case budget_categories::tariffs_export: set_text(state, std::to_string(state.world.nation_get_tariffs_export(state.local_player_nation)));
break;
5725 case budget_categories::gold: set_text(state,
"");
break;
5726 case budget_categories::diplomatic_expenses: set_text(state,
"");
break;
5727 case budget_categories::social: set_text(state, std::to_string(state.world.nation_get_social_spending(state.local_player_nation)));
break;
5728 case budget_categories::military: set_text(state, std::to_string(state.world.nation_get_military_spending(state.local_player_nation)));
break;
5729 case budget_categories::education: set_text(state, std::to_string(state.world.nation_get_education_spending(state.local_player_nation)));
break;
5730 case budget_categories::admin: set_text(state, std::to_string(state.world.nation_get_administrative_spending(state.local_player_nation)));
break;
5731 case budget_categories::domestic_investment: set_text(state, std::to_string(state.world.nation_get_domestic_investment_spending(state.local_player_nation)));
break;
5732 case budget_categories::overseas_spending: set_text(state, std::to_string(state.world.nation_get_overseas_spending(state.local_player_nation)));
break;
5733 case budget_categories::subsidies: set_text(state,
"");
break;
5734 case budget_categories::construction: set_text(state, std::to_string(state.world.nation_get_construction_spending(state.local_player_nation)));
break;
5735 case budget_categories::army_upkeep: set_text(state, std::to_string(state.world.nation_get_land_spending(state.local_player_nation)));
break;
5736 case budget_categories::navy_upkeep: set_text(state, std::to_string(state.world.nation_get_naval_spending(state.local_player_nation)));
break;
5737 case budget_categories::debt_payment: set_text(state,
"");
break;
5738 case budget_categories::stockpile: set_text(state,
"");
break;
5739 default: set_text(state,
"");
break;
5743void budgetwindow_section_header_setting_amount_t::on_create(
sys::state& state)
noexcept {
5752 budget_categories::expanded[section_header.
section_type] = !budget_categories::expanded[section_header.
section_type];
5753 state.game_state_updated.store(
true, std::memory_order::release);
5763 if(!budget_categories::expanded[section_header.
section_type])
5769void budgetwindow_section_header_expand_button_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5771 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, alt_background_texture, alt_texture_key), base_data.get_rotation(),
false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
5773 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()));
5775void budgetwindow_section_header_expand_button_t::on_update(
sys::state& state)
noexcept {
5780 case budget_categories::poor_tax: disabled =
false;
break;
5781 case budget_categories::middle_tax: disabled =
false;
break;
5782 case budget_categories::rich_tax: disabled =
false;
break;
5788 case budget_categories::military: disabled =
false;
break;
5789 case budget_categories::education: disabled =
false;
break;
5790 case budget_categories::admin: disabled =
false;
break;
5791 case budget_categories::domestic_investment: disabled =
false;
break;
5797 case budget_categories::debt_payment: disabled = (
economy::interest_payment(state, state.local_player_nation) <= 0);
break;
5799 default: disabled =
false;
break;
5802 is_active = !(!disabled && budget_categories::expanded[section_header.
section_type]);
5806void budgetwindow_section_header_expand_button_t::on_create(
sys::state& state)
noexcept {
5810void budgetwindow_section_header_total_amount_t::set_text(
sys::state& state, std::string
const& new_text) {
5811 if(new_text != cached_text) {
5812 cached_text = new_text;
5813 internal_layout.contents.clear();
5814 internal_layout.number_of_lines = 0;
5815 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 * 16), 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 };
5816 sl.add_text(state, cached_text);
5819void budgetwindow_section_header_total_amount_t::on_reset_text(
sys::state& state)
noexcept {
5821void budgetwindow_section_header_total_amount_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5822 if(internal_layout.contents.empty())
return;
5824 auto linesz = state.font_collection.line_height(state, fh);
5825 if(linesz == 0.0f)
return;
5826 auto ycentered = (base_data.size.y - linesz) / 2;
5828 for(
auto& t : internal_layout.contents) {
5832void budgetwindow_section_header_total_amount_t::on_update(
sys::state& state)
noexcept {
5848 case budget_categories::domestic_investment: set_text(state,
text::prettify_currency(
economy::estimate_domestic_investment(state, state.local_player_nation) *
float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) *
float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) / 10000.0f));
break;
5856 default: set_text(state,
"");
break;
5860void budgetwindow_section_header_total_amount_t::on_create(
sys::state& state)
noexcept {
5869 case budget_categories::diplomatic_income:
break;
5875 case budget_categories::gold:
break;
5876 case budget_categories::diplomatic_expenses:
break;
5883 case budget_categories::subsidies:
break;
5887 case budget_categories::debt_payment:
break;
5888 case budget_categories::stockpile:
break;
5895 case budget_categories::diplomatic_income:
break;
5896 case budget_categories::poor_tax:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tax,
true);
break;
5897 case budget_categories::middle_tax:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tax,
true);
break;
5898 case budget_categories::rich_tax:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tax,
true);
break;
5899 case budget_categories::tariffs_import:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tariff,
true);
break;
5900 case budget_categories::tariffs_export:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tariff,
true);
break;
5901 case budget_categories::gold:
break;
5902 case budget_categories::diplomatic_expenses:
break;
5903 case budget_categories::social:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_social_spending,
true);
break;
5904 case budget_categories::military:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_military_spending,
true);
break;
5905 case budget_categories::education:
break;
5906 case budget_categories::admin:
break;
5907 case budget_categories::domestic_investment:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_domestic_investment,
true);
break;
5908 case budget_categories::overseas_spending:
break;
5909 case budget_categories::subsidies:
break;
5910 case budget_categories::construction:
break;
5911 case budget_categories::army_upkeep:
break;
5912 case budget_categories::navy_upkeep:
break;
5913 case budget_categories::debt_payment:
break;
5914 case budget_categories::stockpile:
break;
5920void budgetwindow_section_header_min_setting_t::set_text(
sys::state& state, std::string
const& new_text) {
5921 if(new_text != cached_text) {
5922 cached_text = new_text;
5923 internal_layout.contents.clear();
5924 internal_layout.number_of_lines = 0;
5925 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 * 16), 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 };
5926 sl.add_text(state, cached_text);
5929void budgetwindow_section_header_min_setting_t::on_reset_text(
sys::state& state)
noexcept {
5931void budgetwindow_section_header_min_setting_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
5932 if(internal_layout.contents.empty())
return;
5934 auto linesz = state.font_collection.line_height(state, fh);
5935 if(linesz == 0.0f)
return;
5936 auto ycentered = (base_data.size.y - linesz) / 2;
5938 for(
auto& t : internal_layout.contents) {
5942void budgetwindow_section_header_min_setting_t::on_update(
sys::state& state)
noexcept {
5947 case budget_categories::diplomatic_income:
break;
5953 case budget_categories::gold:
break;
5954 case budget_categories::diplomatic_expenses:
break;
5961 case budget_categories::subsidies:
break;
5965 case budget_categories::debt_payment:
break;
5966 case budget_categories::stockpile:
break;
5970 set_text(state,
"");
5978void budgetwindow_section_header_min_setting_t::on_create(
sys::state& state)
noexcept {
5987 case budget_categories::diplomatic_income:
break;
5993 case budget_categories::gold:
break;
5994 case budget_categories::diplomatic_expenses:
break;
6001 case budget_categories::subsidies:
break;
6005 case budget_categories::debt_payment:
break;
6006 case budget_categories::stockpile:
break;
6013 case budget_categories::diplomatic_income:
break;
6014 case budget_categories::poor_tax:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tax,
true);
break;
6015 case budget_categories::middle_tax:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tax,
true);
break;
6016 case budget_categories::rich_tax:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tax,
true);
break;
6017 case budget_categories::tariffs_import:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tariff,
true);
break;
6018 case budget_categories::tariffs_export:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tariff,
true);
break;
6019 case budget_categories::gold:
break;
6020 case budget_categories::diplomatic_expenses:
break;
6021 case budget_categories::social:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_social_spending,
true);
break;
6022 case budget_categories::military:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_military_spending,
true);
break;
6023 case budget_categories::education:
break;
6024 case budget_categories::admin:
break;
6025 case budget_categories::domestic_investment:
ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_domestic_investment,
true);
break;
6026 case budget_categories::overseas_spending:
break;
6027 case budget_categories::subsidies:
break;
6028 case budget_categories::construction:
break;
6029 case budget_categories::army_upkeep:
break;
6030 case budget_categories::navy_upkeep:
break;
6031 case budget_categories::debt_payment:
break;
6032 case budget_categories::stockpile:
break;
6038void budgetwindow_section_header_max_setting_t::set_text(
sys::state& state, std::string
const& new_text) {
6039 if(new_text != cached_text) {
6040 cached_text = new_text;
6041 internal_layout.contents.clear();
6042 internal_layout.number_of_lines = 0;
6043 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 * 16), 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 };
6044 sl.add_text(state, cached_text);
6047void budgetwindow_section_header_max_setting_t::on_reset_text(
sys::state& state)
noexcept {
6049void budgetwindow_section_header_max_setting_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
6050 if(internal_layout.contents.empty())
return;
6052 auto linesz = state.font_collection.line_height(state, fh);
6053 if(linesz == 0.0f)
return;
6054 auto ycentered = (base_data.size.y - linesz) / 2;
6056 for(
auto& t : internal_layout.contents) {
6060void budgetwindow_section_header_max_setting_t::on_update(
sys::state& state)
noexcept {
6065 case budget_categories::diplomatic_income:
break;
6071 case budget_categories::gold:
break;
6072 case budget_categories::diplomatic_expenses:
break;
6079 case budget_categories::subsidies:
break;
6083 case budget_categories::debt_payment:
break;
6084 case budget_categories::stockpile:
break;
6088 set_text(state,
"");
6096void budgetwindow_section_header_max_setting_t::on_create(
sys::state& state)
noexcept {
6106void budgetwindow_section_header_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
6107 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()));
6109void budgetwindow_section_header_t::on_update(
sys::state& state)
noexcept {
6113void budgetwindow_section_header_t::on_create(
sys::state& state)
noexcept {
6114 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"budgetwindow::section_header"));
6115 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6116 std::vector<sys::aui_pending_bytes> pending_children;
6117 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6118 base_data.position.x = win_data.x_pos;
6119 base_data.position.y = win_data.y_pos;
6120 base_data.size.x = win_data.x_size;
6121 base_data.size.y = win_data.y_size;
6122 base_data.flags =
uint8_t(win_data.orientation);
6123 texture_key = win_data.texture;
6124 auto name_key = state.lookup_key(
"budgetwindow::section_header");
6125 for(
auto ex : state.ui_defs.extensions) {
6126 if(name_key && ex.window == name_key) {
6129 this->add_child_to_back(std::move(ch_res));
6133 while(!pending_children.empty()) {
6134 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
6135 pending_children.pop_back();
6136 if(child_data.name ==
"label") {
6137 auto cptr = std::make_unique<budgetwindow_section_header_label_t>();
6138 cptr->parent =
this;
6140 cptr->base_data.position.x = child_data.x_pos;
6141 cptr->base_data.position.y = child_data.y_pos;
6142 cptr->base_data.size.x = child_data.x_size;
6143 cptr->base_data.size.y = child_data.y_size;
6144 cptr->text_scale = child_data.text_scale;
6146 cptr->text_alignment = child_data.text_alignment;
6147 cptr->text_color = child_data.text_color;
6148 cptr->on_create(state);
6149 this->add_child_to_back(std::move(cptr));
6152 if(child_data.name ==
"llbutton") {
6153 auto cptr = std::make_unique<budgetwindow_section_header_llbutton_t>();
6154 cptr->parent =
this;
6155 llbutton = cptr.get();
6156 cptr->base_data.position.x = child_data.x_pos;
6157 cptr->base_data.position.y = child_data.y_pos;
6158 cptr->base_data.size.x = child_data.x_size;
6159 cptr->base_data.size.y = child_data.y_size;
6161 cptr->texture_key = child_data.texture;
6162 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6163 cptr->on_create(state);
6164 this->add_child_to_back(std::move(cptr));
6167 if(child_data.name ==
"lbutton") {
6168 auto cptr = std::make_unique<budgetwindow_section_header_lbutton_t>();
6169 cptr->parent =
this;
6170 lbutton = cptr.get();
6171 cptr->base_data.position.x = child_data.x_pos;
6172 cptr->base_data.position.y = child_data.y_pos;
6173 cptr->base_data.size.x = child_data.x_size;
6174 cptr->base_data.size.y = child_data.y_size;
6176 cptr->texture_key = child_data.texture;
6177 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6178 cptr->on_create(state);
6179 this->add_child_to_back(std::move(cptr));
6182 if(child_data.name ==
"rbutton") {
6183 auto cptr = std::make_unique<budgetwindow_section_header_rbutton_t>();
6184 cptr->parent =
this;
6185 rbutton = cptr.get();
6186 cptr->base_data.position.x = child_data.x_pos;
6187 cptr->base_data.position.y = child_data.y_pos;
6188 cptr->base_data.size.x = child_data.x_size;
6189 cptr->base_data.size.y = child_data.y_size;
6191 cptr->texture_key = child_data.texture;
6192 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6193 cptr->on_create(state);
6194 this->add_child_to_back(std::move(cptr));
6197 if(child_data.name ==
"rrbutton") {
6198 auto cptr = std::make_unique<budgetwindow_section_header_rrbutton_t>();
6199 cptr->parent =
this;
6200 rrbutton = cptr.get();
6201 cptr->base_data.position.x = child_data.x_pos;
6202 cptr->base_data.position.y = child_data.y_pos;
6203 cptr->base_data.size.x = child_data.x_size;
6204 cptr->base_data.size.y = child_data.y_size;
6206 cptr->texture_key = child_data.texture;
6207 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6208 cptr->on_create(state);
6209 this->add_child_to_back(std::move(cptr));
6212 if(child_data.name ==
"setting_amount") {
6213 auto cptr = std::make_unique<budgetwindow_section_header_setting_amount_t>();
6214 cptr->parent =
this;
6215 setting_amount = cptr.get();
6216 cptr->base_data.position.x = child_data.x_pos;
6217 cptr->base_data.position.y = child_data.y_pos;
6218 cptr->base_data.size.x = child_data.x_size;
6219 cptr->base_data.size.y = child_data.y_size;
6220 cptr->text_scale = child_data.text_scale;
6222 cptr->text_alignment = child_data.text_alignment;
6223 cptr->text_color = child_data.text_color;
6224 cptr->on_create(state);
6225 this->add_child_to_back(std::move(cptr));
6228 if(child_data.name ==
"expand_button") {
6229 auto cptr = std::make_unique<budgetwindow_section_header_expand_button_t>();
6230 cptr->parent =
this;
6231 expand_button = cptr.get();
6232 cptr->base_data.position.x = child_data.x_pos;
6233 cptr->base_data.position.y = child_data.y_pos;
6234 cptr->base_data.size.x = child_data.x_size;
6235 cptr->base_data.size.y = child_data.y_size;
6236 cptr->texture_key = child_data.texture;
6237 cptr->alt_texture_key = child_data.alt_texture;
6238 cptr->on_create(state);
6239 this->add_child_to_back(std::move(cptr));
6242 if(child_data.name ==
"total_amount") {
6243 auto cptr = std::make_unique<budgetwindow_section_header_total_amount_t>();
6244 cptr->parent =
this;
6245 total_amount = cptr.get();
6246 cptr->base_data.position.x = child_data.x_pos;
6247 cptr->base_data.position.y = child_data.y_pos;
6248 cptr->base_data.size.x = child_data.x_size;
6249 cptr->base_data.size.y = child_data.y_size;
6250 cptr->text_scale = child_data.text_scale;
6252 cptr->text_alignment = child_data.text_alignment;
6253 cptr->text_color = child_data.text_color;
6254 cptr->on_create(state);
6255 this->add_child_to_back(std::move(cptr));
6258 if(child_data.name ==
"min_setting") {
6259 auto cptr = std::make_unique<budgetwindow_section_header_min_setting_t>();
6260 cptr->parent =
this;
6261 min_setting = cptr.get();
6262 cptr->base_data.position.x = child_data.x_pos;
6263 cptr->base_data.position.y = child_data.y_pos;
6264 cptr->base_data.size.x = child_data.x_size;
6265 cptr->base_data.size.y = child_data.y_size;
6266 cptr->text_scale = child_data.text_scale;
6268 cptr->text_alignment = child_data.text_alignment;
6269 cptr->text_color = child_data.text_color;
6270 cptr->on_create(state);
6271 this->add_child_to_back(std::move(cptr));
6274 if(child_data.name ==
"max_setting") {
6275 auto cptr = std::make_unique<budgetwindow_section_header_max_setting_t>();
6276 cptr->parent =
this;
6277 max_setting = cptr.get();
6278 cptr->base_data.position.x = child_data.x_pos;
6279 cptr->base_data.position.y = child_data.y_pos;
6280 cptr->base_data.size.x = child_data.x_size;
6281 cptr->base_data.size.y = child_data.y_size;
6282 cptr->text_scale = child_data.text_scale;
6284 cptr->text_alignment = child_data.text_alignment;
6285 cptr->text_color = child_data.text_color;
6286 cptr->on_create(state);
6287 this->add_child_to_back(std::move(cptr));
6295 auto ptr = std::make_unique<budgetwindow_section_header_t>();
6296 ptr->on_create(state);
6305void budgetwindow_neutral_spacer_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
6306 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()));
6308void budgetwindow_neutral_spacer_t::on_update(
sys::state& state)
noexcept {
6312void budgetwindow_neutral_spacer_t::on_create(
sys::state& state)
noexcept {
6313 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"budgetwindow::neutral_spacer"));
6314 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6315 std::vector<sys::aui_pending_bytes> pending_children;
6316 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6317 base_data.position.x = win_data.x_pos;
6318 base_data.position.y = win_data.y_pos;
6319 base_data.size.x = win_data.x_size;
6320 base_data.size.y = win_data.y_size;
6321 base_data.flags =
uint8_t(win_data.orientation);
6322 texture_key = win_data.texture;
6323 auto name_key = state.lookup_key(
"budgetwindow::neutral_spacer");
6324 for(
auto ex : state.ui_defs.extensions) {
6325 if(name_key && ex.window == name_key) {
6328 this->add_child_to_back(std::move(ch_res));
6332 while(!pending_children.empty()) {
6333 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
6334 pending_children.pop_back();
6340 auto ptr = std::make_unique<budgetwindow_neutral_spacer_t>();
6341 ptr->on_create(state);
6350void budgetwindow_top_spacer_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
6351 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()));
6353void budgetwindow_top_spacer_t::on_update(
sys::state& state)
noexcept {
6357void budgetwindow_top_spacer_t::on_create(
sys::state& state)
noexcept {
6358 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"budgetwindow::top_spacer"));
6359 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6360 std::vector<sys::aui_pending_bytes> pending_children;
6361 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6362 base_data.position.x = win_data.x_pos;
6363 base_data.position.y = win_data.y_pos;
6364 base_data.size.x = win_data.x_size;
6365 base_data.size.y = win_data.y_size;
6366 base_data.flags =
uint8_t(win_data.orientation);
6367 texture_key = win_data.texture;
6368 auto name_key = state.lookup_key(
"budgetwindow::top_spacer");
6369 for(
auto ex : state.ui_defs.extensions) {
6370 if(name_key && ex.window == name_key) {
6373 this->add_child_to_back(std::move(ch_res));
6377 while(!pending_children.empty()) {
6378 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
6379 pending_children.pop_back();
6385 auto ptr = std::make_unique<budgetwindow_top_spacer_t>();
6386 ptr->on_create(state);
6395void budgetwindow_bottom_spacer_t::render(
sys::state & state, int32_t x, int32_t y)
noexcept {
6396 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()));
6398void budgetwindow_bottom_spacer_t::on_update(
sys::state& state)
noexcept {
6402void budgetwindow_bottom_spacer_t::on_create(
sys::state& state)
noexcept {
6403 auto window_bytes = state.ui_state.new_ui_windows.find(std::string(
"budgetwindow::bottom_spacer"));
6404 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6405 std::vector<sys::aui_pending_bytes> pending_children;
6406 auto win_data =
read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6407 base_data.position.x = win_data.x_pos;
6408 base_data.position.y = win_data.y_pos;
6409 base_data.size.x = win_data.x_size;
6410 base_data.size.y = win_data.y_size;
6411 base_data.flags =
uint8_t(win_data.orientation);
6412 texture_key = win_data.texture;
6413 auto name_key = state.lookup_key(
"budgetwindow::bottom_spacer");
6414 for(
auto ex : state.ui_defs.extensions) {
6415 if(name_key && ex.window == name_key) {
6418 this->add_child_to_back(std::move(ch_res));
6422 while(!pending_children.empty()) {
6423 auto child_data =
read_child_bytes(pending_children.back().data, pending_children.back().size);
6424 pending_children.pop_back();
6430 auto ptr = std::make_unique<budgetwindow_bottom_spacer_t>();
6431 ptr->on_create(state);
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
static constexpr uint8_t wants_update_when_hidden_mask
std::vector< element_base * > children
#define assert(condition)
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)
constexpr int32_t diplomatic_income
constexpr int32_t army_upkeep
constexpr int32_t construction
constexpr int32_t middle_tax
constexpr int32_t tariffs_import
constexpr int32_t navy_upkeep
constexpr int32_t rich_tax
constexpr int32_t poor_tax
constexpr int32_t tariffs_export
std::unique_ptr< ui::element_base > make_budgetwindow_bottom_spacer(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_neutral_spacer(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_top_spacer(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_section_header(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_main(sys::state &state)
budget_settings_data make_empty_budget_settings()
void change_budget_settings(sys::state &state, dcon::nation_id source, budget_settings_data const &values)
float estimate_reparations_income(sys::state &state, dcon::nation_id n)
float estimate_subsidy_spending(sys::state &state, dcon::nation_id n)
float estimate_social_spending(sys::state &state, dcon::nation_id n)
float estimate_subject_payments_paid(sys::state &state, dcon::nation_id n)
float estimate_diplomatic_expenses(sys::state &state, dcon::nation_id n)
float estimate_pop_payouts_by_income_type(sys::state &state, dcon::nation_id n, culture::income_type in)
float estimate_domestic_investment(sys::state &state, dcon::nation_id n)
float estimate_overseas_penalty_spending(sys::state &state, dcon::nation_id n)
float max_loan(sys::state &state, dcon::nation_id n)
float estimate_construction_spending(sys::state &state, dcon::nation_id n)
float estimate_war_subsidies_income(sys::state &state, dcon::nation_id n)
float estimate_land_spending(sys::state &state, dcon::nation_id n)
command::budget_settings_data budget_minimums(sys::state &state, dcon::nation_id n)
float price(sys::state const &state, dcon::state_instance_id s, dcon::commodity_id c)
float estimate_tariff_import_income(sys::state &state, dcon::nation_id n)
std::vector< trade_breakdown_item > explain_national_tariff(sys::state &state, dcon::nation_id n, bool import_flag, bool export_flag)
float estimate_diplomatic_income(sys::state &state, dcon::nation_id n)
float estimate_war_subsidies_spending(sys::state &state, dcon::nation_id n)
float estimate_reparations_spending(sys::state &state, dcon::nation_id n)
float estimate_naval_spending(sys::state &state, dcon::nation_id n)
float estimate_tax_income_by_strata(sys::state &state, dcon::nation_id n, culture::pop_strata ps)
float estimate_stockpile_filling_spending(sys::state &state, dcon::nation_id n)
float estimate_tariff_export_income(sys::state &state, dcon::nation_id n)
float interest_payment(sys::state &state, dcon::nation_id n)
float estimate_gold_income(sys::state &state, dcon::nation_id n)
command::budget_settings_data budget_maximums(sys::state &state, dcon::nation_id n)
GLuint get_late_load_texture_handle(sys::state &state, dcon::texture_id &id, std::string_view asset_name)
void render_alpha_colored_rect(sys::state const &state, float x, float y, float width, float height, float red, float green, float blue, float alpha)
void render_linegraph(sys::state const &state, color_modification enabled, float x, float y, float width, float height, lines &l)
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)
void render_stripchart(sys::state const &state, color_modification enabled, float x, float y, float sizex, float sizey, data_texture &t)
float get_luxury_needs(sys::state const &state, dcon::pop_id p)
float get_life_needs(sys::state const &state, dcon::pop_id p)
float get_everyday_needs(sys::state const &state, dcon::pop_id p)
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
audio_instance & get_click_sound(sys::state &state)
float blue_from_int(uint32_t v)
float green_from_int(uint32_t v)
float red_from_int(uint32_t v)
void merge_sort(IT first, IT end, CMP const &cmp) noexcept
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
layout_box open_layout_box(layout_base &dest, int32_t indent)
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
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)
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
std::string get_dynamic_state_name(sys::state &state, dcon::state_instance_id state_id)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
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)
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
std::string format_percentage(float num, size_t digits)
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
std::string prettify_currency(float num)
void close_layout_box(columnar_layout &dest, layout_box &box)
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)
@ position_sensitive_tooltip
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 active_modifiers_description(sys::state &state, text::layout_base &layout, dcon::nation_id n, int32_t identation, dcon::national_modifier_value nmid, bool header)
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
std::string_view texture_key
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
void on_update(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
text::layout internal_layout
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
text::text_color text_color
void set_text(sys::state &state, std::string const &new_text)
text::alignment text_alignment
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout internal_layout
text::text_color text_color
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
text::alignment text_alignment
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
text::text_color text_color
text::alignment text_alignment
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
void set_text(sys::state &state, std::string const &new_text)
void on_create(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_reset_text(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
text::layout internal_layout
text::alignment text_alignment
text::layout internal_layout
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
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
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
text::alignment text_alignment
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
text::layout internal_layout
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
void on_create(sys::state &state) noexcept override
text::text_color text_color
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 set_text(sys::state &state, std::string const &new_text)
text::text_color text_color
text::layout internal_layout
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
text::alignment text_alignment
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
text::layout internal_layout
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
text::text_color text_color
void on_update(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::alignment text_alignment
void set_text(sys::state &state, std::string const &new_text)
text::text_color text_color
text::alignment text_alignment
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
text::layout internal_layout
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
dcon::text_key tooltip_key
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::message_result on_key_down(sys::state &state, sys::virtual_key key, 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::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
dcon::texture_id background_texture
std::string_view texture_key
ogl::data_texture data_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 update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
std::vector< graph_entry > graph_content
void update_chart(sys::state &state)
void on_create(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
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
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) 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
text::alignment text_alignment
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
dcon::texture_id background_texture
std::string_view alt_texture_key
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
dcon::texture_id alt_background_texture
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
text::text_color text_color
std::string_view texture_key
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout internal_layout
void on_update(sys::state &state) noexcept override
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
text::layout internal_layout
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::alignment text_alignment
void set_text(sys::state &state, std::string const &new_text)
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(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::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
dcon::texture_id background_texture
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_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
text::text_color text_color
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
text::layout internal_layout
void on_reset_text(sys::state &state) noexcept override
text::alignment text_alignment
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
text::layout internal_layout
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_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
text::text_color text_color
text::alignment text_alignment
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_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
std::string_view texture_key
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
void on_update(sys::state &state) noexcept override
text::alignment text_alignment
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(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_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::layout internal_layout
void set_text(sys::state &state, std::string const &new_text)
ui::tooltip_behavior has_tooltip(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
std::string_view texture_key
dcon::texture_id background_texture
ui::message_result on_rbutton_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
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
static dcon::text_key item_name_text_key
static std::string_view ascending_icon_key
static dcon::text_key item_value_text_key
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
std::string item_value_cached_text
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
static std::string_view descending_icon_key
static dcon::texture_id descending_icon
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_reset_text(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout item_value_internal_layout
static int8_t item_name_sort_direction
static int16_t item_name_column_width
static int16_t lead_space_column_width
text::layout item_name_internal_layout
static int16_t lead_space_column_start
static int16_t item_name_column_start
static dcon::texture_id ascending_icon
static text::text_color item_name_text_color
static int8_t item_value_sort_direction
static text::text_color item_value_text_color
static int16_t item_value_column_width
std::string item_name_cached_text
void on_create(sys::state &state) noexcept override
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
static int16_t item_value_column_start
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void set_item_value_text(sys::state &state, std::string const &new_text)
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
static text::alignment item_value_text_alignment
void on_create(sys::state &state) noexcept override
static std::string_view row_texture_key
static std::string_view alt_row_texture_key
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_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
text::text_color item_value_text_color
static dcon::texture_id row_background_texture
std::string item_value_cached_text
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
static text::alignment item_name_text_alignment
text::text_color item_name_text_color
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout item_name_internal_layout
static dcon::texture_id alt_row_background_texture
void set_item_name_text(sys::state &state, std::string const &new_text)
std::pair< std::string, float > value
static text::text_color item_value_default_text_color
text::layout item_value_internal_layout
static text::text_color item_name_default_text_color
std::string item_name_cached_text
std::pair< std::string, float > value
void change_page(sys::state &state, int32_t new_page)
void apply_sort(sys::state &state)
std::unique_ptr< budgetwindow_main_expenses_table_row_t > make_row(sys::state &state)
static ogl::color4f table_highlight_color
void on_create(sys::state &state) noexcept override
std::vector< std::unique_ptr< ui::element_base > > neutral_spacer_pool
void add_insert_top_spacer(sys::state &state)
static ogl::color3f table_divider_color
void impl_apply_sort(sys::state &state)
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
std::vector< std::unique_ptr< ui::element_base > > bottom_spacer_pool
void add_insert_bottom_spacer(sys::state &state)
std::vector< std::unique_ptr< ui::element_base > > section_header_pool
ui::message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
void add_value(std::pair< std::string, float > const &v)
std::unique_ptr< budgetwindow_main_expenses_table_header_t > make_headers(sys::state &state)
std::vector< std::variant< std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option > > values
std::vector< std::unique_ptr< ui::element_base > > top_spacer_pool
void add_insert_neutral_spacer(sys::state &state)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void add_insert_section_header(sys::state &state, int32_t const §ion_type)
void on_update(sys::state &state) noexcept override
void impl_change_page(sys::state &state, int32_t new_page)
std::vector< std::unique_ptr< budgetwindow_main_expenses_table_header_t > > header_pool
std::vector< int32_t > page_starts
std::vector< std::unique_ptr< budgetwindow_main_expenses_table_row_t > > row_pool
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
text::alignment text_alignment
void on_reset_text(sys::state &state) noexcept override
text::text_color text_color
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 set_text(sys::state &state, std::string const &new_text)
void on_hover_end(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
text::layout internal_layout
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
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_hover(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
dcon::texture_id background_texture
dcon::texture_id background_texture
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
std::string_view texture_key
text::alignment text_alignment
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
void on_hover(sys::state &state) noexcept override
text::layout internal_layout
void on_hover_end(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::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
text::text_color text_color
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_create(sys::state &state) noexcept override
std::string_view texture_key
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
text::alignment text_alignment
dcon::texture_id background_texture
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_hover(sys::state &state) noexcept override
void on_reset_text(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 on_hover_end(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
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
text::alignment text_alignment
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
text::layout internal_layout
void on_create(sys::state &state) noexcept override
text::layout internal_layout
void set_text(sys::state &state, std::string const &new_text)
void on_update(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 on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
text::text_color text_color
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_rbutton_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
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
void on_update(sys::state &state) noexcept override
dcon::texture_id background_texture
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
text::alignment text_alignment
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
text::layout internal_layout
void set_text(sys::state &state, std::string const &new_text)
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 render(sys::state &state, int32_t x, int32_t y) 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
std::string_view texture_key
void on_create(sys::state &state) noexcept override
dcon::texture_id background_texture
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_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
static std::string_view ascending_icon_key
static int16_t item_value_column_width
static int16_t item_name_column_width
static dcon::texture_id descending_icon
static int16_t lead_space_column_start
static int16_t lead_space_column_width
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
static text::text_color item_value_text_color
text::layout item_value_internal_layout
void on_reset_text(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::layout item_name_internal_layout
std::string item_name_cached_text
static std::string_view descending_icon_key
void render(sys::state &state, int32_t x, int32_t y) noexcept override
static dcon::text_key item_value_text_key
static int16_t item_value_column_start
void on_create(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
std::string item_value_cached_text
static int16_t item_name_column_start
static text::text_color item_name_text_color
static dcon::texture_id ascending_icon
static dcon::text_key item_name_text_key
static int8_t item_value_sort_direction
static int8_t item_name_sort_direction
void set_item_value_text(sys::state &state, std::string const &new_text)
std::string item_value_cached_text
void on_update(sys::state &state) noexcept override
text::text_color item_name_text_color
static text::text_color item_value_default_text_color
static dcon::texture_id row_background_texture
void on_create(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
static std::string_view row_texture_key
std::pair< std::string, float > value
static dcon::texture_id alt_row_background_texture
static text::alignment item_name_text_alignment
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
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
static text::text_color item_name_default_text_color
void set_item_name_text(sys::state &state, std::string const &new_text)
text::layout item_value_internal_layout
text::text_color item_value_text_color
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
std::string item_name_cached_text
text::layout item_name_internal_layout
static std::string_view alt_row_texture_key
static text::alignment item_value_text_alignment
std::pair< std::string, float > value
void add_insert_section_header(sys::state &state, int32_t const §ion_type)
void impl_apply_sort(sys::state &state)
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void add_insert_bottom_spacer(sys::state &state)
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
std::vector< std::variant< std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option > > values
static ogl::color4f table_highlight_color
std::vector< std::unique_ptr< ui::element_base > > neutral_spacer_pool
std::vector< std::unique_ptr< ui::element_base > > bottom_spacer_pool
void apply_sort(sys::state &state)
std::vector< std::unique_ptr< budgetwindow_main_income_table_header_t > > header_pool
ui::message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
void impl_change_page(sys::state &state, int32_t new_page)
std::vector< std::unique_ptr< budgetwindow_main_income_table_row_t > > row_pool
std::unique_ptr< budgetwindow_main_income_table_row_t > make_row(sys::state &state)
std::unique_ptr< budgetwindow_main_income_table_header_t > make_headers(sys::state &state)
std::vector< int32_t > page_starts
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
static ogl::color3f table_divider_color
std::vector< std::unique_ptr< ui::element_base > > top_spacer_pool
void add_insert_neutral_spacer(sys::state &state)
void change_page(sys::state &state, int32_t new_page)
void add_value(std::pair< std::string, float > const &v)
void add_insert_top_spacer(sys::state &state)
std::vector< std::unique_ptr< ui::element_base > > section_header_pool
void on_reset_text(sys::state &state) noexcept override
text::alignment text_alignment
text::layout internal_layout
text::text_color text_color
void set_text(sys::state &state, std::string const &new_text)
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 render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
text::text_color text_color
void render(sys::state &state, int32_t x, int32_t y) noexcept override
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::tooltip_behavior has_tooltip(sys::state &state) noexcept override
text::alignment text_alignment
void on_reset_text(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
text::layout internal_layout
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
budgetwindow_main_expenses_page_right_t * expenses_page_right
budgetwindow_main_total_debt_label_t * total_debt_label
budgetwindow_main_debt_overlay_t * debt_overlay
budgetwindow_main_expenses_table_t * expenses_table
budgetwindow_main_expenses_page_number_t * expenses_page_number
budgetwindow_main_chart_max_a_t * chart_max_a
budgetwindow_main_chart_max_b_t * chart_max_b
budgetwindow_main_income_page_left_t * income_page_left
void on_drag(sys::state &state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
budgetwindow_main_admin_eff2_t * admin_eff2
budgetwindow_main_close_button_t * close_button
budgetwindow_main_income_page_number_t * income_page_number
budgetwindow_main_chart_poplabel_t * chart_poplabel
budgetwindow_main_income_page_right_t * income_page_right
budgetwindow_main_welfare_label_t * welfare_label
budgetwindow_main_welfare_chart_poor_t * welfare_chart_poor
budgetwindow_main_welfare_chart_middle_t * welfare_chart_middle
budgetwindow_main_chart_min_t * chart_min
budgetwindow_main_max_debt_label_t * max_debt_label
budgetwindow_main_income_amount_t * income_amount
budgetwindow_main_hover_poor_t * hover_poor
budgetwindow_main_hover_rich_t * hover_rich
budgetwindow_main_max_debt_amount_t * max_debt_amount
budgetwindow_main_title_t * title
budgetwindow_main_debt_chart_t * debt_chart
budgetwindow_main_admin_eff1_t * admin_eff1
budgetwindow_main_debt_label_t * debt_label
void render(sys::state &state, int32_t x, int32_t y) noexcept override
budgetwindow_main_expenses_label_t * expenses_label
budgetwindow_main_income_table_t * income_table
budgetwindow_main_chart_needslabel_t * chart_needslabel
budgetwindow_main_welfare_chart_rich_t * welfare_chart_rich
budgetwindow_main_income_label_t * income_label
budgetwindow_main_debt_enable_t * debt_enable
budgetwindow_main_hover_middle_t * hover_middle
budgetwindow_main_expenses_amount_t * expenses_amount
std::string_view texture_key
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
budgetwindow_main_total_debt_amount_t * total_debt_amount
budgetwindow_main_expenses_page_left_t * expenses_page_left
void on_update(sys::state &state) noexcept override
void on_create(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
budgetwindow_main_admin_eff_amount_t * admin_eff_amount
dcon::texture_id background_texture
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
void set_text(sys::state &state, std::string const &new_text)
text::alignment text_alignment
text::layout internal_layout
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::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(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 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
text::layout internal_layout
text::text_color text_color
text::layout internal_layout
text::alignment text_alignment
void on_reset_text(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
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::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
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 set_data_points(sys::state &state, std::vector< float > const &datapoints, float min, float max)
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) 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
void set_data_points(sys::state &state, std::vector< float > const &datapoints, float min, float max)
ui::message_result on_rbutton_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
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) 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
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 set_data_points(sys::state &state, std::vector< float > const &datapoints, float min, float max)
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(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
void on_reset_text(sys::state &state) noexcept override
text::text_color text_color
text::layout internal_layout
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::alignment text_alignment
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
dcon::texture_id background_texture
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) 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::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::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
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
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
int8_t domestic_investment
int8_t administrative_spending
int8_t construction_spending
int8_t education_spending
Holds important data about the game world, state, and other data regarding windowing,...
std::vector< text_chunk > contents