From ed19d7370af447830072d058b16852163ff5a4f7 Mon Sep 17 00:00:00 2001 From: Liquidscroll Date: Wed, 28 Aug 2024 12:54:09 +1000 Subject: [PATCH] fix: updated naming scheme --- coresdk/src/backend/interface_driver.cpp | 18 ++++---- coresdk/src/backend/interface_driver.h | 10 ++--- coresdk/src/coresdk/interface.cpp | 46 ++++++++++----------- coresdk/src/coresdk/interface.h | 52 ++++++++++++------------ coresdk/src/test/test_ui.cpp | 8 ++-- 5 files changed, 67 insertions(+), 67 deletions(-) diff --git a/coresdk/src/backend/interface_driver.cpp b/coresdk/src/backend/interface_driver.cpp index 998fc85d..55901495 100644 --- a/coresdk/src/backend/interface_driver.cpp +++ b/coresdk/src/backend/interface_driver.cpp @@ -581,14 +581,14 @@ namespace splashkit_lib mu_pop_id(ctx); } - bool sk_interface_header(const string& text_label) + bool sk_interface_header(const string& label_text) { - return mu_header(ctx, text_label.c_str()); + return mu_header(ctx, label_text.c_str()); } - void sk_interface_label(const string& text_label) + void sk_interface_label(const string& label_text) { - mu_label(ctx, text_label.c_str()); + mu_label(ctx, label_text.c_str()); } void sk_interface_text(const string& text) @@ -596,18 +596,18 @@ namespace splashkit_lib mu_text(ctx, text.c_str()); } - bool sk_interface_button(const string& text_label, int icon) + bool sk_interface_button(const string& label_text, int icon) { - update_elements_changed(mu_button_ex(ctx, text_label.c_str(), icon, MU_OPT_ALIGNCENTER)); + update_elements_changed(mu_button_ex(ctx, label_text.c_str(), icon, MU_OPT_ALIGNCENTER)); return element_confirmed; } - bool sk_interface_checkbox(const string& text_label, const bool& value) + bool sk_interface_checkbox(const string& label_text, const bool& value) { sk_interface_push_ptr_id((void*)&value); int temp_value = value; - update_elements_changed(mu_checkbox(ctx, text_label.c_str(), &temp_value)); + update_elements_changed(mu_checkbox(ctx, label_text.c_str(), &temp_value)); sk_interface_pop_id(); return temp_value; @@ -929,4 +929,4 @@ namespace splashkit_lib { return interface_enabled; } -} \ No newline at end of file +} diff --git a/coresdk/src/backend/interface_driver.h b/coresdk/src/backend/interface_driver.h index ac3b2569..a775d894 100644 --- a/coresdk/src/backend/interface_driver.h +++ b/coresdk/src/backend/interface_driver.h @@ -54,11 +54,11 @@ namespace splashkit_lib void sk_interface_push_ptr_id(void* ptr); void sk_interface_pop_id(); - bool sk_interface_header(const string& text_label); - void sk_interface_label(const string& text_label); + bool sk_interface_header(const string& label_text); + void sk_interface_label(const string& label_text); void sk_interface_text(const string& text); - bool sk_interface_button(const string& text_label, int icon); - bool sk_interface_checkbox(const string& text_label, const bool& value); + bool sk_interface_button(const string& label_text, int icon); + bool sk_interface_checkbox(const string& label_text, const bool& value); float sk_interface_slider(const float& value, float min_value, float max_value); float sk_interface_number(const float& value, float step); std::string sk_interface_text_box(const std::string& value); @@ -113,4 +113,4 @@ namespace splashkit_lib void sk_interface_set_enabled(bool enabled); bool sk_interface_is_enabled(); } -#endif \ No newline at end of file +#endif diff --git a/coresdk/src/coresdk/interface.cpp b/coresdk/src/coresdk/interface.cpp index 0a174161..e1c08a7d 100644 --- a/coresdk/src/coresdk/interface.cpp +++ b/coresdk/src/coresdk/interface.cpp @@ -730,16 +730,16 @@ namespace splashkit_lib _pop_container_stack(panel_type::column, ""); } - bool header(const string& text_label) + bool header(const string& label_text) { _interface_sanity_check(); - bool open = sk_interface_header(text_label); + bool open = sk_interface_header(label_text); return open; } - void text_label(const string& text) + void label_element(const string& text) { _interface_sanity_check(); @@ -748,13 +748,13 @@ namespace splashkit_lib _update_text_style(); } - void text_label(const string& text, const rectangle& rect) + void label_element(const string& text, const rectangle& rect) { _interface_sanity_check(); sk_interface_set_layout_next(rect, true); - text_label(text); + label_element(text); } void paragraph(const string& text, const rectangle& rect) @@ -774,14 +774,14 @@ namespace splashkit_lib _update_text_style(); } - bool button(const string& text_label, const string& text) + bool button(const string& label_text, const string& text) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); bool res = button(text); leave_column(); @@ -889,14 +889,14 @@ namespace splashkit_lib return bitmap_button(bmp, option_defaults()); } - bool bitmap_button(const string& text_label, bitmap bmp, drawing_options opts) + bool bitmap_button(const string& label_text, bitmap bmp, drawing_options opts) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); bool res = _bitmap_button_internal(bmp, nullptr, opts); @@ -905,9 +905,9 @@ namespace splashkit_lib return res; } - bool bitmap_button(const string& text_label, bitmap bmp) + bool bitmap_button(const string& label_text, bitmap bmp) { - return bitmap_button(text_label, bmp, option_defaults()); + return bitmap_button(label_text, bmp, option_defaults()); } bool bitmap_button(bitmap bmp, const rectangle& rect, drawing_options opts) @@ -920,14 +920,14 @@ namespace splashkit_lib return bitmap_button(bmp, rect, option_defaults()); } - bool checkbox(const string& text_label, const string& text, const bool& value) + bool checkbox(const string& label_text, const string& text, const bool& value) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); bool res = checkbox(text, value); leave_column(); @@ -954,14 +954,14 @@ namespace splashkit_lib return checkbox(text, value); } - float slider(const string& text_label, const float& value, float min_value, float max_value) + float slider(const string& label_text, const float& value, float min_value, float max_value) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); float res = slider(value, min_value, max_value); leave_column(); @@ -1046,14 +1046,14 @@ namespace splashkit_lib return temp_value; } - color color_slider(const string& text_label, const color& clr) + color color_slider(const string& label_text, const color& clr) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); color res = color_slider(clr); leave_column(); @@ -1074,14 +1074,14 @@ namespace splashkit_lib return _color_slider(clr, false); } - color hsb_color_slider(const string& text_label, const color& clr) + color hsb_color_slider(const string& label_text, const color& clr) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); color res = hsb_color_slider(clr); leave_column(); @@ -1102,14 +1102,14 @@ namespace splashkit_lib return _color_slider(clr, true); } - float number_box(const string& text_label, const float& value, float step) + float number_box(const string& label_text, const float& value, float step) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); float res = number_box(value, step); leave_column(); @@ -1132,14 +1132,14 @@ namespace splashkit_lib return number_box(value, step); } - std::string text_box(const string& text_label, const std::string& value) + std::string text_box(const string& label_text, const std::string& value) { _interface_sanity_check(); enter_column(); _two_column_layout(); - splashkit_lib::text_label(text_label); + splashkit_lib::label_element(label_text); std::string res = text_box(value); leave_column(); diff --git a/coresdk/src/coresdk/interface.h b/coresdk/src/coresdk/interface.h index 9cfaa38f..50f65f61 100644 --- a/coresdk/src/coresdk/interface.h +++ b/coresdk/src/coresdk/interface.h @@ -166,17 +166,17 @@ namespace splashkit_lib * The function **must** be accompanied by a call to `end_treenode` * with the same name. * - * @param text_label The name of the node + * @param label_text The name of the node * @return Whether the tree node is expanded or not */ - bool start_treenode(const string& text_label); + bool start_treenode(const string& label_text); /** * Finishes the creation of a tree node. * - * @param text_label The node's name - must match with `start_treenode` + * @param label_text The node's name - must match with `start_treenode` */ - void end_treenode(const string& text_label); + void end_treenode(const string& label_text); /** * Makes the popup named `name` open/popup at the cursor's position. @@ -281,17 +281,17 @@ namespace splashkit_lib * } * ``` * - * @param text_label The label to show in the header + * @param label_text The label to show in the header * @return Whether the header is expanded or not */ - bool header(const string& text_label); + bool header(const string& label_text); /** * Creates a label with the given text. * * @param text The label to show */ - void text_label(const string& text); + void label_element(const string& text); /** * Creates a label at a specific position on screen. @@ -301,7 +301,7 @@ namespace splashkit_lib * * @attribute suffix at_position */ - void text_label(const string& text, const rectangle& rect); + void label_element(const string& text, const rectangle& rect); /** * Creates a paragraph of text that auto-wraps. @@ -333,13 +333,13 @@ namespace splashkit_lib * } * ``` * - * @param text_label The label to show in front of the button + * @param label_text The label to show in front of the button * @param text The text to show inside the button * @return Whether the button was clicked * * @attribute suffix labeled */ - bool button(const string& text_label, const string& text); + bool button(const string& label_text, const string& text); /** * Creates a button without a label. @@ -366,26 +366,26 @@ namespace splashkit_lib * Creates a button with a bitmap in it and a label. * Returns whether the button was clicked. * - * @param text_label The label to show in front of the button + * @param label_text The label to show in front of the button * @param bmp The bitmap to show inside the button * @return Whether the button was clicked * * @attribute suffix labeled */ - bool bitmap_button(const string& text_label, bitmap bmp); + bool bitmap_button(const string& label_text, bitmap bmp); /** * Creates a button with a bitmap in it and a label. * Returns whether the button was clicked. * - * @param text_label The label to show in front of the button + * @param label_text The label to show in front of the button * @param bmp The bitmap to show inside the button * @param opts The drawing options * @return Whether the button was clicked * * @attribute suffix labeled_with_options */ - bool bitmap_button(const string& text_label, bitmap bmp, drawing_options opts); + bool bitmap_button(const string& label_text, bitmap bmp, drawing_options opts); /** * Creates a button with a bitmap in it, and no label. @@ -443,14 +443,14 @@ namespace splashkit_lib * my_bool = checkbox("Checkbox 1", "Enabled?", my_bool); * ``` * - * @param text_label The label to show in front of the checkbox + * @param label_text The label to show in front of the checkbox * @param text The text to show next to the checkbox * @param value The current value of the checkbox * @return The updated value of the checkbox * * @attribute suffix labeled */ - bool checkbox(const string& text_label, const string& text, const bool& value); + bool checkbox(const string& label_text, const string& text, const bool& value); /** * Creates a checkbox. @@ -484,7 +484,7 @@ namespace splashkit_lib * my_float = slider("Percentage", my_float, 0, 100); * ``` * - * @param text_label The label to show in front of the slider + * @param label_text The label to show in front of the slider * @param value The current value of the slider * @param min_value The minimum value of the slider * @param max_value The maximum value of the slider @@ -492,7 +492,7 @@ namespace splashkit_lib * * @attribute suffix labeled */ - float slider(const string& text_label, const float& value, float min_value, float max_value); + float slider(const string& label_text, const float& value, float min_value, float max_value); /** * Creates a slider without a label. @@ -528,13 +528,13 @@ namespace splashkit_lib * my_color = color_slider("Player Color", my_color); * ``` * - * @param text_label The label to show in front of the slider + * @param label_text The label to show in front of the slider * @param clr The current value of the color slider * @return The updated value of the slider * * @attribute suffix labeled */ - color color_slider(const string& text_label, const color& clr); + color color_slider(const string& label_text, const color& clr); /** * Creates a set of RGBA sliders to adjust a color. @@ -566,13 +566,13 @@ namespace splashkit_lib * my_color = hsb_color_slider("Player Color", my_color); * ``` * - * @param text_label The label to show in front of the slider + * @param label_text The label to show in front of the slider * @param clr The current value of the color slider * @return The updated value of the slider * * @attribute suffix labeled */ - color hsb_color_slider(const string& text_label, const color& clr); + color hsb_color_slider(const string& label_text, const color& clr); /** * Creates a set of HSBA (hue, saturation, brightness, alpha) sliders to adjust a color. @@ -604,14 +604,14 @@ namespace splashkit_lib * my_float = number_box("Percentage", my_float, 1); * ``` * - * @param text_label The label to show in front of the number box + * @param label_text The label to show in front of the number box * @param value The current value of the number box * @param step The amount incremented when dragging on the box * @return The updated value of the slider * * @attribute suffix labeled */ - float number_box(const string& text_label, const float& value, float step); + float number_box(const string& label_text, const float& value, float step); /** * Creates a number entry box with a label. @@ -645,13 +645,13 @@ namespace splashkit_lib * my_string = text_box("Name", my_string); * ``` * - * @param text_label The label to show in front of the text box + * @param label_text The label to show in front of the text box * @param value The current value of the text box * @return The updated value of the text box * * @attribute suffix labeled */ - string text_box(const string& text_label, const string& value); + string text_box(const string& label_text, const string& value); /** * Creates a text entry box at a specific position on screen. diff --git a/coresdk/src/test/test_ui.cpp b/coresdk/src/test/test_ui.cpp index c5a1a3f9..efa68451 100644 --- a/coresdk/src/test/test_ui.cpp +++ b/coresdk/src/test/test_ui.cpp @@ -78,7 +78,7 @@ void run_ui_test() add_column(60); add_column(-1); - text_label("Second:"); + label_element("Second:"); // Draw second label + button if (button("Button2")) { @@ -112,13 +112,13 @@ void run_ui_test() set_interface_font(fontB); set_interface_font_size(14); - text_label("Hi world!"); + label_element("Hi world!"); // Switch back to the original font for // second label. set_interface_font(fontA); - text_label("Hello world!"); + label_element("Hello world!"); // Reset text size set_interface_font_size(12); @@ -158,7 +158,7 @@ void run_ui_test() // Show if the window is currently reading text, // useful for testing that behaviour. - text_label("Is reading text: " + (std::string)(reading_text()?"Yea":"Nay")); + label_element("Is reading text: " + (std::string)(reading_text()?"Yea":"Nay")); end_panel("My Window"); }