46 lines
1002 B
Rust

use galactica_content::Content;
use glyphon::TextArea;
use super::{fpsindicator::FpsIndicator, radar::Radar, status::Status};
use crate::{
ui::manager::{UiScene, UiSceneStepResult},
RenderInput, RenderState,
};
pub struct UiFlyingScene {
radar: Radar,
status: Status,
fps: FpsIndicator,
}
impl UiFlyingScene {
pub fn new(_ct: &Content, state: &mut RenderState) -> Self {
Self {
radar: Radar::new(),
status: Status::new(),
fps: FpsIndicator::new(state),
}
}
}
impl<'this> UiScene<'this> for UiFlyingScene {
fn step(&mut self, input: &RenderInput, state: &mut RenderState) -> UiSceneStepResult {
self.fps.update(input, state);
return UiSceneStepResult { new_scene: None };
}
fn draw(&mut self, input: &RenderInput, state: &mut RenderState) {
self.radar.draw(input, state);
self.status.draw(input, state);
}
fn get_textareas(
&'this self,
v: &mut Vec<TextArea<'this>>,
_input: &RenderInput,
_state: &RenderState,
) {
v.push(self.fps.get_textarea());
}
}