mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 03:41:48 +01:00
Add Building, Add Hard floors
This commit is contained in:
98
.idea/.idea.Motherload/.idea/workspace.xml
generated
98
.idea/.idea.Motherload/.idea/workspace.xml
generated
@@ -10,49 +10,18 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="26a0623a-44d5-441c-8048-32ff1dab3479" name="Changes" comment="Pre Point2f Nuke Fixed drawing, Added general optimisations">
|
||||
<list default="true" id="26a0623a-44d5-441c-8048-32ff1dab3479" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/Game/Levels/World/Building.cpp" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/Game/Levels/World/Building.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Collision.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Collision.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Collision.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Collision.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Matrix2x3.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Matrix2x3.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Matrix2x3.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Matrix2x3.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/SVGParser.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/SVGParser.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/SVGParser.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/SVGParser.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Text.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Text.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Text.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Text.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Texture.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Texture.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Texture.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Texture.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Vector2f.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Vector2f.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/Vector2f.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Vector2f.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/structs.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/structs.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/structs.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/structs.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/utils.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/utils.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Engine/utils.h" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/utils.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Animations/Animation.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Animations/Animation.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Animations/Animation.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Animations/Animation.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Camera.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Camera.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Camera.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Camera.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Game.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Game.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/FuelStation.aseprite" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/FuelStation.aseprite" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Game.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.vcxproj" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Gui/Button.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Button.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Gui/Button.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Button.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Gui/Screen.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screen.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Gui/Screen.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screen.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Gui/Screens/FuelScreen.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screens/FuelScreen.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Gui/Screens/FuelScreen.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screens/FuelScreen.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Gui/Screens/ScreenManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screens/ScreenManager.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Levels/Level.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/Level.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Levels/MainMenu/MainMenuLevel.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/MainMenu/MainMenuLevel.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Levels/MainMenu/MainMenuLevel.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/MainMenu/MainMenuLevel.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Player.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Player.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/Player.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Player.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Game/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/main.cpp" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -71,8 +40,10 @@
|
||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/../../../../../../Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/include/vector" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Game/Animations/Animation.h" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Game/Camera.cpp" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="mock://C:/Users/Bram/Desktop/Programming 2/Exam/dae16-VerhulstBram/Game/GridSystem/WorldTile.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Game/pch.cpp" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/Game/pch.h" root0="FORCE_HIGHLIGHTING" />
|
||||
</component>
|
||||
@@ -92,28 +63,28 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"C++ Project.Game.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.sourceCode.C++",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"C++ Project.Game.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.sourceCode.C++",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\Bram\\AppData\\Local\\Symbols\\src"
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\Bram\\AppData\\Roaming\\JetBrains\\Rider2023.3\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\Bram\\AppData\\Local\\Symbols\\src"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Game" type="CppProject" factoryName="C++ Project">
|
||||
<configuration_1>
|
||||
@@ -215,7 +186,9 @@
|
||||
<workItem from="1713295701025" duration="627000" />
|
||||
<workItem from="1713336216993" duration="1172000" />
|
||||
<workItem from="1713346699128" duration="4404000" />
|
||||
<workItem from="1713354379040" duration="383000" />
|
||||
<workItem from="1713354379040" duration="2279000" />
|
||||
<workItem from="1713377152822" duration="1364000" />
|
||||
<workItem from="1713440849218" duration="1218000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Rework Tile detection system">
|
||||
<option name="closed" value="true" />
|
||||
@@ -273,7 +246,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1713269323273</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="8" />
|
||||
<task id="LOCAL-00008" summary="Remove Point2f, replace with Vector2f">
|
||||
<option name="closed" value="true" />
|
||||
<created>1713354916684</created>
|
||||
<option name="number" value="00008" />
|
||||
<option name="presentableId" value="LOCAL-00008" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1713354916684</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="9" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@@ -289,7 +270,8 @@
|
||||
<MESSAGE value="Fix precompiled headers Added edge detection (if it works :/)" />
|
||||
<MESSAGE value="Fixed sidePieces (Need to add more cases tho)" />
|
||||
<MESSAGE value="Pre Point2f Nuke Fixed drawing, Added general optimisations" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Pre Point2f Nuke Fixed drawing, Added general optimisations" />
|
||||
<MESSAGE value="Remove Point2f, replace with Vector2f" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Remove Point2f, replace with Vector2f" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<watches-manager>
|
||||
|
||||
Binary file not shown.
@@ -379,6 +379,7 @@
|
||||
<LinkCompiled>true</LinkCompiled>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Levels\MainMenu\MainMenuLevel.cpp" />
|
||||
<ClCompile Include="Levels\World\Building.cpp" />
|
||||
<ClCompile Include="Levels\World\WorldLevel.cpp">
|
||||
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@@ -471,6 +472,7 @@
|
||||
<ClInclude Include="Gui\Screens\ScreenManager.h" />
|
||||
<ClInclude Include="Levels\Level.h" />
|
||||
<ClInclude Include="Levels\MainMenu\MainMenuLevel.h" />
|
||||
<ClInclude Include="Levels\World\Building.h" />
|
||||
<ClInclude Include="Levels\World\WorldLevel.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="Player.h" />
|
||||
|
||||
@@ -15,15 +15,16 @@ WorldTile::WorldTile(const Vector2f& position, GroundTileType* groundTileType, T
|
||||
// m_pTexture = new Texture(dirtPath);
|
||||
m_pTexture = pTextureManager->GetTexture(groundTileType->getPath());
|
||||
|
||||
m_pBottomLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomLeft.png");
|
||||
m_pBottomRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomRight.png");
|
||||
m_pTopLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/topLeft.png");
|
||||
m_pTopRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/topRight.png");
|
||||
m_SideTextures[TileDirection::TopLeft] = pTextureManager->GetTexture("tiles/dirt/sidepieces/topLeft.png");
|
||||
m_SideTextures[TileDirection::TopRight] = pTextureManager->GetTexture("tiles/dirt/sidepieces/topRight.png");
|
||||
m_SideTextures[TileDirection::BottomLeft] = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomLeft.png");
|
||||
m_SideTextures[TileDirection::BottomRight] = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomRight.png");
|
||||
|
||||
m_pMiddleBottomTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleBottom.png");
|
||||
m_pMiddleTopTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleTop.png");
|
||||
m_pMiddleLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleLeft.png");
|
||||
m_pMiddleRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleRight.png");
|
||||
m_SideTextures[TileDirection::TopMiddle] = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleTop.png");
|
||||
m_SideTextures[TileDirection::BottomMiddle] = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleBottom.png");
|
||||
m_SideTextures[TileDirection::MiddleLeft] = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleLeft.png");
|
||||
m_SideTextures[TileDirection::MiddleRight] = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleRight.png");
|
||||
|
||||
|
||||
m_pAllTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/all.png");
|
||||
}
|
||||
@@ -42,9 +43,9 @@ void WorldTile::Draw() {
|
||||
//check if it's all around dirt
|
||||
bool allDirt = true;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
WorldTile* tile = m_SurroundingTiles.GetTile(static_cast<TileDirection>(i));
|
||||
const WorldTile* tile = m_SurroundingTiles.GetTile(static_cast<TileDirection>(i));
|
||||
if(tile != nullptr) { //Tile exists
|
||||
GroundTileTypes type = tile->GetTileType()->getType();
|
||||
const GroundTileTypes type = tile->GetTileType()->getType();
|
||||
if(type != Tiles::DIRT->getType()) {
|
||||
allDirt = false;
|
||||
break;
|
||||
@@ -57,144 +58,35 @@ void WorldTile::Draw() {
|
||||
}
|
||||
|
||||
if(*m_GroundTileType == Tiles::AIR) {
|
||||
WorldTile* topLeft = m_SurroundingTiles.GetTile(TileDirection::TopLeft);
|
||||
if(topLeft != nullptr) {
|
||||
GroundTileTypes type = topLeft->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pTopLeftTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
this->DrawSide(TileDirection::TopLeft);
|
||||
this->DrawSide(TileDirection::TopRight);
|
||||
this->DrawSide(TileDirection::BottomLeft);
|
||||
this->DrawSide(TileDirection::BottomRight);
|
||||
|
||||
WorldTile* topRight = m_SurroundingTiles.GetTile(TileDirection::TopRight);
|
||||
if(topRight != nullptr) {
|
||||
GroundTileTypes type = topRight->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pTopRightTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
WorldTile* bottomLeft = m_SurroundingTiles.GetTile(TileDirection::BottomLeft);
|
||||
if(bottomLeft != nullptr) {
|
||||
GroundTileTypes type = bottomLeft->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pBottomLeftTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
WorldTile* bottomRight = m_SurroundingTiles.GetTile(TileDirection::BottomRight);
|
||||
if(bottomRight != nullptr) {
|
||||
GroundTileTypes type = bottomRight->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pBottomRightTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
WorldTile* middleTop = m_SurroundingTiles.GetTile(TileDirection::TopMiddle);
|
||||
if(middleTop != nullptr) {
|
||||
GroundTileTypes type = middleTop->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pMiddleTopTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
WorldTile* middleBottom = m_SurroundingTiles.GetTile(TileDirection::BottomMiddle);
|
||||
if(middleBottom != nullptr) {
|
||||
GroundTileTypes type = middleBottom->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pMiddleBottomTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
WorldTile* middleLeft = m_SurroundingTiles.GetTile(TileDirection::MiddleLeft);
|
||||
if(middleLeft != nullptr) {
|
||||
GroundTileTypes type = middleLeft->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pMiddleLeftTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
WorldTile* middleRight = m_SurroundingTiles.GetTile(TileDirection::MiddleRight);
|
||||
if(middleRight != nullptr) {
|
||||
GroundTileTypes type = middleRight->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pMiddleRightTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
WorldTile* bottomMiddle = m_SurroundingTiles.GetTile(TileDirection::BottomMiddle);
|
||||
if(bottomMiddle != nullptr) {
|
||||
GroundTileTypes type = bottomMiddle->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_pMiddleBottomTexture->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
this->DrawSide(TileDirection::TopMiddle);
|
||||
this->DrawSide(TileDirection::BottomMiddle);
|
||||
this->DrawSide(TileDirection::MiddleLeft);
|
||||
this->DrawSide(TileDirection::MiddleRight);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// if(m_Hightlight) {
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// WorldTile* tile = m_SurroundingTiles.GetTile(static_cast<TileDirection>(i));
|
||||
// if(tile != nullptr) { //Tile exists
|
||||
// //TODO: Wow Big mess
|
||||
// GroundTileTypes type = tile->GetTileType()->getType();
|
||||
// if(type == Tiles::AIR->getType()) {
|
||||
// utils::SetColor(Colors::BLACK);
|
||||
// utils::FillRect(Rectf{tile->GetPosition(), Vector2f{50,50}});
|
||||
// continue;
|
||||
// }
|
||||
// if(type != Tiles::AIR->getType()) {
|
||||
// utils::SetColor(Colors::YELLOW);
|
||||
// utils::FillRect(Rectf{tile->GetPosition(), Vector2f{50,50}});
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//Tile is air, So check 8 tiles around
|
||||
// Check the 4 tiles diagonally
|
||||
|
||||
// m_SurroundingTiles = m_pGridManager->GetSurroundingTiles(this);
|
||||
//
|
||||
// //check if all tiles are air
|
||||
// bool allAir = true;
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// WorldTile* tile = m_SurroundingTiles.GetTile(static_cast<TileDirection>(i));
|
||||
// if(tile != nullptr) { //Tile exists
|
||||
// if(tile->GetTileType() != Tiles::AIR) {
|
||||
// allAir = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (allAir) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// WorldTile* topLeft = m_SurroundingTiles.GetTile(TileDirection::TopLeft); //TODO: ask if draw needs to be const
|
||||
// GroundTileType* topLeftType = topLeft != nullptr ? topLeft->GetTileType() : Tiles::AIR;
|
||||
// if(topLeftType != Tiles::AIR) {
|
||||
// m_pTopLeftTexture->Draw(m_Position);
|
||||
// utils::SetColor(Colors::YELLOW);
|
||||
// utils::FillRect(Rectf{topLeft->GetPosition(), Vector2f{50,50}});
|
||||
// }
|
||||
//
|
||||
// WorldTile* topRight = m_SurroundingTiles.GetTile(TileDirection::TopRight);
|
||||
// GroundTileType* topRightType = topRight != nullptr ? topRight->GetTileType() : Tiles::AIR;
|
||||
// if(topRightType != Tiles::AIR) {
|
||||
// m_pTopRightTexture->Draw(m_Position);
|
||||
// }
|
||||
//
|
||||
}
|
||||
void WorldTile::Update(Camera* camera) {
|
||||
Vector2f CurrentIndex = m_pGridManager->GetIndexFromPosition(m_Position);
|
||||
|
||||
void WorldTile::Update(const Camera* camera) {
|
||||
m_pGridManager->GetIndexFromPosition(m_Position);
|
||||
m_SurroundingTiles = m_pGridManager->GetSurroundingTiles(this);
|
||||
Vector2f mousePos = camera->TransformMouse(Vector2f{utils::GetMousePos().x, 500 - utils::GetMousePos().y});
|
||||
m_Hightlight = utils::IsPointInRect(mousePos, Rectf{GetCollisionRect().pos, GetCollisionRect().size});
|
||||
if(CurrentIndex.x == 1 && CurrentIndex.y == 1) {
|
||||
// std::cout << "Hey" << std::endl;
|
||||
}
|
||||
const Vector2f mouse_pos = camera->TransformMouse(Vector2f{utils::GetMousePos().x, 500 - utils::GetMousePos().y});
|
||||
m_Hightlight = utils::IsPointInRect(mouse_pos, Rectf{GetCollisionRect().pos, GetCollisionRect().size});
|
||||
}
|
||||
Collision::TileCollisionRect WorldTile::GetCollisionRect() {
|
||||
return Collision::TileCollisionRect { m_Position, GetSize(), ( this ) };
|
||||
}
|
||||
|
||||
void WorldTile::DrawSide(const TileDirection& direction) {
|
||||
const WorldTile* tile = m_SurroundingTiles.GetTile(direction);
|
||||
if(tile != nullptr) {
|
||||
const GroundTileTypes type = tile->GetTileType()->getType();
|
||||
if(type != Tiles::AIR->getType()) {
|
||||
m_SideTextures[direction]->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ enum class GroundTileTypes
|
||||
{
|
||||
Air,
|
||||
Dirt,
|
||||
Hard,
|
||||
Stone,
|
||||
Iron
|
||||
};
|
||||
@@ -89,6 +90,13 @@ namespace Tiles
|
||||
static GroundTileType* AIR = new GroundTileType("", GroundTileTypes::Air);
|
||||
static GroundTileType* DIRT = new RandomGroundTile("tiles/dirt/dirt[0].png", GroundTileTypes::Dirt, 5);
|
||||
static GroundTileType* IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron);
|
||||
|
||||
namespace Special
|
||||
{
|
||||
static GroundTileType* HARD_LEFT = new GroundTileType("tiles/dirt/special/hardLeft.png", GroundTileTypes::Hard);
|
||||
static GroundTileType* HARD_RIGHT = new GroundTileType("tiles/dirt/special/hardRight.png", GroundTileTypes::Hard);
|
||||
static GroundTileType* HARD_MIDDLE = new GroundTileType("tiles/dirt/special/hardMiddle.png", GroundTileTypes::Hard);
|
||||
}
|
||||
}
|
||||
|
||||
class WorldTile
|
||||
@@ -99,7 +107,7 @@ public:
|
||||
~WorldTile();
|
||||
|
||||
void Draw();
|
||||
void Update(Camera* camera); //TODO: no use
|
||||
void Update(const Camera* camera); //TODO: no use
|
||||
|
||||
Vector2f GetPosition() const {
|
||||
return m_Position;
|
||||
@@ -124,6 +132,9 @@ public:
|
||||
bool m_Hightlight { false };
|
||||
|
||||
private:
|
||||
void DrawSide(const TileDirection& direction);
|
||||
|
||||
|
||||
Vector2f m_Position;
|
||||
GroundTileType* m_GroundTileType;
|
||||
|
||||
@@ -135,17 +146,7 @@ private:
|
||||
|
||||
surroundingTiles m_SurroundingTiles;
|
||||
|
||||
Texture* m_pTopLeftTexture;
|
||||
Texture* m_pTopRightTexture;
|
||||
Texture* m_pBottomLeftTexture;
|
||||
Texture* m_pBottomRightTexture;
|
||||
|
||||
Texture* m_pMiddleTopTexture;
|
||||
Texture* m_pMiddleBottomTexture;
|
||||
Texture* m_pMiddleLeftTexture;
|
||||
Texture* m_pMiddleRightTexture;
|
||||
std::vector<Texture*> m_SideTextures { 8, nullptr };
|
||||
|
||||
Texture* m_pAllTexture;
|
||||
|
||||
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
@@ -19,6 +19,7 @@ Player::Player(const Vector2f& Position, TextureManager* manager) : m_Position(P
|
||||
m_walkAnimation = new Animation(
|
||||
manager->GetTexture("animations/player/player_walk.png"),
|
||||
8, 0.1f, Rectf { 0, 0, 70, 70 });
|
||||
m_currentAnimation = m_walkAnimation;
|
||||
}
|
||||
Collision::CollisionRect Player::GetCollisionRect() const {
|
||||
Collision::CollisionRect rect = { m_Position, m_Size, m_Vel };
|
||||
@@ -34,10 +35,10 @@ void Player::Draw() const {
|
||||
|
||||
const int frameWidth = 70; //TODO: fix this
|
||||
int halfFrameWidth = frameWidth / 2;
|
||||
float bobOffset = m_BobUp ? 1 : 0;
|
||||
Vector2f drawPos = Vector2f { center.x - halfFrameWidth, center.y - halfFrameWidth + 9 + bobOffset} ;
|
||||
|
||||
Vector2f drawPos = Vector2f { center.x - halfFrameWidth, center.y - halfFrameWidth + 9 };
|
||||
|
||||
m_walkAnimation->Draw(drawPos, Rectf { drawPos.x, drawPos.y, frameWidth, frameWidth });
|
||||
m_walkAnimation->Draw(drawPos, Rectf { drawPos.x, drawPos.y , frameWidth, frameWidth });
|
||||
}
|
||||
void Player::ProcessImGui() {
|
||||
ImGui::Begin("Collision Info", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
@@ -56,6 +57,8 @@ void Player::ProcessImGui() {
|
||||
break;
|
||||
}
|
||||
ImGui::Text("Player State %s", currentState.c_str());
|
||||
ImGui::Text("Bob counter: %f", m_BobTimer);
|
||||
ImGui::Text("Bob up: %s", m_BobUp ? "true" : "false");
|
||||
|
||||
|
||||
//ContactMap
|
||||
@@ -68,7 +71,11 @@ void Player::ProcessImGui() {
|
||||
}
|
||||
|
||||
void Player::Update(float elapsedTime, WorldLevel& level) {
|
||||
|
||||
m_BobTimer += elapsedTime;
|
||||
if(m_BobTimer >= m_BobTime) {
|
||||
m_BobUp = !m_BobUp;
|
||||
m_BobTimer = 0.0f;
|
||||
}
|
||||
|
||||
//check for keys
|
||||
if(m_State != PlayerState::Digging) {
|
||||
|
||||
@@ -68,6 +68,9 @@ private:
|
||||
|
||||
Vector2f m_Acc;
|
||||
Vector2f m_Gravity { 0, -9.81f };
|
||||
float m_BobTimer{ 0.0f };
|
||||
const float m_BobTime{ 0.1f };
|
||||
bool m_BobUp{ true };
|
||||
|
||||
Vector2f m_DigDestination{};
|
||||
float m_DigProgress{};
|
||||
@@ -79,7 +82,10 @@ private:
|
||||
bool m_Grounded { false };
|
||||
|
||||
bool m_DidJustDigRight { false };
|
||||
Animation* m_currentAnimation{ nullptr };
|
||||
Animation* m_walkAnimation;
|
||||
Animation* m_turnAnimation;
|
||||
Animation* m_digAnimation;
|
||||
|
||||
PlayerState m_State { PlayerState::Idle };
|
||||
PlayerDirection m_Direction { PlayerDirection::Right };
|
||||
|
||||
BIN
Resources/buildings/fuelStation.png
Normal file
BIN
Resources/buildings/fuelStation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
Resources/tiles/dirt/special/grass1.png
Normal file
BIN
Resources/tiles/dirt/special/grass1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
BIN
Resources/tiles/dirt/special/grass2.png
Normal file
BIN
Resources/tiles/dirt/special/grass2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Resources/tiles/dirt/special/hardLeft.png
Normal file
BIN
Resources/tiles/dirt/special/hardLeft.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
BIN
Resources/tiles/dirt/special/hardMiddle.png
Normal file
BIN
Resources/tiles/dirt/special/hardMiddle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Resources/tiles/dirt/special/hardRight.png
Normal file
BIN
Resources/tiles/dirt/special/hardRight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
Reference in New Issue
Block a user