diff options
Diffstat (limited to 'src/menu/background_color.cpp')
-rw-r--r-- | src/menu/background_color.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/menu/background_color.cpp b/src/menu/background_color.cpp index f55763b7..031ffe26 100644 --- a/src/menu/background_color.cpp +++ b/src/menu/background_color.cpp @@ -28,26 +28,33 @@ namespace usdx { BackgroundColor::BackgroundColor(const DrawableControl &control) - : Background(control), color(0,0,0) + : Background(control), color(0,0,0), size(0, 0) { } BackgroundColor::BackgroundColor(const DrawableControl &control, const RgbColor &color) : - Background(control), color(color) + Background(control), color(color), size(0, 0) { } - void BackgroundColor::draw() + void BackgroundColor::updateVertices() { + vertices[0] = 0; + vertices[1] = get_parent().get_height(); + vertices[2] = get_parent().get_width(); + vertices[3] = get_parent().get_height(); + vertices[4] = get_parent().get_width(); + vertices[5] = 0; + vertices[6] = 0; + vertices[7] = 0; + } + + void BackgroundColor::draw(void) { - 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; + if (size != get_parent().get_size()) { + this->updateVertices(); + size = get_parent().get_size(); + } glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); |