Stupid self-portrait for the game's 'bad guy'.
This commit is contained in:
parent
37d28094ec
commit
3cb4fcfeb5
6 changed files with 23 additions and 5 deletions
BIN
assets/build_success.png
Normal file
BIN
assets/build_success.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
2
gui.cpp
2
gui.cpp
|
@ -7,8 +7,8 @@
|
|||
#include <vector>
|
||||
#include <SFML/Audio.hpp>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <fstream>
|
||||
#include "builder.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using std::string, std::vector;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -40,8 +40,8 @@ class SFMLBackend {
|
|||
sf::RenderWindow window;
|
||||
sf::Clock clock;
|
||||
sf::Clock deltaClock;
|
||||
sf::Sprite background;
|
||||
sf::Texture texture;
|
||||
sf::Sprite face_sprite;
|
||||
sf::Texture face_texture;
|
||||
bool window_active_out = false;
|
||||
bool show_build_log = false;
|
||||
int hit_points = 50;
|
||||
|
|
|
@ -2,9 +2,15 @@
|
|||
|
||||
BUGS:
|
||||
|
||||
* Better error handling on config json.
|
||||
|
||||
TODO:
|
||||
* Add a timer to the game engine so you can set a kind of pomodoro timer and if you don't meet the goal it costs you.
|
||||
|
||||
* Convert buttons to sprites.
|
||||
* Mouse events to the GUI.
|
||||
* sf::Rect::contains(mouse.x, mouse.y) will say if the mouse is inside the sprite rect.
|
||||
|
||||
NOTES:
|
||||
|
||||
Pic is 240x240
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
"build_failed": "./assets/build_failed.mp3",
|
||||
"building": "./assets/building.mp3"
|
||||
},
|
||||
"images": {
|
||||
"build_words": "./assets/build_success.png"
|
||||
},
|
||||
"git_path": ".\\",
|
||||
"build_cmd": "meson compile -C builddir"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue