修改游戏底层矩阵相关

This commit is contained in:
2025-10-26 14:38:53 +08:00
parent dc0213dc16
commit 88f039348a
50 changed files with 1983 additions and 362 deletions

View File

@@ -221,7 +221,7 @@ void GameMap::InitTile()
{
std::string path = tileArr[i];
RefPtr<Tile> tile = new Tile(path);
tile->SetPos(VecFPos{i * 224, -200 - std::get<int>(_MapInfo["background_pos"])});
tile->SetPos(Vec2{i * 224, -200 - std::get<int>(_MapInfo["background_pos"])});
_LayerMap["bottom"]->AddComponent(tile);
}
_MapHeight = 560;
@@ -240,7 +240,7 @@ void GameMap::InitTile()
RefPtr<Tile> tile = new Tile(path);
int xbuf = i % NormalTileCount * 224;
int ybuf = -200 - std::get<int>(_MapInfo["background_pos"]) + NormalTileHeight + 120 * (i / NormalTileCount);
tile->SetPos(VecFPos{xbuf, ybuf});
tile->SetPos(Vec2{xbuf, ybuf});
_LayerMap["bottom"]->AddComponent(tile);
}
}
@@ -269,7 +269,7 @@ void GameMap::InitBackgroundAnimation()
}
for (int i = 0; i < (int)AniList.size(); i++)
{
AniList[i]->SetPos(VecFPos{i * width, -120});
AniList[i]->SetPos(Vec2{i * width, -120});
AniList[i]->SetRenderZOrder(-1000000);
std::string layer = ani.layer;
layer = layer.substr(1, layer.length() - 2);
@@ -294,7 +294,7 @@ void GameMap::InitMapAnimation()
{
std::string path = ani.filename;
RefPtr<Animation> AniObj = new Animation(path);
AniObj->SetPos(VecFPos{ani.XPos, ani.YPos - ani.ZPos});
AniObj->SetPos(Vec2{ani.XPos, ani.YPos - ani.ZPos});
AniObj->SetRenderZOrder(ani.YPos);
std::string layer = ani.layer;
layer = layer.substr(1, layer.length() - 2);
@@ -318,7 +318,7 @@ void GameMap::InitVirtualMovableArea()
float w = Info[i + 2];
float h = Info[i + 3];
if (_DebugMode)
_LayerMap["max"]->AddDebugFeasibleAreaInfo(VecFPos(x, y), VecSize(w, h));
_LayerMap["max"]->AddDebugFeasibleAreaInfo(Vec2(x, y), VecSize(w, h));
_MovableArea.push_back(SDL_FRect{x, y, w, h});
}
}
@@ -364,8 +364,8 @@ void GameMap::Update(float deltaTime)
int targetX = Cam->_currentPosition.x;
int targetY = Cam->_currentPosition.y;
// 屏幕中心
int width_Separate = Game::GetInstance().Screen_W / 2;
int height_Separate = Game::GetInstance().Screen_H / 2;
int width_Separate = 1067 / 2;
int height_Separate = 600 / 2;
// 获取摄像机可行区域限制
auto limitIt = _MapInfo.find("limit_map_camera_move");
@@ -400,7 +400,7 @@ void GameMap::Update(float deltaTime)
posX *= BackgroundMoveSpeed;
posX /= 100;
}
Layer.second->SetPos(VecFPos(posX, posY));
Layer.second->SetPos(Vec2(posX, posY));
}
}

View File

