新增 CharacterShadowActor 类用于处理角色阴影的渲染 在 CharacterObject 中实现阴影的同步和渲染逻辑 移除 GameDebugActor 中不再使用的合成纹理预览代码 添加 EnsureCompositeTextureReady 方法确保纹理准备就绪
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#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 updateMapDebugHighlight();
|
|
void setOverlayVisible(bool visible);
|
|
|
|
GameDebugActor();
|
|
~GameDebugActor() override = default;
|
|
|
|
GameMap* debugMap_ = nullptr;
|
|
CharacterObject* trackedCharacter_ = nullptr;
|
|
RefPtr<NineSliceActor> background_;
|
|
RefPtr<TextSprite> coordText_;
|
|
RefPtr<TextSprite> actionText_;
|
|
};
|
|
|
|
} // namespace frostbite2D
|