- Acabat d'implementar el proces de triar el botó que s'ha polsat

This commit is contained in:
2023-10-19 20:01:18 +02:00
parent d8404ce752
commit 0b80fc1674
2 changed files with 54 additions and 8 deletions

View File

@@ -4,6 +4,19 @@
#include "aux_font.h"
namespace mapa
{
namespace botons
{
const int caminar = 0;
const int parar = 1;
const int cavar = 2;
const int escalar = 3;
const int perforar = 4;
const int escalera = 5;
const int pasarela = 6;
const int corda = 7;
const int suicidi = 8;
const int fastforward = 9;
}
namespace arounders
{
int orientacio_inicial {0};
@@ -148,9 +161,46 @@ namespace mapa
}
}
int procesar(int mousex, int mousey);
const int procesar()
{
int boto = -1;
void setAroundersNum(const int orient, const int total, const int necessaris);
void setActions(const int parar, const int cavar, const int escalar, const int perforar, const int escalera, const int pasarela, const int corda);
if (input::mouseY() >= 171 && input::mouseY() <= 187 && input::mouseX() >= 5 && input::mouseX() <= 165) {
boto = (input::mouseX()-5) / 16;
switch(boto) {
case mapa::botons::parar:
if (mapa::accions::parar == 0) boto = -1;
break;
case mapa::botons::cavar:
if (mapa::accions::cavar == 0) boto = -1;
break;
case mapa::botons::escalar:
if (mapa::accions::escalar == 0) boto = -1;
break;
case mapa::botons::perforar:
if (mapa::accions::perforar == 0) boto = -1;
break;
case mapa::botons::escalera:
if (mapa::accions::escalera == 0) boto = -1;
break;
case mapa::botons::pasarela:
if (mapa::accions::pasarela == 0) boto = -1;
break;
case mapa::botons::corda:
if (mapa::accions::corda == 0) boto = -1;
break;
case botons::fastforward:
if (mapa::velocitat == 70) {
mapa::velocitat = 10;
} else {
mapa::velocitat = 70;
}
boto = -1;
break;
}
}
return boto;
}
}

View File

@@ -29,9 +29,5 @@ namespace mapa
void carregar();
void pintar(int accio, int prevista);
int procesar(int mousex, int mousey);
void setAroundersNum(const int orient, const int total, const int necessaris);
void setActions(const int parar, const int cavar, const int escalar, const int perforar, const int escalera, const int pasarela, const int corda);
const int procesar();
}