APPLE sucks and their libc libraries are old as fuck so c++23 things are not available like linux. Added MAC support so i can develop
This commit is contained in:
+32
-3
@@ -12,8 +12,12 @@
|
||||
#include <SFML/Window/Keyboard.hpp>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#ifdef __APPLE__
|
||||
#include <range/v3/view/iota.hpp>
|
||||
#include <range/v3/view/cartesian_product.hpp>
|
||||
#else
|
||||
#include <ranges>
|
||||
#include <iostream>
|
||||
#endif
|
||||
#include "globals.hpp"
|
||||
#include "elements.hpp"
|
||||
#include "maps.hpp"
|
||||
@@ -50,6 +54,17 @@ int main() {
|
||||
float border_size { -1.0f };
|
||||
} simulated_data;
|
||||
|
||||
#ifdef __APPLE__
|
||||
for(auto[i, j] : ranges::views::cartesian_product(ranges::views::iota(0, MAX_ROWS), ranges::views::iota(0, MAX_COLS))) {
|
||||
if(map_data[i][j] != 1) continue;
|
||||
wall_list[i][j] = new Entity { tile_data.size, tile_data.pos, tile_data.velocity, tile_data.border_size, sf::Color::Black };
|
||||
}
|
||||
|
||||
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;
|
||||
wall_list[i][j]->rect.setPosition({ (j * tile_data.size.x), (i * tile_data.size.y) });
|
||||
}
|
||||
#else
|
||||
for(auto[i, j] : std::views::cartesian_product(std::views::iota(0, MAX_ROWS), std::views::iota(0, MAX_COLS))) {
|
||||
if(map_data[i][j] != 1) continue;
|
||||
wall_list[i][j] = new Entity { tile_data.size, tile_data.pos, tile_data.velocity, tile_data.border_size, sf::Color::Black };
|
||||
@@ -59,6 +74,7 @@ int main() {
|
||||
if(wall_list[i][j] == nullptr) continue;
|
||||
wall_list[i][j]->rect.setPosition({ (j * tile_data.size.x), (i * tile_data.size.y) });
|
||||
}
|
||||
#endif
|
||||
|
||||
Player player {
|
||||
player_data.size, player_data.pos, player_data.velocity,
|
||||
@@ -73,8 +89,7 @@ int main() {
|
||||
|
||||
#ifdef __APPLE__
|
||||
sf::Font font("/Users/andrewhaynes/personal/Projects/CPP/SFML_game_engine/assets/pixel.ttf");
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#else
|
||||
sf::Font font("/home/andrew/personal/Projects/CPP/SFML_game_engine/assets/pixel.ttf");
|
||||
#endif
|
||||
|
||||
@@ -108,16 +123,30 @@ int main() {
|
||||
player.vertical_no_out_of_bounds(line);
|
||||
|
||||
// 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.draw(player.rect);
|
||||
window.draw(line.rect);
|
||||
window.draw(text);
|
||||
window.display();
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
for(auto[i, j] : ranges::views::cartesian_product(ranges::views::iota(0, MAX_ROWS), ranges::views::iota(0, MAX_COLS))) {
|
||||
delete wall_list[i][j];
|
||||
}
|
||||
#else
|
||||
for(auto[i, j] : std::views::cartesian_product(std::views::iota(0, MAX_ROWS), std::views::iota(0, MAX_COLS))) {
|
||||
delete wall_list[i][j];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user