@@ -28,7 +28,7 @@ void GameMapLayer::Render()
}
}
void GameMapLayer::AddDebugFeasibleAreaInfo(VecFPos pos, VecSize size)
void GameMapLayer::AddDebugFeasibleAreaInfo(Vec2 pos, VecSize size)
{
SDL_Rect info;
info.x = pos.x;

View File

@@ -17,7 +17,7 @@ public:
// 重载Render以实现绘制可行区域
void Render() override;
// 添加调试可行区域信息
void AddDebugFeasibleAreaInfo(VecFPos pos, VecSize size);
void AddDebugFeasibleAreaInfo(Vec2 pos, VecSize size);
public:
void AddObject(RefPtr<Actor> obj); // 添加对象

View File

@@ -21,7 +21,7 @@ Tile::~Tile()
{
}
void Tile::SetPos(VecFPos pos)
void Tile::SetPos(Vec2 pos)
{
pos.y += std::get<int>(m_data["pos"]);
Sprite::SetPos(pos);

View File

@@ -16,7 +16,7 @@ public:
Tile(std::string Path);
~Tile();
void SetPos(VecFPos pos) override;
void SetPos(Vec2 pos) override;
void InitInfo(std::string Path);
};

View File

@@ -28,7 +28,7 @@ void BaseObject::SetPosition(VecPos3 pos)
SetRenderZOrder(pos.y); // 设置渲染顺序
}
this->Position = pos;
SetPos(VecFPos{this->Position.x, this->Position.y - this->Position.z});
SetPos(Vec2{this->Position.x, this->Position.y - this->Position.z});
}
VecPos3 BaseObject::GetPosition()
@@ -105,16 +105,16 @@ void BaseObject::MoveBy(int x, int y, int z)
void BaseObject::SetDirection(int dir)
{
this->Direction = dir;
VecFPos sc = GetScale();
Vec2 sc = GetScale();
// 朝右
if (dir == 0)
{
SetScale(VecFPos({SDL_fabsf(sc.x), sc.y}));
SetScale(Vec2({SDL_fabsf(sc.x), sc.y}));
}
// 朝左
else if (dir == 1)
{
SetScale(VecFPos({-SDL_fabsf(sc.x), sc.y}));
SetScale(Vec2({-SDL_fabsf(sc.x), sc.y}));
}
}

View File

@@ -44,7 +44,7 @@ void CharacterObject::ControllerMsg(CONTROLLER_MSG_TYPE msgType, void *msgData)
// 摇杆移动(左)
if (msgType == CONTROLLER_MSG_TYPE::CONTROLLER_MSG_TYPE_LEFT_JOYSTICK_MOVE)
{
VecFPos *pos = (VecFPos *)msgData;
Vec2 *pos = (Vec2 *)msgData;
std::vector<float> movedata = {pos->x, pos->y};
this->GetObjectVars().SetArray("_move_data_", movedata);
this->_StateMachine->ChangeState(BASE_STATE::MOVE);
@@ -56,7 +56,7 @@ void CharacterObject::Update(float deltaTime)
ActiveObject::Update(deltaTime);
}
void CharacterObject::SetPos(VecFPos pos)
void CharacterObject::SetPos(Vec2 pos)
{
BaseObject::SetPos(pos);
if(_Shadow)_Shadow->SetPos(this->GetPos());

View File

@@ -40,6 +40,6 @@ public:
void ControllerMsg(CONTROLLER_MSG_TYPE msgType, void* msgData);
void Update(float deltaTime) override;
void SetPos(VecFPos pos) override;
void SetPos(Vec2 pos) override;
void SetDirection(int dir) override;
};

View File

@@ -8,8 +8,8 @@ private:
CharacterObject *m_pCharacter = nullptr;
public:
VecFPos LeftStick = {0.f, 0.f};
VecFPos RightStick = {0.f, 0.f};
Vec2 LeftStick = {0.f, 0.f};
Vec2 RightStick = {0.f, 0.f};
// 用于将SDL的轴值(-32768到32767)转换为-1到1之间的浮点数
float ConvertAxisValue(Sint16 rawValue);
@@ -19,6 +19,6 @@ public:
void HandleEvents(SDL_Event *e) override;
// 获取摇杆位置的方法
const VecFPos &GetLeftStick() const { return LeftStick; }
const VecFPos &GetRightStick() const { return RightStick; }
const Vec2 &GetLeftStick() const { return LeftStick; }
const Vec2 &GetRightStick() const { return RightStick; }
};

