Created
October 14, 2019 16:56
-
-
Save raizam/4045f3827a86b536e2bf2ff1323de5f8 to your computer and use it in GitHub Desktop.
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
module Glfw; | |
@nogc: | |
nothrow: | |
//Enums | |
enum MouseButton | |
{ | |
Btn1 = 0,//0 | |
Btn2 = 1,//1 | |
Btn3 = 2,//2 | |
Btn4 = 3,//3 | |
Btn5 = 4,//4 | |
Btn6 = 5,//5 | |
Btn7 = 6,//6 | |
Btn8 = 7,//7 | |
BtnLast = Btn8,//GLFW_MOUSE_BUTTON_8 | |
BtnLeft = Btn1,//GLFW_MOUSE_BUTTON_1 | |
BtnRight = Btn2,//GLFW_MOUSE_BUTTON_2 | |
BtnMiddle = Btn3,//GLFW_MOUSE_BUTTON_3 | |
} | |
enum Joystick | |
{ | |
Joy1 = 0,//0 | |
Joy2 = 1,//1 | |
Joy3 = 2,//2 | |
Joy4 = 3,//3 | |
Joy5 = 4,//4 | |
Joy6 = 5,//5 | |
Joy7 = 6,//6 | |
Joy8 = 7,//7 | |
Joy9 = 8,//8 | |
Joy10 = 9,//9 | |
Joy11 = 10,//10 | |
Joy12 = 11,//11 | |
Joy13 = 12,//12 | |
Joy14 = 13,//13 | |
Joy15 = 14,//14 | |
Joy16 = 15,//15 | |
} | |
enum Keyboard : int | |
{ | |
KeyUnknown = -1,//- 1 | |
KeySpace = 32,//32 | |
KeyApostrophe = 39,//39 | |
KeyComma = 44,//44 | |
KeyMinus = 45,//45 | |
KeyPeriod = 46,//46 | |
KeySlash = 47,//47 | |
Key0 = 48,//48 | |
Key1 = 49,//49 | |
Key2 = 50,//50 | |
Key3 = 51,//51 | |
Key4 = 52,//52 | |
Key5 = 53,//53 | |
Key6 = 54,//54 | |
Key7 = 55,//55 | |
Key8 = 56,//56 | |
Key9 = 57,//57 | |
KeySemicolon = 59,//59 | |
KeyEqual = 61,//61 | |
KeyA = 65,//65 | |
KeyB = 66,//66 | |
KeyC = 67,//67 | |
KeyD = 68,//68 | |
KeyE = 69,//69 | |
KeyF = 70,//70 | |
KeyG = 71,//71 | |
KeyH = 72,//72 | |
KeyI = 73,//73 | |
KeyJ = 74,//74 | |
KeyK = 75,//75 | |
KeyL = 76,//76 | |
KeyM = 77,//77 | |
KeyN = 78,//78 | |
KeyO = 79,//79 | |
KeyP = 80,//80 | |
KeyQ = 81,//81 | |
KeyR = 82,//82 | |
KeyS = 83,//83 | |
KeyT = 84,//84 | |
KeyU = 85,//85 | |
KeyV = 86,//86 | |
KeyW = 87,//87 | |
KeyX = 88,//88 | |
KeyY = 89,//89 | |
KeyZ = 90,//90 | |
KeyLeftBracket = 91,//91 | |
KeyBackslash = 92,//92 | |
KeyRightBracket = 93,//93 | |
KeyGraveAccent = 96,//96 | |
KeyWorld1 = 161,//161 | |
KeyWorld2 = 162,//162 | |
KeyEscape = 256,//256 | |
KeyEnter = 257,//257 | |
KeyTab = 258,//258 | |
KeyBackspace = 259,//259 | |
KeyInsert = 260,//260 | |
KeyDelete = 261,//261 | |
KeyRight = 262,//262 | |
KeyLeft = 263,//263 | |
KeyDown = 264,//264 | |
KeyUp = 265,//265 | |
KeyPageUp = 266,//266 | |
KeyPageDown = 267,//267 | |
KeyHome = 268,//268 | |
KeyEnd = 269,//269 | |
KeyCapsLock = 280,//280 | |
KeyScrollLock = 281,//281 | |
KeyNumLock = 282,//282 | |
KeyPrintScreen = 283,//283 | |
KeyPause = 284,//284 | |
KeyF1 = 290,//290 | |
KeyF2 = 291,//291 | |
KeyF3 = 292,//292 | |
KeyF4 = 293,//293 | |
KeyF5 = 294,//294 | |
KeyF6 = 295,//295 | |
KeyF7 = 296,//296 | |
KeyF8 = 297,//297 | |
KeyF9 = 298,//298 | |
KeyF10 = 299,//299 | |
KeyF11 = 300,//300 | |
KeyF12 = 301,//301 | |
KeyF13 = 302,//302 | |
KeyF14 = 303,//303 | |
KeyF15 = 304,//304 | |
KeyF16 = 305,//305 | |
KeyF17 = 306,//306 | |
KeyF18 = 307,//307 | |
KeyF19 = 308,//308 | |
KeyF20 = 309,//309 | |
KeyF21 = 310,//310 | |
KeyF22 = 311,//311 | |
KeyF23 = 312,//312 | |
KeyF24 = 313,//313 | |
KeyF25 = 314,//314 | |
KeyKp0 = 320,//320 | |
KeyKp1 = 321,//321 | |
KeyKp2 = 322,//322 | |
KeyKp3 = 323,//323 | |
KeyKp4 = 324,//324 | |
KeyKp5 = 325,//325 | |
KeyKp6 = 326,//326 | |
KeyKp7 = 327,//327 | |
KeyKp8 = 328,//328 | |
KeyKp9 = 329,//329 | |
KeyKpDecimal = 330,//330 | |
KeyKpDivide = 331,//331 | |
KeyKpMultiply = 332,//332 | |
KeyKpSubtract = 333,//333 | |
KeyKpAdd = 334,//334 | |
KeyKpEnter = 335,//335 | |
KeyKpEqual = 336,//336 | |
KeyLeftShift = 340,//340 | |
KeyLeftControl = 341,//341 | |
KeyLeftAlt = 342,//342 | |
KeyLeftSuper = 343,//343 | |
KeyRightShift = 344,//344 | |
KeyRightControl = 345,//345 | |
KeyRightAlt = 346,//346 | |
KeyRightSuper = 347,//347 | |
KeyMenu = 348,//348 | |
} | |
enum KeyModifiers | |
{ | |
Shift = 0x1,//0x0001 | |
Control = 0x2,//0x0002 | |
Alt = 0x4,//0x0004 | |
Super = 0x8,//0x0008 | |
} | |
enum KeyState | |
{ | |
Release = 0,//0 | |
Press = 1,//1 | |
Repeat = 2,//2 | |
} | |
enum SystemCursors | |
{ | |
ArrowCursor = 221185,//0x00036001 | |
IbeamCursor = 221186,//0x00036002 | |
CrosshairCursor = 221187,//0x00036003 | |
HandCursor = 221188,//0x00036004 | |
HresizeCursor = 221189,//0x00036005 | |
VresizeCursor = 221190,//0x00036006 | |
} | |
//Structs | |
//GLFWvidmode | |
public struct VideoMode | |
{ | |
int width; //size: 4, offset:0 | |
int height; //size: 4, offset:4 | |
int redBits; //size: 4, offset:8 | |
int greenBits; //size: 4, offset:12 | |
int blueBits; //size: 4, offset:16 | |
int refreshRate; //size: 4, offset:20 | |
} | |
//GLFWgammaramp | |
public struct GammaRamp | |
{ | |
ushort* red; //size: 8, offset:0 | |
ushort* green; //size: 8, offset:8 | |
ushort* blue; //size: 8, offset:16 | |
uint size; //size: 4, offset:24 | |
} | |
//GLFWimage | |
public struct Image | |
{ | |
int width; //size: 4, offset:0 | |
int height; //size: 4, offset:4 | |
ubyte* pixels; //size: 8, offset:8 | |
} | |
//OpaquePtrs | |
//GLFWmonitor | |
public struct Monitor | |
{ | |
immutable void* ptr; | |
public this(immutable void* ptr) { this.ptr = ptr; } | |
} | |
//GLFWwindow | |
public struct Window | |
{ | |
immutable void* ptr; | |
public this(immutable void* ptr) { this.ptr = ptr; } | |
} | |
//GLFWcursor | |
public struct Cursor | |
{ | |
immutable void* ptr; | |
public this(immutable void* ptr) { this.ptr = ptr; } | |
} | |
//Delegates | |
public alias ErrorDelegate = void function(int param0, char* param1); | |
public alias MonitorDelegate = void function(Monitor param0, int param1); | |
public alias WindowposDelegate = void function(Window param0, int param1, int param2); | |
public alias WindowsizeDelegate = void function(Window param0, int param1, int param2); | |
public alias WindowcloseDelegate = void function(Window param0); | |
public alias WindowrefreshDelegate = void function(Window param0); | |
public alias WindowfocusDelegate = void function(Window param0, int param1); | |
public alias WindowiconifyDelegate = void function(Window param0, int param1); | |
public alias FramebuffersizeDelegate = void function(Window param0, int param1, int param2); | |
public alias KeyDelegate = void function(Window param0, int param1, int param2, int param3, int param4); | |
public alias CharDelegate = void function(Window param0, uint param1); | |
public alias CharmodsDelegate = void function(Window param0, uint param1, int param2); | |
public alias MousebuttonDelegate = void function(Window param0, int param1, int param2, int param3); | |
public alias CursorposDelegate = void function(Window param0, double param1, double param2); | |
public alias CursorenterDelegate = void function(Window param0, int param1); | |
public alias ScrollDelegate = void function(Window param0, double param1, double param2); | |
public alias DropDelegate = void function(Window param0, int param1, char** param2); | |
public alias JoystickDelegate = void function(int param0, int param1); | |
public alias GlprocDelegate = void function(); | |
extern (C) int glfwInit(); | |
extern (C) void glfwTerminate(); | |
extern (C) void glfwGetVersion(out int major, out int minor, out int rev); | |
extern (C) ref char glfwGetVersionString(); | |
extern (C) ErrorDelegate glfwSetErrorCallback(ErrorDelegate cbfun); | |
extern (C) ref Monitor glfwGetMonitors(out int count); | |
extern (C) Monitor glfwGetPrimaryMonitor(); | |
extern (C) void glfwGetMonitorPos(Monitor monitor, out int xpos, out int ypos); | |
extern (C) void glfwGetMonitorPhysicalSize(Monitor monitor, out int widthMM, out int heightMM); | |
extern (C) ref char glfwGetMonitorName(Monitor monitor); | |
extern (C) MonitorDelegate glfwSetMonitorCallback(MonitorDelegate cbfun); | |
extern (C) ref VideoMode glfwGetVideoModes(Monitor monitor, out int count); | |
extern (C) ref VideoMode glfwGetVideoMode(Monitor monitor); | |
extern (C) void glfwSetGamma(Monitor monitor, float gamma); | |
extern (C) ref GammaRamp glfwGetGammaRamp(Monitor monitor); | |
extern (C) void glfwSetGammaRamp(Monitor monitor, out GammaRamp ramp); | |
extern (C) void glfwDefaultWindowHints(); | |
extern (C) void glfwWindowHint(int hint, int _value); | |
extern (C) Window glfwCreateWindow(int width, int height, in char title, Monitor monitor, Window share); | |
extern (C) void glfwDestroyWindow(Window window); | |
extern (C) int glfwWindowShouldClose(Window window); | |
extern (C) void glfwSetWindowShouldClose(Window window, int _value); | |
extern (C) void glfwSetWindowTitle(Window window, in char title); | |
extern (C) void glfwSetWindowIcon(Window window, int count, out Image images); | |
extern (C) void glfwGetWindowPos(Window window, out int xpos, out int ypos); | |
extern (C) void glfwSetWindowPos(Window window, int xpos, int ypos); | |
extern (C) void glfwGetWindowSize(Window window, out int width, out int height); | |
extern (C) void glfwSetWindowSizeLimits(Window window, int minwidth, int minheight, int maxwidth, int maxheight); | |
extern (C) void glfwSetWindowAspectRatio(Window window, int numer, int denom); | |
extern (C) void glfwSetWindowSize(Window window, int width, int height); | |
extern (C) void glfwGetFramebufferSize(Window window, out int width, out int height); | |
extern (C) void glfwGetWindowFrameSize(Window window, out int left, out int top, out int right, out int bottom); | |
extern (C) void glfwIconifyWindow(Window window); | |
extern (C) void glfwRestoreWindow(Window window); | |
extern (C) void glfwMaximizeWindow(Window window); | |
extern (C) void glfwShowWindow(Window window); | |
extern (C) void glfwHideWindow(Window window); | |
extern (C) void glfwFocusWindow(Window window); | |
extern (C) Monitor glfwGetWindowMonitor(Window window); | |
extern (C) void glfwSetWindowMonitor(Window window, Monitor monitor, int xpos, int ypos, int width, int height, int refreshRate); | |
extern (C) int glfwGetWindowAttrib(Window window, int attrib); | |
extern (C) void glfwSetWindowUserPointer(Window window, void* pointer); | |
extern (C) void* glfwGetWindowUserPointer(Window window); | |
extern (C) WindowposDelegate glfwSetWindowPosCallback(Window window, WindowposDelegate cbfun); | |
extern (C) WindowsizeDelegate glfwSetWindowSizeCallback(Window window, WindowsizeDelegate cbfun); | |
extern (C) WindowcloseDelegate glfwSetWindowCloseCallback(Window window, WindowcloseDelegate cbfun); | |
extern (C) WindowrefreshDelegate glfwSetWindowRefreshCallback(Window window, WindowrefreshDelegate cbfun); | |
extern (C) WindowfocusDelegate glfwSetWindowFocusCallback(Window window, WindowfocusDelegate cbfun); | |
extern (C) WindowiconifyDelegate glfwSetWindowIconifyCallback(Window window, WindowiconifyDelegate cbfun); | |
extern (C) FramebuffersizeDelegate glfwSetFramebufferSizeCallback(Window window, FramebuffersizeDelegate cbfun); | |
extern (C) void glfwPollEvents(); | |
extern (C) void glfwWaitEvents(); | |
extern (C) void glfwWaitEventsTimeout(double timeout); | |
extern (C) void glfwPostEmptyEvent(); | |
extern (C) int glfwGetInputMode(Window window, int mode); | |
extern (C) void glfwSetInputMode(Window window, int mode, int _value); | |
extern (C) ref char glfwGetKeyName(Keyboard key, int scancode); | |
extern (C) int glfwGetKey(Window window, Keyboard key); | |
extern (C) int glfwGetMouseButton(Window window, int button); | |
extern (C) void glfwGetCursorPos(Window window, out double xpos, out double ypos); | |
extern (C) void glfwSetCursorPos(Window window, double xpos, double ypos); | |
extern (C) Cursor glfwCreateCursor(out Image image, int xhot, int yhot); | |
extern (C) Cursor glfwCreateStandardCursor(SystemCursors shape); | |
extern (C) void glfwDestroyCursor(Cursor cursor); | |
extern (C) void glfwSetCursor(Window window, Cursor cursor); | |
extern (C) KeyDelegate glfwSetKeyCallback(Window window, KeyDelegate cbfun); | |
extern (C) CharDelegate glfwSetCharCallback(Window window, CharDelegate cbfun); | |
extern (C) CharmodsDelegate glfwSetCharModsCallback(Window window, CharmodsDelegate cbfun); | |
extern (C) MousebuttonDelegate glfwSetMouseButtonCallback(Window window, MousebuttonDelegate cbfun); | |
extern (C) CursorposDelegate glfwSetCursorPosCallback(Window window, CursorposDelegate cbfun); | |
extern (C) CursorenterDelegate glfwSetCursorEnterCallback(Window window, CursorenterDelegate cbfun); | |
extern (C) ScrollDelegate glfwSetScrollCallback(Window window, ScrollDelegate cbfun); | |
extern (C) DropDelegate glfwSetDropCallback(Window window, DropDelegate cbfun); | |
extern (C) int glfwJoystickPresent(Joystick joy); | |
extern (C) ref float glfwGetJoystickAxes(Joystick joy, out int count); | |
extern (C) ref ubyte glfwGetJoystickButtons(Joystick joy, out int count); | |
extern (C) ref char glfwGetJoystickName(Joystick joy); | |
extern (C) JoystickDelegate glfwSetJoystickCallback(JoystickDelegate cbfun); | |
extern (C) void glfwSetClipboardString(Window window, in char _string); | |
extern (C) ref char glfwGetClipboardString(Window window); | |
extern (C) double glfwGetTime(); | |
extern (C) void glfwSetTime(double time); | |
extern (C) ulong glfwGetTimerValue(); | |
extern (C) ulong glfwGetTimerFrequency(); | |
extern (C) void glfwMakeContextCurrent(Window window); | |
extern (C) Window glfwGetCurrentContext(); | |
extern (C) void glfwSwapBuffers(Window window); | |
extern (C) void glfwSwapInterval(int interval); | |
extern (C) int glfwExtensionSupported(in char extension); | |
extern (C) GlprocDelegate glfwGetProcAddress(in char procname); | |
extern (C) int glfwVulkanSupported(); | |
extern (C) ref char* glfwGetRequiredInstanceExtensions(out uint count); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment