Skip to content

Commit

Permalink
[#190]: Fix SA issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Feb 6, 2024
1 parent 9de0938 commit 8e6076f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
16 changes: 15 additions & 1 deletion editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,18 @@ Editor::GetSelectedObjects() const
void
Editor::SelectGameObject(Object::ID newSelectedGameObject)
{
if (currentSelectedGameObject_ != Object::INVALID_ID)
{
currentLevel_->GetGameObjectRef(currentSelectedGameObject_)
.SetColor({1.0f, 1.0f, 1.0f, 1.0f});
}

currentSelectedGameObject_ = newSelectedGameObject;
gui_.ObjectSelected(currentSelectedGameObject_);

// Make sure to render animation points if needed
auto& gameObject = currentLevel_->GetGameObjectRef(newSelectedGameObject);
gameObject.SetColor({0.4f, 0.0f, 0.0f, 0.8f});
const auto* animatable = dynamic_cast< Animatable* >(&gameObject);

if (animatable and animatable->GetRenderAnimationSteps())
Expand Down Expand Up @@ -634,8 +641,8 @@ Editor::UnselectGameObject(Object::ID object, bool groupSelect)

if (currentSelectedGameObject_ == object)
{
currentLevel_->GetGameObjectRef(object).SetColor({1.0f, 1.0f, 1.0f, 1.0f});
currentSelectedGameObject_ = Object::INVALID_ID;
selectedObjects_.clear();
}
else if (groupSelect)
{
Expand Down Expand Up @@ -670,6 +677,13 @@ Editor::UnselectAll()
gui_.ObjectUnselected(object);
}
selectedObjects_.clear();

if (currentSelectedGameObject_ != Object::INVALID_ID)
{
currentLevel_->GetGameObjectRef(currentSelectedGameObject_)
.SetColor({1.0f, 1.0f, 1.0f, 1.0f});
currentSelectedGameObject_ = Object::INVALID_ID;
}
}

void
Expand Down
9 changes: 1 addition & 8 deletions editor/gizmo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Gizmo::AdjustSize()
float scaleFactor = 1.0f;
if (zoomLevel_ >= 0)
{
scaleFactor = 20.0f / (20.0f - zoomLevel_);
scaleFactor = 20.0f / (20.0f - static_cast< float >(zoomLevel_));
}

gizmoCenter_.Scale(
Expand All @@ -114,13 +114,6 @@ Gizmo::AdjustSize()
0.0f});
}


glm::vec2
Gizmo::Position() const
{
return gizmoCenter_.GetPosition();
}

void
Gizmo::CheckHovered(const glm::vec3& cameraPos, const glm::vec2& globalPosition)
{
Expand Down
2 changes: 0 additions & 2 deletions editor/gizmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class Gizmo
SwitchToRotate();
void
SwitchToTranslate();
glm::vec2
Position() const;

private:
void
Expand Down
2 changes: 1 addition & 1 deletion engine/renderer/sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Sprite::ChangeRenderLayer(int32_t newLayer)

for (auto& vertex : vertices_)
{
vertex.position_.z = LAYERS.at(newLayer);
vertex.position_.z = LAYERS.at(static_cast< uint32_t >(newLayer));
}

const auto transformMat = ComputeModelMat();
Expand Down

0 comments on commit 8e6076f

Please sign in to comment.