????
This commit is contained in:
parent
d594b3f568
commit
62438e0d24
15 changed files with 157 additions and 7 deletions
|
|
@ -5,7 +5,9 @@ version.workspace = true
|
|||
authors.workspace = true
|
||||
|
||||
[dependencies]
|
||||
moonhare_derives = { path = "../moonhare_derives" }
|
||||
moonhare_ecs = { path = "../moonhare_ecs" }
|
||||
moonhare_graphics = { path = "../moonhare_graphics" }
|
||||
moonhare_log = { path = "../moonhare_log" }
|
||||
moonhare_window = { path = "../moonhare_window" }
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
pub mod node;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
pub trait Node {
|
||||
|
||||
}
|
||||
|
|
@ -10,9 +10,7 @@ use moonhare_window::{platforms::glfw_window::GLFWWindow};
|
|||
use crate::systems::system::{BaseSystems, System};
|
||||
|
||||
pub mod systems;
|
||||
pub mod basic;
|
||||
|
||||
/// Only one Game may exist per project
|
||||
pub mod nodes;
|
||||
/* #[derive(Debug)]
|
||||
pub struct Game {
|
||||
pub base_systems: BaseSystems,
|
||||
|
|
@ -22,6 +20,7 @@ pub struct Game {
|
|||
pub name: String,
|
||||
} */
|
||||
|
||||
|
||||
// when creating a game, you can add systems to it, which do _things_
|
||||
// BaseSystems -> Window, Update, Render
|
||||
|
||||
|
|
@ -73,6 +72,8 @@ impl Game {
|
|||
}
|
||||
|
||||
pub fn run(self) {
|
||||
|
||||
|
||||
info("Running Game...");
|
||||
//------------------------------
|
||||
// Run Init on all Systems
|
||||
|
|
@ -116,3 +117,4 @@ fn render(context: Rc<Context>) {
|
|||
let target = moonhare_graphics::glium::Frame::new(context.clone(), context.get_framebuffer_dimensions());
|
||||
moonhare_graphics::draw_background_color(Color::color_from_rgb(255, 255, 255), target);
|
||||
}
|
||||
|
||||
|
|
|
|||
2
crates/moonhare_game/src/nodes/mod.rs
Normal file
2
crates/moonhare_game/src/nodes/mod.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
pub mod node;
|
||||
pub mod window;
|
||||
16
crates/moonhare_game/src/nodes/node.rs
Normal file
16
crates/moonhare_game/src/nodes/node.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use moonhare_derives::Node;
|
||||
|
||||
pub trait Node {
|
||||
fn init(&mut self);
|
||||
fn update(&mut self);
|
||||
}
|
||||
|
||||
impl<T> Node for Box<T> {
|
||||
fn init(&mut self) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn update(&mut self) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
17
crates/moonhare_game/src/nodes/window.rs
Normal file
17
crates/moonhare_game/src/nodes/window.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use moonhare_derives::Node;
|
||||
use crate::nodes::node::Node;
|
||||
|
||||
#[derive(Node)]
|
||||
struct Window {
|
||||
a: Box<String>
|
||||
}
|
||||
|
||||
impl Window {
|
||||
fn init(&mut self) {
|
||||
|
||||
}
|
||||
|
||||
fn update(&mut self) {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue