Preparando la interfaz
This commit is contained in:
commit
66bedbb5f1
17 files changed
+876
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#include "ui/Layout.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace tahgibu {
|
||||
namespace {
|
||||
|
||||
constexpr float kMenuBarHeight = 26.0f;
|
||||
constexpr float kToolBarHeight = 40.0f;
|
||||
constexpr float kPropertiesWidth = 280.0f;
|
||||
constexpr float kTimelineHeight = 200.0f;
|
||||
constexpr float kMinCanvasWidth = 400.0f;
|
||||
constexpr float kMinCanvasHeight = 200.0f;
|
||||
|
||||
} // namespace
|
||||
|
||||
Layout Layout::compute(int windowWidth, int windowHeight) {
|
||||
const float w = static_cast<float>(windowWidth);
|
||||
const float h = static_cast<float>(windowHeight);
|
||||
const float top = kMenuBarHeight + kToolBarHeight;
|
||||
|
||||
const float timelineH = std::min(kTimelineHeight, std::max(0.0f, h - top - kMinCanvasHeight));
|
||||
const float propertiesW = std::min(kPropertiesWidth, std::max(0.0f, w - kMinCanvasWidth));
|
||||
const float middleH = std::max(0.0f, h - top - timelineH);
|
||||
|
||||
Layout layout;
|
||||
layout.menuBar = {0.0f, 0.0f, w, kMenuBarHeight};
|
||||
layout.toolBar = {0.0f, kMenuBarHeight, w, kToolBarHeight};
|
||||
layout.canvas = {0.0f, top, w - propertiesW, middleH};
|
||||
layout.properties = {w - propertiesW, top, propertiesW, middleH};
|
||||
layout.timeline = {0.0f, top + middleH, w, timelineH};
|
||||
return layout;
|
||||
}
|
||||
|
||||
} // namespace tahgibu
|
||||
Reference in new issue
Block a user