Beispiel #1
0
 //------------------------------------------------------------------------------------------------------------------------
 //                                                        RenderSelf()
 //------------------------------------------------------------------------------------------------------------------------
 protected override void RenderSelf(GLContext glContext)
 {
     if (game != null) {
         Vector2[] bounds = GetExtents();
         float maxX = float.MinValue;
         float maxY = float.MinValue;
         float minX = float.MaxValue;
         float minY = float.MaxValue;
         for (int i=0; i<4; i++) {
             if (bounds[i].x > maxX) maxX = bounds[i].x;
             if (bounds[i].x < minX) minX = bounds[i].x;
             if (bounds[i].y > maxY) maxY = bounds[i].y;
             if (bounds[i].y < minY) minY = bounds[i].y;
         }
         bool test = (maxX < 0) || (maxY < 0) || (minX >= game.width) || (minY >= game.height);
         if (test == false) {
             if (blendMode != null) blendMode.enable ();
             _texture.Bind();
             glContext.SetColor((byte)((_color >> 16) & 0xFF),
                                (byte)((_color >> 8) & 0xFF),
                                (byte)(_color & 0xFF),
                                (byte)(_alpha * 0xFF));
             glContext.DrawQuad(GetArea(), _uvs);
             glContext.SetColor(1, 1, 1, 1);
             _texture.Unbind();
             if (blendMode != null) BlendMode.NORMAL.enable();
         }
     }
 }