clang warnings fix

This commit is contained in:
MihailRis
2024-02-02 20:42:49 +03:00
parent 4a22e8d57b
commit f25677d6d2
20 changed files with 37 additions and 45 deletions
-2
View File
@@ -120,8 +120,6 @@ class InventoryView : public gui::Container {
InventoryInteraction* interaction;
std::vector<SlotView*> slots;
int scroll = 0;
public:
InventoryView(
const Content* content,
+1 -1
View File
@@ -106,7 +106,7 @@ void WorldRenderer::drawChunks(Chunks* chunks,
}
float px = camera->position.x / (float)CHUNK_W;
float pz = camera->position.z / (float)CHUNK_D;
std::sort(indices.begin(), indices.end(), [this, chunks, px, pz](size_t i, size_t j) {
std::sort(indices.begin(), indices.end(), [chunks, px, pz](size_t i, size_t j) {
auto a = chunks->chunks[i];
auto b = chunks->chunks[j];
return ((a->x + 0.5f - px)*(a->x + 0.5f - px) +
+1 -1
View File
@@ -39,7 +39,7 @@ Skybox::Skybox(uint size, Shader* shader)
-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f,
-1.0f, -1.0f, 1.0f, 1.0f, 1.0f, -1.0f
};
vattr attrs[] {2, 0};
vattr attrs[] {{2}, {0}};
mesh = std::make_unique<Mesh>(vertices, 6, attrs);
sprites.push_back(skysprite {
+4 -8
View File
@@ -89,6 +89,7 @@ Button::Button(std::shared_ptr<UINode> content, glm::vec4 padding)
padding[1]+padding[3]+margin[1]+margin[3]));
add(content);
scrollable(false);
setHoverColor(glm::vec4(0.05f, 0.1f, 0.15f, 0.75f));
}
Button::Button(std::wstring text, glm::vec4 padding, onaction action)
@@ -102,6 +103,7 @@ Button::Button(std::wstring text, glm::vec4 padding, onaction action)
label = std::make_shared<Label>(text);
label->setAlign(Align::center);
add(label);
setHoverColor(glm::vec4(0.05f, 0.1f, 0.15f, 0.75f));
}
void Button::setText(std::wstring text) {
@@ -124,10 +126,6 @@ Button* Button::textSupplier(wstringsupplier supplier) {
return this;
}
void Button::setHoverColor(glm::vec4 color) {
hoverColor = color;
}
void Button::drawBackground(const GfxContext* pctx, Assets* assets) {
vec2 coord = calcCoord();
auto batch = pctx->getBatch2D();
@@ -163,6 +161,7 @@ void Button::textAlign(Align align) {
// ============================== RichButton ==================================
RichButton::RichButton(vec2 size) : Container(vec2(), size) {
setHoverColor(glm::vec4(0.05f, 0.1f, 0.15f, 0.75f));
}
void RichButton::mouseRelease(GUI* gui, int x, int y) {
@@ -179,10 +178,6 @@ RichButton* RichButton::listenAction(onaction action) {
return this;
}
void RichButton::setHoverColor(glm::vec4 color) {
hoverColor = color;
}
void RichButton::drawBackground(const GfxContext* pctx, Assets* assets) {
vec2 coord = calcCoord();
auto batch = pctx->getBatch2D();
@@ -198,6 +193,7 @@ TextBox::TextBox(std::wstring placeholder, vec4 padding)
placeholder(placeholder) {
label = std::make_shared<Label>(L"");
add(label);
setHoverColor(glm::vec4(0.05f, 0.1f, 0.2f, 0.75f));
}
void TextBox::drawBackground(const GfxContext* pctx, Assets* assets) {
+1 -7
View File
@@ -57,7 +57,6 @@ namespace gui {
class Button : public Panel {
protected:
glm::vec4 hoverColor {0.05f, 0.1f, 0.15f, 0.75f};
glm::vec4 pressedColor {0.0f, 0.0f, 0.0f, 0.95f};
std::vector<onaction> actions;
std::shared_ptr<Label> label = nullptr;
@@ -82,13 +81,11 @@ namespace gui {
virtual std::wstring getText() const;
virtual Button* textSupplier(wstringsupplier supplier);
virtual void setHoverColor(glm::vec4 color);
};
class RichButton : public Container {
protected:
glm::vec4 hoverColor {0.05f, 0.1f, 0.15f, 0.75f};
glm::vec4 pressedColor {0.0f, 0.0f, 0.0f, 0.95f};
std::vector<onaction> actions;
public:
@@ -98,13 +95,10 @@ namespace gui {
virtual void mouseRelease(GUI*, int x, int y) override;
virtual RichButton* listenAction(onaction action);
virtual void setHoverColor(glm::vec4 color);
};
class TextBox : public Panel {
protected:
glm::vec4 hoverColor {0.05f, 0.1f, 0.2f, 0.75f};
glm::vec4 focusedColor {0.0f, 0.0f, 0.0f, 1.0f};
glm::vec4 invalidColor {0.1f, 0.05f, 0.03f, 1.0f};
std::shared_ptr<Label> label;