Something went wrong. Try again.
[Mirror] Libreopolis is a cross-platform city simulation game fully compatible with SimCity 2000. gitlab.com/conasg/libreopolis
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536// sc2k/ui/structure_hover.hpp — input-owned demolition-object hover lifecycle.//// A scene re-projection rebuilds derived render state, but it does not mean the pointer left the// object beneath it. Keep the last pointer sample latched across that rebuild; only a new pointer// sample or an explicit input/UI block may replace it.#pragma once
#include "sc2k/render/world_hit.hpp"
namespace sc2k::ui {
// Physical output pixels; app/view.hpp divides by the continuous world scale before mask sampling.inline constexpr double kObjectHoverHysteresisPixels = 2.0;
class ObjectHoverState {public: render::ObjectSelection selection() const { return selection_; }
bool update_from_pointer(render::ObjectSelection next) { if (next == selection_) return false; selection_ = next; return true; }
bool clear_for_pointer_block() { return update_from_pointer({}); }
// Reprojection invalidates the renderer's derived hit index, not the most recent input result. // Clearing here caused the highlight to fall back to terrain on every simulation refresh. void scene_reprojected() {}
private: render::ObjectSelection selection_{};};
} // namespace sc2k::ui