feat: Adding SpriteNode.hpp

This commit is contained in:
PolishPigeon 2022-01-24 10:05:34 +01:00 committed by KRZYSZTOF RUDNICKI
parent d82d8eb981
commit 79b160dffc
5 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,5 @@
#ifndef SPRITE_NODE_CPP
#define SPRITE_NODE_CPP
#endif // SPRITE_NODE_CPP

View File

@ -0,0 +1,20 @@
#ifndef SPRITE_NODE_HPP
#define SPRITE_NODE_HPP
class SpriteNode : public SceneNode
{
public:
explicit SpriteNode(const sf::Texture& texture);
SpriteNode(const sf::Texture& texture, const sf::IntRect& rectangle);
private:
virtual void drawCurrent(sf::RenderTarget& target, sf::RenderStates states) const;
private:
sf::Sprite mSprite;
};
#include "SpriteNode.cpp"
#endif // SPRITE_NODE_HPP

View File

@ -6,6 +6,7 @@
#include "constants.hpp"
#include "resources.hpp"
#include "SceneNode.hpp"
#include "SpriteNode.hpp"
#include "entity.hpp"
#include "aircraft.hpp"
#include "basic.cpp"
@ -117,7 +118,7 @@ void Game::update(sf::Time deltaTime)
// from physics formula distance = speed * time
// this allows us to move exactly the distance we want it to move in one second, no matter what computer are we on
// delta time / time step - time that has elapsed since the last frame
// mWorldView.move(0.f, mScrollSpeed * deltaTime.asSeconds()); we scroll up the map, we update both the map and the player so he does not get left behind, we multiple by time to ensure that we have the same speed of n pixels per second no matter the simulation frame rate
}
void Game::render()

View File

@ -0,0 +1,5 @@
#ifndef WORLD_CPP // ZA WARUDO
#define WORLD_CPP
#endif WORLD_CPP

View File

@ -0,0 +1,7 @@
#ifndef WORLD_HPP // ZA WARUDO
#define WORLD_HPP
#include "world.cpp"
#endif WORLD_HPP