generated from sigonasr2/CPlusPlusProjectTemplate
Added overworld command menu
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
7a3238cb99
commit
d6840179f0
Binary file not shown.
34
main.cpp
34
main.cpp
@ -1,4 +1,5 @@
|
|||||||
#include "item.h"
|
#include "item.h"
|
||||||
|
#include "layers.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#define OLC_PGE_APPLICATION
|
#define OLC_PGE_APPLICATION
|
||||||
#include "pixelGameEngine.h"
|
#include "pixelGameEngine.h"
|
||||||
@ -147,6 +148,7 @@ public:
|
|||||||
Item*BATTLE_CUSTOM_ITEM;
|
Item*BATTLE_CUSTOM_ITEM;
|
||||||
std::vector<Item*> BATTLE_SPOILS_LIST;
|
std::vector<Item*> BATTLE_SPOILS_LIST;
|
||||||
std::wstring BATTLE_SPOILS_MESSAGE;
|
std::wstring BATTLE_SPOILS_MESSAGE;
|
||||||
|
int OVERWORLD_MENU_SELECTION=0;
|
||||||
|
|
||||||
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
||||||
|
|
||||||
@ -1010,6 +1012,24 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
case GameState::GAME_WORLD:{
|
case GameState::GAME_WORLD:{
|
||||||
if (GetKey(F5).bPressed) {
|
if (GetKey(F5).bPressed) {
|
||||||
GAME_STATE=GameState::EDITOR;
|
GAME_STATE=GameState::EDITOR;
|
||||||
|
} else
|
||||||
|
if (ACTIONKEYPRESSED) {
|
||||||
|
GAME_STATE=GameState::OVERWORLD_MENU;
|
||||||
|
OVERWORLD_MENU_SELECTION=0;
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case GameState::OVERWORLD_MENU:{
|
||||||
|
if (LeftPressed()) {
|
||||||
|
GAME_STATE=GameState::GAME_WORLD;
|
||||||
|
}
|
||||||
|
if (DownPressed()) {
|
||||||
|
OVERWORLD_MENU_SELECTION=(OVERWORLD_MENU_SELECTION+1)%5;
|
||||||
|
}
|
||||||
|
if (UpPressed()) {
|
||||||
|
OVERWORLD_MENU_SELECTION--;
|
||||||
|
if (OVERWORLD_MENU_SELECTION<0) {
|
||||||
|
OVERWORLD_MENU_SELECTION+=5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case GameState::EDITOR:{
|
case GameState::EDITOR:{
|
||||||
@ -1130,8 +1150,20 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (GAME_STATE) {
|
switch (GAME_STATE) {
|
||||||
case GameState::GAME_WORLD:{
|
case GameState::GAME_WORLD:
|
||||||
|
case GameState::OVERWORLD_MENU:{
|
||||||
DrawGameWorld();
|
DrawGameWorld();
|
||||||
|
if (GAME_STATE==GameState::OVERWORLD_MENU) {
|
||||||
|
SetDrawTarget(layer::INTERFACE);
|
||||||
|
vi2d boxPos = {2,2};
|
||||||
|
DrawDialogBox(boxPos,{(int)(WIDTH*0.25+4),5*16+4},Pixel(70, 33, 105,220),Pixel(62, 54, 69,220),Pixel(185, 148, 255,220));
|
||||||
|
const std::array<std::string,5> MENU_ITEMS = {"Check","Power","Items","Equip","Status"};
|
||||||
|
for (int i=0;i<5;i++) {
|
||||||
|
vi2d textPos = {12,i*16+6};
|
||||||
|
DrawStringPropDecal(boxPos+textPos,MENU_ITEMS[i]);
|
||||||
|
}
|
||||||
|
DrawDecal({static_cast<float>(2+4),static_cast<float>(2+6+OVERWORLD_MENU_SELECTION*16)},SPRITES["cursor.png"]);
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
case GameState::EDITOR:{
|
case GameState::EDITOR:{
|
||||||
DrawGameWorld();
|
DrawGameWorld();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user