generated from sigonasr2/CPlusPlusProjectTemplate
Added indicators
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
e4082798c6
commit
b00770e985
@ -75,8 +75,12 @@ public:
|
|||||||
std::string messageBoxRefText;
|
std::string messageBoxRefText;
|
||||||
bool firstNewline=false;
|
bool firstNewline=false;
|
||||||
bool secondNewline=false;
|
bool secondNewline=false;
|
||||||
|
bool foodMeterVisible=false;
|
||||||
|
int foodCount=3;
|
||||||
|
bool oxygenMeterVisible=false;
|
||||||
|
int oxygenQualityLevel=34;
|
||||||
|
|
||||||
olc::Decal*DOME_DECAL;
|
olc::Decal*DOME_DECAL,*FOOD_METER_DECAL,*OXYGEN_METER_DECAL;
|
||||||
std::map<std::string,olc::Decal*> BASE_OBJECTS;
|
std::map<std::string,olc::Decal*> BASE_OBJECTS;
|
||||||
|
|
||||||
void LoadMap(char*mapName) {
|
void LoadMap(char*mapName) {
|
||||||
@ -142,6 +146,8 @@ public:
|
|||||||
// Called once at the start, so create things here
|
// Called once at the start, so create things here
|
||||||
TILES=new olc::Decal(new olc::Sprite("assets/tiles.png"));
|
TILES=new olc::Decal(new olc::Sprite("assets/tiles.png"));
|
||||||
DOME_DECAL=new olc::Decal(new olc::Sprite("assets/dome.png"));
|
DOME_DECAL=new olc::Decal(new olc::Sprite("assets/dome.png"));
|
||||||
|
FOOD_METER_DECAL=new olc::Decal(new olc::Sprite("assets/corn.png"));
|
||||||
|
OXYGEN_METER_DECAL=new olc::Decal(new olc::Sprite("assets/co2.png"));
|
||||||
BASE_OBJECTS["DOME"]=DOME_DECAL;
|
BASE_OBJECTS["DOME"]=DOME_DECAL;
|
||||||
LoadMap("assets/maps/map1");
|
LoadMap("assets/maps/map1");
|
||||||
return true;
|
return true;
|
||||||
@ -278,10 +284,12 @@ public:
|
|||||||
if (!CUTSCENE_FLAGS[2]) {
|
if (!CUTSCENE_FLAGS[2]) {
|
||||||
CUTSCENE_FLAGS[2]=true;
|
CUTSCENE_FLAGS[2]=true;
|
||||||
DisplayMessageBox(2);
|
DisplayMessageBox(2);
|
||||||
|
foodMeterVisible=true;
|
||||||
} else
|
} else
|
||||||
if (!CUTSCENE_FLAGS[3]) {
|
if (!CUTSCENE_FLAGS[3]) {
|
||||||
CUTSCENE_FLAGS[3]=true;
|
CUTSCENE_FLAGS[3]=true;
|
||||||
DisplayMessageBox(3);
|
DisplayMessageBox(3);
|
||||||
|
oxygenMeterVisible=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
@ -408,6 +416,19 @@ public:
|
|||||||
GradientFillRectDecal({WIDTH/2,HEIGHT/2},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1});
|
GradientFillRectDecal({WIDTH/2,HEIGHT/2},{WIDTH/2,HEIGHT/2},{100, 10, 255,ALPHA_SCREEN2},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1},{100, 10, 255,ALPHA_SCREEN1});
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
|
int meterYOffset=2;
|
||||||
|
if (foodMeterVisible) {
|
||||||
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(foodCount)).x*1-8,meterYOffset+2},to_string(foodCount),olc::BLUE,{1,1});
|
||||||
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(foodCount)).x*1-7,meterYOffset+2},to_string(foodCount),olc::BLACK,{1,1});
|
||||||
|
DrawDecal({WIDTH-52*0.4,meterYOffset},FOOD_METER_DECAL,{0.4,0.4});
|
||||||
|
meterYOffset+=(2+48*0.4);
|
||||||
|
}
|
||||||
|
if (oxygenMeterVisible) {
|
||||||
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(oxygenQualityLevel)+"%").x*1-8,meterYOffset+2},to_string(oxygenQualityLevel)+"%",olc::BLUE,{1,1});
|
||||||
|
DrawStringDecal({WIDTH-36*0.4-GetTextSize(to_string(oxygenQualityLevel)+"%").x*1-7,meterYOffset+2},to_string(oxygenQualityLevel)+"%",olc::BLACK,{1,1});
|
||||||
|
DrawDecal({WIDTH-52*0.4,meterYOffset},OXYGEN_METER_DECAL,{0.4,0.4});
|
||||||
|
meterYOffset+=(2+48*0.4);
|
||||||
|
}
|
||||||
if (messageBoxVisible) {
|
if (messageBoxVisible) {
|
||||||
DrawDialogBox({4,HEIGHT-60},{WIDTH/2,16},olc::Pixel(18, 0, 33,180));
|
DrawDialogBox({4,HEIGHT-60},{WIDTH/2,16},olc::Pixel(18, 0, 33,180));
|
||||||
DrawDialogBox({0,HEIGHT-48},{WIDTH,48},olc::Pixel(18, 0, 33,180));
|
DrawDialogBox({0,HEIGHT-48},{WIDTH,48},olc::Pixel(18, 0, 33,180));
|
||||||
|
Binary file not shown.
BIN
assets/co2.png
Normal file
BIN
assets/co2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
assets/corn.png
Normal file
BIN
assets/corn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Loading…
x
Reference in New Issue
Block a user