Moved to SFML 3.0 now.

This commit is contained in:
Zed A. Shaw 2025-01-29 12:55:33 -05:00
parent 7c56f350ab
commit e05b2c304c
12 changed files with 167 additions and 173 deletions

View file

@ -80,8 +80,7 @@ int main(int argc, char *argv[]) {
println("LOADING IMAGE: {}", image_file);
// load the image from argv
sf::Image image;
image.loadFromFile(image_file);
sf::Image image(image_file);
// divide the image into cells
auto size = image.getSize();
@ -101,7 +100,7 @@ int main(int argc, char *argv[]) {
// sum the cell
for(unsigned int x = 0; x < cell.x ; x++) {
for(unsigned int y = 0; y < cell.y ; y++) {
auto pixel = image.getPixel((i*cell.x) + x, (j * cell.y) + y);
auto pixel = image.getPixel({(i*(unsigned int)cell.x) + x, (j * (unsigned int)cell.y) + y});
avg.r += pixel.r;
avg.g += pixel.g;
@ -144,8 +143,6 @@ int main(int argc, char *argv[]) {
return ftxui::canvas(drawing);
}));
sf::Event event;
int start_x = 0;
int start_y = 0;
int end_x = 600;
@ -153,8 +150,7 @@ int main(int argc, char *argv[]) {
int cur_x = start_x;
int cur_y = start_y;
sf::Texture texture;
texture.loadFromFile(image_file);
sf::Texture texture(image_file);
sf::Sprite sprite(texture);
panel.render();
@ -170,8 +166,8 @@ int main(int argc, char *argv[]) {
renderer.draw(panel, cur_x, cur_y);
renderer.display();
while(renderer.poll_event(event)) {
if(event.type == sf::Event::Closed) {
while(const auto event = renderer.poll_event()) {
if(event->is<sf::Event::Closed>()) {
renderer.close();
}
}