diff options
Diffstat (limited to 'src/menu/background_image.cpp')
-rw-r--r-- | src/menu/background_image.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/menu/background_image.cpp b/src/menu/background_image.cpp index c8d8642c..03836902 100644 --- a/src/menu/background_image.cpp +++ b/src/menu/background_image.cpp @@ -25,22 +25,16 @@ */ #include "background_image.hpp" +#include "drawable_control.hpp" namespace usdx { - BackgroundImage::BackgroundImage(boost::filesystem::wpath filename) + BackgroundImage::BackgroundImage(const DrawableControl &control, + boost::filesystem::wpath filename) : + Background(control) { texture = new Texture(filename); - this->vertices[0] = 0.0f; - this->vertices[1] = 600.0f; - this->vertices[2] = 800.0f; - this->vertices[3] = 600.0f; - this->vertices[4] = 800.0f; - this->vertices[5] = 0.0f; - this->vertices[6] = 0.0f; - this->vertices[7] = 0.0f; - this->color[0] = 255; this->color[1] = 255; this->color[2] = 255; @@ -53,10 +47,6 @@ namespace usdx this->color[9] = 255; this->color[10] = 255; this->color[11] = 255; - this->color[12] = 255; - this->color[13] = 255; - this->color[14] = 255; - this->color[15] = 255; this->tex[0] = 0.0f; this->tex[1] = 1.0f; @@ -75,9 +65,14 @@ namespace usdx void BackgroundImage::draw(void) { - glClear(GL_COLOR_BUFFER_BIT); - - glLoadIdentity(); + this->vertices[0] = 0; + this->vertices[1] = get_parent().get_height(); + this->vertices[2] = get_parent().get_width(); + this->vertices[3] = get_parent().get_height(); + this->vertices[4] = get_parent().get_width(); + this->vertices[5] = 0; + this->vertices[6] = 0; + this->vertices[7] = 0; glBindTexture(GL_TEXTURE_2D, texture->get_texture()); @@ -85,8 +80,8 @@ namespace usdx glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_COLOR_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, vertices); - glColorPointer(4, GL_UNSIGNED_BYTE, 0, color); + glVertexPointer(2, GL_INT, 0, vertices); + glColorPointer(3, GL_UNSIGNED_BYTE, 0, color); glTexCoordPointer(2, GL_FLOAT, 0, tex); glDrawArrays(GL_QUADS, 0, 4); |