Hazel icon indicating copy to clipboard operation
Hazel copied to clipboard

Sync Hazelnut window title with active scene name

Open dr01d3k4 opened this issue 3 years ago • 0 comments

When opening or saving a scene, we now sync the window title with both the scene name and the filepath the scene is saved in.

  • Exposed Window::SetTitle() which callls glfwSetWindowTitle
  • Updated SceneSerializer to read/write an actual scene name instead of hardcoded. We store this in Scene::m_Name. It can't be changed in the UI yet, only the .hazel scene file. Also updated the demo scenes to have a correct title
  • EditorLayer tracks m_EditorScenePath very similarly to how it was added in 816baa3e055f5b8010ebc514a775e2928e032a7f in physics branch
  • Consolidated changing which scene is active into a method EditorLayer::SetActiveScene()
  • Changed EditorLayer::OnAttach() to use NewScene() and OpenScene() methods. This did introduced an awkward issue with m_ViewportSize, as SetActiveScene() tries to resize the viewport in the active scene, but during OnAttach() the viewport size is 0, which leads to the resize methods asserting. The solution taken here was to set the viewport size to a valid value based on how the framebuffer was created before doing new/open scene, then when we go to update/render, it'll be set to the correct value based on how the viewport actually looks.
Impact Issue/PR
Issues this solves None
Other PRs this solves None

dr01d3k4 avatar Dec 28 '21 01:12 dr01d3k4