Beispiel #1
0
        static UserInput()
        {
            Fragment = Platform.UserInputFragment ?? throw Platform.APIException("UserInputAPI");

            Fragment.WndProcess = args =>
            {
                if (args.Message == WindowsMessages.MOUSEMOVE)
                {
                    var x = (short)args.LParam;
                    var y = (short)(args.LParam >> 16);

                    CursorPos2D = new Point(x, y);
                }

                OnWndProc.SafeInvoke(args);
            };
        }
Beispiel #2
0
        static Render()
        {
            Fragment = Platform.RenderFragment ?? throw Platform.APIException("RenderAPI");

            Fragment.Draw        = () => InvokeRenderEvent(OnDraw);
            Fragment.EndScene    = () => InvokeRenderEvent(OnEndScene);
            Fragment.LostDevice  = () => InvokeRenderEvent(OnLostDevice);
            Fragment.ResetDevice = () => InvokeRenderEvent(OnResetDevice);

            void OnExit(object o, EventArgs args) => InvokeRenderEvent(OnDispose);

            AppDomain.CurrentDomain.DomainUnload += OnExit;
            AppDomain.CurrentDomain.ProcessExit  += OnExit;

            typeof(Vector).Trigger();
            typeof(Circle).Trigger();
            typeof(Text).Trigger();
            typeof(Picture).Trigger();
        }