- Treballant en algo de UI

This commit is contained in:
2023-06-06 11:55:47 +02:00
parent f7f6131a79
commit 0460efc64a
8 changed files with 81 additions and 16 deletions

View File

@@ -4,15 +4,16 @@
#include <SDL2/SDL.h>
#include "actor.h"
#include "room.h"
#include "jui.h"
draw::surface *surf;
actor::actor_t *box;
int ii = 0;
int room_w = 0;
void restart()
{
actor::clear();
room::load(ii,3);
room::load(room_w,3);
box = actor::create("ASCENSOR",{16,32,0}, {8,8,4}, {64,0,32,24}, {0,24});
box->flags = FLAG_MOVING;
@@ -67,12 +68,6 @@ int sx=1, sy=0;
bool game::loop()
{
if ( input::keyPressed(SDL_SCANCODE_Q) )
{
ii++;if(ii>3)ii=0;
restart();
}
actor::update(actor::getFirst());
actor::reorder();
@@ -82,12 +77,20 @@ bool game::loop()
room::draw2();
//draw::draw(148+sx*2-sy*2, 67+sx+sy,24,24,24,0);
print(0,0,input::mouseX()/3);
print(0,20,input::mouseY()/3);
print(0,0,input::mouseX());
print(0,20,input::mouseY());
print(0,30,input::mouseBtn(1)?1:0);
print(0,40,input::mouseBtn(2)?1:0);
print(0,50,input::mouseBtn(3)?1:0);
draw::print("HOLA!", 30, 10, 14, 8);
char buffer[100];
draw::print("ROOM WIDTH:", 330, 13, 15, 0);
if (ui::button(SDL_itoa(room_w, buffer, 10), 380, 10, 28, 11))
{
room_w++;if(room_w>3)room_w=0;
restart();
}
draw::render();
return true;