- [ONGOING] Treballant en que els camps d'edició funcionen millor

This commit is contained in:
2024-07-10 14:02:17 +02:00
parent 77cb597c80
commit 2a629529fd
5 changed files with 33 additions and 8 deletions

View File

@@ -16,6 +16,8 @@ namespace modules
std::vector<std::string> gifs;
int treeview_scroll = 0;
int *current_field = nullptr;
void init()
{
actor::clear(true);
@@ -61,11 +63,18 @@ namespace modules
const bool btn_small(const int x, const int y, int &var, int min, int max)
{
char buffer[100];
if (current_field == &var) {
ui::selected(false);
} else {
ui::selected(true);
}
const char *result=ui::spin(SDL_itoa(var, buffer, 10), x, y, 17, 11);
ui::selected(false);
if (result)
{
const int value = SDL_atoi(result);
var=SDL_max(min, SDL_min(max, value));
current_field = &var;
return true;
}
return false;