Пример #1
0
 public InputState(Window window)
 {
     //register with window
     window.OnMouseMove += (coords, delta) => this.MousePosition = coords;
     window.OnMousePress += button => this[button] = true;
     window.OnMouseRelease += button => this[button] = false;
     window.OnKeyPress += button => this[button] = true;
     window.OnKeyRelease += button => this[button] = false;
 }
Пример #2
0
        /// <summary>
        /// Creates a new Root for the given Window.
        /// </summary>
        public Root(Window window)
        {
            //set values
            Position.Value = 0;
            Size.Value = 1;
            Size.OnFilter += size => VectorUtil.Max(size, 1);
            Size.OnUpdate += () => Dirty.Value = true;
            ZCoord.Value = 0;
            Clip.Value = new Rectangle{Min = int.MinValue, Max = int.MaxValue};
            RootObj.Value = this;
            Dirty.Value = true;
            Visible.Value = true;
            Hidden.Value = true;
            Opaque.Value = true;
            InputVisible.Exp = () => Visible.Value;
            InputHidden.Exp = () => Hidden.Value;
            InputOpaque.Exp = () => Opaque.Value;

            InputHandler = new RootInputHandler(this);
            WindowObj = window;
        }
Пример #3
0
        /// <summary>
        /// Creates a new <see cref="Core"/> with the given title, tick rate, and buffer strategy.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="tickRate">The tick rate in Hz.</param>
        /// <param name="renderBufferType">The render buffer type.</param>
        protected Core(String title, double tickRate, Type renderBufferType)
        {
            //set tickRate vars
            TickRate = tickRate;

            //set the title
            Title = title;
            //create the window
            WindowObj = new Window(renderBufferType);
            WindowObj.Bounds = GetScreenBounds() / 2;
            WindowObj.OnResize += (size => MarkDirty());

            //create the frame rate counter
            RenderRate = new FrameRate();
        }
Пример #4
0
 public void Dispose()
 {
     //remove listeners
     WindowObj = null;
 }