diff --git a/source/main.cpp b/source/main.cpp index d33efa7..17af64d 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -61,6 +61,8 @@ void game::init() actor::setDirty(hero, true); restart(); + + actor::select(actor::find("BOX")); } int sx=1, sy=0; @@ -89,7 +91,7 @@ void btn(const char* label, const int x, const int y, int &var, int min, int max char buffer[100]; int result=0; draw::print(label, x, y+3, 15, 0); - result=ui::button(SDL_itoa(var, buffer, 10), x+50, y, 28, 11); + result=ui::button(SDL_itoa(var, buffer, 10), x+50, y, 28, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE); if (result) { var=SDL_max(min, SDL_min(max, var-(result-2))); @@ -97,6 +99,8 @@ void btn(const char* label, const int x, const int y, int &var, int min, int max } } +int section = 0; + bool game::loop() { actor::update(actor::getFirst()); @@ -114,18 +118,43 @@ bool game::loop() print(0,40,input::mouseBtn(2)?1:0); print(0,50,input::mouseBtn(3)?1:0); - btn("ROOM WIDTH:", 330, 10, room_w, 0, 3); - btn("ROOM HEIGHT:", 330, 25, room_h, 0, 3); + if (section==0) { + draw::print("ROOM", 334, 13, YELLOW, LIGHT+BLACK); + if (ui::button("ACTORS", 365, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=1; + } else { + if (ui::button("ROOM", 330, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=0; + draw::print("ACTORS", 369, 13, YELLOW, BLACK); + } - btn("DOOR XP:", 330, 50, room_xp, -1, 5); - btn("DOOR XN:", 330, 65, room_xn, -1, 5); - btn("DOOR YP:", 330, 80, room_yp, -1, 5); - btn("DOOR YN:", 330, 95, room_yn, -1, 5); - btn("COLOR:", 330, 110, room_color, 5, 11); - btn("FLOOR:", 330, 125, room_floor, 0, 5); - btn("WALLS:", 330, 140, room_walls, 0, 5); - btn("DOORS:", 330, 155, room_doors, 0, 4); - btn("WDOORS:", 330, 170, room_walldoors, 0, 5); + switch (section) { + case 0: + btn("ROOM WIDTH:", 330, 40, room_w, 0, 3); + btn("ROOM HEIGHT:", 330, 55, room_h, 0, 3); + + btn("DOOR XP:", 330, 80, room_xp, -1, 5); + btn("DOOR XN:", 330, 95, room_xn, -1, 5); + btn("DOOR YP:", 330, 110, room_yp, -1, 5); + btn("DOOR YN:", 330, 125, room_yn, -1, 5); + btn("COLOR:", 330, 140, room_color, 5, 11); + btn("FLOOR:", 330, 155, room_floor, 0, 5); + btn("WALLS:", 330, 170, room_walls, 0, 5); + btn("DOORS:", 330, 185, room_doors, 0, 4); + btn("WDOORS:", 330, 200, room_walldoors, 0, 5); + break; + case 1: + int line = 0; + actor::actor_t *act = actor::getFirst(); + while (act) { + if (act==actor::getSelected()) { + draw::color(TEAL); + draw::fillrect(330, 40+line*8, 50, 8); + } + draw::print(act->name, 330, 40+line*8, WHITE, BLACK); + line++; + act = act->next; + } + break; + } draw::render();