My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/games/rstnode/rst-client/src/editor/mod.rs

54 lines
1.3 KiB

use crate::{
assets::Assets, input::InputArbiter, ui::Button, viewport::Viewport, EventId, GameSettings,
};
use ggez::{
event::{EventHandler, MouseButton},
graphics::{self, Color},
Context, GameResult,
};
pub struct EditorState {
assets: Assets,
settings: GameSettings,
input: InputArbiter,
vp: Viewport,
btn: EventId,
btn2: EventId,
}
impl EditorState {
pub fn new(settings: GameSettings, assets: Assets) -> Self {
info!("Initialising map editor state");
Self {
assets,
settings,
vp: Viewport::new(),
input: InputArbiter::new(),
btn: Button::new(
(25.0, 25.0).into(),
(250.0, 125.0).into(),
Some("Create Node".into()),
Color::from_rgb(50, 50, 50),
)
.register(),
btn2: Button::new(
(300.0, 25.0).into(),
(250.0, 125.0).into(),
Some("Destroy Node".into()),
Color::from_rgb(50, 50, 50),
)
.register(),
}
}
}
impl EventHandler for EditorState {
fn update(&mut self, ctx: &mut Context) -> GameResult<()> {
Ok(())
}
fn draw(&mut self, ctx: &mut Context) -> GameResult<()> {
Ok(())
}
}