From 96b9b92d53e889820d14292403f89c0110dd114f Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 19 Jun 2024 13:57:39 +0200 Subject: [PATCH] - [NEW] Scrollbar rudimentaria per al treeview --- data/caixes.gif | Bin 2213 -> 2455 bytes data/floor.gif | Bin 467 -> 651 bytes data/rooms/00.txt | 19 ++-- data/rooms/02.txt | 1 + data/rooms/04.txt | 250 ++++++++++++++++++++++++++++++++++++++++++++++ data/rooms/05.txt | 9 ++ data/walls.gif | Bin 1230 -> 1353 bytes source/main.cpp | 26 ++++- todo.txt | 6 +- 9 files changed, 299 insertions(+), 12 deletions(-) create mode 100644 data/rooms/04.txt create mode 100644 data/rooms/05.txt diff --git a/data/caixes.gif b/data/caixes.gif index d868d8ba7244bb4d4f96327e483146aae0b4a9a9..b0919caa3bddfabf4c98691317fe9a8250507106 100644 GIT binary patch delta 920 zcmV;J184lD5tkFN4hDZYt#vW;nam6qG^Z&pvN@BQ*lY*FvdPUw1nipK#3p}esh=o9 zE1bk2X8meqt0x%}oaihDFD!K{Qql8(i11rHIY~7RwQig#;9T~acdvaiB4s~J-9rHO z0kGLE01Y*0FyEH2d@w11CBTfj&a(%J{{M=iMvIJ0DpRk9n)H7IGxWs=ObXG0dK6_m zYss2Mx=<1zfu#+t+!1h!gqJ2SrV+{$?Y3vroSw9$Q4zyYjfyIt)*y3s>l};FF_IE6 zm8F@~0#708R9WdJU?Q!|RZ=;EmF^UxS4FE?vAWisexR#Q9UE9@vZft*ri>zRYfE#w zSG4x^tVeAsTQWL3tV>QOl~h-Pv$!%M1RZFnm4$psi#0xH8w>nwSju*Mvy-WA> z$VjMx2z}iuZ*7Gu+sHOHyQrOtRCaE)t0zTiH^@5GZmYFRZ*7ItP&(ASrb43W0_}EUr+0c%*w5Lt&YFqo-*v_`Lx6SQtd;8nq4!5|+P404=``qYGx4PHO?smKT-SCdL zyyt&S?|Q?r$L;o>z2hdkdVho7gu^$t38znU6TF|{KKRuP4%HBeIN@K7+94s%9*IkF z+$uDz9m!21y`84qJgQqJ7(Oq6?0DK;d)vvSo$`Q@oFXm<`O9L?@tMEuD7vfzZ002ATchd6! delta 676 zcmV;V0$cr;6QvQb4hDb8%w{_Cnb3@;G^a_;YFhJ}*v#gy0;tVy5@nN=@}@Yi&Y&{87(q0sSH1d`8Iv6DWDG-Xe$dk zuQkPvalBOM6@<36RuxHnz?A4kK8LZ+LH~+SsnlpY(sIw9I5dBHj1%cVzymg+c(gKC z38_kB!930ZRC;@P+9hY2NZ2V2R06zVm`1ogp3+p0qHgF zDfU%FuhQCT@=AaCRKU9AmZXenSPcuuo%YI>33s^v)3ri%DYRWcWY>QTsi9P!=JDMt%tXAs!)|$p zkQ?*{cfD0OZxMmlT==pVmA+$U2G}V6{Vx;_EMT`O7`F_* z7I@qnVe@vkNCvJj6;it{4gXfP9uBdHM@-@poA|^iPO*wt%;FZi_{A`ev5aR-;~Lxe z#yHNgj(2~|;~x9?$3PCUkcUj_z*MJYH%85qWyVa1>=EfK7)qQbZN5E#>wYM!+!+qX! zo<;UDKEF)RZKepKVI1f}4;m4Rej+hI`ut}PBPJYhHxA9!sH{V(?YOF04)P2+_T~q0RTJcSX77r diff --git a/data/floor.gif b/data/floor.gif index 8d180d8d5054ff2f17b514195d1c1db2318971d5..b5c635df8707906705799455564a080861b68de6 100644 GIT binary patch delta 220 zcmV<203-j?1B(R-M@dFFH(}raAdv|l0U)s{0|5d5lPv+Ef6=U4yM7Hj_UK2mfylm% zJGbs@I0I*p=zF*D;l$}Q1~;YV+v3cd@1D4ev)NbnoLj%%x~WrolU>CMmIb@`@m&B@ zpJsdOcZtAPlYcLMUvKl^rB&Q_e*l})LZ+})L?B#ddMEo7-+<<^^CzcA)Ef`04 z2u^sLO&^&@J_%C-`uAOW6n@CudD?Z;NQCPl2V#oNb=cSsa#5pVj0sW#SaLi-B4ds- WQiK_gI{w()7PFlOWRas4002AiJZTO9 delta 35 rcmeBXz0Az%?&)S>p7?-4U?QhHqrgT@W=6&(lXV#vva+%=FjxZsr6dRc diff --git a/data/rooms/00.txt b/data/rooms/00.txt index 52af3c0..b6554fb 100644 --- a/data/rooms/00.txt +++ b/data/rooms/00.txt @@ -7,18 +7,10 @@ floor-texture: 0 wall-texture: 2 door-texture: 0 under-door-texture: 0 +exit-xp: 5 exit-xn: 1 exit-zn: 2 -actor{ - name: PLATFORM00 - bmp: test.gif - bmp-rect: 64 0 32 24 - bmp-offset: 0 24 - pos: 8 28 0 - size: 8 8 4 -} - actor{ name: PLATFORM02 bmp: test.gif @@ -28,6 +20,15 @@ actor{ size: 8 8 4 } +actor{ + name: PLATFORM00 + bmp: test.gif + bmp-rect: 64 0 32 24 + bmp-offset: 0 24 + pos: 8 28 0 + size: 8 8 4 +} + actor{ name: PLATFORM01 bmp: test.gif diff --git a/data/rooms/02.txt b/data/rooms/02.txt index 373015f..d5d73f1 100644 --- a/data/rooms/02.txt +++ b/data/rooms/02.txt @@ -8,6 +8,7 @@ wall-texture: 2 door-texture: 0 under-door-texture: 2 exit-xn: 3 +exit-yp: 4 exit-zp: 0 actor{ diff --git a/data/rooms/04.txt b/data/rooms/04.txt new file mode 100644 index 0000000..6989325 --- /dev/null +++ b/data/rooms/04.txt @@ -0,0 +1,250 @@ +width: 2 +height: 3 +door-height-yp: 2 +door-height-yn: 2 +color: GREEN +floor-texture: 1 +wall-texture: 5 +door-texture: 4 +under-door-texture: 0 +exit-yn: 2 + +actor{ + name: BOX + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 0 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX02 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 16 0 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX03 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 24 0 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX20 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 8 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX01 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 16 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX11 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 24 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX12 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 32 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX13 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 40 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX14 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 48 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX21 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 8 56 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX15 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 16 56 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX16 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 24 56 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX04 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 32 0 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX17 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 32 56 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX05 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 40 0 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX22 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 0 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX06 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 8 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX07 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 16 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX08 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 24 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX09 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 32 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX10 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 40 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX19 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 48 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX18 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 40 56 0 + size: 8 8 8 + movement: CW +} + +actor{ + name: BOX23 + bmp: caixes.gif + bmp-rect: 64 64 32 32 + bmp-offset: 0 32 + pos: 48 56 0 + size: 8 8 8 + movement: CW +} diff --git a/data/rooms/05.txt b/data/rooms/05.txt new file mode 100644 index 0000000..c765d43 --- /dev/null +++ b/data/rooms/05.txt @@ -0,0 +1,9 @@ +width: 2 +height: 2 +door-height-xn: 0 +color: YELLOW +floor-texture: 8 +wall-texture: 8 +door-texture: 5 +under-door-texture: 0 +exit-xn: 0 diff --git a/data/walls.gif b/data/walls.gif index efb5c263fd85840e1fb54ee1667b7122c55d105a..2189dae66ca2c9494937aec2efe9d2755da59ee3 100644 GIT binary patch delta 1286 zcmV+h1^N2U3CRkOQ-AJs#uQ91XTY{EX*;Z$Mfa1iJjDhHbz_`_O@*)d+)Zmfl5EL* zJ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v79QW(W+#@o?L+-U#n`LtSVB}G-7R0b-C4FiES zR~v4Q@qdRDD4G2bpjp9LHW5|RMTZq%rG zRAcwebzW%`U6Rs;Po0&GFQ)AnO;7t=H`iwldPN^(>QV3$kbMOg8#hbA)*WCnLba8D zBMu_hjviH@4wbG6`BpZFA=%bzMN;%78ex_fR)3T$+`p~{vUXn*X5?-w#l`bc_P8_@*;b#h}Q!->nPgZJCU{Ogi7mpnxJQOK8LbF(8u$=% 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: diff --git a/todo.txt b/todo.txt index c479fa7..8c42367 100644 --- a/todo.txt +++ b/todo.txt @@ -10,6 +10,10 @@ x Gràfics de taula - Grafics de cadires - Gràfics de conveyor belt x Gràfics de consoles i comps +- Gràfics de nevera +- Gràfics de bancada de cuina +- Gràfics de sofà? +- Gràfics de Plantes, arbres... - Decidir objectes de habilitats - Motxilla, espardenyes... @@ -18,7 +22,7 @@ x Gràfics de consoles i comps - Implementar eixides per dalt x Implementar eixides per baix -- Implementar pickar objectes +x Implementar pickar objectes - Implementar inventari - Menus