Sprite sheets, atlases, game UI, time of day, weather presets, headless captures
- BillboardInstance: per-instance uv sub-rect, feet anchor, turn, dithered alpha, flash; BillboardBatch::sharedTexture; Texture createEmpty/update/cellUV/cellAnchor/nearest - SpriteAtlas: fixed-cell runtime atlas with gutters - hd2d::ui: Octopath-style panels, fonts (Cinzel, EB Garamond), dialogue box with typewriter + portraits + choices, menus, nameplates, toasts, ImGui theme - DayCycle (dawn/day/dusk/night keyframes, sun + moon arcs), Weather overcast/mist/ lightning, night-aware presets, stars and moon in the sky - Hidden-window offscreen captures (Window visible=false, Renderer output FBO, OffscreenTarget); --screenshot never opens a window - Camera::worldToScreen; CMake usable via add_subdirectory (HD2D_BUILD_DEMO, HD2D_ENGINE_ASSET_DIR)
This commit is contained in:
@@ -10,19 +10,27 @@ namespace hd2d {
|
||||
class Window {
|
||||
public:
|
||||
// Non-resizable windows float on tiling WMs, keeping an exact size.
|
||||
bool create(int width, int height, const std::string& title, bool vsync = true, bool resizable = true);
|
||||
// `visible = false` creates a hidden, never-focused window that only
|
||||
// provides the GL context (headless captures: render into an
|
||||
// OffscreenTarget, see Screenshot.h). Hidden windows ignore vsync,
|
||||
// swapBuffers() is a no-op (unmapped Wayland surfaces never get frame
|
||||
// callbacks, so a real swap could block forever) and every input query
|
||||
// reports nothing, so the user's keyboard/mouse cannot affect them.
|
||||
bool create(int width, int height, const std::string& title, bool vsync = true, bool resizable = true,
|
||||
bool visible = true);
|
||||
void destroy();
|
||||
|
||||
// Polls events and refreshes per-frame input state. Returns false once the
|
||||
// window should close.
|
||||
bool pollEvents();
|
||||
void swapBuffers();
|
||||
bool visible() const { return visible_; }
|
||||
|
||||
bool keyDown(int glfwKey) const;
|
||||
bool keyPressed(int glfwKey) const; // went down this frame
|
||||
bool mouseDown(int glfwButton) const;
|
||||
glm::vec2 mouseDelta() const { return mouseDelta_; }
|
||||
float scrollDelta() const { return scrollDelta_; }
|
||||
glm::vec2 mouseDelta() const { return visible_ ? mouseDelta_ : glm::vec2(0.0f); }
|
||||
float scrollDelta() const { return visible_ ? scrollDelta_ : 0.0f; }
|
||||
|
||||
int width() const { return width_; }
|
||||
int height() const { return height_; }
|
||||
@@ -38,6 +46,7 @@ private:
|
||||
GLFWwindow* window_ = nullptr;
|
||||
int width_ = 0, height_ = 0;
|
||||
bool resized_ = false;
|
||||
bool visible_ = true;
|
||||
bool keys_[512] = {};
|
||||
bool prevKeys_[512] = {};
|
||||
glm::vec2 lastMouse_{0.0f};
|
||||
|
||||
Reference in New Issue
Block a user