aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu/software_mouse_pointer.cpp
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-03-22 22:33:22 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:52 +0100
commit3d6a2c963c24212a0650f6dce5c1a47899f0e387 (patch)
tree5c69cee69b43c5e049a9bde34a4fd4fd77bb7b86 /src/menu/software_mouse_pointer.cpp
parent37d83729fd3bc90930c4f7a9aa2ec8fdf21b9fed (diff)
downloadusdx-3d6a2c963c24212a0650f6dce5c1a47899f0e387.tar.gz
usdx-3d6a2c963c24212a0650f6dce5c1a47899f0e387.tar.xz
usdx-3d6a2c963c24212a0650f6dce5c1a47899f0e387.zip
menu/drawable_control: added position, glTransform to position before drawing
software_mouse_pointer does not need an own position anymore and simply draw it without position change
Diffstat (limited to 'src/menu/software_mouse_pointer.cpp')
-rw-r--r--src/menu/software_mouse_pointer.cpp40
1 files changed, 15 insertions, 25 deletions
diff --git a/src/menu/software_mouse_pointer.cpp b/src/menu/software_mouse_pointer.cpp
index 32609e13..dfe67475 100644
--- a/src/menu/software_mouse_pointer.cpp
+++ b/src/menu/software_mouse_pointer.cpp
@@ -31,7 +31,7 @@
namespace usdx
{
SoftwareMousePointer::SoftwareMousePointer(Container* parent, EventManager* event_manager)
- : DrawableControl(parent), x(-1), y(-1)
+ : DrawableControl(parent)
{
this->vertices[0] = 0.0f;
this->vertices[1] = 40.0f;
@@ -68,6 +68,8 @@ namespace usdx
this->texture[6] = 0.0f;
this->texture[7] = 0.0f;
+ set_position(0, 0);
+
texture_normal = new Texture("game/themes/Deluxe/interface/cursor.png");
texture_pressed = new Texture("game/themes/Deluxe/interface/cursor_pressed.png");
@@ -92,38 +94,26 @@ namespace usdx
void SoftwareMousePointer::draw(void)
{
- glLoadIdentity();
-
- boost::mutex::scoped_lock lock(mutex);
-
- if (x >= 0 && y >= 0) {
- glTranslatef(x, y, 0.0f);
- lock.unlock();
+ glBindTexture(GL_TEXTURE_2D, texture_normal->get_texture());
- glBindTexture(GL_TEXTURE_2D, texture_normal->get_texture());
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, vertices);
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, color);
+ glTexCoordPointer(2, GL_FLOAT, 0, texture);
- glVertexPointer(2, GL_FLOAT, 0, vertices);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, color);
- glTexCoordPointer(2, GL_FLOAT, 0, texture);
+ glDrawArrays(GL_QUADS, 0, 4);
- glDrawArrays(GL_QUADS, 0, 4);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
- }
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
}
void SoftwareMousePointer::on_mouse_move(int x, int y)
{
- boost::mutex::scoped_lock lock(mutex);
-
- this->x = x;
- this->y = y;
+ set_position(x, y);
}
};