Example #1
0
 // Resizes the sprite to accomidate the gui component
 public void resize(Point2i pt, Size2i size)
 {
     vertices[0]=	new Point3f(pt.x, pt.y, 0f);
     vertices[1]=	new Point3f(pt.x, pt.y+size.height, 0f);
     vertices[2]=	new Point3f(pt.x+size.width, pt.y+size.height, 0f);
     vertices[3]=	new Point3f(pt.x+size.width, pt.y, 0f);
     bvolume=	new BVBox(pt.toPoint3f(), (pt+size).toPoint3f());
 }
Example #2
0
        internal MouseHelper(Viewport pmViewport)
        {
            viewport=	pmViewport;
            held=	new bool[]{false, false, false, false, false};
            lastPosition=	Point2f.ORIGIN;
            currPosition=	Point2f.ORIGIN;
            movement=	Vector2.ZERO;
            bLockToCenter=	false;
            bPrevLock=	false;
            tick=	0;
            mouseWheel=	0;

            viewport.LostFocus+=	onLostFocus;
            viewport.MouseDown+=	onMouseDown;
            viewport.MouseUp+=	onMouseUp;
            viewport.MouseLeave+=	onMouseLeave;
            viewport.MouseHover+=	onMouseHover;
            viewport.MouseWheel+=	onMouseWheelMoved;
            viewport.GotFocus+=	onGotFocus;
        }
Example #3
0
 // Subtracts the two points to get a vector pointing in between both
 public Vector3 subtract(Point2i pt)
 {
     return new Vector3(x-(float)pt.x, y-(float)pt.y, z);
 }
Example #4
0
 // Finds if the given 2d point is inside the volume
 public override bool contains(ref Point2i pt)
 {
     return contains((float)pt.x, (float)pt.y);
 }
Example #5
0
 // Adds the point with the size to get another point
 public Point2i add(Point2i pt)
 {
     return new Point2i((int)width+pt.x, (int)height+pt.y);
 }
Example #6
0
        // Gets the maximum value of the point
        public static Point2i max(Point2i value, Point2i max)
        {
            // Variables
            Point2i	temp=	value;

            if(value.x> max.x)
                temp.x=	max.x;
            if(value.y> max.y)
                temp.y=	max.y;

            return temp;
        }
Example #7
0
        // Clamps the point to the given min and max bounds
        public static Point2i clamp(Point2i value, Point2i min, Point2i max)
        {
            // Variables
            Point2i	temp=	value;

            if(value.x< min.x)
                temp.x=	min.x;
            else if(value.x> max.x)
                temp.x=	max.x;
            if(value.y< min.y)
                temp.y=	min.y;
            else if(value.y> max.y)
                temp.y=	max.y;

            return temp;
        }
Example #8
0
 // Subtracts the two points to get a vector pointing in between both
 public Vector2 subtract(Point2i pt)
 {
     return new Vector2((float)(x-pt.x), (float)(y-pt.y));
 }
Example #9
0
 public virtual bool contains(Point2i pt)
 {
     return contains(ref pt);
 }
Example #10
0
 // Finds if the given 2d point is inside the volume
 public abstract bool contains(ref Point2i pt);
Example #11
0
        // Updates the mouse movement
        internal void updateMouseMovement()
        {
            mouseWheel=	0;
            currPosition=	(Point2i)(viewport.PointToClient(Cursor.Position));
            if(pLockToCenter && tick> 4)
            {
                // Variables
                int	hw=	viewport.Size.Width/2;
                int	hh=	viewport.Size.Height/2;

                tick=	0;
                movement.x=	currPosition.x-hw;
                movement.y=	hh-currPosition.y;
                Cursor.Position=	viewport.PointToScreen(new Sdx.Point(hw, hh));
            }
            else if(bLockToCenter)
                tick++;
            else if(tick!= 24)
                tick=	24;
            else if(!bLockToCenter)
            {
                movement=	currPosition-lastPosition;
                movement.y*=	-1;
                lastPosition.x=	currPosition.x;
                lastPosition.y=	currPosition.y;
            }
        }
Example #12
0
 // Sets the position of the mouse
 public void setPosition(Point2i pt)
 {
     Cursor.Position=	pt.toSysPoint();
 }
Example #13
0
 // Multiplies a 2d point to affect it
 public Point2i multiply(Point2i pt)
 {
     return new Point2i
     (
         (int)(xx*pt.x+yx*pt.y+ox),
         (int)(xy*pt.x+yy*pt.y+oy)
     );
 }
Example #14
0
 // Finds if the two points are equal
 public bool equals(Point2i pt)
 {
     return (x== pt.x && y== pt.y);
 }
Example #15
0
 // Adds the point with the vector to get a new point
 public Point2i add(Point2i pt)
 {
     return new Point2i((int)x+pt.x, (int)y+pt.y);
 }
Example #16
0
 // Gets the midpoint of the two points
 public Point2f getMidpoint(Point2i pt)
 {
     return new Point2f((float)(x+pt.x)/2f, (float)(y+pt.y)/2f);
 }
Example #17
0
 // Subtracts the point with the vector to get a new point
 public Point2i subtract(Point2i pt)
 {
     return new Point2i((int)x-pt.x, (int)y-pt.y);
 }
Example #18
0
 // Cuts off part the rendering screen
 public void startScissorCut(Point2i location, Size2i size)
 {
     Gl.glEnable(Gl.GL_SCISSOR_TEST);
     Gl.glScissor(location.x, location.y+size.height, size.width, size.height);
 }
Example #19
0
 // Subtracts the two points to get a vector pointing in between both
 public Vector3 subtract(Point2i pt)
 {
     return new Vector3((float)(x-pt.x), (float)(y-pt.y), (float)z);
 }
Example #20
0
        // Gets the most minimum point of the two given points
        public static Point2i getMostMin(Point2i val1, Point2i val2)
        {
            // Variables
            Point2i	pt=	Point2i.ORIGIN;

            if(val1.x< val2.x)
                pt.x=	val1.x;
            else
                pt.x=	val2.x;
            if(val1.y< val2.y)
                pt.y=	val1.y;
            else
                pt.y=	val2.y;

            return pt;
        }
Example #21
0
 // Finds if the two points are equal
 public bool equals(Point2i pt)
 {
     return ((int)x== pt.x && (int)y== pt.y);
 }
Example #22
0
        // Gets the minimum value of the point
        public static Point2i min(Point2i value, Point2i min)
        {
            // Variables
            Point2i	temp=	value;

            if(value.x< min.x)
                temp.x=	min.x;
            if(value.y< min.y)
                temp.y=	min.y;

            return temp;
        }
Example #23
0
 // Subtracts the two points to get a vector pointing in between both
 public Vector2 subtract(Point2i pt)
 {
     return new Vector2(x-(float)pt.x, y-(float)pt.y);
 }
Example #24
0
 // Subtracts the point with the size to get another point
 public Point2i subtract(Point2i pt)
 {
     return new Point2i((int)width-pt.x, (int)height-pt.y);
 }
Example #25
0
 // Gets the midpoint of the two points
 public Point3f getMidpoint(Point2i pt)
 {
     return new Point3f((x+(float)pt.x)/2f, (y+(float)pt.y)/2f, z/2f);
 }
Example #26
0
 public Rectangle(Point2i pmPos, Size2i pmSize)
     : this((Point2f)pmPos, (Size2f)pmSize)
 {
 }
Example #27
0
 public Circle(Point2i pmPos, float r)
     : this((Point2f)pmPos, r)
 {
 }