diff --git a/examples/particles/src/main.cpp b/examples/particles/src/main.cpp index 4343fdc..11adb5e 100644 --- a/examples/particles/src/main.cpp +++ b/examples/particles/src/main.cpp @@ -50,7 +50,12 @@ public: ParticleEmitter() : Super(texture, sf::Vector2f(350, 350), .5f, 5, 900, se::Range2f(-25, 25, -25, 25), se::particle::ParticleAttributes{std::chrono::milliseconds(500), sf::Vector2f(.1f, .1f), 5, sf::Vector2f(2, 2)}, particle_properties, emitter_properties) { - texture.loadFromFile("particle.png"); // The particle I tested with was 5x5 pixels + // The particle I tested with was 5x5 pixels + if (!texture.loadFromFile("particle.png")) { + std::cerr << "Failed to load particle.png!" << std::endl; + throw std::runtime_error("Failed to load particle.png"); + } + texture.setSmooth(true); particle_properties.emplace_back(std::make_unique(se::Range2f(-1.5f, 1.5f, -1.5f, 1.5f))); diff --git a/include/simpleengine/async_event.h b/include/simpleengine/async_event.h index 23e0280..871f7ad 100644 --- a/include/simpleengine/async_event.h +++ b/include/simpleengine/async_event.h @@ -18,12 +18,12 @@ namespace simpleengine { public: explicit AsyncEvent(sf::RenderWindow* window = nullptr) : simpleengine::Event(window) { update_thread = std::thread( [this]() { - while (!quit) { + while (!destroying) { std::unique_lock unique_lock(mutex); cond_var.wait(unique_lock); // After waiting check if we're quiting and if we need to stop this thread. - if (quit) break; + if (destroying) break; AsyncUpdate(tick_delta_time); } @@ -31,7 +31,7 @@ namespace simpleengine { } virtual ~AsyncEvent() { - quit = true; + destroying = true; // Notify the async updating thread that we're quiting. { diff --git a/include/simpleengine/events/entity_event.h b/include/simpleengine/events/entity_event.h index 1abc32d..9713e39 100644 --- a/include/simpleengine/events/entity_event.h +++ b/include/simpleengine/events/entity_event.h @@ -21,7 +21,7 @@ namespace simpleengine { entity->Update(delta_time); if (entity->IsDestroying()) { - quit = true; + destroying = true; } }