Basic screen system

This commit is contained in:
Bram Verhulst
2024-04-02 10:17:20 +02:00
parent 0f9bb76973
commit df9e2f0b64
15 changed files with 404 additions and 410 deletions

View File

@@ -9,8 +9,10 @@
#include "Collision.h"
#include "colors.h"
#include "utils.h"
#include "GridSystem/WorldTile.h"
class GroundTileType;
WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
m_gridManager(WorldGridManager()),
m_player(Player { Point2f { 0, 100 }, TextureManager::GetInstance() }),
@@ -33,7 +35,7 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
//AIR
break;
default:
std::cout << "??" << std::endl;
std::cout << "??" << '\n';
}
m_gridManager.SetTileAtIndex(x, y, new WorldTile { pos, type, TextureManager::GetInstance() });
@@ -42,6 +44,8 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
for (size_t x { 0 }; x < WORLD_WIDTH; ++x) {
m_gridManager.GetTileAtIndex(x, 0)->SetTileType(Tiles::AIR);
}
Point2f screenCenterPos = Point2f { m_viewport.width / 2 - 492 / 2, m_viewport.height / 2 - 396 / 2 };
m_screen = Screen{ "gui/fuel/background.png", screenCenterPos, Point2f { 492, 396 }, TextureManager::GetInstance() };
}
WorldLevel::~WorldLevel() {
//delete m_pTextTexture;
@@ -117,6 +121,10 @@ void WorldLevel::Draw() const {
m_player.Draw();
m_pCamera->EndRendering();
utils::FillRect(utils::GetMousePos(), 10, 10);
m_screen.Draw();
}
void WorldLevel::MouseMove(const Point2f& mousePos) {
m_mousePos = mousePos;