From 1383ebfd05c1b1bc090b6ac03ae0a5ea5ae8b2c5 Mon Sep 17 00:00:00 2001 From: SimonFJ20 Date: Mon, 1 Apr 2024 22:03:04 +0200 Subject: [PATCH] comment out code to compile --- src/engine.rs | 18 +----------------- src/main.rs | 8 +++----- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 62dffe6..bb1f2d5 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1,4 +1,4 @@ -use std::{path::Component, time::Duration}; +use std::time::Duration; use sdl2::{ event::Event, @@ -40,8 +40,6 @@ macro_rules! impl_from_T_for_Error { impl_from_T_for_Error!(String, WindowBuildError, IntegerOrSdlError); -static RANDOM_U64_COUNTER: u64 = 0; - pub struct Entity(u64); pub trait Component {} @@ -95,20 +93,6 @@ impl<'a> Context<'a> { system.on_add(self); self.systems.push(system) } - - pub fn query bool>(&mut self, predicate: F) -> Vec { - let mut entities = Vec::::new(); - for entity in &mut *self.entities { - if predicate(entity.0) { - entities.push(entity.0) - } - } - entities - } - - pub fn has_component(&mut self, entity_id: u64) -> bool { - for (id, component) in self.components {} - } } pub trait System { diff --git a/src/main.rs b/src/main.rs index fc70348..3c6f0a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,9 +12,7 @@ impl<'a> Component for Player<'a> {} struct PlayerRenderer; impl System for PlayerRenderer { - fn on_add(&self, ctx: &mut engine::Context) { - for entity in ctx.query(|id| ) {} - } + fn on_add(&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.spawn(vec![Box::new(Player { sprite: None })]); - // let sprite = context.load_sprite("textures/player.png").unwrap(); - // context.draw_sprite(&sprite, 16, 16).unwrap(); + let sprite = context.load_sprite("textures/player.png").unwrap(); + context.draw_sprite(&sprite, 16, 16).unwrap(); } game.run();