diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2025-03-17 09:42:21 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2025-03-17 09:42:21 -0300 |
commit | 80c81c6c63155065dd5a406fce36206edbda23df (patch) | |
tree | 9b4aad1dc4ab8b2eaba95477fdc28a1d6d84831a | |
parent | c8ca03ff0eaf58ca06f16ebeb60048da49ec0f2d (diff) |
Update placeholder GUI resources default
-rw-r--r-- | gradle.properties | 4 | ||||
-rw-r--r-- | gui/radio-receiver.c | 43 |
2 files changed, 40 insertions, 7 deletions
diff --git a/gradle.properties b/gradle.properties index 24c6f63..dc33772 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,11 +10,11 @@ loader_version=0.16.10 fabric_kotlin_version=1.13.1+kotlin.2.1.10 # Mod Properties -mod_version=1.0.0 +mod_version=1.0.1 maven_group=space.autistic.radio archives_base_name=pirate-radio # Dependencies fabric_version=0.115.0+1.21.1 kotlin_test_version=2.1.10 -chicory_version=1.1.0 \ No newline at end of file +chicory_version=1.1.0 diff --git a/gui/radio-receiver.c b/gui/radio-receiver.c index fef0858..136b45f 100644 --- a/gui/radio-receiver.c +++ b/gui/radio-receiver.c @@ -46,13 +46,46 @@ extern int simulator_get_volume(); [[clang::import_module("simulator")]] [[clang::import_name("get-frequency")]] extern int simulator_get_frequency(); +[[clang::import_module("screen")]] [[clang::import_name("get-width")]] +extern int screen_get_width(); +[[clang::import_module("screen")]] [[clang::import_name("get-height")]] +extern int screen_get_height(); + +[[clang::import_module("volume-plus-widget")]] [[clang::import_name("set-dimensions")]] +extern void vp_set_dimensions(int x, int y, int width, int height); +[[clang::import_module("volume-minus-widget")]] [[clang::import_name("set-dimensions")]] +extern void vm_set_dimensions(int x, int y, int width, int height); +[[clang::import_module("frequency-plus-widget")]] [[clang::import_name("set-dimensions")]] +extern void fp_set_dimensions(int x, int y, int width, int height); +[[clang::import_module("frequency-minus-widget")]] [[clang::import_name("set-dimensions")]] +extern void fm_set_dimensions(int x, int y, int width, int height); +[[clang::import_module("toggle-widget")]] [[clang::import_name("set-dimensions")]] +extern void mode_set_dimensions(int x, int y, int width, int height); + +#define BACKGROUND_WIDTH 200 +#define BACKGROUND_HEIGHT 100 + void init() { logger_log_begin(LOG_INFO); - logger_log_message("default radio skin."); - set_background_size(100, 100); + logger_log_message("placeholder radio skin."); + set_background_size(BACKGROUND_WIDTH, BACKGROUND_HEIGHT); + + int width = screen_get_width(); + int height = screen_get_height(); + int base_x = (width - BACKGROUND_WIDTH) / 2; + int base_y = (height - BACKGROUND_HEIGHT) / 2; + fp_set_dimensions(base_x + 100 - 40, base_y, 20, 20); + fm_set_dimensions(base_x + 120 - 40, base_y, 20, 20); + vp_set_dimensions(base_x + 100 - 40, base_y + 20, 20, 20); + vm_set_dimensions(base_x + 120 - 40, base_y + 20, 20, 20); + mode_set_dimensions(base_x + 100 - 100, base_y + 40, 100, 20); } void render(int mouseX, int mouseY, float delta) { + int width = screen_get_width(); + int height = screen_get_height(); + int base_x = (width - BACKGROUND_WIDTH) / 2 + 100; + int base_y = (height - BACKGROUND_HEIGHT) / 2 + (20 - 9) / 2; int t1; switch (simulator_get_mode()) { case SIMULATOR_FAST: @@ -71,7 +104,7 @@ void render(int mouseX, int mouseY, float delta) { } } int t2 = text_arguments("pirate-radio.mode.selected", 1, &t1); - render_text_object(t2, 200, 100, -1, true); + render_text_object(t2, base_x, base_y + 40, -1, true); text_free(t1); text_free(t2); @@ -84,7 +117,7 @@ void render(int mouseX, int mouseY, float delta) { t1 = text_literal(volume_text); } t2 = text_arguments("pirate-radio.volume.selected", 1, &t1); - render_text_object(t2, 200, 120, -1, true); + render_text_object(t2, base_x, base_y + 20, -1, true); text_free(t1); text_free(t2); @@ -98,7 +131,7 @@ void render(int mouseX, int mouseY, float delta) { t2 = text_literal(freq_text); int freq_args[2] = {t1, t2}; int t3 = text_arguments("pirate-radio.frequency.selected", 2, freq_args); - render_text_object(t3, 200, 140, -1, true); + render_text_object(t3, base_x, base_y + 0, -1, true); text_free(t1); text_free(t2); text_free(t3); |