Maraiah/source/tycho/editor.rs

52 lines
1.2 KiB
Rust

//! Main map editor module.
//!
//! The entry point is responsible for maintaining the lifetime of the editor
//! state and human interactions with it, but is otherwise not permitted to
//! directly edit it.
use maraiah::{durandal::image::*,
marathon::map,
rozinante::{color::*, draw::*}};
impl MapEditorState
{
/// Creates a new empty map.
pub fn new() -> MapEditorState
{
let info = Default::default();
let ed = MapEditorState{info};
ed
}
/// Draws the "no map" screen.
pub fn draw_none<D, I>(d: &D, im: &I)
where D: DrawArea<NativeImage = I>,
I: CacheImage
{
d.clear(Color16::new(0, 0, 0));
d.image((d.w() / 2 - im.w() / 2, d.h() / 2 - im.h() / 2), im);
d.rect(Rect{x: 0, y: 0, w: d.w(), h: 18}, CR_DARK_RED);
d.text((4, 14), "Map Required To Proceed", CR_RED);
d.rect(Rect{x: 0, y: d.h() - 18, w: d.w(), h: 18}, CR_DARK_RED);
d.text((4, d.h() - 4), "CAS.qterm//CyberAcme Systems Inc.", CR_RED);
}
}
impl Drop for MapEditorState
{
fn drop(&mut self) {eprintln!("dropping MapEditorState");}
}
/// The state of a single opened map.
pub struct MapEditorState
{
info: map::Minf,
}
// EOF