summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-06 20:48:33 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-07 01:02:02 +0000
commit2f8d7643d03f39fa848576692264d0fe3a37ed91 (patch)
treef4578e2ce3020c04a206f9eb0bc02587de5b3d6a /ui
parentDon't request a specific OpenGL version, just check we get something sufficie... (diff)
downloadilt-2f8d7643d03f39fa848576692264d0fe3a37ed91.tar.bz2
ilt-2f8d7643d03f39fa848576692264d0fe3a37ed91.tar.xz
ilt-2f8d7643d03f39fa848576692264d0fe3a37ed91.zip
Reformat with new clang-format
Diffstat (limited to 'ui')
-rw-r--r--ui/font.cpp1
-rw-r--r--ui/font.h1
-rw-r--r--ui/gameMainSelector.cpp1
-rw-r--r--ui/gameMainWindow.cpp4
-rw-r--r--ui/iconButton.h1
-rw-r--r--ui/modeHelper.h1
-rw-r--r--ui/text.cpp1
-rw-r--r--ui/text.h1
-rw-r--r--ui/uiComponent.cpp1
-rw-r--r--ui/uiComponent.h1
-rw-r--r--ui/uiComponentPlacer.cpp1
-rw-r--r--ui/window.h1
12 files changed, 15 insertions, 0 deletions
diff --git a/ui/font.cpp b/ui/font.cpp
index 108f905..ebd856d 100644
--- a/ui/font.cpp
+++ b/ui/font.cpp
@@ -14,6 +14,7 @@
#include <unicode.h>
#include <util.h>
#include <utility>
+
// IWYU pragma: no_forward_declare FT_LibraryRec_
std::string
diff --git a/ui/font.h b/ui/font.h
index 6c86e18..2f3337f 100644
--- a/ui/font.h
+++ b/ui/font.h
@@ -31,6 +31,7 @@ public:
glm::ivec2 bearing;
long advance;
};
+
struct FontTexture {
glTexture texture;
unsigned int used;
diff --git a/ui/gameMainSelector.cpp b/ui/gameMainSelector.cpp
index 081718d..6c6935c 100644
--- a/ui/gameMainSelector.cpp
+++ b/ui/gameMainSelector.cpp
@@ -15,6 +15,7 @@
#include <vector>
GameMainSelector::GameMainSelector(const Camera * c, glm::vec2 size) : UIComponent {{{}, size}}, camera {c} { }
+
constexpr glm::vec2 TargetPos {5, 45};
void
diff --git a/ui/gameMainWindow.cpp b/ui/gameMainWindow.cpp
index c35c9c6..b94accd 100644
--- a/ui/gameMainWindow.cpp
+++ b/ui/gameMainWindow.cpp
@@ -48,6 +48,7 @@ GameMainWindow::render() const
SceneRenderer::render(*this);
Window::render();
}
+
void
GameMainWindow::content(const SceneShader & shader) const
{
@@ -59,17 +60,20 @@ GameMainWindow::content(const SceneShader & shader) const
gameState->world.apply<Renderable>(&Renderable::render, shader);
uiComponents.apply<WorldOverlay>(&WorldOverlay::render, shader);
}
+
void
GameMainWindow::environment(const SceneShader & s, const SceneRenderer & r) const
{
// default for now
SceneProvider::environment(s, r);
}
+
void
GameMainWindow::lights(const SceneShader & shader) const
{
gameState->world.apply<Renderable>(&Renderable::lights, shader);
}
+
void
GameMainWindow::shadows(const ShadowMapper & shadowMapper) const
{
diff --git a/ui/iconButton.h b/ui/iconButton.h
index 6ac9317..0afe92d 100644
--- a/ui/iconButton.h
+++ b/ui/iconButton.h
@@ -10,6 +10,7 @@ class UIShader;
union SDL_Event;
static const constexpr glm::vec2 ICON_SIZE {32.F, 32.F};
+
class IconButton : public UIComponent {
public:
IconButton(const std::string & icon, glm::vec2 position, UIEvent click);
diff --git a/ui/modeHelper.h b/ui/modeHelper.h
index 77707f2..d20f2db 100644
--- a/ui/modeHelper.h
+++ b/ui/modeHelper.h
@@ -4,6 +4,7 @@
union SDL_Event;
enum ModeSecondClick { Unset, Reset, NoAction };
+
template<typename Target, ModeSecondClick msc = ModeSecondClick::Unset> class Mode {
public:
explicit Mode(Target & t) : target {t} { }
diff --git a/ui/text.cpp b/ui/text.cpp
index d24c268..b776b90 100644
--- a/ui/text.cpp
+++ b/ui/text.cpp
@@ -12,6 +12,7 @@
#include <utility>
const std::filesystem::path font {"/usr/share/fonts/hack/Hack-Regular.ttf"};
+
Text::Text(std::string_view s, Position pos, glm::vec3 c) : UIComponent {pos}, colour {c}
{
for (const auto & textureQuads :
diff --git a/ui/text.h b/ui/text.h
index 9fe87d1..de2fe2e 100644
--- a/ui/text.h
+++ b/ui/text.h
@@ -25,6 +25,7 @@ private:
glVertexArray vao;
glBuffer vbo;
};
+
std::vector<Model> models;
glm::vec3 colour;
};
diff --git a/ui/uiComponent.cpp b/ui/uiComponent.cpp
index e480fbc..aa4838d 100644
--- a/ui/uiComponent.cpp
+++ b/ui/uiComponent.cpp
@@ -20,6 +20,7 @@ UIComponent::Position::operator&(const glm::vec2 & pos) const
{
return (pos.x >= origin.x && pos.y >= origin.y && pos.x < origin.x + size.x && pos.y < origin.y + size.y);
}
+
bool
UIComponent::Position::operator&(const SDL_MouseButtonEvent & pos) const
{
diff --git a/ui/uiComponent.h b/ui/uiComponent.h
index 75c2284..71d2659 100644
--- a/ui/uiComponent.h
+++ b/ui/uiComponent.h
@@ -18,6 +18,7 @@ public:
bool operator&(const SDL_MouseButtonEvent &) const;
bool operator&(const glm::vec2 &) const;
};
+
explicit UIComponent(Position);
virtual ~UIComponent() = default;
diff --git a/ui/uiComponentPlacer.cpp b/ui/uiComponentPlacer.cpp
index 368e772..5e645d8 100644
--- a/ui/uiComponentPlacer.cpp
+++ b/ui/uiComponentPlacer.cpp
@@ -16,6 +16,7 @@ UIComponentPlacer::next(glm::vec2 size)
max = std::max(max, size[1 - axis]);
return n;
}
+
glm::vec2
UIComponentPlacer::getLimit() const
{
diff --git a/ui/window.h b/ui/window.h
index 369228a..183a65a 100644
--- a/ui/window.h
+++ b/ui/window.h
@@ -31,6 +31,7 @@ public:
protected:
virtual void render() const;
+
struct GLInitHelper {
GLInitHelper();
};