Clicker now moves when you click him.

This commit is contained in:
Zed A. Shaw 2025-05-11 16:08:55 -04:00
parent 9a4b0adc1f
commit a9e219ea96
4 changed files with 100 additions and 25 deletions

View file

@ -1,6 +1,7 @@
#include "guecs/ui.hpp"
#include "guecs/sfml/backend.hpp"
#include <cassert>
#include <iostream>
namespace guecs {
using std::make_shared;
@ -88,10 +89,19 @@ namespace guecs {
}
void Background::init() {
assert(w > 0.0f && "Background.w must be > 0.0f. Forgot $gui.$parser?");
assert(h > 0.0f && "Background.h must be > 0.0f. Forgot $gui.$parser?");
std::cout << "x=" << x << " y=" << y << " w=" << w << " h=" << h << std::endl;
sf::Vector2f size{float(w), float(h)};
if(shape == nullptr) shape = make_shared<sf::RectangleShape>(size);
if(shape == nullptr) {
shape = make_shared<sf::RectangleShape>(size);
} else {
shape->setSize(size);
}
shape->setPosition({float(x), float(y)});
shape->setFillColor(color);
assert(shape != nullptr && "failed to make rectangle");
}
void Effect::init(lel::Cell &cell) {

View file

@ -2,6 +2,7 @@
#include <typeinfo>
#include <cassert>
#include <fmt/core.h>
#include <iostream>
namespace guecs {
using std::make_shared;