Include touch controls

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent b5a5228690
commit e60ef8e17b
  1. 140
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. BIN
      assets/touchcontroller.png

@ -673,7 +673,7 @@ public:
std::string CONSOLE_REF_TEXT; std::string CONSOLE_REF_TEXT;
bool SOUND_IS_PLAYING=false; bool SOUND_IS_PLAYING=false;
int MAIN_MENU_SELECTION=0; int MAIN_MENU_SELECTION=0;
std::string MENU_OPTIONS[4]={"NEW GAME","CONTINUE","MUTE SOUND","EXIT"}; std::string MENU_OPTIONS[4]={"NEW GAME","MUTE SOUND","EXIT"};
int BATTLE_REASON_CODE=-1; int BATTLE_REASON_CODE=-1;
bool BATTLE_DROUGHT_ACTIVE=false; bool BATTLE_DROUGHT_ACTIVE=false;
bool ROCKET_BOARD_OPTION=false; bool ROCKET_BOARD_OPTION=false;
@ -682,6 +682,8 @@ public:
vf2d BOSS_SIZE={1,1}; vf2d BOSS_SIZE={1,1};
vf2d CREDITS_SCROLLING_OFFSET={0,12}; vf2d CREDITS_SCROLLING_OFFSET={0,12};
bool HIDE_CARDS=false; bool HIDE_CARDS=false;
bool USE_TOUCH_CONTROLS=false;
bool MOUSE_DOWN=false;
Map*MAP_1=new Map("map1"); Map*MAP_1=new Map("map1");
Map*MAP_2=new Map("map2"); Map*MAP_2=new Map("map2");
@ -700,7 +702,7 @@ public:
*SANDWORM_DECAL,*SNAKE_DECAL,*MOTH_DECAL,*FLASH_FLOOD_DECAL,*SUNNY_DAY_DECAL,*FIRESTORM_DECAL,*SOLARFLARE_DECAL, *SANDWORM_DECAL,*SNAKE_DECAL,*MOTH_DECAL,*FLASH_FLOOD_DECAL,*SUNNY_DAY_DECAL,*FIRESTORM_DECAL,*SOLARFLARE_DECAL,
*HP_REGEN_DECAL,*SLOWED_DECAL, *SPEED_DECAL,*HIDDEN_DECAL,*BOOK_DECAL,*BOOK2_DECAL, *HP_REGEN_DECAL,*SLOWED_DECAL, *SPEED_DECAL,*HIDDEN_DECAL,*BOOK_DECAL,*BOOK2_DECAL,
*LAUNCHPAD_CLOSED_DECAL,*LAUNCHPAD_HALF1_DECAL,*LAUNCHPAD_HALF2_DECAL,*LAUNCHPAD_DECAL,*Y_Y_DECAL, *LAUNCHPAD_CLOSED_DECAL,*LAUNCHPAD_HALF1_DECAL,*LAUNCHPAD_HALF2_DECAL,*LAUNCHPAD_DECAL,*Y_Y_DECAL,
*PETRIFY_DECAL,*A_A_DECAL,*A_A_RECHARGE_DECAL, *ENERGYBALL_DECAL; *PETRIFY_DECAL,*A_A_DECAL,*A_A_RECHARGE_DECAL, *ENERGYBALL_DECAL, *TOUCHSCREEN_DECAL;
std::map<std::string,ObjectLoadInfo*> BASE_OBJECTS; std::map<std::string,ObjectLoadInfo*> BASE_OBJECTS;
std::vector<Encounter> ENCOUNTERS; std::vector<Encounter> ENCOUNTERS;
Encounter ENCOUNTER_SPIDEY_1; Encounter ENCOUNTER_SPIDEY_1;
@ -734,6 +736,8 @@ public:
int PETRIFY_TURNS=0; int PETRIFY_TURNS=0;
int LAST_FRAME_SOUND_PLAYED=0; int LAST_FRAME_SOUND_PLAYED=0;
bool queueBGMPlayback=false; bool queueBGMPlayback=false;
bool MOUSE_PRESSED_DOWN=false;
bool MOUSE_RELEASED=false;
Map*CURRENT_MAP=MAP_1; Map*CURRENT_MAP=MAP_1;
@ -885,6 +889,7 @@ public:
A_A_DECAL=new Decal(new Sprite("assets/A.A.png")); A_A_DECAL=new Decal(new Sprite("assets/A.A.png"));
A_A_RECHARGE_DECAL=new Decal(new Sprite("assets/A.A_recharge.png")); A_A_RECHARGE_DECAL=new Decal(new Sprite("assets/A.A_recharge.png"));
ENERGYBALL_DECAL=new Decal(new Sprite("assets/energyball.png")); ENERGYBALL_DECAL=new Decal(new Sprite("assets/energyball.png"));
TOUCHSCREEN_DECAL=new Decal(new Sprite("assets/touchcontroller.png"));
playerAnim->spr=PLAYER_DECAL; playerAnim->spr=PLAYER_DECAL;
playerAnimRight->spr=PLAYER_DECAL; playerAnimRight->spr=PLAYER_DECAL;
@ -1272,6 +1277,11 @@ public:
} }
return; return;
} }
if (GetMouse(0).bPressed) {
USE_TOUCH_CONTROLS=true;
} else {
USE_TOUCH_CONTROLS=false;
}
if (!GetKey(W).bPressed&&!GetKey(A).bPressed&&!GetKey(S).bPressed&&!GetKey(D).bPressed&& if (!GetKey(W).bPressed&&!GetKey(A).bPressed&&!GetKey(S).bPressed&&!GetKey(D).bPressed&&
!GetKey(UP).bPressed&&!GetKey(RIGHT).bPressed&&!GetKey(DOWN).bPressed&&!GetKey(LEFT).bPressed) { !GetKey(UP).bPressed&&!GetKey(RIGHT).bPressed&&!GetKey(DOWN).bPressed&&!GetKey(LEFT).bPressed) {
ActionButtonPress(); ActionButtonPress();
@ -1309,6 +1319,13 @@ public:
} }
void ActionButtonPress() { void ActionButtonPress() {
if (GetMouse(0).bPressed) {
MOUSE_DOWN=true;
MOUSE_PRESSED_DOWN=true;
if (GetMouseX()<128&&GetMouseY()>128) {
return;
}
}
if (playerCanMove()) { if (playerCanMove()) {
switch (GAME_STATE) { switch (GAME_STATE) {
case GAMEWORLD:{ case GAMEWORLD:{
@ -1326,23 +1343,22 @@ public:
} }
if (GAME_STATE==CUTSCENE_3) { if (GAME_STATE==CUTSCENE_3) {
switch (MAIN_MENU_SELECTION) { switch (MAIN_MENU_SELECTION) {
case 0: case 0:{
case 1:{
PlaySound(&SOUND_SELECT); PlaySound(&SOUND_SELECT);
fadeOut(); fadeOut();
audioFadeOut(); audioFadeOut();
}break; }break;
case 2:{ case 1:{
SOUND_IS_MUTED=!SOUND_IS_MUTED; SOUND_IS_MUTED=!SOUND_IS_MUTED;
if (SOUND_IS_MUTED) { if (SOUND_IS_MUTED) {
MENU_OPTIONS[2]="UNMUTE SOUND"; MENU_OPTIONS[1]="UNMUTE SOUND";
engine.SetOutputVolume(0); engine.SetOutputVolume(0);
} else { } else {
MENU_OPTIONS[2]="MUTE SOUND"; MENU_OPTIONS[1]="MUTE SOUND";
engine.SetOutputVolume(0.6); engine.SetOutputVolume(0.6);
} }
}break; }break;
case 3:{ case 2:{
END_THE_GAME=true; END_THE_GAME=true;
}break; }break;
} }
@ -1412,41 +1428,45 @@ public:
bool OnUserUpdate(float fElapsedTime) override bool OnUserUpdate(float fElapsedTime) override
{ {
elapsedTime+=fElapsedTime; elapsedTime+=fElapsedTime;
if (GetMouse(0).bReleased) {
MOUSE_DOWN=false;
MOUSE_RELEASED=true;
}
while (elapsedTime>TARGET_RATE) { while (elapsedTime>TARGET_RATE) {
elapsedTime-=TARGET_RATE; elapsedTime-=TARGET_RATE;
updateGame(); updateGame();
rand(); rand();
} }
if (GetKey(F1).bPressed) { if (GetKey(F1).bPressed) {
ConsoleShow(F1,false); //ConsoleShow(F1,false); //Disable for official release.
} }
if (playerCanMove()) { if (playerCanMove()) {
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) { if (RightPressed()) {
changeAnimation(playerAnimWalkRight); changeAnimation(playerAnimWalkRight);
} }
if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed) { if (LeftPressed()) {
changeAnimation(playerAnimWalkLeft); changeAnimation(playerAnimWalkLeft);
} }
if (GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed) { if (UpPressed()) {
changeAnimation(playerAnimWalkUp); changeAnimation(playerAnimWalkUp);
} }
if (GetKey(S).bPressed||GetKey(DOWN).bPressed||GetKey(NP5).bPressed||GetKey(NP2).bPressed) { if (DownPressed()) {
changeAnimation(playerAnimWalkDown); changeAnimation(playerAnimWalkDown);
} }
if (!GetKey(D).bHeld&&!GetKey(RIGHT).bHeld&&!GetKey(NP6).bHeld&& if (!RightHeld()&&
!GetKey(A).bHeld&&!GetKey(LEFT).bHeld&&!GetKey(NP4).bHeld&& !LeftHeld()&&
!GetKey(S).bHeld&&!GetKey(UP).bHeld&&!GetKey(NP8).bHeld&& !UpHeld()&&
!GetKey(W).bHeld&&!GetKey(DOWN).bHeld&&!GetKey(NP5).bHeld&&!GetKey(NP2).bHeld) { !DownHeld()) {
if (GetKey(D).bReleased||GetKey(RIGHT).bReleased||GetKey(NP6).bReleased) { if (RightReleased()) {
changeAnimation(playerAnimRight); changeAnimation(playerAnimRight);
} }
if (GetKey(A).bReleased||GetKey(LEFT).bReleased||GetKey(NP4).bReleased) { if (LeftReleased()) {
changeAnimation(playerAnimLeft); changeAnimation(playerAnimLeft);
} }
if (GetKey(W).bReleased||GetKey(UP).bReleased||GetKey(NP8).bReleased) { if (UpReleased()) {
changeAnimation(playerAnim); changeAnimation(playerAnim);
} }
if (GetKey(S).bReleased||GetKey(DOWN).bReleased||GetKey(NP5).bReleased||GetKey(NP2).bReleased) { if (DownReleased()) {
changeAnimation(playerAnimDown); changeAnimation(playerAnimDown);
} }
} }
@ -1454,12 +1474,12 @@ public:
if (IN_BATTLE_ENCOUNTER&&!messageBoxVisible) { if (IN_BATTLE_ENCOUNTER&&!messageBoxVisible) {
switch (BATTLE_STATE) { switch (BATTLE_STATE) {
case battle::PLAYER_SELECTION:{ case battle::PLAYER_SELECTION:{
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) { if (RightPressed()) {
BATTLE_CARD_SELECTION_IND=(BATTLE_CARD_SELECTION_IND+1)%availablePowers.size(); BATTLE_CARD_SELECTION_IND=(BATTLE_CARD_SELECTION_IND+1)%availablePowers.size();
BATTLE_CARD_SELECTION=availablePowers[BATTLE_CARD_SELECTION_IND]; BATTLE_CARD_SELECTION=availablePowers[BATTLE_CARD_SELECTION_IND];
PlaySound(&SOUND_CHANGE_OPTION); PlaySound(&SOUND_CHANGE_OPTION);
} }
if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed) { if (LeftPressed()) {
if (--BATTLE_CARD_SELECTION_IND<0) { if (--BATTLE_CARD_SELECTION_IND<0) {
BATTLE_CARD_SELECTION_IND=availablePowers.size()-1; BATTLE_CARD_SELECTION_IND=availablePowers.size()-1;
} }
@ -1468,7 +1488,7 @@ public:
} }
}break; }break;
case battle::PLAYER_TARGET_SELECTION:{ case battle::PLAYER_TARGET_SELECTION:{
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) { if (RightPressed()) {
while (true) { while (true) {
PLAYER_SELECTED_TARGET=(PLAYER_SELECTED_TARGET+1)%CURRENT_ENCOUNTER.entities.size(); PLAYER_SELECTED_TARGET=(PLAYER_SELECTED_TARGET+1)%CURRENT_ENCOUNTER.entities.size();
if (CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->hp>0) { if (CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->hp>0) {
@ -1477,12 +1497,12 @@ public:
} }
PlaySound(&SOUND_CHANGE_OPTION); PlaySound(&SOUND_CHANGE_OPTION);
} }
if (GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed) { if (UpPressed()) {
PLAYER_SELECTED_TARGET=-1; PLAYER_SELECTED_TARGET=-1;
//std::cout<<"Battle State is "<<BATTLE_STATE<<" (1)\n"; //std::cout<<"Battle State is "<<BATTLE_STATE<<" (1)\n";
BATTLE_STATE=battle::PLAYER_SELECTION; BATTLE_STATE=battle::PLAYER_SELECTION;
} }
if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed) { if (LeftPressed()) {
while (true) { while (true) {
if (--PLAYER_SELECTED_TARGET<0) { if (--PLAYER_SELECTED_TARGET<0) {
PLAYER_SELECTED_TARGET=CURRENT_ENCOUNTER.entities.size()-1; PLAYER_SELECTED_TARGET=CURRENT_ENCOUNTER.entities.size()-1;
@ -1497,28 +1517,28 @@ public:
} }
} else { } else {
if (GAME_STATE==CUTSCENE_3) { if (GAME_STATE==CUTSCENE_3) {
if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed|GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed) { if (LeftPressed()||UpPressed()) {
MAIN_MENU_SELECTION--; MAIN_MENU_SELECTION--;
if (MAIN_MENU_SELECTION<0) { if (MAIN_MENU_SELECTION<0) {
MAIN_MENU_SELECTION=3; MAIN_MENU_SELECTION=2;
} }
PlaySound(&SOUND_CHANGE_OPTION); PlaySound(&SOUND_CHANGE_OPTION);
} }
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed||GetKey(S).bPressed||GetKey(DOWN).bPressed||GetKey(NP5).bPressed||GetKey(NP2).bPressed) { if (DownPressed()||RightPressed()) {
MAIN_MENU_SELECTION=(MAIN_MENU_SELECTION+1)%4; MAIN_MENU_SELECTION=(MAIN_MENU_SELECTION+1)%3;
PlaySound(&SOUND_CHANGE_OPTION); PlaySound(&SOUND_CHANGE_OPTION);
} }
} }
switch (CURRENT_CUTSCENE) { switch (CURRENT_CUTSCENE) {
case cutscene::INPUT_USERNAME:{ case cutscene::INPUT_USERNAME:{
if (GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed) { if (UpPressed()) {
TERMINAL_SELECTED_CHAR=TERMINAL_SELECTED_CHAR-7; TERMINAL_SELECTED_CHAR=TERMINAL_SELECTED_CHAR-7;
if (TERMINAL_SELECTED_CHAR<0) { if (TERMINAL_SELECTED_CHAR<0) {
TERMINAL_SELECTED_CHAR+=28; TERMINAL_SELECTED_CHAR+=28;
} }
PlaySound(&SOUND_MSG); PlaySound(&SOUND_MSG);
} }
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) { if (RightPressed()) {
if ((TERMINAL_SELECTED_CHAR+1)%7==0) { if ((TERMINAL_SELECTED_CHAR+1)%7==0) {
TERMINAL_SELECTED_CHAR-=6; TERMINAL_SELECTED_CHAR-=6;
} else { } else {
@ -1526,7 +1546,7 @@ public:
} }
PlaySound(&SOUND_MSG); PlaySound(&SOUND_MSG);
} }
if (GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed) { if (LeftPressed()) {
if ((TERMINAL_SELECTED_CHAR-1)%7==6||TERMINAL_SELECTED_CHAR-1<0) { if ((TERMINAL_SELECTED_CHAR-1)%7==6||TERMINAL_SELECTED_CHAR-1<0) {
TERMINAL_SELECTED_CHAR+=6; TERMINAL_SELECTED_CHAR+=6;
} else { } else {
@ -1534,7 +1554,7 @@ public:
} }
PlaySound(&SOUND_MSG); PlaySound(&SOUND_MSG);
} }
if (GetKey(S).bPressed||GetKey(DOWN).bPressed||GetKey(NP5).bPressed||GetKey(NP2).bPressed) { if (DownPressed()) {
if (TERMINAL_SELECTED_CHAR+7>=28) { if (TERMINAL_SELECTED_CHAR+7>=28) {
TERMINAL_SELECTED_CHAR=(TERMINAL_SELECTED_CHAR+7)%28; TERMINAL_SELECTED_CHAR=(TERMINAL_SELECTED_CHAR+7)%28;
} else { } else {
@ -1544,7 +1564,7 @@ public:
} }
}break; }break;
case cutscene::READY_TO_BOARD:{ case cutscene::READY_TO_BOARD:{
if (GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed||GetKey(S).bPressed||GetKey(DOWN).bPressed||GetKey(NP5).bPressed||GetKey(NP2).bPressed) { if (UpPressed()||DownPressed()) {
ROCKET_BOARD_OPTION=!ROCKET_BOARD_OPTION; ROCKET_BOARD_OPTION=!ROCKET_BOARD_OPTION;
} }
}break; }break;
@ -1556,6 +1576,8 @@ public:
Clear(BLANK); Clear(BLANK);
SetDrawTarget(2); SetDrawTarget(2);
drawGame(); drawGame();
MOUSE_PRESSED_DOWN=false;
MOUSE_RELEASED=false;
// called once per frame // called once per frame
return !END_THE_GAME; return !END_THE_GAME;
} }
@ -1955,7 +1977,7 @@ public:
if (playerCanMove()) { if (playerCanMove()) {
bool animationchanged=false; bool animationchanged=false;
bool positionModified=false; bool positionModified=false;
if (GetKey(D).bHeld||GetKey(RIGHT).bHeld||GetKey(NP6).bHeld) { if (RightHeld()) {
if (GAME_STATE!=IN_SPACE&&MAP[(int)PLAYER_COORDS[1]][(int)std::clamp(PLAYER_COORDS[0]+MOVE_SPD,0.1,(double)MAP_WIDTH)]!=4) { if (GAME_STATE!=IN_SPACE&&MAP[(int)PLAYER_COORDS[1]][(int)std::clamp(PLAYER_COORDS[0]+MOVE_SPD,0.1,(double)MAP_WIDTH)]!=4) {
PLAYER_COORDS[0]=std::clamp(PLAYER_COORDS[0]+MOVE_SPD,0.1,(double)MAP_WIDTH); PLAYER_COORDS[0]=std::clamp(PLAYER_COORDS[0]+MOVE_SPD,0.1,(double)MAP_WIDTH);
positionModified=true; positionModified=true;
@ -1967,7 +1989,7 @@ public:
animationchanged=true; animationchanged=true;
} }
} }
if (GetKey(A).bHeld||GetKey(LEFT).bHeld||GetKey(NP4).bHeld) { if (LeftHeld()) {
if (GAME_STATE!=IN_SPACE&&MAP[(int)PLAYER_COORDS[1]][(int)std::clamp(PLAYER_COORDS[0]-MOVE_SPD,0.1,(double)MAP_WIDTH)]!=4) { if (GAME_STATE!=IN_SPACE&&MAP[(int)PLAYER_COORDS[1]][(int)std::clamp(PLAYER_COORDS[0]-MOVE_SPD,0.1,(double)MAP_WIDTH)]!=4) {
PLAYER_COORDS[0]=std::clamp(PLAYER_COORDS[0]-MOVE_SPD,0.1,(double)MAP_WIDTH); PLAYER_COORDS[0]=std::clamp(PLAYER_COORDS[0]-MOVE_SPD,0.1,(double)MAP_WIDTH);
positionModified=true; positionModified=true;
@ -1979,7 +2001,7 @@ public:
animationchanged=true; animationchanged=true;
} }
} }
if (GetKey(W).bHeld||GetKey(UP).bHeld||GetKey(NP8).bHeld) { if (UpHeld()) {
if (GAME_STATE!=IN_SPACE&&MAP[(int)std::clamp(PLAYER_COORDS[1]-MOVE_SPD,0.1,(double)MAP_HEIGHT)][(int)PLAYER_COORDS[0]]!=4) { if (GAME_STATE!=IN_SPACE&&MAP[(int)std::clamp(PLAYER_COORDS[1]-MOVE_SPD,0.1,(double)MAP_HEIGHT)][(int)PLAYER_COORDS[0]]!=4) {
PLAYER_COORDS[1]=std::clamp(PLAYER_COORDS[1]-MOVE_SPD,0.1,(double)MAP_HEIGHT); PLAYER_COORDS[1]=std::clamp(PLAYER_COORDS[1]-MOVE_SPD,0.1,(double)MAP_HEIGHT);
positionModified=true; positionModified=true;
@ -1996,7 +2018,7 @@ public:
} else { } else {
HIDE_CARDS=false; HIDE_CARDS=false;
} }
if (GetKey(S).bHeld||GetKey(DOWN).bHeld||GetKey(NP5).bHeld||GetKey(NP2).bHeld) { if (DownHeld()) {
if (GAME_STATE!=IN_SPACE&&MAP[(int)std::clamp(PLAYER_COORDS[1]+MOVE_SPD,0.1,(double)MAP_HEIGHT)][(int)PLAYER_COORDS[0]]!=4) { if (GAME_STATE!=IN_SPACE&&MAP[(int)std::clamp(PLAYER_COORDS[1]+MOVE_SPD,0.1,(double)MAP_HEIGHT)][(int)PLAYER_COORDS[0]]!=4) {
PLAYER_COORDS[1]=std::clamp(PLAYER_COORDS[1]+MOVE_SPD,0.1,(double)MAP_HEIGHT); PLAYER_COORDS[1]=std::clamp(PLAYER_COORDS[1]+MOVE_SPD,0.1,(double)MAP_HEIGHT);
positionModified=true; positionModified=true;
@ -3690,6 +3712,9 @@ public:
FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(ORIGINAL_FOREGROUND_EFFECT_COLOR.r,ORIGINAL_FOREGROUND_EFFECT_COLOR.g,ORIGINAL_FOREGROUND_EFFECT_COLOR.b,ORIGINAL_FOREGROUND_EFFECT_COLOR.a*PIXEL_EFFECT_TRANSPARENCY)); FillRectDecal({0,0},{WIDTH,HEIGHT},Pixel(ORIGINAL_FOREGROUND_EFFECT_COLOR.r,ORIGINAL_FOREGROUND_EFFECT_COLOR.g,ORIGINAL_FOREGROUND_EFFECT_COLOR.b,ORIGINAL_FOREGROUND_EFFECT_COLOR.a*PIXEL_EFFECT_TRANSPARENCY));
SetDrawTarget(2); SetDrawTarget(2);
} }
if (USE_TOUCH_CONTROLS&&(CURRENT_CUTSCENE==cutscene::NONE||CURRENT_CUTSCENE==cutscene::INPUT_USERNAME||CURRENT_CUTSCENE==cutscene::READY_TO_BOARD)) {
DrawDecal({0,HEIGHT-128},TOUCHSCREEN_DECAL,{1,1},Pixel(255,255,255,128));
}
if (messageBoxVisible) { if (messageBoxVisible) {
SetDrawTarget(nullptr); SetDrawTarget(nullptr);
DrawDialogBox({4,HEIGHT-60},{WIDTH/2,16},Pixel(18, 0, 33,180)); DrawDialogBox({4,HEIGHT-60},{WIDTH/2,16},Pixel(18, 0, 33,180));
@ -4661,6 +4686,43 @@ public:
FillRectDecal(starpixels[i]->pos,starpixels[i]->size,{(uint8_t)(starpixels[i]->r),(uint8_t)(starpixels[i]->g),(uint8_t)(starpixels[i]->b),(uint8_t)(std::clamp(distanceFromCenter/64.0*255,0.0,255.0))}); FillRectDecal(starpixels[i]->pos,starpixels[i]->size,{(uint8_t)(starpixels[i]->r),(uint8_t)(starpixels[i]->g),(uint8_t)(starpixels[i]->b),(uint8_t)(std::clamp(distanceFromCenter/64.0*255,0.0,255.0))});
} }
} }
bool UpPressed(){
return GetKey(W).bPressed||GetKey(UP).bPressed||GetKey(NP8).bPressed||MOUSE_PRESSED_DOWN&&GetMouseY()<=HEIGHT-128+32&&GetMouseY()>=HEIGHT-128;
}
bool DownPressed(){
return GetKey(S).bPressed||GetKey(DOWN).bPressed||GetKey(NP5).bPressed||GetKey(NP2).bPressed||MOUSE_PRESSED_DOWN&&GetMouseY()<=HEIGHT&&GetMouseY()>=HEIGHT-32;
}
bool LeftPressed(){
return GetKey(A).bPressed||GetKey(LEFT).bPressed||GetKey(NP4).bPressed||MOUSE_PRESSED_DOWN&&GetMouseX()<=32&&GetMouseX()>=0;
}
bool RightPressed(){
return GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed||MOUSE_PRESSED_DOWN&&GetMouseX()<=128&&GetMouseX()>=96;
}
bool UpHeld(){
return GetKey(W).bHeld||GetKey(UP).bHeld||GetKey(NP8).bHeld||MOUSE_DOWN&&GetMouseY()<=HEIGHT-128+32&&GetMouseY()>=HEIGHT-128;
}
bool DownHeld(){
return GetKey(S).bHeld||GetKey(DOWN).bHeld||GetKey(NP5).bHeld||GetKey(NP2).bHeld||MOUSE_DOWN&&GetMouseY()<=HEIGHT&&GetMouseY()>=HEIGHT-32;
}
bool LeftHeld(){
return GetKey(A).bHeld||GetKey(LEFT).bHeld||GetKey(NP4).bHeld||MOUSE_DOWN&&GetMouseX()<=32&&GetMouseX()>=0;
}
bool RightHeld(){
return GetKey(D).bHeld||GetKey(RIGHT).bHeld||GetKey(NP6).bHeld||MOUSE_DOWN&&GetMouseX()<=128&&GetMouseX()>=96;
}
bool UpReleased(){
return GetKey(W).bReleased||GetKey(UP).bReleased||GetKey(NP8).bReleased||MOUSE_RELEASED&&GetMouseY()<=HEIGHT-128+32&&GetMouseY()>=HEIGHT-128;
}
bool DownReleased(){
return GetKey(S).bReleased||GetKey(DOWN).bReleased||GetKey(NP5).bReleased||GetKey(NP2).bReleased||MOUSE_RELEASED&&GetMouseY()<=HEIGHT&&GetMouseY()>=HEIGHT-32;
}
bool LeftReleased(){
return GetKey(A).bReleased||GetKey(LEFT).bReleased||GetKey(NP4).bReleased||MOUSE_RELEASED&&GetMouseX()<=32&&GetMouseX()>=0;
}
bool RightReleased(){
return GetKey(D).bReleased||GetKey(RIGHT).bReleased||GetKey(NP6).bReleased||MOUSE_RELEASED&&GetMouseX()<=128&&GetMouseX()>=96;
}
}; };

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Loading…
Cancel
Save