feat(场景管理): 添加UIScene支持并重构场景管理器
refactor(渲染器): 优化相机切换时的渲染批处理 feat(调试工具): 新增游戏调试UI场景和九宫格面板组件 fix(动画系统): 跳过缺失的动画资源加载并记录日志 perf(资源加载): 使用BinaryFileStreamReader优化NPK文件解析 feat(地图系统): 支持多边形可行走区域调试显示 style(代码格式): 清理多余空格和统一文件编码 docs(注释): 补充关键类和方法的文档说明 test(启动跟踪): 添加启动过程性能跟踪工具 chore(依赖): 添加SDL2_ttf库支持
This commit is contained in:
47
Game/include/common/GameDebugActor.h
Normal file
47
Game/include/common/GameDebugActor.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <frostbite2D/2d/actor.h>
|
||||
|
||||
namespace frostbite2D {
|
||||
|
||||
class CharacterObject;
|
||||
class GameMap;
|
||||
class NineSliceActor;
|
||||
class TextSprite;
|
||||
|
||||
/**
|
||||
* @brief Reusable singleton debug actor for UI scenes.
|
||||
*/
|
||||
class GameDebugActor : public Actor {
|
||||
public:
|
||||
static GameDebugActor& get();
|
||||
static Ptr<GameDebugActor> getPtr();
|
||||
|
||||
GameDebugActor(const GameDebugActor&) = delete;
|
||||
GameDebugActor& operator=(const GameDebugActor&) = delete;
|
||||
|
||||
bool AttachToScene(Scene* scene);
|
||||
bool AttachToParent(Actor* parent);
|
||||
void DetachFromParent();
|
||||
|
||||
void SetDebugMap(GameMap* map);
|
||||
void SetTrackedCharacter(CharacterObject* character);
|
||||
void ClearDebugContext();
|
||||
|
||||
void OnUpdate(float deltaTime) override;
|
||||
|
||||
private:
|
||||
void initOverlay();
|
||||
void updateOverlay();
|
||||
void setOverlayVisible(bool visible);
|
||||
|
||||
GameDebugActor();
|
||||
~GameDebugActor() override = default;
|
||||
|
||||
GameMap* debugMap_ = nullptr;
|
||||
CharacterObject* trackedCharacter_ = nullptr;
|
||||
RefPtr<NineSliceActor> background_;
|
||||
RefPtr<TextSprite> coordText_;
|
||||
};
|
||||
|
||||
} // namespace frostbite2D
|
||||
Reference in New Issue
Block a user