This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static byte LOBYTE(ushort a) => | |
| (byte)(a & 0xFF); | |
| public static byte HIBYTE(ushort a) => | |
| (byte)((a >> 8) & 0xFF); | |
| public static ushort HIWORD(uint a) => | |
| (ushort)((a >> 16) & 0xFFFF); | |
| public static ushort LOWORD(uint a) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define MIN(A, B) ((A) < (B) ? (A) : (B)) | |
| #define MAX(A, B) ((A) > (B) ? (A) : (B)) | |
| #define CLAMP(N, LO, HI) (MIN(MAX((LO), (N)), (HI))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.ComponentModel; | |
| using System.Windows.Interop; | |
| using System.Windows.Input; | |
| using System.Runtime.InteropServices; | |
| using System.IO; | |
| using Windows.Win32.Foundation; | |
| using Windows.Win32.UI.WindowsAndMessaging; | |
| using Windows.Win32; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static T CycleEnum<T>(T type, int direction) where T : Enum | |
| { | |
| var values = (T[])Enum.GetValues(typeof(T)); | |
| var index = Array.IndexOf(values, type); | |
| var newIndex = Math.Clamp(index + direction, 0, values.Length - 1); | |
| return values[newIndex]; | |
| } |
OlderNewer