aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-07-02 10:11:45 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-07-02 10:11:45 -0400
commitd96c869152527ae0c570de1d1c8552ec64d7fddb (patch)
tree89ef30120517c769be5c6fbf3920f6952b723950 /include
parent6f13e748c526576198d197ad194f4c1d8fdadec0 (diff)
fixed quest menu, only entity vector in worlds
Diffstat (limited to 'include')
-rw-r--r--include/coolarray.hpp21
-rw-r--r--include/ui_quest.hpp6
2 files changed, 26 insertions, 1 deletions
diff --git a/include/coolarray.hpp b/include/coolarray.hpp
index 5388aab..be221b8 100644
--- a/include/coolarray.hpp
+++ b/include/coolarray.hpp
@@ -16,7 +16,13 @@ public:
_capacity = 0;
}
- CoolArray(size_t n, const T& value=0) {
+ CoolArray(size_t n) {
+ buffer = new T[n];
+ _size = 0;
+ _capacity = n;
+ }
+
+ CoolArray(size_t n, const T& value) {
buffer = new T[n];
_size = n;
_capacity = n;
@@ -41,6 +47,11 @@ public:
std::copy(a.begin(), a.end(), buffer);
}
+ void operator+=(std::initializer_list<T> n) {
+ for (const auto &e : n)
+ push_back(e);
+ }
+
template<class Func>
void remove_if(Func f) {
for (size_t i = 0; i < _size; ++i) {
@@ -73,6 +84,10 @@ public:
_capacity = 0;
}
+ void reset(void) {
+ _size = 0;
+ }
+
size_t size(void) const {
return _size;
}
@@ -81,6 +96,10 @@ public:
return _capacity;
}
+ T* data(void) {
+ return buffer;
+ }
+
T& front(void) {
return buffer[0];
}
diff --git a/include/ui_quest.hpp b/include/ui_quest.hpp
index a0f3ad4..24a5e1b 100644
--- a/include/ui_quest.hpp
+++ b/include/ui_quest.hpp
@@ -13,9 +13,13 @@ namespace ui {
}
void draw(void) {
+ static unsigned int textWrap = 40;
+
if (!_toggle)
return;
+ std::swap(textWrap, ui::textWrapLimit);
+
float top_y = offset.y + 200;
ui::drawNiceBox(vec2 {offset.x - 200, top_y },
vec2 {offset.x + 200, offset.y - 200 },
@@ -31,6 +35,8 @@ namespace ui {
ui::putText(x + 40, y, q.desc.c_str());
y -= 40;
}
+
+ std::swap(textWrap, ui::textWrapLimit);
}
}
}