- [FIX] Ja eix correctament del editor
- [NEW] Més gràfics - [NEW] Ara es pot modificar el valor dels camps escribint el numero
This commit is contained in:
BIN
data/altres.gif
BIN
data/altres.gif
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.2 KiB |
@@ -11,15 +11,6 @@ exit-xp: 5
|
|||||||
exit-xn: 1
|
exit-xn: 1
|
||||||
exit-zn: 2
|
exit-zn: 2
|
||||||
|
|
||||||
actor{
|
|
||||||
name: PLATFORM02
|
|
||||||
bmp: test.gif
|
|
||||||
bmp-rect: 64 0 32 24
|
|
||||||
bmp-offset: 0 24
|
|
||||||
pos: 16 20 0
|
|
||||||
size: 8 8 4
|
|
||||||
}
|
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: PLATFORM00
|
name: PLATFORM00
|
||||||
bmp: test.gif
|
bmp: test.gif
|
||||||
@@ -29,6 +20,15 @@ actor{
|
|||||||
size: 8 8 4
|
size: 8 8 4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: PLATFORM02
|
||||||
|
bmp: test.gif
|
||||||
|
bmp-rect: 64 0 32 24
|
||||||
|
bmp-offset: 0 24
|
||||||
|
pos: 16 20 0
|
||||||
|
size: 8 8 4
|
||||||
|
}
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: PLATFORM01
|
name: PLATFORM01
|
||||||
bmp: test.gif
|
bmp: test.gif
|
||||||
|
|||||||
@@ -6,12 +6,189 @@ wall-texture: 0
|
|||||||
door-texture: 0
|
door-texture: 0
|
||||||
under-door-texture: 0
|
under-door-texture: 0
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 0 64 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 8 4
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX05
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 128 0 20 42
|
||||||
|
bmp-offset: -5 46
|
||||||
|
pos: 0 0 4
|
||||||
|
size: 8 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 0 48 24 27
|
||||||
|
bmp-offset: 0 31
|
||||||
|
pos: 0 8 0
|
||||||
|
size: 4 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A03
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 72 48 24 27
|
||||||
|
bmp-offset: 0 31
|
||||||
|
pos: 0 16 0
|
||||||
|
size: 4 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A04
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 72 48 24 27
|
||||||
|
bmp-offset: -8 31
|
||||||
|
pos: 8 0 0
|
||||||
|
size: 8 4 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A05
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 96 48 24 27
|
||||||
|
bmp-offset: -8 31
|
||||||
|
pos: 8 0 8
|
||||||
|
size: 8 4 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: ARCADE
|
name: ARCADE
|
||||||
bmp: altres.gif
|
bmp: altres.gif
|
||||||
bmp-rect: 160 0 30 48
|
bmp-rect: 160 0 30 48
|
||||||
bmp-offset: 0 48
|
bmp-offset: 0 48
|
||||||
pos: 0 0 0
|
pos: 16 0 0
|
||||||
size: 8 8 16
|
size: 8 8 16
|
||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX01
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 128 32 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 16 24 0
|
||||||
|
size: 8 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A07
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 96 48 24 27
|
||||||
|
bmp-offset: -8 31
|
||||||
|
pos: 24 0 0
|
||||||
|
size: 8 4 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX02
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 160 32 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 24 24 0
|
||||||
|
size: 8 8 8
|
||||||
|
react-push: XP
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A08
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 24 48 24 27
|
||||||
|
bmp-offset: -8 31
|
||||||
|
pos: 32 0 0
|
||||||
|
size: 8 4 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A01
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 24 48 24 27
|
||||||
|
bmp-offset: 0 31
|
||||||
|
pos: 0 8 8
|
||||||
|
size: 4 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A02
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 48 48 24 27
|
||||||
|
bmp-offset: 0 31
|
||||||
|
pos: 0 16 8
|
||||||
|
size: 4 8 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX03
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 128 0 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 16 24 8
|
||||||
|
size: 8 8 8
|
||||||
|
react-push: XP
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A06
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 72 48 24 27
|
||||||
|
bmp-offset: -8 31
|
||||||
|
pos: 24 0 8
|
||||||
|
size: 8 4 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: BOX04
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 32 64 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 24 24 8
|
||||||
|
size: 8 8 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
react-push: XP
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A09
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 0 48 24 27
|
||||||
|
bmp-offset: -8 31
|
||||||
|
pos: 32 0 8
|
||||||
|
size: 8 4 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|||||||
@@ -177,3 +177,13 @@ actor{
|
|||||||
size: 16 16 6
|
size: 16 16 6
|
||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: KALLAX-A
|
||||||
|
bmp: altres.gif
|
||||||
|
bmp-rect: 0 48 24 27
|
||||||
|
bmp-offset: 0 31
|
||||||
|
pos: 0 0 0
|
||||||
|
size: 8 4 8
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,7 +6,14 @@
|
|||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
static bool select = false;
|
static int current_spin = -1;
|
||||||
|
static int selected_spin = -1;
|
||||||
|
static int hovering_spin = -1;
|
||||||
|
|
||||||
|
void start()
|
||||||
|
{
|
||||||
|
current_spin = -1;
|
||||||
|
}
|
||||||
|
|
||||||
void label(const char *label, const int x, const int y, const int w, const int h, const int color)
|
void label(const char *label, const int x, const int y, const int w, const int h, const int color)
|
||||||
{
|
{
|
||||||
@@ -121,14 +128,20 @@ namespace ui
|
|||||||
|
|
||||||
const char *spin(const char *lbl, 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)
|
||||||
{
|
{
|
||||||
|
current_spin++;
|
||||||
const int mx = draw::getLocalX(input::mouseX());
|
const int mx = draw::getLocalX(input::mouseX());
|
||||||
const int my = draw::getLocalY(input::mouseY());
|
const int my = draw::getLocalY(input::mouseY());
|
||||||
//const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
//const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
||||||
const bool inside = (mx>=x) && (mx<x+w) && (my>=y) && (my<y+h);
|
const bool inside = (mx>=x) && (mx<x+w) && (my>=y) && (my<y+h);
|
||||||
|
if (inside && current_spin!=hovering_spin)
|
||||||
|
{
|
||||||
|
hovering_spin=current_spin;
|
||||||
|
selected_spin=-1;
|
||||||
|
}
|
||||||
//const int txt_size = strlen(label)*4;
|
//const int txt_size = strlen(label)*4;
|
||||||
//const int txt_x = x+(w-txt_size)/2;
|
//const int txt_x = x+(w-txt_size)/2;
|
||||||
char label[100];
|
char label[100];
|
||||||
if (!select) {
|
if (current_spin!=selected_spin) {
|
||||||
label[0]='0'; label[1]='\0';
|
label[0]='0'; label[1]='\0';
|
||||||
} else {
|
} else {
|
||||||
strcpy(label, lbl);
|
strcpy(label, lbl);
|
||||||
@@ -138,7 +151,7 @@ namespace ui
|
|||||||
draw::fillrect(x, y, w, h);
|
draw::fillrect(x, y, w, h);
|
||||||
draw::color(WHITE);
|
draw::color(WHITE);
|
||||||
draw::rect(x, y, w, h);
|
draw::rect(x, y, w, h);
|
||||||
draw::print(label, x+3, y+3, PAPER, 0);
|
draw::print(lbl, x+3, y+3, PAPER, 0);
|
||||||
|
|
||||||
if (inside)
|
if (inside)
|
||||||
{
|
{
|
||||||
@@ -146,20 +159,24 @@ namespace ui
|
|||||||
draw::rect(x+1, y+1, w-2, h-2);
|
draw::rect(x+1, y+1, w-2, h-2);
|
||||||
const uint8_t key = input::getKeyPressed();
|
const uint8_t key = input::getKeyPressed();
|
||||||
if (key==SDL_SCANCODE_BACKSPACE) {
|
if (key==SDL_SCANCODE_BACKSPACE) {
|
||||||
|
selected_spin=current_spin;
|
||||||
strcpy(temp, label); const int size = strlen(label);
|
strcpy(temp, label); const int size = strlen(label);
|
||||||
temp[size-1] = '\0';
|
temp[size-1] = '\0';
|
||||||
return temp;
|
return temp;
|
||||||
} else if (key==SDL_SCANCODE_0) {
|
} else if (key==SDL_SCANCODE_0 || key==SDL_SCANCODE_KP_0) {
|
||||||
|
selected_spin=current_spin;
|
||||||
strcpy(temp, label); const int size = strlen(label);
|
strcpy(temp, label); const int size = strlen(label);
|
||||||
temp[size] = '0'; temp[size+1] = '\0';
|
temp[size] = '0'; temp[size+1] = '\0';
|
||||||
return temp;
|
return temp;
|
||||||
} else if (key>=SDL_SCANCODE_1 && key<=SDL_SCANCODE_9) {
|
} else if ( (key>=SDL_SCANCODE_1 && key<=SDL_SCANCODE_9) || (key>=SDL_SCANCODE_KP_1 && key<=SDL_SCANCODE_KP_9) ) {
|
||||||
|
selected_spin=current_spin;
|
||||||
strcpy(temp, label); const int size = strlen(label);
|
strcpy(temp, label); const int size = strlen(label);
|
||||||
temp[size] = key+19; temp[size+1] = '\0';
|
temp[size] = key<40 ? key+19 : key-40; temp[size+1] = '\0';
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
const int wheel = input::mouseWheel();
|
const int wheel = input::mouseWheel();
|
||||||
if (wheel != 0) {
|
if (wheel != 0) {
|
||||||
|
selected_spin=current_spin;
|
||||||
const int value = SDL_atoi(lbl)+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);
|
SDL_itoa(value, temp, 10);
|
||||||
return temp;
|
return temp;
|
||||||
@@ -191,10 +208,4 @@ namespace ui
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void selected(const bool value)
|
|
||||||
{
|
|
||||||
select = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,11 @@
|
|||||||
|
|
||||||
namespace ui
|
namespace ui
|
||||||
{
|
{
|
||||||
|
void start();
|
||||||
void label(const char *label, const int x, const int y, const int w, const int h, const int color=WHITE+LIGHT);
|
void label(const char *label, const int x, const int y, const int w, const int h, const int color=WHITE+LIGHT);
|
||||||
const bool button(const char *label, const int x, const int y, const int w, const int h, const bool pressed=false);
|
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 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 int combo(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 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);
|
const int textbox(const char *label, const int x, const int y, const int w, const int h);
|
||||||
|
|
||||||
void selected(const bool value);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ namespace modules
|
|||||||
std::vector<std::string> gifs;
|
std::vector<std::string> gifs;
|
||||||
int treeview_scroll = 0;
|
int treeview_scroll = 0;
|
||||||
|
|
||||||
int *current_field = nullptr;
|
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
actor::clear(true);
|
actor::clear(true);
|
||||||
@@ -63,18 +61,11 @@ namespace modules
|
|||||||
const bool btn_small(const int x, const int y, int &var, int min, int max)
|
const bool btn_small(const int x, const int y, int &var, int min, int max)
|
||||||
{
|
{
|
||||||
char buffer[100];
|
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);
|
const char *result=ui::spin(SDL_itoa(var, buffer, 10), x, y, 17, 11);
|
||||||
ui::selected(false);
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
const int value = SDL_atoi(result);
|
const int value = SDL_atoi(result);
|
||||||
var=SDL_max(min, SDL_min(max, value));
|
var=SDL_max(min, SDL_min(max, value));
|
||||||
current_field = &var;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -338,7 +329,7 @@ namespace modules
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ui::start();
|
||||||
|
|
||||||
actor::actor_t *act = nullptr;
|
actor::actor_t *act = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,13 @@ bool game::loop()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case M_GAME:
|
case M_GAME:
|
||||||
if (!modules::game::loop()) { modules::ingame::init(); current_module = M_INGAME; }
|
if (!modules::game::loop()) {
|
||||||
|
if (editor::isDevMode()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
modules::ingame::init(); current_module = M_INGAME;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case M_INGAME:
|
case M_INGAME:
|
||||||
option = modules::ingame::loop();
|
option = modules::ingame::loop();
|
||||||
|
|||||||
Reference in New Issue
Block a user