Implement M9.3 camera navigation and bounded input intentions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "evo/client/input.hpp"
|
||||
#include "evo/render/frame.hpp"
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
@@ -27,7 +28,8 @@ struct WindowState {
|
||||
float content_scale{1};
|
||||
bool focused{}, minimized{}, hidden{}, closed{}, failed{};
|
||||
[[nodiscard]] bool accepts_input() const noexcept {
|
||||
return focused && !minimized && !hidden && !closed && !failed;
|
||||
return focused && !minimized && !hidden && !closed && !failed && logical_width > 0 &&
|
||||
logical_height > 0 && pixel_width > 0 && pixel_height > 0;
|
||||
}
|
||||
};
|
||||
// One owner, process main thread only (including destruction). No SDL owner may coexist.
|
||||
@@ -39,6 +41,12 @@ class Application {
|
||||
Application(const Application&) = delete;
|
||||
Application& operator=(const Application&) = delete;
|
||||
[[nodiscard]] WindowState state() const noexcept;
|
||||
[[nodiscard]] std::expected<void, Error> poll_events();
|
||||
[[nodiscard]] std::expected<Step, Error> present(const render::Frame& frame);
|
||||
void set_ui_capture(bool captured) noexcept;
|
||||
[[nodiscard]] bool ui_captured() const noexcept;
|
||||
[[nodiscard]] Navigation take_navigation() noexcept;
|
||||
[[nodiscard]] std::expected<Intention, InputError> sample_intention(std::uint64_t tick);
|
||||
// Borrows the immutable frame for this call only. Errors latch until destruction.
|
||||
[[nodiscard]] std::expected<Step, Error> step(const render::Frame& frame);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user