3 Commits

8 changed files with 46 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -1,7 +1,17 @@
width: 2
height: 2
width: 3
height: 3
color: CYAN
floor-texture: 0
wall-texture: 0
door-texture: 0
under-door-texture: 0
actor{
name: ARCADE
bmp: altres.gif
bmp-rect: 160 0 30 48
bmp-offset: 0 48
pos: 0 0 0
size: 8 8 16
movement: CW
}

View File

@@ -4,7 +4,7 @@ actor{
bmp: test.gif
bmp-rect: 32 0 32 32
bmp-offset: 0 32
pos: 32 32 8
pos: 32 32 0
size: 8 8 8
movement: CW
}

View File

@@ -6,6 +6,8 @@
namespace ui
{
static bool select = false;
void label(const char *label, const int x, const int y, const int w, const int h, const int color)
{
draw::color(color);
@@ -117,7 +119,7 @@ namespace ui
char temp[10];
const char *spin(const char *label, const int x, const int y, const int w, const int h)
const char *spin(const char *lbl, const int x, const int y, const int w, const int h)
{
const int mx = draw::getLocalX(input::mouseX());
const int my = draw::getLocalY(input::mouseY());
@@ -125,6 +127,12 @@ namespace ui
const bool inside = (mx>=x) && (mx<x+w) && (my>=y) && (my<y+h);
//const int txt_size = strlen(label)*4;
//const int txt_x = x+(w-txt_size)/2;
char label[100];
if (!select) {
label[0]='0'; label[1]='\0';
} else {
strcpy(label, lbl);
}
draw::color(LIGHT+WHITE);
draw::fillrect(x, y, w, h);
@@ -152,7 +160,7 @@ namespace ui
}
const int wheel = input::mouseWheel();
if (wheel != 0) {
const int value = SDL_atoi(label)+wheel*(input::keyDown(SDL_SCANCODE_LCTRL)?32:1);
const int value = SDL_atoi(lbl)+wheel*(input::keyDown(SDL_SCANCODE_LCTRL)?32:1);
SDL_itoa(value, temp, 10);
return temp;
}
@@ -183,4 +191,10 @@ namespace ui
}
return 0;
}
void selected(const bool value)
{
select = value;
}
}

View File

@@ -8,6 +8,8 @@ namespace ui
const bool button(const char *label, const int x, const int y, const int w, const int h, const bool pressed=false);
const int check(const char *label, const int x, const int y, const int w, const int h, const bool checked);
const int combo(const char *label, const int x, const int y, const int w, const int h);
const char *spin(const char *label, const int x, const int y, const int w, const int h);
const char *spin(const char *lbl, const int x, const int y, const int w, const int h);
const int textbox(const char *label, const int x, const int y, const int w, const int h);
void selected(const bool value);
}

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;
@@ -79,6 +88,7 @@ namespace modules
{
const int value = SDL_atoi(result);
var=SDL_max(min, SDL_min(max, value));
return true;
}
return false;
}

View File

@@ -15,11 +15,11 @@ x Gràfics de bancada de cuina
x Gràfics de sofà
- Gràfics de Plantes, arbres...
x Gràfics de llit
- Gràfics de lampara
- Grafics de mancuerna
- Gràfics de recreativa
x Gràfics de lampara
x Grafics de mancuerna
x Gràfics de recreativa
- Gràfics de Batman
- gràfics de WC, Pila
x gràfics de WC, Pila
- Decidir objectes de habilitats
x Motxilla: permet agafar parts de la piscina