Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.cc12
-rw-r--r--src/ui/font.cc4
-rw-r--r--src/ui/font.h4
-rw-r--r--src/ui/inputbox.cc4
-rwxr-xr-xsrc/ui/modelview.cc6
-rw-r--r--src/ui/paint.cc49
-rw-r--r--src/ui/scrollpane.cc4
-rw-r--r--src/ui/ui.cc6
-rw-r--r--src/ui/widget.cc4
-rw-r--r--src/ui/widget.h12
10 files changed, 53 insertions, 52 deletions
diff --git a/src/ui/console.cc b/src/ui/console.cc
index 5f7313b..4fcba7d 100644
--- a/src/ui/console.cc
+++ b/src/ui/console.cc
@@ -181,14 +181,14 @@ void Console::draw()
}
math::Vector2f s(size());
- s.x -= 8;
- s.y -= 8;
+ s[0] -= 8;
+ s[1] -= 8;
console_scrollpane->set_location(4, 4);
- console_scrollpane->set_size(s.x, s.y - font()->height());
+ console_scrollpane->set_size(s.width(), s.height() - font()->height());
console_input->set_location(4, height() - font()->height() -4);
- console_input->set_size(s.x, font()->height());
+ console_input->set_size(s.width(), font()->height());
math::Color fancy(palette()->fancy());
fancy.a = 0.5f;
@@ -196,8 +196,8 @@ void Console::draw()
std::string version(core::name() + ' ' + core::version());
s.assign(version.size() * font()->width(), font()->height());
math::Vector2f l(global_location());
- l.x += width() - s.width() -4;
- l.y += height() - s.height() -4;
+ l[0] += width() - s.width() -4;
+ l[1] += height() - s.height() -4;
paint::text(l, s, font(), version);
}
diff --git a/src/ui/font.cc b/src/ui/font.cc
index 9d721fd..1523eeb 100644
--- a/src/ui/font.cc
+++ b/src/ui/font.cc
@@ -31,12 +31,12 @@ void Font::set_size(const math::Vector2f &size)
void Font::set_width(const float width)
{
- font_size.x = width;
+ font_size.get_x() = width;
}
void Font::set_height(const float height)
{
- font_size.y = height;
+ font_size.get_y() = height;
}
void Font::set_name(const char *name)
diff --git a/src/ui/font.h b/src/ui/font.h
index 1261427..4fb6310 100644
--- a/src/ui/font.h
+++ b/src/ui/font.h
@@ -28,11 +28,11 @@ public:
}
inline float width() const {
- return font_size.x;
+ return font_size.width();
}
inline float height() const {
- return font_size.y;
+ return font_size.height();
}
void set_size(const float width, const float height);
diff --git a/src/ui/inputbox.cc b/src/ui/inputbox.cc
index 08b85be..07a0a7e 100644
--- a/src/ui/inputbox.cc
+++ b/src/ui/inputbox.cc
@@ -76,7 +76,7 @@ void InputBox::draw()
// draw the prompt
if (prompt_width) {
paint::text(v, size(), font(), input_prompt);
- v.x += prompt_width * font()->width();
+ v[0] += prompt_width * font()->width();
}
paint::color(palette()->text());
@@ -110,7 +110,7 @@ void InputBox::draw()
}
// draw the part behind the cursor
- v.x += draw_width * font()->width();
+ v[0] += draw_width * font()->width();
if (input_pos < input_text.size()) {
if (input_pos > 1 && aux::is_color_code(input_text.c_str() + input_pos -1)) {
paint::color_code(input_text[input_pos]);
diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc
index e3816cd..1e89397 100755
--- a/src/ui/modelview.cc
+++ b/src/ui/modelview.cc
@@ -87,13 +87,13 @@ void ModelView::draw()
math ::Vector2f center(global_location());
- center.x += width() * 0.5f;
- center.y += height() * 0.5f;
+ center[0] += width() * 0.5f;
+ center[1] += height() * 0.5f;
gl::clear(GL_DEPTH_BUFFER_BIT);
// gl 3d mode
- render::Camera::frustum_default(model->radius() * modelview_zoom, center.x, center.y);
+ render::Camera::frustum_default(model->radius() * modelview_zoom, center.x(), center.y());
gl::disable(GL_BLEND);
gl::depthmask(GL_TRUE); // enable writing to the depth buffer
diff --git a/src/ui/paint.cc b/src/ui/paint.cc
index e6f2402..576484e 100644
--- a/src/ui/paint.cc
+++ b/src/ui/paint.cc
@@ -42,10 +42,10 @@ void border(const math::Vector2f &location, const math::Vector2f &size)
using namespace gl;
begin(LineLoop);
- vertex(location.x +1 , location.y);
- vertex(location.x + size.x, location.y);
- vertex(location.x + size.x, location.y + size.y -1);
- vertex(location.x +1, location.y + size.y - 1);
+ vertex(location.x(), location.y());
+ vertex(location.x() + size.width(), location.y());
+ vertex(location.x() + size.width(), location.y() + size.height());
+ vertex(location.x(), location.y() + size.height());
end();
}
@@ -54,10 +54,10 @@ void rectangle(const math::Vector2f &location, const math::Vector2f &size)
using namespace gl;
begin(Quads);
- vertex(location.x +1 , location.y);
- vertex(location.x + size.x, location.y);
- vertex(location.x + size.x, location.y + size.y -1);
- vertex(location.x +1, location.y + size.y - 1);
+ vertex(location.x(), location.y());
+ vertex(location.x() + size.width(), location.y());
+ vertex(location.x() + size.width(), location.y() + size.height());
+ vertex(location.x(), location.y() + size.height());
end();
}
@@ -70,16 +70,17 @@ void bitmap(const math::Vector2f &location, const math::Vector2f &size, std::str
gl::begin(gl::Quads);
glTexCoord2f(0.0f, 0.0f);
- gl::vertex(location.x +1 , location.y);
-
+ gl::vertex(location.x(), location.y());
+
glTexCoord2f(1.0f, 0.0f);
- gl::vertex(location.x + size.x, location.y);
-
+ gl::vertex(location.x() + size.width(), location.y());
+
glTexCoord2f(1.0f, 1.0f);
- gl::vertex(location.x + size.x, location.y + size.y -1);
-
+ gl::vertex(location.x() + size.width(), location.y() + size.height());
+
glTexCoord2f(0.0f, 1.0f);
- gl::vertex(location.x +1, location.y + size.y - 1);
+ gl::vertex(location.x(), location.y() + size.height());
+
gl::end();
gl::disable(GL_TEXTURE_2D);
@@ -112,29 +113,29 @@ void label(const math::Vector2f &location, const math::Vector2f &size, const Fon
switch (align_horizontal) {
case AlignLeft:
- v.x += font->width();
+ v[0] += font->width();
break;
case AlignHCenter:
- v.x += (size.x - text_width) / 2.0f;
+ v[0] += (size.width() - text_width) / 2.0f;
break;
case AlignRight:
- v.x += size.x - text_width - font->width();
+ v[0] += size.width() - text_width - font->width();
break;
}
switch (align_vertical) {
case AlignTop:
- v.y += font->height()*0.5f;
+ v[1] += font->height()*0.5f;
break;
case AlignVCenter:
- v.y += (size.y - text_height) / 2.0f;
+ v[1] += (size.height() - text_height) / 2.0f;
break;
case AlignBottom:
- v.y += size.y - text_height - font->height()*0.5f;
+ v[1] += size.height() - text_height - font->height()*0.5f;
break;
}
- render::Text::draw(v.x, v.y, text);
+ render::Text::draw(v.x(), v.y(), text);
// disable OpenGL textures
gl::disable(GL_TEXTURE_2D);
@@ -149,7 +150,7 @@ void text(const math::Vector2f &location, const math::Vector2f &size, const Font
// enable OpenGL textures
gl::enable(GL_TEXTURE_2D);
- render::Text::draw(location.x, location.y, text);
+ render::Text::draw(location.x(), location.y(), text);
// disable OpenGL textures
gl::disable(GL_TEXTURE_2D);
@@ -164,7 +165,7 @@ void text(const math::Vector2f &location, const math::Vector2f &size, const Font
// enable OpenGL textures
gl::enable(GL_TEXTURE_2D);
- render::Text::draw(location.x, location.y, textstream);
+ render::Text::draw(location.x(), location.y(), textstream);
// disable OpenGL textures
gl::disable(GL_TEXTURE_2D);
diff --git a/src/ui/scrollpane.cc b/src/ui/scrollpane.cc
index d660663..20325d8 100644
--- a/src/ui/scrollpane.cc
+++ b/src/ui/scrollpane.cc
@@ -171,7 +171,7 @@ void ScrollPane::draw()
int i = (int) lines.size();
for (ui::Text::iterator it = lines.begin(); it != lines.end(); it++) {
if (i <= text_height) {
- render::Text::draw(gl.x, gl.y + y, (*it));
+ render::Text::draw(gl.x(), gl.y() + y, (*it));
y += font()->height();
}
i--;
@@ -179,7 +179,7 @@ void ScrollPane::draw()
} else {
y = height() - font()->height();
for (ui::Text::reverse_iterator rit = lines.rbegin(); (y >= 0) && (rit != lines.rend()); ++rit) {
- render::Text::draw(gl.x, gl.y + y, (*rit));
+ render::Text::draw(gl.x(), gl.y() + y, (*rit));
y -= font()->height();
}
}
diff --git a/src/ui/ui.cc b/src/ui/ui.cc
index b60a65e..82d3990 100644
--- a/src/ui/ui.cc
+++ b/src/ui/ui.cc
@@ -568,7 +568,7 @@ void UI::draw_pointer()
c.a = 0.5f;
}
paint::color(c);
- math::Vector2f pos(mouse_cursor.x - pointer_size * 0.5f, mouse_cursor.y - pointer_size * 0.5f);
+ math::Vector2f pos(mouse_cursor.x() - pointer_size * 0.5f, mouse_cursor.y() - pointer_size * 0.5f);
math::Vector2f s(pointer_size, pointer_size);
std::string texture("pointers/");
@@ -576,12 +576,12 @@ void UI::draw_pointer()
if (mouse_pointer_animated) {
gl::push();
- gl::translate(mouse_cursor.x, mouse_cursor.y, 0);
+ gl::translate(mouse_cursor.x(), mouse_cursor.y(), 0);
float angle = core::application()->time()* 0.75f - floorf(core::application()->time() * 0.75f);
angle *= 360.0f;
gl::rotate(angle, math::Vector3f(0, 0, 1.0f));
- gl::translate(-mouse_cursor.x, -mouse_cursor.y, 0);
+ gl::translate(-mouse_cursor.x(), -mouse_cursor.y(), 0);
}
paint::bitmap(pos, s, texture);
diff --git a/src/ui/widget.cc b/src/ui/widget.cc
index cc53c9f..b1157d5 100644
--- a/src/ui/widget.cc
+++ b/src/ui/widget.cc
@@ -232,12 +232,12 @@ void Widget::set_size(const math::Vector2f &size)
void Widget::set_width(const float w)
{
- widget_size.x = w;
+ widget_size[0] = w;
}
void Widget::set_height(const float h)
{
- widget_size.y = h;
+ widget_size[1] = h;
}
Widget::Children::iterator Widget::find_child(Widget *child)
diff --git a/src/ui/widget.h b/src/ui/widget.h
index 2de7a3d..20e4ac4 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -55,7 +55,7 @@ public:
* @see location()
*/
inline float left() const {
- return widget_location.x;
+ return widget_location.x();
}
/// x coordinate of the right of the widget
@@ -64,7 +64,7 @@ public:
* @see size()
*/
inline float right() const {
- return widget_location.x + widget_size.x;
+ return widget_location.x() + widget_size.width();
}
/// y coordinate of the top of the widget
@@ -72,7 +72,7 @@ public:
* @see location()
*/
inline float top() const {
- return widget_location.y;
+ return widget_location.y();
}
/// y coordinate of the bottom of the widget
@@ -81,7 +81,7 @@ public:
* @see size()
*/
inline float bottom() const {
- return widget_location.y + widget_size.y;
+ return widget_location.y() + widget_size.height();
}
/// width of the widget in pixels
@@ -89,7 +89,7 @@ public:
* @see size()
*/
inline float width() const {
- return widget_size.x;
+ return widget_size.width();
}
/// height of the widget in pixels
@@ -97,7 +97,7 @@ public:
* @see size()
*/
inline float height() const {
- return widget_size.y;
+ return widget_size.height();
}
/// widget label