removed 'coord' ui elements contructors argument
This commit is contained in:
parent
c71c918a9c
commit
a80e7e4220
@ -78,9 +78,9 @@ void InventoryBuilder::addGrid(
|
||||
view->setSize(vsize);
|
||||
|
||||
if (addpanel) {
|
||||
auto panel = std::make_shared<gui::Container>(coord, glm::vec2(width, height));
|
||||
auto panel = std::make_shared<gui::Container>(glm::vec2(width, height));
|
||||
view->setColor(glm::vec4(0.122f, 0.122f, 0.122f, 0.878f));
|
||||
view->add(panel);
|
||||
view->add(panel, coord);
|
||||
}
|
||||
|
||||
for (int row = 0; row < rows; row++) {
|
||||
@ -109,7 +109,7 @@ std::shared_ptr<InventoryView> InventoryBuilder::build() {
|
||||
|
||||
SlotView::SlotView(
|
||||
SlotLayout layout
|
||||
) : UINode(glm::vec2(), glm::vec2(InventoryView::SLOT_SIZE)),
|
||||
) : UINode(glm::vec2(InventoryView::SLOT_SIZE)),
|
||||
layout(layout)
|
||||
{
|
||||
setColor(glm::vec4(0, 0, 0, 0.2f));
|
||||
@ -280,7 +280,7 @@ const SlotLayout& SlotView::getLayout() const {
|
||||
return layout;
|
||||
}
|
||||
|
||||
InventoryView::InventoryView() : Container(glm::vec2(), glm::vec2()) {
|
||||
InventoryView::InventoryView() : Container(glm::vec2()) {
|
||||
setColor(glm::vec4(0, 0, 0, 0.0f));
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ std::shared_ptr<UINode> create_debug_panel(
|
||||
}));
|
||||
|
||||
for (int ax = 0; ax < 3; ax++) {
|
||||
auto sub = std::make_shared<Container>(glm::vec2(), glm::vec2(250, 27));
|
||||
auto sub = std::make_shared<Container>(glm::vec2(250, 27));
|
||||
|
||||
std::wstring str = L"x: ";
|
||||
str[0] += ax;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
using namespace gui;
|
||||
|
||||
GUI::GUI() {
|
||||
container = std::make_shared<Container>(glm::vec2(0, 0), glm::vec2(1000));
|
||||
container = std::make_shared<Container>(glm::vec2(1000));
|
||||
uicamera = std::make_unique<Camera>(glm::vec3(), Window::height);
|
||||
uicamera->perspective = false;
|
||||
uicamera->flipped = true;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
using gui::UINode;
|
||||
using gui::Align;
|
||||
|
||||
UINode::UINode(glm::vec2 coord, glm::vec2 size) : coord(coord), size(size) {
|
||||
UINode::UINode(glm::vec2 size) : size(size) {
|
||||
}
|
||||
|
||||
UINode::~UINode() {
|
||||
|
||||
@ -30,7 +30,7 @@ namespace gui {
|
||||
*/
|
||||
std::string id = "";
|
||||
protected:
|
||||
glm::vec2 coord;
|
||||
glm::vec2 coord {0.0f};
|
||||
glm::vec2 size;
|
||||
glm::vec2 minSize {1.0f};
|
||||
glm::vec4 color {1.0f};
|
||||
@ -46,7 +46,7 @@ namespace gui {
|
||||
Align align = Align::left;
|
||||
UINode* parent = nullptr;
|
||||
vec2supplier positionfunc = nullptr;
|
||||
UINode(glm::vec2 coord, glm::vec2 size);
|
||||
UINode(glm::vec2 size);
|
||||
public:
|
||||
virtual ~UINode();
|
||||
/** Called every frame for all visible elements
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
using namespace gui;
|
||||
|
||||
Container::Container(glm::vec2 coord, glm::vec2 size) : UINode(coord, size) {
|
||||
Container::Container(glm::vec2 size) : UINode(size) {
|
||||
actualLength = size.y;
|
||||
setColor(glm::vec4());
|
||||
}
|
||||
@ -157,9 +157,10 @@ const std::vector<std::shared_ptr<UINode>>& Container::getNodes() const {
|
||||
}
|
||||
|
||||
Panel::Panel(glm::vec2 size, glm::vec4 padding, float interval)
|
||||
: Container(glm::vec2(), size),
|
||||
padding(padding),
|
||||
interval(interval) {
|
||||
: Container(size),
|
||||
padding(padding),
|
||||
interval(interval)
|
||||
{
|
||||
setColor(glm::vec4(0.0f, 0.0f, 0.0f, 0.75f));
|
||||
}
|
||||
|
||||
@ -245,7 +246,7 @@ Orientation Panel::getOrientation() const {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
PagesControl::PagesControl() : Container(glm::vec2(), glm::vec2(1)){
|
||||
PagesControl::PagesControl() : Container(glm::vec2(1)){
|
||||
}
|
||||
|
||||
bool PagesControl::has(std::string name) {
|
||||
|
||||
@ -33,7 +33,7 @@ namespace gui {
|
||||
int actualLength = 0;
|
||||
bool scrollable = true;
|
||||
public:
|
||||
Container(glm::vec2 coord, glm::vec2 size);
|
||||
Container(glm::vec2 size);
|
||||
|
||||
virtual void act(float delta) override;
|
||||
virtual void drawBackground(const GfxContext* pctx, Assets* assets);
|
||||
|
||||
@ -17,17 +17,19 @@
|
||||
using namespace gui;
|
||||
|
||||
Label::Label(std::string text, std::string fontName)
|
||||
: UINode(glm::vec2(), glm::vec2(text.length() * 8, 15)),
|
||||
text(util::str2wstr_utf8(text)),
|
||||
fontName(fontName) {
|
||||
: UINode(glm::vec2(text.length() * 8, 15)),
|
||||
text(util::str2wstr_utf8(text)),
|
||||
fontName(fontName)
|
||||
{
|
||||
setInteractive(false);
|
||||
}
|
||||
|
||||
|
||||
Label::Label(std::wstring text, std::string fontName)
|
||||
: UINode(glm::vec2(), glm::vec2(text.length() * 8, 15)),
|
||||
text(text),
|
||||
fontName(fontName) {
|
||||
: UINode(glm::vec2(text.length() * 8, 15)),
|
||||
text(text),
|
||||
fontName(fontName)
|
||||
{
|
||||
setInteractive(false);
|
||||
}
|
||||
|
||||
@ -191,7 +193,7 @@ bool Label::isMultiline() const {
|
||||
}
|
||||
|
||||
// ================================= Image ====================================
|
||||
Image::Image(std::string texture, glm::vec2 size) : UINode(glm::vec2(), size), texture(texture) {
|
||||
Image::Image(std::string texture, glm::vec2 size) : UINode(size), texture(texture) {
|
||||
setInteractive(false);
|
||||
}
|
||||
|
||||
@ -330,7 +332,7 @@ Align Button::getTextAlign() const {
|
||||
}
|
||||
|
||||
// ============================== RichButton ==================================
|
||||
RichButton::RichButton(glm::vec2 size) : Container(glm::vec2(), size) {
|
||||
RichButton::RichButton(glm::vec2 size) : Container(size) {
|
||||
setHoverColor(glm::vec4(0.05f, 0.1f, 0.15f, 0.75f));
|
||||
}
|
||||
|
||||
@ -904,17 +906,19 @@ void InputBindBox::keyPressed(keycode key) {
|
||||
}
|
||||
|
||||
// ================================ TrackBar ==================================
|
||||
TrackBar::TrackBar(double min,
|
||||
double max,
|
||||
double value,
|
||||
double step,
|
||||
int trackWidth)
|
||||
: UINode(glm::vec2(), glm::vec2(26)),
|
||||
min(min),
|
||||
max(max),
|
||||
value(value),
|
||||
step(step),
|
||||
trackWidth(trackWidth) {
|
||||
TrackBar::TrackBar(
|
||||
double min,
|
||||
double max,
|
||||
double value,
|
||||
double step,
|
||||
int trackWidth
|
||||
) : UINode(glm::vec2(26)),
|
||||
min(min),
|
||||
max(max),
|
||||
value(value),
|
||||
step(step),
|
||||
trackWidth(trackWidth)
|
||||
{
|
||||
setColor(glm::vec4(0.f, 0.f, 0.f, 0.4f));
|
||||
setHoverColor(glm::vec4(0.01f, 0.02f, 0.03f, 0.5f));
|
||||
}
|
||||
@ -1009,7 +1013,7 @@ void TrackBar::setTrackColor(glm::vec4 color) {
|
||||
}
|
||||
|
||||
// ================================ CheckBox ==================================
|
||||
CheckBox::CheckBox(bool checked) : UINode(glm::vec2(), glm::vec2(32.0f)), checked(checked) {
|
||||
CheckBox::CheckBox(bool checked) : UINode(glm::vec2(32.0f)), checked(checked) {
|
||||
setColor(glm::vec4(0.0f, 0.0f, 0.0f, 0.5f));
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ static std::shared_ptr<UINode> readLabel(UiXmlReader& reader, xml::xmlelement el
|
||||
}
|
||||
|
||||
static std::shared_ptr<UINode> readContainer(UiXmlReader& reader, xml::xmlelement element) {
|
||||
auto container = std::make_shared<Container>(glm::vec2(), glm::vec2());
|
||||
auto container = std::make_shared<Container>(glm::vec2());
|
||||
_readContainer(reader, element, *container);
|
||||
return container;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user