View File

@@ -30,15 +30,15 @@ void Chr_Shadow::SetAction(std::string actionName)
void Chr_Shadow::SetDirection(int dir)
{
VecFPos sc = GetScale();
Vec2 sc = GetScale();
// 朝右
if (dir == 0)
{
SetScale(VecFPos({SDL_fabsf(sc.x), sc.y}));
SetScale(Vec2({SDL_fabsf(sc.x), sc.y}));
}
// 朝左
else if (dir == 1)
{
SetScale(VecFPos({-SDL_fabsf(sc.x), sc.y}));
SetScale(Vec2({-SDL_fabsf(sc.x), sc.y}));
}
}

View File

@@ -1,7 +1,8 @@
#pragma once
#include "squirrel/SquirrelEx.h"
#include "EngineFrame/Actor/Actor.h"
#include "Sqr_CommonFunc.hpp"
#include "EngineFrame/Component/Sprite.h"
#include "EngineFrame/Component/Canvas.h"
#include "EngineFrame/Component/Text.h"
static SQInteger _file_releasehook(SQUserPointer p, SQInteger SQ_UNUSED_ARG(size))
{
@@ -27,6 +28,27 @@ static SQInteger SQR_CreateActor(HSQUIRRELVM v)
return 1;
}
static SQInteger SQR_SetName(HSQUIRRELVM v)
{
SQUserPointer A_obj;
sq_getuserpointer(v, 2, &A_obj);
const SQChar *name;
sq_getstring(v, 3, &name);
Actor *Aobj = (Actor *)A_obj;
Aobj->SetName(name);
return 0;
}
static SQInteger SQR_GetName(HSQUIRRELVM v)
{
SQUserPointer A_obj;
sq_getuserpointer(v, 2, &A_obj);
Actor *Aobj = (Actor *)A_obj;
sq_pushstring(v, Aobj->GetName().c_str(), -1);
return 1;
}
static SQInteger SQR_AddChild(HSQUIRRELVM v)
{
SQUserPointer A_obj;
@@ -76,7 +98,7 @@ static SQInteger SQR_GetPos(HSQUIRRELVM v)
SQUserPointer A_obj;
sq_getuserpointer(v, 2, &A_obj);
Actor *Aobj = (Actor *)A_obj;
VecFPos Pos = Aobj->GetPos();
Vec2 Pos = Aobj->GetPos();
sq_newtable(v);
sq_pushstring(v, _SC("x"), -1);
@@ -95,7 +117,7 @@ static SQInteger SQR_SetPos(HSQUIRRELVM v)
if (sq_gettop(v) == 3)
{
VecFPos Pos;
Vec2 Pos;
sq_pushnull(v); // null iterator
while (SQ_SUCCEEDED(sq_next(v, 3)))
{
@@ -125,7 +147,7 @@ static SQInteger SQR_SetPos(HSQUIRRELVM v)
sq_getfloat(v, 3, &X);
sq_getfloat(v, 4, &Y);
Actor *Aobj = (Actor *)A_obj;
Aobj->SetPos(VecFPos(X, Y));
Aobj->SetPos(Vec2(X, Y));
}
return 0;
}
@@ -135,7 +157,7 @@ static SQInteger SQR_GetWorldPos(HSQUIRRELVM v)
SQUserPointer A_obj;
sq_getuserpointer(v, 2, &A_obj);
Actor *Aobj = (Actor *)A_obj;
VecFPos Pos = Aobj->GetWorldPos();
Vec2 Pos = Aobj->GetWorldPos();
sq_newtable(v);
sq_pushstring(v, _SC("x"), -1);
@@ -172,7 +194,7 @@ static SQInteger SQR_GetScale(HSQUIRRELVM v)
SQUserPointer A_obj;
sq_getuserpointer(v, 2, &A_obj);
Actor *Aobj = (Actor *)A_obj;
VecFPos Pos = Aobj->GetScale();
Vec2 Pos = Aobj->GetScale();
sq_newtable(v);
sq_pushstring(v, _SC("x"), -1);
sq_pushfloat(v, Pos.x);
@@ -190,7 +212,7 @@ static SQInteger SQR_SetScale(HSQUIRRELVM v)
if (sq_gettop(v) == 3)
{
VecFPos Pos;
Vec2 Pos;
sq_pushnull(v); // null iterator
while (SQ_SUCCEEDED(sq_next(v, 3)))
{
@@ -220,7 +242,7 @@ static SQInteger SQR_SetScale(HSQUIRRELVM v)
sq_getfloat(v, 3, &X);
sq_getfloat(v, 4, &Y);
Actor *Aobj = (Actor *)A_obj;
Aobj->SetScale(VecFPos(X, Y));
Aobj->SetScale(Vec2(X, Y));
}
return 0;
}
@@ -232,6 +254,7 @@ static SQInteger SQR_GetRotation(HSQUIRRELVM v)
Actor *Aobj = (Actor *)A_obj;
sq_pushfloat(v, Aobj->GetRotation());
return 1;
}
static SQInteger SQR_SetRotation(HSQUIRRELVM v)
@@ -314,6 +337,26 @@ static SQInteger SQR_SetVisible(HSQUIRRELVM v){
return 0;
}
static SQInteger SQR_GetVisible(HSQUIRRELVM v)
{
SQUserPointer A_obj;
sq_getuserpointer(v, 2, &A_obj);
Actor *Aobj = (Actor *)A_obj;
sq_pushbool(v, Aobj->GetVisible());
return 1;
}
static SQInteger SQR_SetBlendMode(HSQUIRRELVM v)
{
SQUserPointer A_obj;
sq_getuserpointer(v, 2, &A_obj);
SQInteger Value;
sq_getinteger(v, 3, &Value);
Actor *Aobj = (Actor *)A_obj;
Aobj->SetBlendMode((LE_BlEND_MODE)Value);
return 0;
}
static SQInteger SQR_CreateSprite(HSQUIRRELVM v)
{
const SQChar *ImgPath;
@@ -326,6 +369,77 @@ static SQInteger SQR_CreateSprite(HSQUIRRELVM v)
return 1;
}
static SQInteger SQR_CreateCanvas(HSQUIRRELVM v)
{
SQInteger Width, Height;
sq_getinteger(v, 2, &Width);
sq_getinteger(v, 3, &Height);
RefPtr<Canvas> act = new Canvas(VecSize(Width, Height));
act->Retain();
sq_pushuserpointer(v, act.Get());
return 1;
}
static SQInteger SQR_Canvas_DrawImg(HSQUIRRELVM v)
{
SQUserPointer A_obj;
const SQChar *ImgPath;
SQInteger Idx;
Vec2 Pos;
sq_getuserpointer(v, 2, &A_obj);
sq_getstring(v, 3, &ImgPath);
sq_getinteger(v, 4, &Idx);
sq_GetVec2(v, 5, &Pos);
Canvas *Aobj = (Canvas *)A_obj;
Aobj->DrawImg(ImgPath, Idx, Pos);
return 0;
}
static SQInteger SQR_Canvas_DrawImgRect(HSQUIRRELVM v)
{
SQUserPointer A_obj;
const SQChar *ImgPath;
SQInteger Idx;
SDL_FRect Rect;
sq_getuserpointer(v, 2, &A_obj);
sq_getstring(v, 3, &ImgPath);
sq_getinteger(v, 4, &Idx);
sq_GetFRect(v, 5, &Rect);
Canvas *Aobj = (Canvas *)A_obj;
Aobj->DrawImg(ImgPath, Idx, Rect);
return 0;
}
static SQInteger SQR_CreateText(HSQUIRRELVM v)
{
const SQChar *Str;
SQInteger FontIndex, FontColor;
SDL_Color color;
sq_getstring(v, 2, &Str);
sq_getinteger(v, 3, &FontIndex);
sq_getinteger(v, 4, &FontColor);
color.a = (FontColor >> 24) & 0xFF;
color.r = (FontColor >> 16) & 0xFF;
color.g = (FontColor >> 8) & 0xFF;
color.b = FontColor & 0xFF;
RefPtr<Text> act = new Text();
act->Init(Str, Global_Game::GetInstance().Fonts[FontIndex], color);
act->Retain();
sq_pushuserpointer(v, act.Get());
return 1;
}
static SQInteger SQR_Text_SetText(HSQUIRRELVM v)
{
SQUserPointer A_obj;
const SQChar *Str;
sq_getuserpointer(v, 2, &A_obj);
sq_getstring(v, 3, &Str);
Text *Aobj = (Text *)A_obj;
Aobj->SetText(Str);
return 0;
}
static void RegisterUINutApi(const SQChar *funcName, SQFUNCTION funcAddr, HSQUIRRELVM v)
{
sq_pushroottable(v);
@@ -344,6 +458,8 @@ static void RegisterUI()
RegisterUINutApi(_SC("sq_RegisterDestruction"), SQR_RegisterDestruction, v);
RegisterUINutApi(_SC("sq_CreateActor"), SQR_CreateActor, v);
RegisterUINutApi(_SC("sq_SetName"), SQR_SetName, v);
RegisterUINutApi(_SC("sq_GetName"), SQR_GetName, v);
RegisterUINutApi(_SC("sq_AddChild"), SQR_AddChild, v);
RegisterUINutApi(_SC("sq_RemoveChild"), SQR_RemoveChild, v);
RegisterUINutApi(_SC("sq_GetZOrder"), SQR_GetZOrder, v);
@@ -360,6 +476,15 @@ static void RegisterUI()
RegisterUINutApi(_SC("sq_GetSize"), SQR_GetSize, v);
RegisterUINutApi(_SC("sq_SetSize"), SQR_SetSize, v);
RegisterUINutApi(_SC("sq_SetVisible"), SQR_SetVisible, v);
RegisterUINutApi(_SC("sq_GetVisible"), SQR_GetVisible, v);
RegisterUINutApi(_SC("sq_SetBlendMode"), SQR_SetBlendMode, v);
RegisterUINutApi(_SC("sq_CreateSprite"), SQR_CreateSprite, v);
RegisterUINutApi(_SC("sq_CreateCanvas"), SQR_CreateCanvas, v);
RegisterUINutApi(_SC("sq_Canvas_DrawImg"), SQR_Canvas_DrawImg, v);
RegisterUINutApi(_SC("sq_Canvas_DrawImgRect"), SQR_Canvas_DrawImgRect, v);
RegisterUINutApi(_SC("sq_CreateText"), SQR_CreateText, v);
RegisterUINutApi(_SC("sq_Text_SetText"), SQR_Text_SetText, v);
}

