Пример #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());
 }
Пример #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;
        }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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;
        }
Пример #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;
        }
Пример #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));
 }
Пример #9
0
 public virtual bool contains(Point2i pt)
 {
     return contains(ref pt);
 }
Пример #10
0
 // Finds if the given 2d point is inside the volume
 public abstract bool contains(ref Point2i pt);
Пример #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;
            }
        }
Пример #12
0
 // Sets the position of the mouse
 public void setPosition(Point2i pt)
 {
     Cursor.Position=	pt.toSysPoint();
 }
Пример #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)
     );
 }
Пример #14
0
 // Finds if the two points are equal
 public bool equals(Point2i pt)
 {
     return (x== pt.x && y== pt.y);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #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;
        }
Пример #21
0
 // Finds if the two points are equal
 public bool equals(Point2i pt)
 {
     return ((int)x== pt.x && (int)y== pt.y);
 }
Пример #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;
        }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #26
0
 public Rectangle(Point2i pmPos, Size2i pmSize)
     : this((Point2f)pmPos, (Size2f)pmSize)
 {
 }
Пример #27
0
 public Circle(Point2i pmPos, float r)
     : this((Point2f)pmPos, r)
 {
 }