mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 14:43:01 +02:00
feat: Adding SpriteNode.hpp
This commit is contained in:
parent
5e46729227
commit
5d2ec62f08
5
SFMLEngine/makingAGameTick/SpriteNode.cpp
Normal file
5
SFMLEngine/makingAGameTick/SpriteNode.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#ifndef SPRITE_NODE_CPP
|
||||
#define SPRITE_NODE_CPP
|
||||
|
||||
|
||||
#endif // SPRITE_NODE_CPP
|
||||
20
SFMLEngine/makingAGameTick/SpriteNode.hpp
Normal file
20
SFMLEngine/makingAGameTick/SpriteNode.hpp
Normal 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
|
||||
@ -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()
|
||||
|
||||
5
SFMLEngine/makingAGameTick/world.cpp
Normal file
5
SFMLEngine/makingAGameTick/world.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#ifndef WORLD_CPP // ZA WARUDO
|
||||
#define WORLD_CPP
|
||||
|
||||
|
||||
#endif WORLD_CPP
|
||||
7
SFMLEngine/makingAGameTick/world.hpp
Normal file
7
SFMLEngine/makingAGameTick/world.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef WORLD_HPP // ZA WARUDO
|
||||
#define WORLD_HPP
|
||||
|
||||
|
||||
|
||||
#include "world.cpp"
|
||||
#endif WORLD_HPP
|
||||
Loading…
Reference in New Issue
Block a user