]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
added switch for Transparency -> F9
authorPeter Schaefer <schaeferpm@gmail.com>
Thu, 25 Jun 2015 19:21:47 +0000 (21:21 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Thu, 25 Jun 2015 19:21:47 +0000 (21:21 +0200)
Weave/Events.cpp
Weave/Graphix/Graphix.cpp
Weave/Graphix/Graphix.h

index e763a11bc334f8a571c4f6cfe93b9a4ad7c2d922..d1561132cdc68a0d3fc6ecddb47d459b70f8679a 100644 (file)
@@ -122,13 +122,17 @@ void Events::KeyDown(int _key)
                break;
        case SDLK_F9:
                //TRANSPARENCY
+               if (!key_toggle[SDLK_F9])
+                       Graphix::disableEffects(EF_TRANSPARENCY);
+               else
+                       Graphix::enableEffects(EF_TRANSPARENCY);
                break;
        case SDLK_F10:
                //??? FullScreen
-               if (key_toggle[SDLK_F10])
-                       Graphix::FullScreen(false,true);
-               else
+               if (!key_toggle[SDLK_F10])
                        Graphix::FullScreen(true,true);
+               else
+                       Graphix::FullScreen(false,true);
                break;
        case SDLK_SPACE:
                jump++;
index 5f91b012f06cb7202b51ba21b6ca4fb11dafd4e6..5f5d40a4781af727b63323807237214e79b8eb5d 100644 (file)
@@ -34,12 +34,16 @@ unsigned int Graphix::getWindowWidth()
 void Graphix::enableEffects(Effects _eff)
 {
        effects |=  _eff;
+
+       updateEffects();
 }
 
 
 void Graphix::disableEffects(Effects _eff)
 {
        effects &= ~_eff;
+
+       updateEffects();
 }
 
 bool Graphix::testEffect(Effects _eff)
@@ -47,6 +51,18 @@ bool Graphix::testEffect(Effects _eff)
        return effects & _eff;
 }
 
+void Graphix::updateEffects()
+{
+       //Transparency
+       if (effects & EF_TRANSPARENCY)
+       {
+               glEnable(GL_BLEND);
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+       }
+       else
+               glDisable(GL_BLEND);
+}
+
 void Graphix::init()
 {
 
index 3d4d3cbdd989d322af8a9c9e0b89a320e3eeed0d..bde1f6ad5bb3e8793e8bc3db8d8f1c93f16b74b1 100644 (file)
@@ -45,6 +45,9 @@ public:
        static Shader* shader_BBox;
 
 private:
+
+       static void updateEffects();
+
        static unsigned int xpos, ypos, width, height;
        static unsigned int  width_bkp, height_bkp;