Files
ss/src/d/lyt/d_window.cpp
T
Elijah Thomas 26af4db82d update from dtk-template - clangd :) (#66)
* update from dtk-template and start work towards using clangd

* include <a> -> "a"

* Update build.yml

* remove/add non-trivial class in union warning
2024-10-16 15:36:02 -04:00

31 lines
836 B
C++

#include "d/lyt/d_window.h"
#include "d/lyt/d_textbox.h"
dWindow_c::dWindow_c(const nw4r::lyt::res::Window *pBlock, const nw4r::lyt::ResBlockSet &ResBlockSet)
: nw4r::lyt::Window(pBlock, ResBlockSet) {}
void dWindow_c::UpdateSize(dTextBox_c *textBox, f32 f) {
if (textBox == nullptr) {
return;
}
u8 rem = mBasePosition % 3;
if (rem == 0) {
nw4r::math::VEC3 other = textBox->GetTranslate();
nw4r::math::VEC3 my = GetTranslate();
f = (other.x - my.x) * 2.0f;
} else if (rem == 2) {
nw4r::math::VEC3 other = textBox->GetTranslate();
nw4r::math::VEC3 my = GetTranslate();
f = (my.x - other.x) * 2.0f;
}
nw4r::lyt::Size size = GetSize();
f32 width = textBox->GetLineWidth(nullptr);
width += f;
size.width = width;
SetSize(size);
}