From: Nils Forssén Date: Fri, 10 Nov 2023 00:28:22 +0000 (+0100) Subject: Added background map X-Git-Url: https://gitweb.forssennils.se/?a=commitdiff_plain;h=f3098156c0f5ea2c941cce01bead715d13eb8416;p=TDDC76_proj.git Added background map --- diff --git a/src/Map.cc b/src/Map.cc index e69de29..16ef100 100644 --- a/src/Map.cc +++ b/src/Map.cc @@ -0,0 +1,18 @@ +#include "Map.h" + +Map::Map() : texture{}, sprite{} +{ + texture.loadFromFile("assets/bakgrund.png"); + sprite.setTexture(texture); + + sprite.setScale(S_SCALE_KOEFF, S_SCALE_KOEFF); + sprite.setPosition(0,0); +} + +void Map::update() +{} + +void Map::render(sf::RenderWindow& window) const +{ + window.draw(sprite); +} \ No newline at end of file diff --git a/src/Map.h b/src/Map.h index e69de29..b59816a 100644 --- a/src/Map.h +++ b/src/Map.h @@ -0,0 +1,21 @@ +#ifndef MAP_H +#define MAP_H + +#include +#include "constants.h" + +class Map +{ +public: + Map(); + ~Map() = default; + + void update(); + void render(sf::RenderWindow& window) const; +protected: +private: + sf::Texture texture; + sf::Sprite sprite; +}; + +#endif \ No newline at end of file