feat: Adding readme and sprites/textures handling

This commit is contained in:
PolishPigeon 2022-01-21 07:15:38 +01:00
parent 862090b43f
commit 6d39483528
6 changed files with 13 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

View File

@ -3,6 +3,8 @@
#include <SFML/Graphics.hpp>
// Paths
const std::string PATH_TO_PLAYER_TEXTURE = "Textures/Player.png";
// Player constants
const float PLAYER_RADIUS = 40;

View File

@ -20,14 +20,19 @@ class Game
bool mIsMovingDown = false;
private:
sf::RenderWindow mWindow;
sf::CircleShape mPlayer;
sf::Texture mTexture;
sf::Sprite mPlayer;
};
Game::Game() : mWindow(sf::VideoMode(640, 480), "SFML Application"), mPlayer()
Game::Game() : mWindow(sf::VideoMode(640, 480), "SFML Application"), mTexture(), mPlayer()
{
mPlayer.setRadius(PLAYER_RADIUS);
if (!mTexture.loadFromFile(PATH_TO_PLAYER_TEXTURE))
{
std::cout << "NO FILE: " << PATH_TO_PLAYER_TEXTURE << std::endl;
mWindow.close();
}
mPlayer.setTexture(mTexture);
mPlayer.setPosition(PLAYER_X_POSITION, PLAYER_Y_POSITION);
mPlayer.setFillColor(PLAYER_COLOR);
}
void Game::run()

Binary file not shown.

2
SFMLEngine/readme.md Normal file
View File

@ -0,0 +1,2 @@
Textures and Audio used:
Space Game Starter Set by hc - https://opengameart.org/content/space-game-starter-set