コード例 #1
0
        internal static void Update()
        {
            InputLL.UpdateKeyboard();

            foreach (KeyValuePair <Key, Action> handler in handlers)
            {
                if (IsKeyPressed(handler.Key))
                {
                    handler.Value();
                }
            }
        }
コード例 #2
0
        internal static void Update()
        {
            lock (locker)
            {
                prevMouse = curMouse;
                curMouse  = InputLL.UpdateMouse();

                MouseDelta = prevMouse - curMouse;

                ButtonsDown = new MouseButtons()
                {
                    Left   = InputLL.LeftMouseButtonDown(),
                    Right  = InputLL.RightMouseButtonDown(),
                    Middle = InputLL.MiddleMouseButtonDown()
                };

                NDMousePos = InputLL.GetNDMousePos(curMouse);
            }
        }
コード例 #3
0
        private static void Game_UpdateFrame(object sender, FrameEventArgs e)
        {
#if DEBUG
            if (Context == null && PerfAPI.MetricsEnabled)
            {
                Context = new GPUPerfAPI.NET.Context(GraphicsContext.CurrentContextHandle.Handle);
            }
            PerfAPI.BeginFrame();
#endif
            DeleteSomeObjects();
#if DEBUG
            GenericMetrics.UpdateLog();

            updateCnt++;
            int len = GL.GetInteger((GetPName)All.MaxDebugMessageLength);
            if (GL.GetDebugMessageLog(1, len, out var source, out var type, out var id, out var severity, out var strlen, out var str) > 0)
            {
                var consoleCol = Console.ForegroundColor;
                switch (severity)
                {
                case DebugSeverity.DebugSeverityHigh:
                    Console.ForegroundColor = ConsoleColor.Red;
                    break;

                case DebugSeverity.DebugSeverityLow:
                    Console.ForegroundColor = ConsoleColor.Blue;
                    break;

                case DebugSeverity.DebugSeverityMedium:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    break;

                case DebugSeverity.DebugSeverityNotification:
                    Console.ForegroundColor = ConsoleColor.Green;
                    break;
                }
                Console.WriteLine($"[{type}][{source}] {str}");
                Console.ForegroundColor = consoleCol;
            }
#endif
            InputLL.IsFocused(Window.Focused);
            Update?.Invoke(e.Time);
        }
コード例 #4
0
 /// <summary>
 /// Check if a key is pressed
 /// </summary>
 /// <param name="k">The key to test</param>
 /// <returns>A boolean describing whether the key is pressed or not</returns>
 public static bool IsKeyPressed(Key k)
 {
     return(InputLL.KeyDown(k));
 }
コード例 #5
0
ファイル: Keyboard.cs プロジェクト: himanshugoel2797/KokoroVR
 internal static bool IsKeyDown(Key k)
 {
     return(InputLL.KeyDown(k));
 }
コード例 #6
0
ファイル: Keyboard.cs プロジェクト: himanshugoel2797/KokoroVR
 /// <summary>
 /// Check if a key is pressed
 /// </summary>
 /// <param name="k">The key to test</param>
 /// <returns>A boolean describing whether the key is pressed or not</returns>
 internal static bool IsKeyReleased(Key k)
 {
     return(InputLL.KeyReleased(k));
 }
コード例 #7
0
 private static void Window_Resize(object sender, EventArgs e)
 {
     GPUStateMachine.SetViewport(0, 0, game.Width, game.Height);
     InputLL.SetWinXY(game.Location.X, game.Location.Y, game.ClientSize.Width, game.ClientSize.Height);
 }