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.
36 lines
1.0 KiB
36 lines
1.0 KiB
//! Graphics module
|
|
//!
|
|
//! Each entity in the game has a graphics companion object in
|
|
//! [`entities`](self::entities), which knows how to render a given
|
|
//! object. Different game screens and UI elements can be found in
|
|
//! [`ui`](self::ui).
|
|
|
|
pub mod entities;
|
|
pub mod ui;
|
|
|
|
mod vector2;
|
|
pub use vector2::*;
|
|
|
|
use crate::state::ClientState;
|
|
use ggez::{Context, GameResult};
|
|
use std::ops::{Add, Mul, Sub};
|
|
|
|
/// A utility module to include everything required to implement a
|
|
/// graphics entity
|
|
pub(self) mod prelude {
|
|
pub use ggez::{
|
|
event::EventHandler,
|
|
graphics::{self, DrawMode, DrawParam, Drawable, Mesh},
|
|
Context, GameResult,
|
|
};
|
|
pub use mint::Point2;
|
|
|
|
pub use super::Renderer;
|
|
pub use crate::state::ClientState;
|
|
}
|
|
|
|
/// A rendering trait which is given graphics context, and game state
|
|
pub trait Renderer {
|
|
// fn update(&mut self, _state: &mut ClientState, _ctx: &mut Context) -> GameResult<()>:
|
|
fn draw(&self, _state: &ClientState, _ctx: &mut Context) -> GameResult<()>;
|
|
}
|
|
|