|
|
|
@ -10,6 +10,8 @@ |
|
|
|
|
#include <SFML/Window/Event.hpp> |
|
|
|
|
#include <nlohmann/json.hpp> |
|
|
|
|
#include "sfmlbackend.hpp" |
|
|
|
|
#include <fstream> |
|
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
using namespace fmt; |
|
|
|
|
using namespace nlohmann; |
|
|
|
@ -109,8 +111,9 @@ sf::RectangleShape SFMLBackend::box(int x, int y, int width, int height, |
|
|
|
|
void SFMLBackend::update_entities() { |
|
|
|
|
window.clear(); |
|
|
|
|
|
|
|
|
|
sf::RectangleShape face_box = box(2, 2, |
|
|
|
|
X_ROWS/4, Y_LINES/2, sf::Color(100, 250, 200)); |
|
|
|
|
sf::RectangleShape face_box = box(2, 2, X_ROWS/4, Y_LINES/2); |
|
|
|
|
face_sprite.setPosition(translate(2,2)); |
|
|
|
|
window.draw(face_sprite); |
|
|
|
|
|
|
|
|
|
sf::RectangleShape stats_box = box(X_ROWS/4 + 4, 2, |
|
|
|
|
X_ROWS - X_ROWS/4 - 5, Y_LINES/2); |
|
|
|
@ -145,7 +148,13 @@ void SFMLBackend::update_entities() { |
|
|
|
|
|
|
|
|
|
SFMLBackend::SFMLBackend(GameEngine &g) : window(sf::VideoMode(X_DIM, Y_DIM), "Turing's Tarpit", sf::Style::None, settings), game(g) |
|
|
|
|
{ |
|
|
|
|
std::ifstream infile(".tarpit.json"); |
|
|
|
|
json data = json::parse(infile); |
|
|
|
|
auto audio = data["images"]; |
|
|
|
|
json::string_t file_name = audio["build_works"].template get<string>(); |
|
|
|
|
|
|
|
|
|
face_texture.loadFromFile(file_name); |
|
|
|
|
face_sprite.setTexture(face_texture); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|