prep the select func
This commit is contained in:
parent
7ef3237d88
commit
ed325934ee
@ -234,4 +234,9 @@ void ApplicationClass::AddCube()
|
||||
newCube->SetTranslateMatrix(XMMatrixTranslation(0.0f, 0.0f, 0.0f));
|
||||
|
||||
m_cubes.push_back(newCube);
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationClass::SelectedObject(int mouseX, int mouseY)
|
||||
{
|
||||
// TODO: Implement this function
|
||||
}
|
||||
|
@ -45,6 +45,8 @@ public:
|
||||
void AddCube();
|
||||
int GetCubeCount() const { return m_cubes.size(); };
|
||||
|
||||
void SelectedObject(int mouseX, int mouseY);
|
||||
|
||||
private:
|
||||
bool Render(float);
|
||||
|
||||
@ -57,6 +59,7 @@ private:
|
||||
LightClass* m_Light;
|
||||
float speed = 0.1f;
|
||||
std::vector<Object*> m_cubes;
|
||||
Object* m_SelectedObject;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3,6 +3,6 @@ Pos=60,60
|
||||
Size=400,400
|
||||
|
||||
[Window][Khaotic Engine]
|
||||
Pos=522,44
|
||||
Pos=43,18
|
||||
Size=694,367
|
||||
|
||||
|
@ -74,4 +74,30 @@ void imguiManager::WidgetAddObject(ApplicationClass* app)
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Number of cubes: %d", app->GetCubeCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void imguiManager::WidgetSelectedObject(ApplicationClass* app)
|
||||
{
|
||||
Object* selectedObject = app->SelectedObject();
|
||||
if (selectedObject)
|
||||
{
|
||||
if (ImGui::CollapsingHeader("Selected Object"))
|
||||
{
|
||||
XMFLOAT3 position, rotation, scale;
|
||||
// Get the current position, rotation, and scale of the object
|
||||
XMStoreFloat3(&position, selectedObject->GetTranslateMatrix().r[3]);
|
||||
XMStoreFloat3(&rotation, selectedObject->GetRotateMatrix().r[3]);
|
||||
XMStoreFloat3(&scale, selectedObject->GetScaleMatrix().r[3]);
|
||||
|
||||
// Create ImGui controls to modify these values
|
||||
ImGui::InputFloat3("Position", &position.x);
|
||||
ImGui::InputFloat3("Rotation", &rotation.x);
|
||||
ImGui::InputFloat3("Scale", &scale.x);
|
||||
|
||||
// Update the object's matrices with the new values
|
||||
selectedObject->SetTranslateMatrix(XMMatrixTranslationFromVector(XMLoadFloat3(&position)));
|
||||
selectedObject->SetRotateMatrix(XMMatrixRotationRollPitchYawFromVector(XMLoadFloat3(&rotation)));
|
||||
selectedObject->SetScaleMatrix(XMMatrixScalingFromVector(XMLoadFloat3(&scale)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
void WidgetButton();
|
||||
void WidgetFPS();
|
||||
void WidgetAddObject(ApplicationClass* app);
|
||||
void WidgetSelectedObject(ApplicationClass* app);
|
||||
|
||||
private:
|
||||
ImGuiIO* io;
|
||||
|
Loading…
x
Reference in New Issue
Block a user