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:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "hd2d/Camera.h"
|
||||
#include "hd2d/Scene.h"
|
||||
#include "hd2d/SpriteAtlas.h"
|
||||
#include "hd2d/Weather.h"
|
||||
|
||||
#include <array>
|
||||
@@ -21,11 +22,24 @@ public:
|
||||
glm::vec3 playerPos{0.0f};
|
||||
hd2d::Weather weather; // call weather.update() each frame before rendering
|
||||
|
||||
// Billboard feature test (`--sprite-test`; set before load()): a row of
|
||||
// atlas / sprite-sheet sprites behind the player exercising sub-rect
|
||||
// frames, flip, turn, alpha dither and flash. Labels are world-space
|
||||
// points (sprite tops) for the caller to draw.
|
||||
bool spriteTest = false;
|
||||
struct Label {
|
||||
glm::vec3 pos;
|
||||
const char* text;
|
||||
};
|
||||
std::vector<Label> labels;
|
||||
|
||||
private:
|
||||
struct Obstacle {
|
||||
glm::vec2 pos;
|
||||
float radius;
|
||||
};
|
||||
bool buildSpriteTest(const std::string& assetDir);
|
||||
void updateSpriteTest(float time, const hd2d::Camera& camera);
|
||||
void buildTerrain();
|
||||
void scatterProps();
|
||||
bool walkable(glm::vec2 from, glm::vec2 to) const;
|
||||
@@ -45,6 +59,11 @@ private:
|
||||
std::mt19937 rng_{42};
|
||||
float playerSpeed_ = 4.2f;
|
||||
float walkPhase_ = 0.0f;
|
||||
hd2d::SpriteAtlas atlas_; // sprite test: runtime-packed cells
|
||||
hd2d::BillboardBatch atlasSprites_; // uses atlas_.texture() via sharedTexture
|
||||
hd2d::BillboardBatch sheetSprites_; // own texture: a 2x1 sheet read with Texture::cellUV
|
||||
int atlasSlots_[3] = {-1, -1, -1}; // hero, flowers, tuft
|
||||
int sheetFeetRows_[2] = {0, 0}; // per sheet cell, from the cell top
|
||||
float stepTimer_ = 0.0f;
|
||||
float facing_ = 0.0f;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user