// Begins clipping part of the scene public virtual void beginClip(Rectangle clipBounds) { // Variables int[] data= new int[4]; GL.GetInteger(GetPName.Viewport, data); clipBounds.yi= data[3]-(clipBounds.yi+clipBounds.heighti); GL.Scissor(clipBounds.xi, clipBounds.yi, clipBounds.widthi, clipBounds.heighti); GL.Enable(EnableCap.ScissorTest); }
public Border() { bounds= Rectangle.EMPTY; colors= new GUIColorPacket ( new Color(0, 0, 0), new Color(0, 0, 0), new Color(0, 0, 0), new Color(0, 0, 0) ); secondSetColors= new GUIColorPacket ( new Color(255, 255, 255), new Color(255, 255, 255), new Color(255, 255, 255), new Color(255, 255, 255) ); borderSize= 1f; style= BorderStyle.SOLID; }
// Renders the border given the game to render it on, state 0 is normal, state 1 is disabled, state 2 is hovered, and state 3 is pressed public void render(Game game, Rectangle prevClipRegion, byte state) { game.graphics.endClip(); switch((int)(style)) { case 0: return; case 1: renderSolid(ref game, state); break; case 2: renderDashed(ref game, state); break; case 3: renderDotted(ref game, state); break; case 4: renderDouble(ref game, state); break; case 5: renderGroove(ref game, state); break; case 6: renderRidge(ref game, state); break; case 7: renderInset(ref game, state); break; case 8: renderOutset(ref game, state); break; } game.graphics.beginClip(prevClipRegion); }
public Curve(Rectangle pmBounds, CurveFunc pmFunc) : this(pmBounds, 1f, pmFunc) { }
public Curve(Rectangle pmBounds, float pmSegmentSize, CurveFunc pmFunc) { func= pmFunc; bounds= pmBounds; segmentSize= Math.Abs(pmSegmentSize); }
// Renders the outline of a rectangle with the given rectangle, color, and line width public virtual void outlineRect(Rectangle bounds, Color color, float lineWidth) { // Variables Point3[] endpoints= bounds.getEndpoints(); GL.Disable(EnableCap.Texture2D); GL.LineWidth(lineWidth); GL.Begin(PrimitiveType.Lines); { GL.Color4(color.red, color.green, color.blue, color.alpha); for(int i= 0; i< endpoints.Length; i++) { GL.Vertex3(endpoints[i].x, endpoints[i].y, endpoints[i].z); if(i== endpoints.Length-1) GL.Vertex3(endpoints[0].x, endpoints[0].y, endpoints[0].z); else GL.Vertex3(endpoints[i+1].x, endpoints[i+1].y, endpoints[i+1].z); } } GL.End(); GL.LineWidth(1f); GL.Enable(EnableCap.Texture2D); renderEndpoints(endpoints, color, lineWidth); }
public virtual void renderRectEndpoints(Rectangle bounds, float pointSize) { renderRectEndpoints(bounds, defaultColor, pointSize); }
public virtual void renderRectEndpoints(Rectangle bounds) { renderRectEndpoints(bounds, defaultColor, 1f); }
// Renders the endpoints of a rectangle with the given rectangle, color, and point size public virtual void renderRectEndpoints(Rectangle bounds, Color color, float pointSize) { renderEndpoints(bounds.getEndpoints(), color, pointSize); }
public virtual void renderRectEndpoints(Rectangle bounds, Color color) { renderRectEndpoints(bounds, color, 1f); }
public virtual void renderRect(Rectangle bounds) { renderRect(bounds, defaultColor); }
// Renders a rectangle with the given rectangle and color public virtual void renderRect(Rectangle bounds, Color color) { // Variables Point3[] endpoints= bounds.getEndpoints(); GL.Disable(EnableCap.Texture2D); GL.Begin(PrimitiveType.Quads); { GL.Color4(color.red, color.green, color.blue, color.alpha); // Rectangle ABCD GL.Vertex3(endpoints[0].x, endpoints[0].y, endpoints[0].z); GL.Vertex3(endpoints[1].x, endpoints[1].y, endpoints[1].z); GL.Vertex3(endpoints[2].x, endpoints[2].y, endpoints[2].z); GL.Vertex3(endpoints[3].x, endpoints[3].y, endpoints[3].z); } GL.End(); GL.Enable(EnableCap.Texture2D); }
public virtual void outlineRect(Rectangle bounds) { outlineRect(bounds, defaultColor, 1f); }
public virtual void outlineRect(Rectangle bounds, float lineWidth) { outlineRect(bounds, defaultColor, lineWidth); }
public virtual void outlineRect(Rectangle bounds, Color color) { outlineRect(bounds, color, 1f); }