aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu/software_mouse_pointer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-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);
}
};