Exemplo n.º 1
0
        public void RenderFrame(double deltaTime, Matrix4 projection, Matrix4 view, IGameWindow gameWindow, ViewContainer rootView, int width, int height, float cameraZ)
        {
            //if there is no root view just no render anything
            if (rootView == null)
            {
                return;
            }

            //measure only if size has changed
            if (lastWidth != width || lastHeight != height)
            {
                rootView.Mesure(width, height, Values.MeasureSpecMode.Exactly);
            }
            else
            {
                rootView.Check();
            }

            //render view
            rootView.GLDraw(projection, view, new RectangleF(0, 0, 1000, 1000), width, height, cameraZ);

            var mouseX = OpenTK.Input.Mouse.GetCursorState().X - gameWindow.X;
            var mouseY = OpenTK.Input.Mouse.GetCursorState().Y - gameWindow.Y;

            Console.WriteLine("X: {0}, Y: {1}", mouseX, mouseY);

            lastWidth  = width;
            lastHeight = height;
        }