started implementing dynamic widget allocation by xml tag

This commit is contained in:
2017-01-29 17:42:23 +00:00
parent 7436706b37
commit 16c1b6481e
10 changed files with 94 additions and 46 deletions

View File

@@ -1,14 +1,9 @@
#pragma once
#include "shape.hpp"
#include "util.hpp"
namespace att
{
uint16_t constexpr const_hash(char const *input)
{
return *input ?
static_cast<uint16_t>(*input) + 33 * const_hash(input + 1) :
5381;
}
enum class kAttribute : uint16_t
{
Width = const_hash("width"),
@@ -107,13 +102,20 @@ namespace att
class Widget
{
public:
glm::mat4 mvp;
glm::vec4 clip;
virtual void draw() { };
};
class WidgetBorder : public Widget
{
public:
static class Plane* m_plane;
static Plane* m_plane;
virtual void draw() override
{
m_plane->draw_fill();
}
};
class Node
@@ -186,11 +188,12 @@ public:
}
void update(float width, float height);
void update_internal(glm::vec2 origin);
void update_internal(const glm::vec2& origin, const glm::mat4& proj);
void parse_attributes(att::kAttribute ka, const tinyxml2::XMLAttribute* attr);
void load(const char* path);
void load_internal(const tinyxml2::XMLElement* x_node);
void reload();
void draw();
class iterator
{