add battery-ui #6
3 changed files with 7 additions and 8 deletions
|
@ -6,14 +6,14 @@ use comfy::EngineContext;
|
||||||
use std::ops::Sub;
|
use std::ops::Sub;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Gost {
|
pub struct Ghost {
|
||||||
LuckyTurtleDev marked this conversation as resolved
Outdated
|
|||||||
/// current electric charge of the Ghost
|
/// current electric charge of the Ghost
|
||||||
pub charge: f32,
|
pub charge: f32,
|
||||||
/// max electric charge of the Ghost
|
/// max electric charge of the Ghost
|
||||||
pub max_charge: f32
|
pub max_charge: f32
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Gost {
|
impl Default for Ghost {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
charge: 1000.0,
|
charge: 1000.0,
|
||||||
|
|
|
@ -12,8 +12,8 @@ mod ui;
|
||||||
|
|
||||||
use self::{
|
use self::{
|
||||||
activities::{house::HouseState, overworld::worldgen::Overworld, Activity},
|
activities::{house::HouseState, overworld::worldgen::Overworld, Activity},
|
||||||
assets::Assets
|
assets::Assets,
|
||||||
use game::Gost;
|
game::Ghost
|
||||||
};
|
};
|
||||||
use comfy::{
|
use comfy::{
|
||||||
init_game_config, pollster, run_comfy_main_async, EngineContext, EngineState,
|
init_game_config, pollster, run_comfy_main_async, EngineContext, EngineState,
|
||||||
|
@ -26,8 +26,7 @@ const GAME_NAME: &str = "Powercreep";
|
||||||
struct State {
|
struct State {
|
||||||
setup_called: bool,
|
setup_called: bool,
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
activity: Activity,
|
ghost: Ghost,
|
||||||
gohst: Gost
|
|
||||||
overworld: Overworld,
|
overworld: Overworld,
|
||||||
house: HouseState
|
house: HouseState
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use comfy::{
|
||||||
EngineContext, Vec2, BLUE, RED
|
EngineContext, Vec2, BLUE, RED
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn draw(state: &State, engine: &EngineContext) {
|
pub fn draw(state: &State, _engine: &EngineContext<'_>) {
|
||||||
// seperate fill state into smaller section for better readability
|
// seperate fill state into smaller section for better readability
|
||||||
let section_count = 5;
|
let section_count = 5;
|
||||||
let mut start_positon = screen_to_world(Vec2::new(screen_width(), screen_height()));
|
let mut start_positon = screen_to_world(Vec2::new(screen_width(), screen_height()));
|
||||||
|
@ -14,7 +14,7 @@ pub fn draw(state: &State, engine: &EngineContext) {
|
||||||
start_positon.y += 0.5 * section_size.y + 0.5 * section_size.y;
|
start_positon.y += 0.5 * section_size.y + 0.5 * section_size.y;
|
||||||
// draw fill level
|
// draw fill level
|
||||||
{
|
{
|
||||||
let gohst = &state.gohst;
|
let gohst = &state.ghost;
|
||||||
let percent = gohst.charge / gohst.max_charge;
|
let percent = gohst.charge / gohst.max_charge;
|
||||||
LuckyTurtleDev marked this conversation as resolved
Outdated
msrd0
commented
GHOST!!! GHOST!!!
|
|||||||
let mut size = section_size;
|
let mut size = section_size;
|
||||||
size.y = section_size.y * section_count as f32 * percent;
|
size.y = section_size.y * section_count as f32 * percent;
|
||||||
|
|
Loading…
Reference in a new issue
Ghost