diff --git a/examples/snake/src/main.cpp b/examples/snake/src/main.cpp index d87ff76..63e5bef 100644 --- a/examples/snake/src/main.cpp +++ b/examples/snake/src/main.cpp @@ -77,34 +77,11 @@ public: } } - void Render(sf::RenderTarget* target = nullptr) override { + void Render(sf::RenderTarget* target) override { target->draw(shape); } }; -/*class PlayerEvent : public simpleengine::Event { -private: - SnakePlayerEntity snake_player; -public: - explicit PlayerEvent(sf::RenderWindow* window) : simpleengine::Event(window), - snake_player(SnakePlayerEntity(window->getSize())) { - } - - void CheckForQuit() override { - if (sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)) { - quit = true; - } - } - - void Update(const float& delta_time) override { - snake_player.Update(delta_time); - } - - void Render(sf::RenderTarget* target = nullptr) override { - snake_player.Render(target); - } -};*/ - int main(int argc, char *argv[]) { simpleengine::Game game(500, 500, "First Example"); game.AddEvent(new simpleengine::EntityEvent(game.GetWindow(), new SnakePlayerEntity(game.GetWindow()->getSize()))); diff --git a/include/simpleengine/component.h b/include/simpleengine/component.h index a82853e..f5bb501 100644 --- a/include/simpleengine/component.h +++ b/include/simpleengine/component.h @@ -17,7 +17,7 @@ namespace simpleengine { virtual ~Component() = default; virtual void Update(const float& delta_time) = 0; - virtual void Render(sf::RenderTarget* target = nullptr) {}; // Most components won't need to be rendered. + virtual void Render(sf::RenderTarget* target) {}; // Most components won't need to be rendered. protected: Entity* owning_entity; }; diff --git a/include/simpleengine/entity.h b/include/simpleengine/entity.h index 120ea06..937360f 100644 --- a/include/simpleengine/entity.h +++ b/include/simpleengine/entity.h @@ -24,7 +24,7 @@ namespace simpleengine { virtual void Move(const float& delta_time, const float& x, const float& y) {}; virtual void Update(const float& delta_time) = 0; - virtual void Render(sf::RenderTarget* target = nullptr) = 0; + virtual void Render(sf::RenderTarget* target) = 0; virtual void Destroying() {}; // Called when the entity is about to be destroyed. void DestroyEntity() { diff --git a/include/simpleengine/event.h b/include/simpleengine/event.h index ed93088..b009a84 100644 --- a/include/simpleengine/event.h +++ b/include/simpleengine/event.h @@ -23,7 +23,7 @@ namespace simpleengine { virtual void CheckForQuit() = 0; // Ran every Update to check if we're gonna quit. virtual void Quiting() {} // Ran when a State is about to be destroyed. virtual void Update(const float& delta_time) = 0; - virtual void Render(sf::RenderTarget* target = nullptr) = 0; + virtual void Render(sf::RenderTarget* target) = 0; protected: sf::RenderWindow* window; bool quit = false; diff --git a/include/simpleengine/events/entity_event.h b/include/simpleengine/events/entity_event.h index b082438..9310ea2 100644 --- a/include/simpleengine/events/entity_event.h +++ b/include/simpleengine/events/entity_event.h @@ -31,7 +31,7 @@ namespace simpleengine { entity->Update(delta_time); } - void Render(sf::RenderTarget* target = nullptr) override { + void Render(sf::RenderTarget* target) override { entity->Render(target); } private: