00001 #include "alpha.hh" 00002 #include "register.hh" 00003 #include <stdlib.h> 00004 #include <GL/gl.h> 00005 00006 namespace anoid { 00007 namespace plugin { 00008 using namespace config; 00009 00010 void Alpha::init(Configuration &c) { 00011 if (c.hasElement("alpha")) 00012 alpha = c.getDouble("alpha"); 00013 else 00014 alpha = 1.0; 00015 00016 Ability::init(c); 00017 registerName("Alpha"); 00018 } 00019 00020 double Alpha::getAlpha() { 00021 return alpha; 00022 } 00023 00024 void Alpha::setAlpha(const double a) { 00025 alpha = a; 00026 } 00027 00028 Alpha::Alpha(): alpha(1) { 00029 } 00030 00031 void Alpha::redraw() { 00032 float colors[4]; 00033 glGetFloatv(GL_CURRENT_COLOR, colors); 00034 colors[4] = alpha; 00035 glColor4fv(colors); 00036 00037 Ability::redraw(); 00038 } 00039 00040 Register(Alpha) 00041 00042 }; 00043 };