- Treballant en el editor
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
enum sections { SECTION_GENERAL, SECTION_ROOM, SECTION_ACTOR };
|
||||
|
||||
draw::surface *surf;
|
||||
int room_w = 2;
|
||||
int room_h = 2;
|
||||
@@ -244,7 +246,7 @@ void btn_txt(const char* label, const int x, const int y, char *var)
|
||||
}
|
||||
}
|
||||
|
||||
int section = 0;
|
||||
int section = SECTION_ROOM;
|
||||
|
||||
void editor_move_selected()
|
||||
{
|
||||
@@ -314,28 +316,92 @@ bool game::loop()
|
||||
switch (section) {
|
||||
case 0:
|
||||
*/
|
||||
bool change = false;
|
||||
draw::setViewport(0,0,100,240);
|
||||
|
||||
draw::color(WHITE);
|
||||
draw::fillrect(0, 0, 100, 240);
|
||||
|
||||
/*
|
||||
bool change = false;
|
||||
|
||||
change |= btn("ROOM WIDTH:", 10, 40, room::editor::refWidth(), 0, 3);
|
||||
change |= btn("ROOM HEIGHT:", 10, 55, room::editor::refHeight(), 0, 3);
|
||||
|
||||
draw::print("DOORS:", 10, 80, 15, 0);
|
||||
btn_small(32, 80, room::editor::refDoor(XN), -1, 5);
|
||||
btn_small(49, 80, room_yp, -1, 5);
|
||||
btn_small(66, 80, room_xp, -1, 5);
|
||||
btn_small(83, 80, room_yn, -1, 5);
|
||||
change |= btn_small(32, 80, room::editor::refDoor(XN), -1, 5);
|
||||
change |= btn_small(49, 80, room::editor::refDoor(YP), -1, 5);
|
||||
change |= btn_small(66, 80, room::editor::refDoor(XP), -1, 5);
|
||||
change |= btn_small(83, 80, room::editor::refDoor(YN), -1, 5);
|
||||
|
||||
btn("COLOR:", 10, 140, room_color, 5, 11);
|
||||
btn("FLOOR:", 10, 155, room_floor, 0, 5);
|
||||
btn("WALLS:", 10, 170, room_walls, 0, 5);
|
||||
btn("DOORS:", 10, 185, room_doors, 0, 4);
|
||||
btn("WDOORS:", 10, 200, room_walldoors, 0, 5);
|
||||
btn("COLOR:", 10, 140, room::editor::refColor(), 5, 11);
|
||||
btn("FLOOR:", 10, 155, room::editor::refFloorTex(), 0, 5);
|
||||
btn("WALLS:", 10, 170, room::editor::refWallTex(), 0, 5);
|
||||
btn("DOORS:", 10, 185, room::editor::refDoorTex(), 0, 4);
|
||||
btn("WDOORS:", 10, 200, room::editor::refWallDoorTex(), 0, 5);
|
||||
|
||||
if (change) room::update();
|
||||
*/
|
||||
|
||||
draw::color(LIGHT+WHITE);
|
||||
draw::fillrect(2, 2, 96, 236);
|
||||
draw::color(PAPER);
|
||||
draw::rect(2, 2, 96, 236);
|
||||
|
||||
const int mx = draw::getLocalX(input::mouseX());
|
||||
const int my = draw::getLocalY(input::mouseY());
|
||||
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
||||
|
||||
int line = 0;
|
||||
if (section==SECTION_GENERAL)
|
||||
{
|
||||
draw::color(LIGHT+BLUE);
|
||||
draw::fillrect(4, 2+line*9, 92, 9);
|
||||
}
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
|
||||
section = SECTION_GENERAL;
|
||||
}
|
||||
draw::print("-THE POOL", 6, 4+line*9, LIGHT+WHITE, BLACK);
|
||||
line++;
|
||||
for (int i=0;i<64;++i)
|
||||
{
|
||||
if (room::editor::roomExists(i))
|
||||
{
|
||||
if (section==SECTION_ROOM && i == room::editor::getCurrentRoom())
|
||||
{
|
||||
draw::color(LIGHT+BLUE);
|
||||
draw::fillrect(4, 2+line*9, 92, 9);
|
||||
}
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
|
||||
room::load(i);
|
||||
section = SECTION_ROOM;
|
||||
}
|
||||
char num[] = "+ROOM 00";
|
||||
num[6] = int(i/10)+48;
|
||||
num[7] = (i%10)+48;
|
||||
draw::print(num, 10, 4+line*9, LIGHT+WHITE, BLACK); line++;
|
||||
|
||||
if (i==room::editor::getCurrentRoom())
|
||||
{
|
||||
act = actor::getFirst();
|
||||
while (act) {
|
||||
if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR && (act->flags&FLAG_HERO)!=FLAG_HERO) {
|
||||
if (section==SECTION_ACTOR && act==actor::getSelected()) {
|
||||
draw::color(LIGHT+BLUE);
|
||||
draw::fillrect(4, 2+line*9, 92, 9);
|
||||
}
|
||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
|
||||
actor::select(act);
|
||||
section = SECTION_ACTOR;
|
||||
}
|
||||
draw::print(act->name, 14, 4+line*9, LIGHT+WHITE, BLACK);
|
||||
line++;
|
||||
}
|
||||
act = act->next;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
break;
|
||||
case 1:
|
||||
@@ -351,6 +417,7 @@ bool game::loop()
|
||||
draw::color(PAPER);
|
||||
draw::rect(2, 0, 96, 100);
|
||||
|
||||
/*
|
||||
const int mx = draw::getLocalX(input::mouseX());
|
||||
const int my = draw::getLocalY(input::mouseY());
|
||||
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
||||
@@ -372,7 +439,7 @@ bool game::loop()
|
||||
}
|
||||
act = act->next;
|
||||
}
|
||||
|
||||
*/
|
||||
act = actor::getSelected();
|
||||
if (act)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user