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