- [NEW] Scrollbar rudimentaria per al treeview

This commit is contained in:
2024-06-19 13:57:39 +02:00
parent 6adc44e9d6
commit 96b9b92d53
9 changed files with 299 additions and 12 deletions

View File

@@ -26,6 +26,8 @@ int room_walldoors = 0;
std::vector<std::string> gifs;
int treeview_scroll = 0;
void restart()
{
room::load(0); //room_w, room_h, room_xp, room_xn, room_yp, room_yn, room_color, room_floor, room_walls, room_doors, room_walldoors);
@@ -424,13 +426,25 @@ bool game::loop()
draw::color(PAPER);
draw::rect(2, 15, 96, 223);
draw::setViewport(0, 15, 100, 225);
draw::setViewport(0, 15, 100, 222);
const int mx = draw::getLocalX(input::mouseX());
const int my = draw::getLocalY(input::mouseY());
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
if (mx>=0 && mx <=100 && my>=0 && my<=221)
{
treeview_scroll -= input::mouseWheel();
if (treeview_scroll<0) treeview_scroll=0;
}
int line = 0;
switch (section)
{
case SECTION_GENERAL: treeview_scroll = 0; break;
case SECTION_ROOM: if (treeview_scroll > room::editor::getCurrentRoom()+1) treeview_scroll = room::editor::getCurrentRoom()+1;
}
int line = -treeview_scroll;
if (section==SECTION_GENERAL)
{
draw::color(LIGHT+BLUE);
@@ -483,6 +497,14 @@ bool game::loop()
}
}
if ((line+treeview_scroll)>24)
{
const float total_size = float(line+treeview_scroll);
int ascensor_length = 222.0f/(total_size/24.0f);
int ascensor_pos = 222.0f/(total_size/treeview_scroll);
draw::color(WHITE);
draw::fillrect(95, ascensor_pos, 2, ascensor_length);
}
/*
break;
case 1: