Example #1
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="window">Herní okno.</param>
        public GlibInput(GlibWindow window)
        {
            if (window == null)
                throw new ArgumentNullException("window", "Instance pro GlibWindow je NULL.");

            this.window = window;
        }
Example #2
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="window">Herní okno.</param>
        public KeyboardInput(GlibWindow window)
            : base(window)
        {
            keys = new List<OpenTK.Input.Key>();

            window.Keyboard.KeyDown += (o, e) => { KeyDown(e); };
            window.Keyboard.KeyUp += (o, e) => { KeyUp(e); };
        }
Example #3
0
        /// <summary>
        /// Hlavní konstruktor.
        /// </summary>
        /// <param name="window">Herní okno.</param>
        public Keyboard(GlibWindow window)
            : base(window)
        {
            keyboard = new KeyboardDirect(Input);
            keyboard.Properties.BufferSize = 128;
            keyboard.Acquire();

            state = new KeyboardState();
        }
Example #4
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="window">Herní okno.</param>
        /// <param name="font">Font.</param>
        public GDebug(GlibWindow window, Font font)
        {
            this.window = window;

            Font = font;
            FontColor = Color4.Red;
            Position = new Vector2(10, 10);
            OffsetY = 20f;
            Enabled = true;
        }
Example #5
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="window">Herní okno.</param>
        public MouseInput(GlibWindow window)
            : base(window)
        {
            window.Mouse.ButtonDown += (o, e) => { MouseDown(e); };
            window.Mouse.ButtonUp += (o, e) => { MouseUp(e); };
            window.Mouse.Move += (o, e) => { MouseMove(e); };
            window.UpdateFrame += (o, e) =>
            {
                Rectangle temp = window.Bounds;
                temp.Width += (temp.Bottom - temp.Width);

                // TODO: stále problém s rámečkem okna na ose Y
                containsMouse = temp.IntersectsWith(new Rectangle(Cursor.Position.X, Cursor.Position.Y, 1, 1));
            };
        }
Example #6
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="window"></param>
        public Mouse(GlibWindow window)
        {
            if (window == null)
                throw new ArgumentNullException("window", "Window was null. Please provide an instance of GlibWindow.");

            this.window = window;

            DoubleClickRate = TimeSpan.FromMilliseconds(Win32Methods.GetDoubleClickTime());

            position = Point.Empty;
            oldPosition = Point.Empty;

            buttons = new bool[BUTTON_COUNT];
            oldButtons = new bool[BUTTON_COUNT];

            window.OnUpdate += Update;
        }
Example #7
0
 /// <summary>
 /// Konstruktor.
 /// </summary>
 /// <param name="window">Herní okno.</param>
 public GDebug(GlibWindow window)
     : this(window, null)
 {
 }
Example #8
0
        /// <summary>
        /// Hlavní konstruktor.
        /// </summary>
        /// <param name="window">Herní okno.</param>
        public InputBase(GlibWindow window)
        {
            input = new DirectInput();

            window.OnUpdate += Update;
        }