From f3098156c0f5ea2c941cce01bead715d13eb8416 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nils=20Forss=C3=A9n?= Date: Fri, 10 Nov 2023 01:28:22 +0100 Subject: [PATCH] Added background map --- src/Map.cc | 18 ++++++++++++++++++ src/Map.h | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+) 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 -- 2.30.2