comment out code to compile

This commit is contained in:
SimonFJ20 2024-04-01 22:03:04 +02:00
parent 9642194fac
commit 1383ebfd05
2 changed files with 4 additions and 22 deletions

View File

@ -1,4 +1,4 @@
use std::{path::Component, time::Duration}; use std::time::Duration;
use sdl2::{ use sdl2::{
event::Event, event::Event,
@ -40,8 +40,6 @@ macro_rules! impl_from_T_for_Error {
impl_from_T_for_Error!(String, WindowBuildError, IntegerOrSdlError); impl_from_T_for_Error!(String, WindowBuildError, IntegerOrSdlError);
static RANDOM_U64_COUNTER: u64 = 0;
pub struct Entity(u64); pub struct Entity(u64);
pub trait Component {} pub trait Component {}
@ -95,20 +93,6 @@ impl<'a> Context<'a> {
system.on_add(self); system.on_add(self);
self.systems.push(system) self.systems.push(system)
} }
pub fn query<F: Fn(u64) -> bool>(&mut self, predicate: F) -> Vec<u64> {
let mut entities = Vec::<u64>::new();
for entity in &mut *self.entities {
if predicate(entity.0) {
entities.push(entity.0)
}
}
entities
}
pub fn has_component<T>(&mut self, entity_id: u64) -> bool {
for (id, component) in self.components {}
}
} }
pub trait System { pub trait System {

View File

@ -12,9 +12,7 @@ impl<'a> Component for Player<'a> {}
struct PlayerRenderer; struct PlayerRenderer;
impl System for PlayerRenderer { impl System for PlayerRenderer {
fn on_add(&self, ctx: &mut engine::Context) { fn on_add(&self, ctx: &mut engine::Context) {}
for entity in ctx.query(|id| ) {}
}
fn on_update(&self, _ctx: &mut engine::Context) {} fn on_update(&self, _ctx: &mut engine::Context) {}
} }
@ -27,8 +25,8 @@ fn main() {
context.add_system(Box::new(PlayerRenderer)); context.add_system(Box::new(PlayerRenderer));
context.spawn(vec![Box::new(Player { sprite: None })]); context.spawn(vec![Box::new(Player { sprite: None })]);
// let sprite = context.load_sprite("textures/player.png").unwrap(); let sprite = context.load_sprite("textures/player.png").unwrap();
// context.draw_sprite(&sprite, 16, 16).unwrap(); context.draw_sprite(&sprite, 16, 16).unwrap();
} }
game.run(); game.run();