添加场景的组件动态添加删除功能
This commit is contained in:
@ -57,16 +57,16 @@ namespace Hazel
|
||||
public:
|
||||
void OnUpdate(const TimeStep ts)
|
||||
{
|
||||
auto& transform = GetComponent<TransformComponent>().Transform;
|
||||
auto& translation = GetComponent<TransformComponent>().Translation;
|
||||
static const auto state = SDL_GetKeyboardState(nullptr);
|
||||
if (state[SDL_SCANCODE_A])
|
||||
transform[3][0] -= ts * speed;
|
||||
translation.x -= ts * speed;
|
||||
if (state[SDL_SCANCODE_D])
|
||||
transform[3][0] += ts * speed;
|
||||
translation.x += ts * speed;
|
||||
if (state[SDL_SCANCODE_W])
|
||||
transform[3][1] += ts * speed;
|
||||
translation.y += ts * speed;
|
||||
if (state[SDL_SCANCODE_S])
|
||||
transform[3][1] -= ts * speed;
|
||||
translation.y -= ts * speed;
|
||||
}
|
||||
private:
|
||||
float speed = 2.0f;
|
||||
@ -175,6 +175,8 @@ namespace Hazel
|
||||
|
||||
// Submit the DockSpace
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.WindowMinSize.x = 350.0f;
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||
{
|
||||
ImGuiID dockspace_id = ImGui::GetID("MyDockSpace");
|
||||
|
||||
Reference in New Issue
Block a user