52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <windows.h>
|
|
|
|
#include "settlement/core/world.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <span>
|
|
#include <vector>
|
|
|
|
namespace settlement::viewer {
|
|
|
|
struct BlueprintPart {
|
|
GridPosition cell;
|
|
RecipeId recipe;
|
|
BedBase base = BedBase::Wood;
|
|
};
|
|
|
|
struct SceneView {
|
|
int width;
|
|
int height;
|
|
float origin_x;
|
|
float origin_y;
|
|
float scale;
|
|
float tile_half_width;
|
|
float tile_half_height;
|
|
std::optional<GridPosition> cursor;
|
|
bool valid_cursor;
|
|
std::optional<GridPosition> move_source;
|
|
std::optional<AgentId> selected;
|
|
std::span<const BlueprintPart> blueprint;
|
|
std::optional<BlueprintPart> preview;
|
|
};
|
|
|
|
class D3DScene {
|
|
public:
|
|
D3DScene();
|
|
~D3DScene();
|
|
bool initialize(HWND target, bool software = false);
|
|
[[nodiscard]] bool ready() const noexcept;
|
|
bool render(const World& world, const SceneView& view, std::vector<std::uint32_t>* capture = nullptr);
|
|
void reset() noexcept;
|
|
|
|
private:
|
|
struct Backend;
|
|
std::unique_ptr<Backend> backend_;
|
|
};
|
|
|
|
} // namespace settlement::viewer
|