- Nous gràfics

- [FIX] text en el combobox
- [NEW] Selector de bitmap
- [NEW] Selector de color
- [NEW] Shortcuts per a esborrar (SUPR) i duplicar (CTRL+D) actors
This commit is contained in:
2024-09-18 13:55:43 +02:00
parent a825581108
commit 99d0583833
10 changed files with 192 additions and 184 deletions

View File

@@ -16,6 +16,8 @@ namespace modules
std::vector<std::string> gifs;
int treeview_scroll = 0;
std::vector<std::string> getGifs() { return gifs; }
void init()
{
actor::clear(true);
@@ -256,6 +258,8 @@ namespace modules
int loop()
{
int return_value = GAME_NONE;
if (actor::hero::isDead()) return GAME_DEAD;
if (input::keyPressed(SDL_SCANCODE_ESCAPE))
@@ -609,8 +613,19 @@ namespace modules
ui::label("TEXTURES", 2, line, 96, 11, GRAY); line+=10;
changed |= btn_opt("COLOR", 2, line, room::editor::refColor(), {0, 1, 2, 3, 4}, {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"}, 47); //ui::label("COLOR", 2, line, 64, 11);
//changed |= btn_small(64, line, room::editor::refColor(), 5, 11);
//changed |= btn_opt("COLOR", 2, line, room::editor::refColor(), {0, 1, 2, 3, 4}, {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"}, 47); //ui::label("COLOR", 2, line, 64, 11);
{
const char *colors[] = {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"};
ui::label("COLOR", 2, line, 48, 11);
const int color = room::editor::refColor();
if (ui::combo(colors[color], 48, line, 49, 11)) {
//if (ui::button(colors[room::editor::refColor()], 48, line+1, 49, 9)) {
//ui::button(colors[room::editor::refColor()], 48, line+1, 49, 9, true);
return_value = GAME_EDITOR_COLORS;
}
draw::color(LIGHT+color+7); draw::fillrect(77,2+line,7,7);draw::color(PAPER); draw::rect(77,2+line,7,7);
}
line += 10;
ui::label("FLOOR", 2, line, 48, 11);
changed |= btn_small(48, line, room::editor::refFloorTex(), 0, room::getFloorCount()-1, 50);
@@ -694,11 +709,22 @@ namespace modules
ui::label("BITMAP", 2, line, 96, 11, GRAY); line+=10;
{
ui::label("FILE", 2, line, 49, 11);
if (ui::combo(act->bmp, 49, line, 48, 11)) {
//if (ui::button(colors[room::editor::refColor()], 48, line+1, 49, 9)) {
//ui::button(colors[room::editor::refColor()], 48, line+1, 49, 9, true);
return_value = GAME_EDITOR_BITMAP_FILE;
}
}
/*
if (btn_opt2("FILE", 2, line, act->bmp, gifs)) {
//draw::freeSurface(act->surface);
act->surface = draw::getSurface(act->bmp);
changed = true;
}
*/
line+=10;
ui::label("POS", 2, line, 48, 11);
changed |= btn_small(49, line, act->bmp_rect.x, 0, 512, 25);
@@ -771,7 +797,7 @@ namespace modules
draw::color(PAPER);
draw::rect(2, 0, 96, 204);
if (ui::button("DUPLICATE", 2, line, 48, 11))
if (ui::button("DUPLICATE", 2, line, 48, 11) || (input::keyDown(SDL_SCANCODE_LCTRL) && input::keyPressed(SDL_SCANCODE_D)))
{
actor::actor_t *new_act = actor::duplicate(act);
actor::setUniqueName(new_act);
@@ -780,7 +806,7 @@ namespace modules
actor::select(new_act);
changed = true;
}
if (ui::button("DELETE", 48, line, 48, 11))
if (ui::button("DELETE", 48, line, 48, 11) || input::keyPressed(SDL_SCANCODE_DELETE))
{
actor::remove(act);
act = nullptr;
@@ -801,7 +827,7 @@ namespace modules
};
draw::render();
return GAME_NONE;
return return_value;
}
}