3 Commits

8 changed files with 91 additions and 16 deletions

View File

@@ -1,10 +1,13 @@
width: 3
height: 3
door-height-xp: 0
door-height-xn: 0
color: PURPLE
floor-texture: 0
wall-texture: 0
door-texture: 0
under-door-texture: 0
exit-xn: 8
exit-zn: 6
actor{

35
data/rooms/08.txt Normal file
View File

@@ -0,0 +1,35 @@
width: 2
height: 2
door-height-xp: 0
color: CYAN
floor-texture: 0
wall-texture: 11
door-texture: 0
under-door-texture: 0
exit-xp: 7
actor{
name: P-FILTER
bmp: objectes.gif
bmp-rect: 24 0 24 32
bmp-offset: -4 34
pos: 8 8 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: SPECIAL
movement: CW
}
actor{
name: P-TIMER
bmp: objectes.gif
bmp-rect: 96 0 24 32
bmp-offset: -4 34
pos: 8 16 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: SPECIAL
movement: CW
}

View File

@@ -20,7 +20,7 @@ actor{
anim-wait: 1
flags: PUSHABLE ANIMATED GRAVITY
movement: CW
}
}
actor{
name: NEVERA1
@@ -79,3 +79,16 @@ actor{
flags: SPECIAL
movement: CW
}
actor{
name: P-TIMER
bmp: objectes.gif
bmp-rect: 96 0 24 32
bmp-offset: -4 34
pos: 8 16 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: SPECIAL
movement: CW
}

View File

@@ -965,7 +965,13 @@ namespace actor
if (sign) draw::draw(x,y,5,7,50,120);
}
//int order=0;
void drawAt(actor_t * act, const int x, const int y)
{
act->inner_x = x;
act->inner_y = y;
draw(act, false);
}
void draw(actor_t *act, const bool draw_all)
{
if (!act) return;

View File

@@ -135,6 +135,7 @@ namespace actor
void update(actor_t *act, const bool update_all=true);
void updateEditor(actor_t *act, const bool update_all=true);
void drawAt(actor_t * act, const int x, const int y);
void draw(actor_t *act, const bool draw_all=true);
actor_t *find(std::string name);

View File

@@ -115,7 +115,9 @@ namespace ui
return 0;
}
const int spin(const char *label, const int x, const int y, const int w, const int h)
char temp[10];
const char *spin(const char *label, 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());
@@ -134,14 +136,30 @@ namespace ui
{
draw::color(PAPER);
draw::rect(x+1, y+1, w-2, h-2);
if (input::keyDown(SDL_SCANCODE_LCTRL))
return input::mouseWheel()*32;
else
return input::mouseWheel();
const uint8_t key = input::getKeyPressed();
if (key==SDL_SCANCODE_BACKSPACE) {
strcpy(temp, label); const int size = strlen(label);
temp[size-1] = '\0';
return temp;
} else if (key==SDL_SCANCODE_0) {
strcpy(temp, label); const int size = strlen(label);
temp[size] = '0'; temp[size+1] = '\0';
return temp;
} else if (key>=SDL_SCANCODE_1 && key<=SDL_SCANCODE_9) {
strcpy(temp, label); const int size = strlen(label);
temp[size] = key+19; temp[size+1] = '\0';
return temp;
}
const int wheel = input::mouseWheel();
if (wheel != 0) {
const int value = SDL_atoi(label)+wheel*(input::keyDown(SDL_SCANCODE_LCTRL)?32:1);
SDL_itoa(value, temp, 10);
return temp;
}
//if (input::mouseClk(1)) return 1;
//if (input::mouseClk(3)) return 3;
}
return 0;
return nullptr;
}

View File

@@ -8,6 +8,6 @@ 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 int spin(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 int textbox(const char *label, const int x, const int y, const int w, const int h);
}

View File

@@ -60,11 +60,11 @@ namespace modules
const bool btn_small(const int x, const int y, int &var, int min, int max)
{
char buffer[100];
int result=0;
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);
if (result)
{
var=SDL_max(min, SDL_min(max, var+result));
const int value = SDL_atoi(result);
var=SDL_max(min, SDL_min(max, value));
return true;
}
return false;
@@ -73,12 +73,11 @@ namespace modules
const bool btn_small(const int x, const int y, int &var, int min, int max, int width)
{
char buffer[100];
int result=0;
result=ui::spin(SDL_itoa(var, buffer, 10), x, y, width, 11);
const char *result=ui::spin(SDL_itoa(var, buffer, 10), x, y, width, 11);
if (result)
{
var=SDL_max(min, SDL_min(max, var+result));
return true;
const int value = SDL_atoi(result);
var=SDL_max(min, SDL_min(max, value));
}
return false;
}