mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-22 01:52:43 +00:00
Make sliders show their number value
This commit is contained in:
parent
2479eaabfb
commit
64ef23ba6a
3 changed files with 7 additions and 2 deletions
|
|
@ -38,6 +38,9 @@ void djui_slider_update_value(struct DjuiBase* base) {
|
|||
u32 max = slider->max;
|
||||
u32* value = slider->value;
|
||||
djui_base_set_size(&slider->rectValue->base, ((f32)*value - min) / ((f32)max - min), 1.0f);
|
||||
char message[128];
|
||||
snprintf(message, 128, "%s - %d", slider->message, *value);
|
||||
djui_text_set_text(slider->text, message);
|
||||
}
|
||||
|
||||
static void djui_slider_get_cursor_hover_location(struct DjuiBase* base, f32* x, f32* y) {
|
||||
|
|
@ -109,6 +112,7 @@ struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* messa
|
|||
slider->value = value;
|
||||
slider->min = min;
|
||||
slider->max = max;
|
||||
slider->message = message;
|
||||
|
||||
slider->updateRectValueColor = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ struct DjuiSlider {
|
|||
unsigned int min;
|
||||
unsigned int max;
|
||||
bool updateRectValueColor;
|
||||
const char* message;
|
||||
};
|
||||
|
||||
struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* message, unsigned int* value, unsigned int min, unsigned int max, void (*on_value_change)(struct DjuiBase*));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef GFX_SCREEN_CONFIG_H
|
||||
#define GFX_SCREEN_CONFIG_H
|
||||
|
||||
#define DESIRED_SCREEN_WIDTH 800
|
||||
#define DESIRED_SCREEN_HEIGHT 600
|
||||
#define DESIRED_SCREEN_WIDTH 1024
|
||||
#define DESIRED_SCREEN_HEIGHT 768
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue