Exemplo n.º 1
0
 public Input()
 {
     Device.RegisterDevice(UsagePage.Generic, UsageId.Keyboard, DeviceFlags.None);
     Device.KeyboardInput += new EventHandler<KeyboardInputEventArgs>(keyboardInput);
     Device.RegisterDevice(UsagePage.Generic, UsageId.Mouse, DeviceFlags.None);
     Device.MouseInput += new EventHandler<MouseInputEventArgs>(mouseInput);
     MouseWheelDelta = 0;
     MousePos = new Vector2Int(0, 0);
     Pressed = new Dictionary<Keys, bool>();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Quad" /> class.
 /// </summary>
 /// <param name="x">The x coordinate of the upper-left vertex.</param>
 /// <param name="y">The y coordinate of the upper-left vertex.</param>
 /// <param name="screenWidth">Width of the screen.</param>
 /// <param name="screenHeight">Height of the screen.</param>
 /// <param name="textureFileName">Path to the texture file.</param>
 /// <param name="width">The width of the quad.</param>
 /// <param name="height">The height of the quad.</param>
 /// <param name="colour">The colour to blend this quad's texture with.</param>
 public Quad(int x, int y, int screenWidth, int screenHeight, string textureFileName, int width, int height, Color4 colour)
 {
     this.position = new Vector2Int(x, y);
     this.screenDimensions = new Vector2Int(screenWidth, screenHeight);
     this.width = width;
     this.height = height;
     this.Colour = colour;
     TexturePath = textureFileName;
     vertices = buildVertices();
     indices = buildIndices();
 }
Exemplo n.º 3
0
        private void mouseInput(object sender, MouseInputEventArgs e)
        {
            MousePos = new Vector2Int(e.X, e.Y);
            MouseWheelDelta += e.WheelDelta;
            EventArgs args = new EventArgs();

            if (e.ButtonFlags.HasFlag(MouseButtonFlags.LeftDown))
            {
                if (OnLeftMouseDown != null)
                {
                    OnLeftMouseDown(this, args);
                }
            }
            if (e.ButtonFlags.HasFlag(MouseButtonFlags.LeftUp))
            {
                if (OnLeftMouseUp != null)
                {
                    OnLeftMouseUp(this, args);
                }
            }

            if (e.ButtonFlags.HasFlag(MouseButtonFlags.MiddleDown))
            {
                if (OnMiddleMouseDown != null)
                {
                    OnMiddleMouseDown(this, args);
                }
            }
            if (e.ButtonFlags.HasFlag(MouseButtonFlags.MiddleUp))
            {
                if (OnMiddleMouseUp != null)
                {
                    OnMiddleMouseUp(this, args);
                }
            }

            if (e.ButtonFlags.HasFlag(MouseButtonFlags.RightDown))
            {
                if (OnRightMouseDown != null)
                {
                    OnRightMouseDown(this, args);
                }
            }
            if (e.ButtonFlags.HasFlag(MouseButtonFlags.RightUp))
            {
                if (OnRightMouseUp != null)
                {
                    OnRightMouseUp(this, args);
                }
            }

            if (e.ButtonFlags.HasFlag(MouseButtonFlags.Button4Down))
            {
                if (OnButton4MouseDown != null)
                {
                    OnButton4MouseDown(this, args);
                }
            }
            if (e.ButtonFlags.HasFlag(MouseButtonFlags.Button4Up))
            {
                if (OnButton4MouseUp != null)
                {
                    OnButton4MouseUp(this, args);
                }
            }

            if (e.ButtonFlags.HasFlag(MouseButtonFlags.Button5Down))
            {
                if (OnButton5MouseDown != null)
                {
                    OnButton5MouseDown(this, args);
                }
            }
            if (e.ButtonFlags.HasFlag(MouseButtonFlags.Button5Up))
            {
                if (OnButton5MouseUp != null)
                {
                    OnButton5MouseUp(this, args);
                }
            }
        }
Exemplo n.º 4
0
 public FontChar()
 {
     Position = new Vector2Int(0, 0);
     Width = 0;
     Height = 0;
     Offset = new Vector2Int(0, 0);
     XAdvance = 0;
     KerningList = new List<Kerning>();
 }