mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 22:21:47 +01:00
Add Building, Add Hard floors
This commit is contained in:
13
Game/Levels/World/Building.cpp
Normal file
13
Game/Levels/World/Building.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "pch.h"
|
||||
#include "Building.h"
|
||||
Building::Building(const std::string& filePath, const Vector2f& position, TextureManager* pTextureManager): m_Position(position) {
|
||||
m_Texture = pTextureManager->GetTexture(filePath);
|
||||
m_Size = Vector2f(m_Texture->GetWidth(), m_Texture->GetHeight());
|
||||
}
|
||||
Building::~Building() {
|
||||
}
|
||||
void Building::Draw() const {
|
||||
m_Texture->Draw(m_Position);
|
||||
}
|
||||
void Building::Update(float dt) {
|
||||
}
|
||||
20
Game/Levels/World/Building.h
Normal file
20
Game/Levels/World/Building.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "Texture.h"
|
||||
#include "TextureManager.h"
|
||||
|
||||
class Building
|
||||
{
|
||||
public:
|
||||
Building(const std::string& filePath, const Vector2f& position, TextureManager* pTextureManager);
|
||||
~Building();
|
||||
|
||||
void Draw() const;
|
||||
void Update(float dt);
|
||||
|
||||
|
||||
private:
|
||||
Texture* m_Texture;
|
||||
Vector2f m_Position;
|
||||
Vector2f m_Size;
|
||||
|
||||
};
|
||||
@@ -46,6 +46,11 @@ 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);
|
||||
}
|
||||
m_refeulBuilding = new Building { "buildings/fuelStation.png", Vector2f { -700, -50 }, TextureManager::GetInstance() };
|
||||
m_gridManager.GetTileAtWorldPos(Vector2f{-700, -50})->SetTileType(Tiles::Special::HARD_LEFT);
|
||||
m_gridManager.GetTileAtWorldPos(Vector2f{-650, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
|
||||
m_gridManager.GetTileAtWorldPos(Vector2f{-600, -50})->SetTileType(Tiles::Special::HARD_RIGHT);
|
||||
|
||||
}
|
||||
WorldLevel::~WorldLevel() {
|
||||
//delete m_pTextTexture;
|
||||
@@ -132,6 +137,8 @@ void WorldLevel::Draw() const {
|
||||
if(m_pSelectedTile != nullptr) {
|
||||
m_pSelectedTile->Draw();
|
||||
}
|
||||
|
||||
m_refeulBuilding->Draw();
|
||||
|
||||
m_pCamera->EndRendering();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "Building.h"
|
||||
#include "Collision.h"
|
||||
#include "Levels/Level.h"
|
||||
#include "Player.h"
|
||||
@@ -38,6 +39,8 @@ private:
|
||||
|
||||
WorldTile* m_pSelectedTile { nullptr };
|
||||
|
||||
Building* m_refeulBuilding;
|
||||
|
||||
float testLerp{ 0.0f };
|
||||
|
||||
// ImGui Vars
|
||||
|
||||
Reference in New Issue
Block a user