aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu/software_mouse_pointer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/menu/software_mouse_pointer.cpp')
-rw-r--r--src/menu/software_mouse_pointer.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/menu/software_mouse_pointer.cpp b/src/menu/software_mouse_pointer.cpp
index e9b3b603..a3594479 100644
--- a/src/menu/software_mouse_pointer.cpp
+++ b/src/menu/software_mouse_pointer.cpp
@@ -25,6 +25,7 @@
#include "software_mouse_pointer.hpp"
#include <GL/gl.h>
#include <iostream>
+#include "utils/activator.hpp"
namespace usdx
{
@@ -42,20 +43,11 @@ namespace usdx
this->vertices[6] = 0.0f;
this->vertices[7] = 0.0f;
- this->texture[0] = 0.0f;
- this->texture[1] = 1.0f;
- this->texture[2] = 1.0f;
- this->texture[3] = 1.0f;
- this->texture[4] = 1.0f;
- this->texture[5] = 0.0f;
- this->texture[6] = 0.0f;
- this->texture[7] = 0.0f;
-
set_position(0, 0);
set_size(40, 40);
- texture_normal = new Texture("game/themes/Deluxe/interface/cursor.png");
- texture_pressed = new Texture("game/themes/Deluxe/interface/cursor_pressed.png");
+ texture_normal = new Disposer<Texture>(new Texture("game/themes/Deluxe/interface/cursor.png"));
+ texture_pressed = new Disposer<Texture>(new Texture("game/themes/Deluxe/interface/cursor_pressed.png"));
mouse_move_connection = event_manager->mouse_move.connect(
boost::bind(&SoftwareMousePointer::on_mouse_move, this, _1, _2));
@@ -83,8 +75,7 @@ namespace usdx
return;
}
- glEnable(GL_TEXTURE_2D);
- glBindTexture(GL_TEXTURE_2D, texture_normal->get_texture());
+ Activator<Texture> a(texture_normal->get());
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -92,7 +83,7 @@ namespace usdx
glVertexPointer(2, GL_FLOAT, 0, vertices);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, color.get_array(4));
- glTexCoordPointer(2, GL_FLOAT, 0, texture);
+ glTexCoordPointer(2, GL_FLOAT, 0, Texture::default_vertices);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -104,8 +95,6 @@ namespace usdx
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
-
- glDisable(GL_TEXTURE_2D);
}
void SoftwareMousePointer::on_mouse_move(int x, int y)