cs381/as6/EnergyBarRaygui.hpp

60 lines
2.4 KiB
C++

/*******************************************************************************************
*
* LayoutName v1.0.0 - Tool Description
*
* LICENSE: Propietary License
*
* Copyright (c) 2022 raylib technologies. All Rights Reserved.
*
* Unauthorized copying of this file, via any medium is strictly prohibited
* This project is proprietary and confidential unless the owner allows
* usage in any other form by expresely written permission.
*
**********************************************************************************************/
#pragma once
#include "raygui.h"
#include "raylib.h"
inline constexpr float WINDOW_WIDTH = 700;
inline constexpr float WINDOW_HEIGHT = 460;
//----------------------------------------------------------------------------------
// Controls Functions Declaration
//----------------------------------------------------------------------------------
inline void DrawHud(float value, int stars) {
GuiProgressBar((Rectangle){72, 440, 120, 16}, "ENERGY", nullptr, value, 0, 1);
GuiLabel((Rectangle){24, 8, 120, 24}, TextFormat("STARS: x%d", stars));
}
inline void DrawMainMenu() {
GuiLabel((Rectangle){WINDOW_WIDTH / 2 - 60, WINDOW_HEIGHT / 2 - 60, 200, 40},
"GRAVITY SURFING");
GuiLabel((Rectangle){WINDOW_WIDTH / 2 - 160, WINDOW_HEIGHT / 2, 400, 60},
"LEFT CLICK to place a black hole that lasts 1 second\n"
"Each black hole costs 10 meter and does not drain over time\n"
"Avoid hazards and collect stars to refill meter\n"
"Place as many black holes as your meter allows\n"
"Press SPACE or LEFT CLICK to start");
}
inline bool DrawMuteButton(bool muted) {
const char *label = muted ? "Audio: Muted" : "Audio: On";
return GuiButton((Rectangle){WINDOW_WIDTH - 136, 16, 120, 28}, label);
}
inline void DrawDeathStats(int stars) {
GuiLabel((Rectangle){WINDOW_WIDTH / 2 - 120, WINDOW_HEIGHT / 2 - 40, 300, 32}, "YOU DIED");
GuiLabel((Rectangle){WINDOW_WIDTH / 2 - 120, WINDOW_HEIGHT / 2 - 4, 300, 24},
TextFormat("Stars Collected: %d", stars));
GuiLabel((Rectangle){WINDOW_WIDTH / 2 - 120, WINDOW_HEIGHT / 2 + 28, 300, 20},
"Press ENTER or LEFT CLICK to retry");
}
//------------------------------------------------------------------------------------
// Controls Functions Definitions (local)
//------------------------------------------------------------------------------------