Files
aevolution/include/evo/client/selection.hpp
T
dingoandClaude Opus 5.5 897055883a Add M9.8c launcher, legend, labelled inspector and click selection
Toolkit-independent launcher, selection, label and outcome-log models with
bounded inputs and fixed error text; Dear ImGui overlay in the native adapter
with toolkit-first event routing and capture; engineering panels for fixture vs
dev region, legend, inspector, session outcomes, notices and dialog. Additive
SessionClient::unreachable_attempts() bounds unreachable connects. Docs, CI
targets and validation evidence updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-02 10:09:11 -04:00

40 lines
1.7 KiB
C++

#pragma once
#include "evo/client/camera.hpp"
#include "evo/client/environment_view.hpp"
#include "evo/client/organism_view.hpp"
#include <cstdint>
#include <optional>
// M9.8c click selection (toolkit-independent). Selection names a presentation item by
// key (organism id or voxel) and re-resolves it against each new presentation; it
// never holds pointers into presentations across frames and selects nothing in the
// world itself.
namespace evo::client {
class Selection {
public:
enum class Kind : std::uint8_t { none, organism, cell };
enum class Change : std::uint8_t { none, organism_gone, cell_gone };
// Topmost organism whose drawn body contains the point wins; otherwise the habitat
// cell whose voxel contains it; otherwise the selection clears.
void pick(ScreenPoint point, const EnvironmentPresentation* environment,
const OrganismPresentation* organisms, const Camera& camera);
// Clears when the selected item is absent from a present presentation. Without a
// presentation (no view yet, reconnecting) the selection is kept but not shown.
[[nodiscard]] Change refresh(const EnvironmentPresentation* environment,
const OrganismPresentation* organisms);
void clear() noexcept {
kind_ = Kind::none;
}
[[nodiscard]] Kind kind() const noexcept {
return kind_;
}
[[nodiscard]] const OrganismCell* organism(const OrganismPresentation* organisms) const;
[[nodiscard]] const EnvironmentCell* cell(const EnvironmentPresentation* environment) const;
private:
Kind kind_{Kind::none};
std::uint64_t organism_{};
world::VoxelAddress voxel_{};
};
} // namespace evo::client