View File

@@ -3,6 +3,8 @@
void SquirrelManager::Init()
{
SDL_Log("开始初始化sqr管理器!");
// 系统函数
RegisterSystem();
// UI函数
RegisterUI();
// 基础对象
@@ -11,4 +13,6 @@ void SquirrelManager::Init()
RegisterActiveObject();
// 角色对象
RegisterCharacterObject();
//资产
RegisterAsset();
}

View File

@@ -1,8 +1,11 @@
#pragma once
#include "Global/Global_Game.h"
#include "Asset/Squirrel/Sqr_System.hpp"
#include "Asset/Squirrel/Sqr_UI.hpp"
#include "Asset/Squirrel/Sqr_BaseObject.hpp"
#include "Asset/Squirrel/Sqr_ActiveObject.hpp"
#include "Asset/Squirrel/Sqr_CharacterObject.hpp"
#include "Asset/Squirrel/Sqr_Asset.hpp"
class SquirrelManager
{
public:

View File

@@ -1,4 +1,5 @@
#include "Global_Game.h"
#include "Asset/Squirrel/SquirrelManager.h"
Global_Game::Global_Game()
{
@@ -7,18 +8,68 @@ Global_Game::~Global_Game()
{
}
void Global_Game::InitFont()
{
HSQUIRRELVM v = SquirrelEx::GetInstance().GetSquirrelVM();
SQInteger top = sq_gettop(v);
sq_pushroottable(v);
sq_pushstring(v, _SC("_InitFont_"), -1);
if (SQ_SUCCEEDED(sq_get(v, -2)))
{
sq_pushroottable(v);
if (SQ_SUCCEEDED(sq_call(v, 1, SQTrue, SQTrue)))
{
sq_pushnull(v);
while (SQ_SUCCEEDED(sq_next(v, -2)))
{
const SQChar *path = nullptr;
SQInteger size = 0;
if (sq_gettype(v, -1) == OT_TABLE)
{
// 获取path
sq_pushstring(v, _SC("path"), -1);
if (SQ_SUCCEEDED(sq_get(v, -2)))
{
sq_getstring(v, -1, &path);
sq_pop(v, 1);
}
// 获取size
sq_pushstring(v, _SC("size"), -1);
if (SQ_SUCCEEDED(sq_get(v, -2)))
{
sq_getinteger(v, -1, &size);
sq_pop(v, 1);
}
// 初始化ttf字体资源
TTF_Font *FontBuf = TTF_OpenFont(path, size);
if (!FontBuf)
{
SDL_LogError(0, "字体加载失败: %s", TTF_GetError());
continue;
}
Fonts.push_back(FontBuf);
}
sq_pop(v, 2);
}
sq_pop(v, 1);
}
}
sq_settop(v, top);
}
void Global_Game::Init()
{
// 初始化ttf字体资源
TTF_Font *FontBuf = TTF_OpenFont("Fonts/VonwaonBitmap-12px.ttf", 24);
InitFont();
// TTF_Font *FontBuf = TTF_OpenFont("Fonts/NotoSansSC-Regular.otf", 24);
// TTF_Font *FontBuf = TTF_OpenFont("Fonts/calibri.ttf", 24);
if (!FontBuf)
{
SDL_LogError(0, "字体加载失败: %s", TTF_GetError());
}
Fonts.push_back(FontBuf);
}
void Global_Game::InitGame()

View File

@@ -4,7 +4,6 @@
#include "Global/Script/EquipmentConfig.h"
#include "Global/Script/MonsterConfig.h"
#include "Global/Save/SavaManager.h"
#include "Asset/Squirrel/SquirrelManager.h"
class Global_Game
{
@@ -48,4 +47,6 @@ public:
private:
Global_Game(/* args */);
~Global_Game();
void InitFont();
};

View File

@@ -22,23 +22,19 @@ void Scene_Loading_UI::Enter()
RefPtr<Sprite> BackGroundSp = new Sprite("ImagePacks2/Loading1.png");
actor->AddComponent(BackGroundSp);
RefPtr<Sprite> BackGround2Sp = new Sprite("ImagePacks2/Loading0.png");
BackGround2Sp->SetPos(VecFPos{0, 686});
BackGround2Sp->SetPos(Vec2{0, 686});
actor->AddComponent(BackGround2Sp);
RefPtr<Sprite> LoadCircleSp = new Sprite("ImagePacks2/Loading2.png");
LoadCircleSp->SetName("LoadCircle");
LoadCircleSp->SetPos(VecFPos{1280 - 60, 686 - 60});
LoadCircleSp->SetPos(Vec2{1280 - 60, 686 - 60});
LoadCircleSp->SetBlendMode(LINEARDODGE);
LoadCircleSp->SetAnchor(VecFPos{0.5f, 0.5f});
LoadCircleSp->SetAnchor(Vec2{0.5f, 0.5f});
actor->AddComponent(LoadCircleSp);
actor->SetCallbackOnUpdate([LoadCircleSp](float deltaTime) mutable
{
float angle = LoadCircleSp->GetRotation();
LoadCircleSp->SetRotation(angle + 180.0f * deltaTime); });
// 文字测试
// RefPtr<Text> text = new Text("测试文字加载中...", Global_Game::GetInstance().Fonts[0], SDL_Color{255, 255, 255, 255}, SDL_Color{0, 0, 0, 255}, 4);
// actor->AddComponent(text);
}
void Scene_Loading_UI::Update(float deltaTime)

View File

@@ -4,7 +4,6 @@
void Scene_MainUi::Enter()
{
Scene::Enter();
HSQUIRRELVM v = SquirrelEx::GetInstance().GetSquirrelVM();
SQInteger top = sq_gettop(v);
sq_pushroottable(v);

View File

@@ -16,41 +16,42 @@ Scene_Test::~Scene_Test()
void Scene_Test::Enter()
{
SetScale(VecFPos(1.2f, 1.2f));
map = new GameMap;
map->LoadMap("map/cataclysm/town/elvengard/new_elvengard.map");
map->LoadMap("map/cataclysm/town/elvengard/new_d_elvengard_l.map");
map->Enter(this);
RefPtr<CharacterObject> obj = new CharacterObject();
obj->SetPosition({1000, 300, 0});
obj->Construction(0);
map->AddObject(obj);
RefPtr<MonsterObject> monster = new MonsterObject();
monster->SetPosition({1200, 301, 0});
monster->Construction(1);
monster->SetDirection(1);
map->AddObject(obj);
map->AddObject(monster);
_camera = new GameMapCamera;
_camera->SetFromActor(obj.Get());
return;
// // SDL_Log("Scene_Test::进入测试场景!");
RefPtr<Actor> actor = new Actor;
AddChild(actor);
RefPtr<Sprite> sprite = new Sprite("ImagePacks2/test_white_background.png");
// RefPtr<Sprite> sprite = new Sprite("ImagePacks2/test_white_background.png");
RefPtr<Sprite> chr = new Sprite("sprite/interface2/hud/hud.img", 0);
// chr->SetPos(VecFPos{200, 100});
chr->SetPos(Vec2{200, 100});
// chr->SetAlpha(0.5);
// chr->SetShadow();
actor->AddComponent(chr);
// actor->AddComponent(chr);
// RefPtr<Canvas> canvas = new Canvas(VecSize{1280, 720});
// actor->AddChild(canvas);
RefPtr<Canvas> canvas = new Canvas(VecSize{250, 720});
actor->AddChild(canvas);
canvas->DrawImg("sprite/interface2/hud/hud.img", 0, Vec2{0, 0});
// canvas->AddChild(chr);
@@ -58,21 +59,16 @@ void Scene_Test::Enter()
// RefPtr<Animation> ani4 = new Animation("map/cataclysm/town/hendonmyre/animation/object/gateall_02.ani");
// Am->AddAnimation(ani4);
// // Am->SetPos(VecFPos{200, 100});
// // Am->SetPos(Vec2{200, 100});
// actor->AddChild(Am);
// RefPtr<Text> text = new Text();
// text->Init("测试文本", Global_Game::GetInstance().Fonts[0], SDL_Color{255, 255, 255, 255});
// text->SetPos(VecFPos{200, 100});
// actor->AddChild(text);
// // sprite2->UnsetClipRect();
// RefPtr<Actor> actor2 = new Actor;
// actor->AddChild(actor2);
// RefPtr<Animation> ani4 = new Animation("map/cataclysm/town/hendonmyre/animation/object/gateall_02.ani");
// // ani4->SetScale(VecFPos{-1.0, 1.0});
// // ani4->SetScale(Vec2{-1.0, 1.0});
// actor->AddChild(ani4);
// RefPtr<Animation> ani3 = new Animation("map/cataclysm/town/elvengard/animation/obj/serialight01_right.ani");