Exemplo n.º 1
0
        // Gets the input args of the game
        public static InputArgs getInputArgs()
        {
            // Variables
            InputArgs	args=	new InputArgs();
            OTKInput.MouseState	tempm=	OTKInput.Mouse.GetState();
            MBL	mbuttons=	MBL.NONE;
            Point2	nmp=	new Point2(tempm.X, tempm.Y); // New Mouse Location

            args.keyboard=	new KeyboardState();
            args.mouse=	new MouseState();
            //args.gamepad=	new GamepadState();

            // Keyboard State
            args.keyboard.kstate=	OTKInput.Keyboard.GetState();

            // Mouse State
            if(viewport!= null)
            {
                // Variables
                Sdx.Point	pt=	Forms.Cursor.Position;

                pt=	viewport.PointToClient(pt);

                nmp=	new Point2(pt.X, pt.Y);
            }
            if(tempm.LeftButton== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.LMB;
            if(tempm.MiddleButton== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.MMB;
            if(tempm.RightButton== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.RMB;
            if(tempm.XButton1== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.XB1;
            if(tempm.XButton2== OTKInput.ButtonState.Pressed)
                mbuttons|=	MBL.XB2;
            if(tempm.Wheel> 0)
                mbuttons|=	MBL.WHEEL_UP;
            if(tempm.Wheel< 0)
                mbuttons|=	MBL.WHEEL_DOWN;
            if(!lmp.Equals(nmp))
            {
                if(nmp.y< lmp.y)
                    mbuttons|=	MBL.MOVE_UP;
                if(nmp.x> lmp.x)
                    mbuttons|=	MBL.MOVE_RIGHT;
                if(nmp.y> lmp.y)
                    mbuttons|=	MBL.MOVE_DOWN;
                if(nmp.x< lmp.x)
                    mbuttons|=	MBL.MOVE_LEFT;
                lmp=	nmp;
            }
            args.mouse.buttons=	mbuttons;
            args.mouse.pWheelDelta=	tempm.ScrollWheelValue;
            args.mouse.wheelDeltaPrecise=	tempm.WheelPrecise;
            args.mouse.mousePosition=	nmp;

            return args;
        }
Exemplo n.º 2
0
 public Rectangle(Point2 pmPosition, Size2 pmSize)
     : this(pmPosition.toPoint3(), pmSize, Vector3.ZERO)
 {
 }
Exemplo n.º 3
0
 public Rectangle(Point2 pmPosition, Size2 pmSize, Vector3 pmNormal)
     : this(pmPosition.toPoint3(), pmSize, pmNormal)
 {
 }
Exemplo n.º 4
0
 public Triangle(Point2 pmA, Point2 pmB, Point2 pmC)
     : this(new Point3(pmA.x, pmA.y, 0f), new Point3(pmB.x, pmB.y, 0f), new Point3(pmC.x, pmC.y, 0f))
 {
 }
Exemplo n.º 5
0
 public virtual void renderString(string str, Font font, Point2 location)
 {
     renderString(str, font, location.toPoint3(), defaultColor, font.size);
 }
Exemplo n.º 6
0
 public virtual void renderString(string str, Font font, Point2 location, Color color)
 {
     renderString(str, font, location.toPoint3(), color, font.size);
 }
Exemplo n.º 7
0
 public virtual void renderLineEndpoints(Point2 pt1, Point2 pt2)
 {
     renderLineEndpoints(pt1.toPoint3(), pt2.toPoint3(), defaultColor, 1f);
 }
Exemplo n.º 8
0
 public virtual void renderLineEndpoints(Point2 pt1, Point2 pt2, float pointSize)
 {
     renderLineEndpoints(pt1.toPoint3(), pt2.toPoint3(), defaultColor, pointSize);
 }
Exemplo n.º 9
0
 public virtual void renderLineEndpoints(Point2 pt1, Point2 pt2, Color color)
 {
     renderLineEndpoints(pt1.toPoint3(), pt2.toPoint3(), color, 1f);
 }
Exemplo n.º 10
0
 public virtual void renderLine(Point2 pt1, Point2 pt2, float lineWidth)
 {
     renderLine(pt1.toPoint3(), pt2.toPoint3(), defaultColor, lineWidth);
 }
Exemplo n.º 11
0
 public Segment(Point2 pmA, Point2 pmB)
     : this(new Point3(pmA.x, pmA.y, 0f), new Point3(pmB.x, pmB.y, 0f))
 {
 }