예제 #1
0
        protected override void OnLoad(EventArgs ee)
        {
            base.OnLoad(ee);
            var glInterface = GRGlInterface.CreateNativeGlInterface();

            Debug.Assert(glInterface.Validate());

            this.context = GRContext.Create(GRBackend.OpenGL, glInterface);
            Debug.Assert(this.context.Handle != IntPtr.Zero);
            this.renderTarget = CreateRenderTarget();

            this.KeyDown += (o, e) =>
            {
                if (e.Key == Key.Escape)
                {
                    this.Close();
                }
            };
            InputMouse                   = new InputMouse(this);
            InputMouse.MouseDown        += state => Engine.OnMouse(state);
            InputMouse.MouseUp          += state => Engine.OnMouse(state);
            InputMouse.MouseMove        += state => Engine.OnMouse(state);
            InputMouse.MousePressedMove += state => Engine.OnMouse(state);
            FocusedChanged              += OnFocusedChanged;

            //    WindowState = WindowState.Fullscreen;
            CursorVisible = false;
        }
예제 #2
0
        private void OnPaintSurface(object sender, SKPaintGLSurfaceEventArgs e)
        {
            var canvas = e.Surface.Canvas;

            canvas.Clear(new SKColor(50, 50, 50));

            Engine.Draw(canvas);

            InputMouse.Draw(Engine.Surface.Canvas);
        }
예제 #3
0
        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);


            Engine.Step(e.Time, 1);

            UpdateSurface?.Invoke(this, e.Time);

            InputMouse.Update();
        }