修改游戏底层矩阵相关

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

@@ -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;
};