fixes
This commit is contained in:
+2
-18
@@ -1,11 +1,7 @@
|
||||
#include <SFML/Audio.hpp>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Graphics/Color.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <SFML/Window.hpp>
|
||||
#include <SFML/System.hpp>
|
||||
#include <SFML/Window/Keyboard.hpp>
|
||||
#include <SFML/Window/Mouse.hpp>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
@@ -41,14 +37,6 @@ int main() {
|
||||
player_data.dash_distance, sf::Color::Black, sf::Color::White
|
||||
};
|
||||
|
||||
Entity enemy {
|
||||
{ TILESIZE / 2.0f, TILESIZE / 2.0f },
|
||||
{ TILESIZE * 5, TILESIZE * 3 },
|
||||
{ 0, 0 },
|
||||
-1.0f,
|
||||
sf::Color::Red
|
||||
};
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode({WIDTH, HEIGHT}), "SFML window", sf::Style::Default);
|
||||
window.setFramerateLimit(FPS);
|
||||
|
||||
@@ -63,7 +51,7 @@ int main() {
|
||||
|
||||
bool running = true;
|
||||
std::thread player_dash_cooldown([&] { time.update_timers(running, player.timers); } );
|
||||
// sf::View view1(sf::FloatRect({000.f, 000.f}, {WIDTH + (TILESIZE * 3), HEIGHT + (TILESIZE * 3)}));
|
||||
|
||||
while (window.isOpen()) {
|
||||
window.clear(sf::Color::Black);
|
||||
text.setString(std::to_string(player.timers.dash_cooldown));
|
||||
@@ -73,6 +61,7 @@ int main() {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Escape)) {
|
||||
running = false;
|
||||
window.close();
|
||||
@@ -97,7 +86,6 @@ int main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Horizontal movement and collisions
|
||||
player.handle_movment();
|
||||
player.get_horizontal_collision(wall_list);
|
||||
|
||||
@@ -109,22 +97,18 @@ int main() {
|
||||
player.get_vertical_top_collision(wall_list);
|
||||
}
|
||||
|
||||
// Drawing Everything to window
|
||||
#ifdef __APPLE__
|
||||
for(auto[i, j] : ranges::views::cartesian_product(ranges::views::iota(0, MAX_ROWS), ranges::views::iota(0, MAX_COLS))) {
|
||||
if(wall_list[i][j] == nullptr) continue;
|
||||
window.draw(wall_list[i][j]->rect);
|
||||
}
|
||||
#else
|
||||
|
||||
for(auto[i, j] : std::views::cartesian_product(std::views::iota(0, MAX_ROWS), std::views::iota(0, MAX_COLS))) {
|
||||
if(wall_list[i][j] == nullptr) continue;
|
||||
window.draw(wall_list[i][j]->rect);
|
||||
}
|
||||
#endif
|
||||
// window.setView(view1);
|
||||
window.draw(player.rect);
|
||||
window.draw(enemy.rect);
|
||||
window.draw(text);
|
||||
window.display();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ void clear_map(Entity* wall_list[MAX_ROWS][MAX_COLS]) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void create_map() {
|
||||
char output[MAX_ROWS][MAX_COLS] = {};
|
||||
|
||||
}
|
||||
|
||||
void load_map(Entity* wall_list[MAX_ROWS][MAX_COLS], const char map_data[MAX_ROWS][MAX_COLS]) {
|
||||
#ifdef __APPLE__
|
||||
for(auto[i, j] : ranges::views::cartesian_product(ranges::views::iota(0, MAX_ROWS), ranges::views::iota(0, MAX_COLS))) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// timer for player cooldown
|
||||
//
|
||||
|
||||
#include "scheduler.hpp"
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
Reference in New Issue
Block a user