- Treballant en les propietats dels actors

This commit is contained in:
2023-09-21 12:19:54 +02:00
parent 510bc7d9bb
commit d3b14662f4

View File

@@ -100,6 +100,27 @@ void btn(const char* label, const int x, const int y, int &var, int min, int max
}
}
void btn_small(const int x, const int y, int &var, int min, int max)
{
char buffer[100];
int result=0;
result=ui::button(SDL_itoa(var, buffer, 10), x, y, 15, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE);
if (result)
{
var=SDL_max(min, SDL_min(max, var-(result-2)));
}
}
void btn_txt(const char* label, const int x, const int y, char *var)
{
draw::print(label, x, y+3, 15, 0);
int result = 0;
result = ui::button(var, x+22, y, 66, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE);
if (result)
{
}
}
int section = 0;
void editor_move_selected()
@@ -148,6 +169,8 @@ bool game::loop()
draw::print("ACTORS", 369, 13, YELLOW, BLACK);
}
actor::actor_t *act = nullptr;
switch (section) {
case 0:
btn("ROOM WIDTH:", 330, 40, room_w, 0, 3);
@@ -164,6 +187,19 @@ bool game::loop()
btn("WDOORS:", 330, 200, room_walldoors, 0, 5);
break;
case 1:
act = actor::getSelected();
if (act)
{
btn_txt("NAME:", 330, 40, act->name);
btn_txt("BMP:", 330, 55, act->bmp);
draw::print("RECT:", 330, 73, 15, 0);
btn_small(352, 70, act->bmp_rect.x, 0, 512);
btn_small(369, 70, act->bmp_rect.y, 0, 512);
btn_small(386, 70, act->bmp_rect.w, 0, 512);
btn_small(403, 70, act->bmp_rect.h, 0, 512);
break;
}
case 2:
draw::color(TEAL);
draw::rect(328, 38, 67, 94);
const int mx = input::mouseX();
@@ -171,7 +207,7 @@ bool game::loop()
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
int line = 0;
actor::actor_t *act = actor::getFirst();
act = actor::getFirst();
while (act) {
if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR) {
if (act==actor::getSelected()) {