GLFW header

Advanced game related topics
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

GLFW header

Post by idle »

download libs here
http://www.glfw.org/download.html

linux test glfw 2.75 shared object
http://www.idlearts.com/glfw.zip

linux test glfw 3 static lib
http://www.idlearts.com/glfw3pb.zip


glfw 2.7.5 Windows version by eesau with the DLL and LIB files included here.
Last edited by idle on Mon Jun 04, 2012 3:11 am, edited 4 times in total.
Windows 11, Manjaro, Raspberry Pi OS
Image
Pureabc
User
User
Posts: 76
Joined: Mon Jan 16, 2006 1:11 am

Re: GLFW header

Post by Pureabc »

idle,

This looks interesting.

I grab the GLFW file, but it contain several dlls, which one do I use?

I am also having a problem compiling it though.
Getting the "Linker error":
unrecoginzed option: IGL, IGLU
Unresolved external symbol: _glViewport....

What files do I need to include?

Thank you.
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: GLFW header

Post by idle »

You will have to add the name of the imports for windows
change the import in the pbi at line 519 to gl.lib and line 549 to glu.lib
should be in your system32 folder
Also you could try xorc1zt's framework or use the imports from his lib
http://www.purebasic.fr/english/viewtop ... 16&t=48667
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: GLFW header

Post by djes »

I'm hacking a bit around OpenGL, and I've seen this thread. It seems easy to use native pb keyboard input, so I don't see the point of using GLFW... :?
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: GLFW header

Post by idle »

On linux PB screen doesn't play nicely with duel heads and it also locks the mouse
So it might be handy for some users.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: GLFW header

Post by djes »

Ok, thank you for the answer. I'd like to have a complete and sure multiplatform opengl initialisation/keyboard/joystick/image handling. I don't want to rely on external dll and to be able to port on another platform rapidly.
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: GLFW header

Post by idle »

you can always use the static libs, GLFW compiles both static and dynamic libs.
Windows 11, Manjaro, Raspberry Pi OS
Image
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Re: GLFW header

Post by eesau »

For anyone interested, here is the header for Windows (x86). Needs GLFW.dll and GLFWDLL.lib. Thanks to idle for the original version!

Code: Select all

; /************************************************************************
;  * GLFW - An OpenGL framework
;  * API version: 2.7
;  * WWW:         http://www.glfw.org/
;  *------------------------------------------------------------------------
;  * Copyright (c) 2002-2006 Marcus Geelnard
;  * Copyright (c) 2006-2010 Camilla Berglund
;  *
;  * This software is provided 'as-is', without any express Or implied
;  * warranty. In no event will the authors be held liable For any damages
;  * arising from the use of this software.
;  *
;  * Permission is granted To anyone To use this software For any purpose,
;  * including commercial applications, And To alter it And redistribute it
;  * freely, subject To the following restrictions:
;  *
;  * 1. The origin of this software must Not be misrepresented; you must not
;  *    claim that you wrote the original software. If you use this software
;  *    in a product, an acknowledgment in the product documentation would
;  *    be appreciated but is Not required.
;  *
;  * 2. Altered source versions must be plainly marked As such, And must Not
;  *    be misrepresented As being the original software.
;  *
;  * 3. This notice may Not be removed Or altered from any source
;  *    distribution.
;  *
;  *************************************************************************/


; /*************************************************************************
;  * GLFW version
;  *************************************************************************/

#GLFW_VERSION_MAJOR  =  2
#GLFW_VERSION_MINOR =   7
#GLFW_VERSION_REVISION= 3


; /*************************************************************************
;  * Input handling definitions
;  *************************************************************************/

;/* Key And button state/action definitions */
#GLFW_RELEASE =  0
#GLFW_PRESS  =  1

; /* Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
;  * For printable keys (such As A-Z, 0-9 etc), And values above 256
;  * represent special (non-printable) keys (e.g. F1, Page Up etc).
;  */
#GLFW_KEY_UNKNOWN  =  -1
#GLFW_KEY_SPACE   =    32
#GLFW_KEY_SPECIAL =    256
#GLFW_KEY_ESC          = (#GLFW_KEY_SPECIAL+1)
#GLFW_KEY_F1           = (#GLFW_KEY_SPECIAL+2)
#GLFW_KEY_F2           = (#GLFW_KEY_SPECIAL+3)
#GLFW_KEY_F3           = (#GLFW_KEY_SPECIAL+4)
#GLFW_KEY_F4           = (#GLFW_KEY_SPECIAL+5)
#GLFW_KEY_F5           = (#GLFW_KEY_SPECIAL+6)
#GLFW_KEY_F6           = (#GLFW_KEY_SPECIAL+7)
#GLFW_KEY_F7           = (#GLFW_KEY_SPECIAL+8)
#GLFW_KEY_F8           = (#GLFW_KEY_SPECIAL+9)
#GLFW_KEY_F9           = (#GLFW_KEY_SPECIAL+10)
#GLFW_KEY_F10          = (#GLFW_KEY_SPECIAL+11)
#GLFW_KEY_F11          = (#GLFW_KEY_SPECIAL+12)
#GLFW_KEY_F12          = (#GLFW_KEY_SPECIAL+13)
#GLFW_KEY_F13          = (#GLFW_KEY_SPECIAL+14)
#GLFW_KEY_F14          = (#GLFW_KEY_SPECIAL+15)
#GLFW_KEY_F15          = (#GLFW_KEY_SPECIAL+16)
#GLFW_KEY_F16          = (#GLFW_KEY_SPECIAL+17)
#GLFW_KEY_F17          = (#GLFW_KEY_SPECIAL+18)
#GLFW_KEY_F18          = (#GLFW_KEY_SPECIAL+19)
#GLFW_KEY_F19          = (#GLFW_KEY_SPECIAL+20)
#GLFW_KEY_F20          = (#GLFW_KEY_SPECIAL+21)
#GLFW_KEY_F21          = (#GLFW_KEY_SPECIAL+22)
#GLFW_KEY_F22          = (#GLFW_KEY_SPECIAL+23)
#GLFW_KEY_F23          = (#GLFW_KEY_SPECIAL+24)
#GLFW_KEY_F24          = (#GLFW_KEY_SPECIAL+25)
#GLFW_KEY_F25          = (#GLFW_KEY_SPECIAL+26)
#GLFW_KEY_UP           = (#GLFW_KEY_SPECIAL+27)
#GLFW_KEY_DOWN         = (#GLFW_KEY_SPECIAL+28)
#GLFW_KEY_LEFT         = (#GLFW_KEY_SPECIAL+29)
#GLFW_KEY_RIGHT        = (#GLFW_KEY_SPECIAL+30)
#GLFW_KEY_LSHIFT       = (#GLFW_KEY_SPECIAL+31)
#GLFW_KEY_RSHIFT       = (#GLFW_KEY_SPECIAL+32)
#GLFW_KEY_LCTRL        = (#GLFW_KEY_SPECIAL+33)
#GLFW_KEY_RCTRL        = (#GLFW_KEY_SPECIAL+34)
#GLFW_KEY_LALT         = (#GLFW_KEY_SPECIAL+35)
#GLFW_KEY_RALT         = (#GLFW_KEY_SPECIAL+36)
#GLFW_KEY_TAB          = (#GLFW_KEY_SPECIAL+37)
#GLFW_KEY_ENTER        = (#GLFW_KEY_SPECIAL+38)
#GLFW_KEY_BACKSPACE    = (#GLFW_KEY_SPECIAL+39)
#GLFW_KEY_INSERT       = (#GLFW_KEY_SPECIAL+40)
#GLFW_KEY_DEL          = (#GLFW_KEY_SPECIAL+41)
#GLFW_KEY_PAGEUP       = (#GLFW_KEY_SPECIAL+42)
#GLFW_KEY_PAGEDOWN     = (#GLFW_KEY_SPECIAL+43)
#GLFW_KEY_HOME         = (#GLFW_KEY_SPECIAL+44)
#GLFW_KEY_END          = (#GLFW_KEY_SPECIAL+45)
#GLFW_KEY_KP_0         = (#GLFW_KEY_SPECIAL+46)
#GLFW_KEY_KP_1         = (#GLFW_KEY_SPECIAL+47)
#GLFW_KEY_KP_2         = (#GLFW_KEY_SPECIAL+48)
#GLFW_KEY_KP_3         = (#GLFW_KEY_SPECIAL+49)
#GLFW_KEY_KP_4         = (#GLFW_KEY_SPECIAL+50)
#GLFW_KEY_KP_5         = (#GLFW_KEY_SPECIAL+51)
#GLFW_KEY_KP_6         = (#GLFW_KEY_SPECIAL+52)
#GLFW_KEY_KP_7         = (#GLFW_KEY_SPECIAL+53)
#GLFW_KEY_KP_8         = (#GLFW_KEY_SPECIAL+54)
#GLFW_KEY_KP_9         = (#GLFW_KEY_SPECIAL+55)
#GLFW_KEY_KP_DIVIDE    = (#GLFW_KEY_SPECIAL+56)
#GLFW_KEY_KP_MULTIPLY  = (#GLFW_KEY_SPECIAL+57)
#GLFW_KEY_KP_SUBTRACT  = (#GLFW_KEY_SPECIAL+58)
#GLFW_KEY_KP_ADD       = (#GLFW_KEY_SPECIAL+59)
#GLFW_KEY_KP_DECIMAL   = (#GLFW_KEY_SPECIAL+60)
#GLFW_KEY_KP_EQUAL     = (#GLFW_KEY_SPECIAL+61)
#GLFW_KEY_KP_ENTER     = (#GLFW_KEY_SPECIAL+62)
#GLFW_KEY_KP_NUM_LOCK  = (#GLFW_KEY_SPECIAL+63)
#GLFW_KEY_CAPS_LOCK    = (#GLFW_KEY_SPECIAL+64)
#GLFW_KEY_SCROLL_LOCK  = (#GLFW_KEY_SPECIAL+65)
#GLFW_KEY_PAUSE        = (#GLFW_KEY_SPECIAL+66)
#GLFW_KEY_LSUPER       = (#GLFW_KEY_SPECIAL+67)
#GLFW_KEY_RSUPER       = (#GLFW_KEY_SPECIAL+68)
#GLFW_KEY_MENU         = (#GLFW_KEY_SPECIAL+69)
#GLFW_KEY_LAST    =     #GLFW_KEY_MENU

;/* Mouse button definitions */
#GLFW_MOUSE_BUTTON_1  =    0
#GLFW_MOUSE_BUTTON_2   =   1
#GLFW_MOUSE_BUTTON_3   =   2
#GLFW_MOUSE_BUTTON_4   =   3
#GLFW_MOUSE_BUTTON_5   =   4
#GLFW_MOUSE_BUTTON_6   =   5
#GLFW_MOUSE_BUTTON_7   =   6
#GLFW_MOUSE_BUTTON_8    =  7
#GLFW_MOUSE_BUTTON_LAST  = #GLFW_MOUSE_BUTTON_8

;/* Mouse button aliases */
#GLFW_MOUSE_BUTTON_LEFT   = #GLFW_MOUSE_BUTTON_1
#GLFW_MOUSE_BUTTON_RIGHT  = #GLFW_MOUSE_BUTTON_2
#GLFW_MOUSE_BUTTON_MIDDLE  = #GLFW_MOUSE_BUTTON_3


;/* Joystick identifiers */
#GLFW_JOYSTICK_1   =       0
#GLFW_JOYSTICK_2   =       1
#GLFW_JOYSTICK_3    =      2
#GLFW_JOYSTICK_4    =      3
#GLFW_JOYSTICK_5    =      4
#GLFW_JOYSTICK_6    =      5
#GLFW_JOYSTICK_7    =      6
#GLFW_JOYSTICK_8    =      7
#GLFW_JOYSTICK_9    =      8
#GLFW_JOYSTICK_10   =      9
#GLFW_JOYSTICK_11    =     10
#GLFW_JOYSTICK_12    =     11
#GLFW_JOYSTICK_13    =     12
#GLFW_JOYSTICK_14    =     13
#GLFW_JOYSTICK_15    =     14
#GLFW_JOYSTICK_16     =    15
#GLFW_JOYSTICK_LAST    =   #GLFW_JOYSTICK_16


;/*************************************************************************
;  * Other definitions
;  *************************************************************************/

;/* glfwOpenWindow modes */
#GLFW_WINDOW    =           $00010001
#GLFW_FULLSCREEN =          $00010002

;/* glfwGetWindowParam tokens */
#GLFW_OPENED       =        $00020001
#GLFW_ACTIVE          =     $00020002
#GLFW_ICONIFIED       =     $00020003
#GLFW_ACCELERATED    =      $00020004
#GLFW_RED_BITS           =  $00020005
#GLFW_GREEN_BITS        =   $00020006
#GLFW_BLUE_BITS             = $00020007
#GLFW_ALPHA_BITS            = $00020008
#GLFW_DEPTH_BITS            = $00020009
#GLFW_STENCIL_BITS          = $0002000A

; ;/* The following constants are used For both glfwGetWindowParam
;  * And glfwOpenWindowHint
;  */
#GLFW_REFRESH_RATE          = $0002000B
#GLFW_ACCUM_RED_BITS        = $0002000C
#GLFW_ACCUM_GREEN_BITS      = $0002000D
#GLFW_ACCUM_BLUE_BITS       = $0002000E
#GLFW_ACCUM_ALPHA_BITS      = $0002000F
#GLFW_AUX_BUFFERS           = $00020010
#GLFW_STEREO                = $00020011
#GLFW_WINDOW_NO_RESIZE      = $00020012
#GLFW_FSAA_SAMPLES          = $00020013
#GLFW_OPENGL_VERSION_MAJOR  = $00020014
#GLFW_OPENGL_VERSION_MINOR  = $00020015
#GLFW_OPENGL_FORWARD_COMPAT  = $00020016
#GLFW_OPENGL_DEBUG_CONTEXT  = $00020017
#GLFW_OPENGL_PROFILE        = $00020018

;/* GLFW_OPENGL_PROFILE tokens */
#GLFW_OPENGL_CORE_PROFILE   = $00050001
#GLFW_OPENGL_COMPAT_PROFILE  = $00050002

;/* glfwEnable/glfwDisable tokens */
#GLFW_MOUSE_CURSOR          = $00030001
#GLFW_STICKY_KEYS           = $00030002
#GLFW_STICKY_MOUSE_BUTTONS  = $00030003
#GLFW_SYSTEM_KEYS           = $00030004
#GLFW_KEY_REPEAT            = $00030005
#GLFW_AUTO_POLL_EVENTS      = $00030006

;/* glfwWaitThread wait modes */
#GLFW_WAIT                  = $00040001
#GLFW_NOWAIT                = $00040002

;/* glfwGetJoystickParam tokens */
#GLFW_PRESENT               = $00050001
#GLFW_AXES                  = $00050002
#GLFW_BUTTONS               = $00050003

;/* glfwReadImage/glfwLoadTexture2D flags */
#GLFW_NO_RESCALE_BIT        = $00000001 ;;/* Only For glfwReadImage */
#GLFW_ORIGIN_UL_BIT         = $00000002
#GLFW_BUILD_MIPMAPS_BIT     = $00000004 ;;/* Only For glfwLoadTexture2D */
#GLFW_ALPHA_MAP_BIT         = $00000008

;/* Time spans longer than this (seconds) are considered To be infinity */
#GLFW_INFINITY = 100000.0


;/*************************************************************************
;  * Typedefs
;  *************************************************************************/

;/* The video mode Structure used by glfwGetVideoModes() */
Structure GLFWvidmode;
  Width.l
  Height.l
  RedBits.l
  BlueBits.l
  GreenBits.l
EndStructure

;/* Image/texture information */
Structure  GLFWimage;
  Width.l
  Height.l
  Format.l
  BytesPerPixel.l
  *idata
EndStructure;

;/* Thread ID */
Structure GLFWthread;
EndStructure
;/* Mutex object */
Structure GLFWmutex;
EndStructure
;/* Condition variable object */
Structure GLFWcond;
EndStructure

; ;/* Function pointer types */
; typedef void = (#GLFWCALL * GLFWwindowsizefun)(int,int);
; typedef Int  = (#GLFWCALL * GLFWwindowclosefun)(void);
; typedef void (GLFWCALL * GLFWwindowrefreshfun)(void);
; typedef void (GLFWCALL * GLFWmousebuttonfun)(int,int);
; typedef void (GLFWCALL * GLFWmouseposfun)(int,int);
; typedef void (GLFWCALL * GLFWmousewheelfun)(int);
; typedef void (GLFWCALL * GLFWkeyfun)(int,int);
; typedef void (GLFWCALL * GLFWcharfun)(int,int);
; typedef void (GLFWCALL * GLFWthreadfun)(void *);

CompilerIf #PB_Compiler_Processor = #PB_Processor_x64

	CompilerError "Please use the x86 compiler, this import library is not compatible with x64"

CompilerEndIf

Import "GLFWDLL.lib"

	;/* GLFW initialization, termination And version querying */
	glfwInit() As "_glfwInit@0"
	glfwTerminate() As "_glfwTerminate@0"
	glfwGetVersion(*major, *minor, *rev) As "_glfwGetVersion@12"
	
	;/* Window handling */
	glfwOpenWindow(width, height, redbits, greenbits, bluebits, alphabits, depthbits, stencilbits, mode) As "_glfwOpenWindow@36"
	glfwOpenWindowHint(target, hint) As "_glfwOpenWindowHint@8"
	glfwCloseWindow() As "_glfwCloseWindow@0"
	glfwSetWindowTitle(title.p-ascii) As "_glfwSetWindowTitle@4"
	glfwGetWindowSize(*width, *height) As "_glfwGetWindowSize@8"
	glfwSetWindowSize(width, height) As "_glfwSetWindowSize@8"
	glfwSetWindowPos(x, y) As "_glfwSetWindowPos@8"
	glfwIconifyWindow() As "_glfwIconifyWindow@0"
	glfwRestoreWindow() As "_glfwRestoreWindow@0"
	glfwSwapBuffers() As "_glfwSwapBuffers@0"
	glfwSwapInterval(interval) As "_glfwSwapInterval@4"
	glfwGetWindowParam(param) As "_glfwGetWindowParam@4"
	glfwSetWindowSizeCallback(*cbfun) As "_glfwSetWindowSizeCallback@4"
	glfwSetWindowCloseCallback(*cbfun) As "_glfwSetWindowCloseCallback@4"
	glfwSetWindowRefreshCallback(*cbfun) As "_glfwSetWindowRefreshCallback@4"
	
	;/* Video mode functions */
	glfwGetVideoModes(*list.GLFWvidmode, maxcount) As "_glfwGetVideoModes@8"
	glfwGetDesktopMode(*mode.GLFWvidmode) As "_glfwGetDesktopMode@4"
	
	;/* Input handling */
	glfwPollEvents() As "_glfwPollEvents@0"
	glfwWaitEvents() As "_glfwWaitEvents@0"
	glfwGetKey(key) As "_glfwGetKey@4"
	glfwGetMouseButton(button) As "_glfwGetMouseButton@4"
	glfwGetMousePos(*xpos, *ypos) As "_glfwGetMousePos@8"
	glfwSetMousePos(xpos, ypos) As "_glfwSetMousePos@8"
	glfwGetMouseWheel() As "_glfwGetMouseWheel@0"
	glfwSetMouseWheel(pos) As "_glfwSetMouseWheel@4"
	glfwSetKeyCallback(*cbfun) As "_glfwSetKeyCallback@4"
	glfwSetCharCallback(*cbfun) As "_glfwSetCharCallback@4"
	glfwSetMouseButtonCallback(*cbfun) As "_glfwSetMouseButtonCallback@4"
	glfwSetMousePosCallback(*cbfun) As "_glfwSetMousePosCallback@4"
	glfwSetMouseWheelCallback(*cbfun) As "_glfwSetMouseWheelCallback@4"
	
	;/* Joystick input */
	glfwGetJoystickParam(joy, param) As "_glfwGetJoystickParam@8"
	glfwGetJoystickPos(joy, *pos.float, numaxes) As "_glfwGetJoystickPos@12"
	glfwGetJoystickButtons(joy, *buttons.word, numbuttons) As "_glfwGetJoystickButtons@12"
	
	;/* Time */
	glfwGetTime.d() As "_glfwGetTime@0"
	glfwSetTime(time.d) As "_glfwSetTime@8"
	glfwSleep(time.d) As "_glfwSleep@8"

	;/* Extension support */	
	glfwExtensionSupported(extension.p-ascii) As "_glfwExtensionSupported@4"
	glfwGetProcAddress(procname.p-ascii) As "_glfwGetProcAddress@4"
	glfwGetGLVersion(*major, *minor, *rev) As "_glfwGetGLVersion@12"
	
	;/* Threading support */
	glfwCreateThread(*fun, *arg) As "_glfwCreateThread@8"
	glfwDestroyThread(ID) As "_glfwDestroyThread@4"
	glfwWaitThread(ID, waitmode) As "_glfwWaitThread@8"
	glfwGetThreadID() As "_glfwGetThreadID@0"
	glfwCreateMutex() As "_glfwCreateMutex@0"
	glfwDestroyMutex(mutex) As "_glfwDestroyMutex@4"
	glfwLockMutex(mutex) As "_glfwLockMutex@4"
	glfwUnlockMutex(mutex) As "_glfwUnlockMutex@4"
	glfwCreateCond() As "_glfwCreateCond@0"
	glfwDestroyCond(cond) As "_glfwDestroyCond@4"
	glfwWaitCond(cond, mutex, timeout.d) As "_glfwWaitCond@16"
	glfwSignalCond(cond) As "_glfwSignalCond@4"
	glfwBroadcastCond(cond) As "_glfwBroadcastCond@4"
	glfwGetNumberOfProcessors() As "_glfwGetNumberOfProcessors@0"
	
	;/* Enable/disable functions */
	glfwEnable(token) As "_glfwEnable@4"
	glfwDisable(token) As "_glfwDisable@4"
	
	;/* Image/texture I/O support */
	glfwReadImage(name.p-ascii, *img.GLFWimage, flags) As "_glfwReadImage@12"
	glfwReadMemoryImage(*mData, size, *img.GLFWimage, flags) As "_glfwReadMemoryImage@16"
	glfwFreeImage(*img.GLFWimage) As "_glfwFreeImage@4"
	glfwLoadTexture2D(name.p-ascii, flags) As "_glfwLoadTexture2D@4"
	glfwLoadMemoryTexture2D(*mData, size, flags) As "_glfwLoadMemoryTexture2D@12"
	glfwLoadTextureImage2D(*img.GLFWimage, flags) As "_glfwLoadTextureImage2D@8"

EndImport
Last edited by eesau on Sat Jun 02, 2012 9:27 am, edited 1 time in total.
gekkonier
User
User
Posts: 78
Joined: Mon Apr 23, 2007 9:42 am

Re: GLFW header

Post by gekkonier »

Thank you all!
Does anyone know how we can get this to work on OSX?
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: GLFW header

Post by idle »

The first posts headers should be ok for OSX

and thanks for the windows headers eesau.
Windows 11, Manjaro, Raspberry Pi OS
Image
xorc1zt
Enthusiast
Enthusiast
Posts: 276
Joined: Sat Jul 09, 2011 7:57 am

Re: GLFW header

Post by xorc1zt »

anyone has the header for the 3.0 version please ?
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: GLFW header

Post by idle »

where's the 3.0 version? Current version is 2.7.5
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: GLFW header

Post by idle »

thanks didn't see that
I sent you a partial port of the v3 header.

here's the header with static and dynamic imports, no time to test it!

Code: Select all

; ;/*************************************************************************
;  * GLFW - An OpenGL library
;  * API version: 3.0
;  * WWW:         http://www.glfw.org/
;  *------------------------------------------------------------------------
;  * Copyright (c) 2002-2006 Marcus Geelnard
;  * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
;  *
;  * This software is provided 'as-is', without any express Or implied
;  * warranty. In no event will the authors be held liable For any damages
;  * arising from the use of this software.
;  *
;  * Permission is granted To anyone To use this software For any purpose,
;  * including commercial applications, And To alter it And redistribute it
;  * freely, subject To the following restrictions:
;  *
;  * 1. The origin of this software must Not be misrepresented; you must not
;  *    claim that you wrote the original software. If you use this software
;  *    in a product, an acknowledgment in the product documentation would
;  *    be appreciated but is Not required.
;  *
;  * 2. Altered source versions must be plainly marked As such, And must Not
;  *    be misrepresented As being the original software.
;  *
;  * 3. This notice may Not be removed Or altered from any source
;  *    distribution.
;  *
;  *************************************************************************/

; ;/*************************************************************************
;  * GLFW version
;  *************************************************************************/

#GLFW_VERSION_MAJOR  =  3
#GLFW_VERSION_MINOR  =  0
#GLFW_VERSION_REVISION =0


; ;/*************************************************************************
;  * Input handling definitions
;  *************************************************************************/

;;/* Key And button state/action definitions */
#GLFW_RELEASE  =          0
#GLFW_PRESS    =          1

; ;/* Keyboard raw key codes.
;  * These key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60),
;  * but re-arranged To Map To 7-bit ASCII For printable keys (function keys are
;  * put in the 256+ range).
;  * The naming of the key codes follow these rules:
;  *  - The US keyboard layout is used.
;  *  - Names of printable alpha-numeric characters are used (e.g. "A", "R",
;  *    "3", etc).
;  *  - For non-alphanumeric characters, Unicode:ish names are used (e.g.
;  *    "COMMA", "LEFT_SQUARE_BRACKET", etc). Note that some names do Not
;  *    correspond To the Unicode standard (usually For brevity).
;  *  - Keys that lack a clear US mapping are named "WORLD_x".
;  *  - For non-printable keys, custom names are used (e.g. "F4",
;  *    "BACKSPACE", etc).
;  */
; 
; ;/* Printable keys */
#GLFW_KEY_SPACE  =                32
#GLFW_KEY_APOSTROPHE =            39 ;' ;/* ' */
#GLFW_KEY_COMMA   =               44 ;' ;/* , */
#GLFW_KEY_MINUS    =              45 ;' ;/* - */
#GLFW_KEY_PERIOD  =               46 ;' ;/* . */
#GLFW_KEY_SLASH   =               47  ;';/* / */
#GLFW_KEY_0    =                  48
#GLFW_KEY_1     =                 49
#GLFW_KEY_2     =                 50
#GLFW_KEY_3      =                51
#GLFW_KEY_4      =                52
#GLFW_KEY_5      =                53
#GLFW_KEY_6       =               54
#GLFW_KEY_7      =                55
#GLFW_KEY_8      =                56
#GLFW_KEY_9       =               57
#GLFW_KEY_SEMICOLON =             59  ;;/* ; */
#GLFW_KEY_EQUAL  =                61  ;;/* = */
#GLFW_KEY_A    =                  65
#GLFW_KEY_B    =                  66
#GLFW_KEY_C    =                  67
#GLFW_KEY_D    =                  68
#GLFW_KEY_E    =                  69
#GLFW_KEY_F     =                 70
#GLFW_KEY_G    =                  71
#GLFW_KEY_H    =                  72
#GLFW_KEY_I     =                 73
#GLFW_KEY_J     =                 74
#GLFW_KEY_K     =                 75
#GLFW_KEY_L      =                76
#GLFW_KEY_M     =                 77
#GLFW_KEY_N      =                78
#GLFW_KEY_O     =                 79
#GLFW_KEY_P     =                 80
#GLFW_KEY_Q    =                  81
#GLFW_KEY_R    =                  82
#GLFW_KEY_S    =                  83
#GLFW_KEY_T    =                  84
#GLFW_KEY_U    =                  85
#GLFW_KEY_V    =                  86
#GLFW_KEY_W   =                   87
#GLFW_KEY_X    =                  88
#GLFW_KEY_Y    =                  89
#GLFW_KEY_Z     =                 90
#GLFW_KEY_LEFT_BRACKET =          91  ;;/* [ */
#GLFW_KEY_BACKSLASH   =           92  ;;/* \ */
#GLFW_KEY_RIGHT_BRACKET =         93  ;;/* ] */
#GLFW_KEY_GRAVE_ACCENT  =         96  ;;/* ` */
#GLFW_KEY_WORLD_1   =             161 ;;/* non-US #1 */
#GLFW_KEY_WORLD_2   =             162 ;;/* non-US #2 */

;;/* Function keys */
#GLFW_KEY_ESCAPE   =              256
#GLFW_KEY_ENTER    =              257
#GLFW_KEY_TAB     =               258
#GLFW_KEY_BACKSPACE =             259
#GLFW_KEY_INSERT   =              260
#GLFW_KEY_DELETE   =              261
#GLFW_KEY_RIGHT    =              262
#GLFW_KEY_LEFT    =               263
#GLFW_KEY_DOWN   =                264
#GLFW_KEY_UP    =                 265
#GLFW_KEY_PAGE_UP =               266
#GLFW_KEY_PAGE_DOWN=              267
#GLFW_KEY_HOME  =                 268
#GLFW_KEY_END   =                 269
#GLFW_KEY_CAPS_LOCK =             280
#GLFW_KEY_SCROLL_LOCK =           281
#GLFW_KEY_NUM_LOCK   =            282
#GLFW_KEY_PRINT_SCREEN =          283
#GLFW_KEY_PAUSE   =               284
#GLFW_KEY_F1   =                  290
#GLFW_KEY_F2    =                 291
#GLFW_KEY_F3    =                 292
#GLFW_KEY_F4    =                 293
#GLFW_KEY_F5    =                 294
#GLFW_KEY_F6    =                 295
#GLFW_KEY_F7    =                 296
#GLFW_KEY_F8    =                 297
#GLFW_KEY_F9    =                 298
#GLFW_KEY_F10   =                 299
#GLFW_KEY_F11    =                300
#GLFW_KEY_F12   =                 301
#GLFW_KEY_F13    =                302
#GLFW_KEY_F14    =                303
#GLFW_KEY_F15   =                 304
#GLFW_KEY_F16   =                 305
#GLFW_KEY_F17   =                 306
#GLFW_KEY_F18   =                 307
#GLFW_KEY_F19   =                 308
#GLFW_KEY_F20   =                 309
#GLFW_KEY_F21    =                310
#GLFW_KEY_F22   =                 311
#GLFW_KEY_F23   =                 312
#GLFW_KEY_F24   =                 313
#GLFW_KEY_F25   =                 314
#GLFW_KEY_KP_0   =                320
#GLFW_KEY_KP_1   =                321
#GLFW_KEY_KP_2   =                322
#GLFW_KEY_KP_3   =                323
#GLFW_KEY_KP_4   =                324
#GLFW_KEY_KP_5   =                325
#GLFW_KEY_KP_6    =               326
#GLFW_KEY_KP_7   =                327
#GLFW_KEY_KP_8    =               328
#GLFW_KEY_KP_9    =               329
#GLFW_KEY_KP_DECIMAL =            330
#GLFW_KEY_KP_DIVIDE  =            331
#GLFW_KEY_KP_MULTIPLY =           332
#GLFW_KEY_KP_SUBTRACT  =          333
#GLFW_KEY_KP_ADD   =              334
#GLFW_KEY_KP_ENTER =              335
#GLFW_KEY_KP_EQUAL  =             336
#GLFW_KEY_LEFT_SHIFT  =           340
#GLFW_KEY_LEFT_CONTROL =          341
#GLFW_KEY_LEFT_ALT   =            342
#GLFW_KEY_LEFT_SUPER  =           343
#GLFW_KEY_RIGHT_SHIFT  =          344
#GLFW_KEY_RIGHT_CONTROL  =        345
#GLFW_KEY_RIGHT_ALT   =           346
#GLFW_KEY_RIGHT_SUPER  =          347
#GLFW_KEY_MENU    =               348
#GLFW_KEY_LAST     =              #GLFW_KEY_MENU

;;/* GLFW 2.x key name aliases (deprecated) */
#GLFW_KEY_ESC    =    #GLFW_KEY_ESCAPE
#GLFW_KEY_DEL    =    #GLFW_KEY_DELETE
#GLFW_KEY_PAGEUP   =   #GLFW_KEY_PAGE_UP
#GLFW_KEY_PAGEDOWN   =  #GLFW_KEY_PAGE_DOWN
#GLFW_KEY_KP_NUM_LOCK  = #GLFW_KEY_NUM_LOCK
#GLFW_KEY_LCTRL    =     #GLFW_KEY_LEFT_CONTROL
#GLFW_KEY_LSHIFT    =    #GLFW_KEY_LEFT_SHIFT
#GLFW_KEY_LALT    =       #GLFW_KEY_LEFT_ALT
#GLFW_KEY_LSUPER     =   #GLFW_KEY_LEFT_SUPER
#GLFW_KEY_RCTRL     =  #GLFW_KEY_RIGHT_CONTROL
#GLFW_KEY_RSHIFT    =  #GLFW_KEY_RIGHT_SHIFT
#GLFW_KEY_RALT    =  #GLFW_KEY_RIGHT_ALT
#GLFW_KEY_RSUPER    = #GLFW_KEY_RIGHT_SUPER

;/* Mouse button definitions */
#GLFW_MOUSE_BUTTON_1   =   0
#GLFW_MOUSE_BUTTON_2   =   1
#GLFW_MOUSE_BUTTON_3   =   2
#GLFW_MOUSE_BUTTON_4   =   3
#GLFW_MOUSE_BUTTON_5   =   4
#GLFW_MOUSE_BUTTON_6   =   5
#GLFW_MOUSE_BUTTON_7   =   6
#GLFW_MOUSE_BUTTON_8   =   7
#GLFW_MOUSE_BUTTON_LAST = #GLFW_MOUSE_BUTTON_8

;/* Mouse button aliases */
#GLFW_MOUSE_BUTTON_LEFT   = #GLFW_MOUSE_BUTTON_1
#GLFW_MOUSE_BUTTON_RIGHT  = #GLFW_MOUSE_BUTTON_2
#GLFW_MOUSE_BUTTON_MIDDLE = #GLFW_MOUSE_BUTTON_3

;/* Joystick identifiers */
#GLFW_JOYSTICK_1     =    0
#GLFW_JOYSTICK_2    =     1
#GLFW_JOYSTICK_3    =     2
#GLFW_JOYSTICK_4    =     3
#GLFW_JOYSTICK_5    =     4
#GLFW_JOYSTICK_6    =     5
#GLFW_JOYSTICK_7    =     6
#GLFW_JOYSTICK_8    =     7
#GLFW_JOYSTICK_9    =     8
#GLFW_JOYSTICK_10   =     9
#GLFW_JOYSTICK_11   =     10
#GLFW_JOYSTICK_12   =     11
#GLFW_JOYSTICK_13   =     12
#GLFW_JOYSTICK_14   =     13
#GLFW_JOYSTICK_15   =     14
#GLFW_JOYSTICK_16   =     15
#GLFW_JOYSTICK_LAST   =   #GLFW_JOYSTICK_16


;/*************************************************************************
; * Other definitions
; *************************************************************************/

;/* glfwOpenWindow modes */
#GLFW_WINDOWED    =        $00010001
#GLFW_FULLSCREEN   =       $00010002

;/* glfwGetWindowParam tokens */
#GLFW_ACTIVE      =        $00020001
#GLFW_ICONIFIED   =        $00020002
#GLFW_ACCELERATED  =       $00020003
#GLFW_OPENGL_REVISION  =   $00020004

;/* The following constants are used For both glfwGetWindowParam
; * And glfwOpenWindowHint
; */
#GLFW_RED_BITS   =         $00021000
#GLFW_GREEN_BITS =         $00021001
#GLFW_BLUE_BITS     =      $00021002
#GLFW_ALPHA_BITS    =      $00021003
#GLFW_DEPTH_BITS    =      $00021004
#GLFW_STENCIL_BITS  =      $00021005
#GLFW_REFRESH_RATE  =      $00021006
#GLFW_ACCUM_RED_BITS =     $00021007
#GLFW_ACCUM_GREEN_BITS =    $00021008
#GLFW_ACCUM_BLUE_BITS  =    $00021009
#GLFW_ACCUM_ALPHA_BITS  =   $0002100A
#GLFW_AUX_BUFFERS   =       $0002100B
#GLFW_STEREO     =          $0002100C
#GLFW_WINDOW_RESIZABLE  =   $0002100D
#GLFW_FSAA_SAMPLES   =      $0002100E
#GLFW_OPENGL_VERSION_MAJOR = $0002100F
#GLFW_OPENGL_VERSION_MINOR = $00021010
#GLFW_OPENGL_FORWARD_COMPAT = $00021011
#GLFW_OPENGL_DEBUG_CONTEXT = $00021012
#GLFW_OPENGL_PROFILE   =    $00021013
#GLFW_OPENGL_ROBUSTNESS  =  $00021014

;/* GLFW_OPENGL_ROBUSTNESS mode tokens */
#GLFW_OPENGL_NO_ROBUSTNESS    =     $00000000
#GLFW_OPENGL_NO_RESET_NOTIFICATION = $00000001
#GLFW_OPENGL_LOSE_CONTEXT_ON_RESET = $00000002

;/* GLFW_OPENGL_PROFILE bit tokens */
#GLFW_OPENGL_NO_PROFILE  =  $00000000
#GLFW_OPENGL_CORE_PROFILE = $00000001
#GLFW_OPENGL_COMPAT_PROFILE = $00000002
#GLFW_OPENGL_ES2_PROFILE =  $00000004

;/* glfwGetInputMode/glfwSetInputMode tokens */
#GLFW_CURSOR_MODE   =       $00030001
#GLFW_STICKY_KEYS   =       $00030002
#GLFW_STICKY_MOUSE_BUTTONS = $00030003
#GLFW_SYSTEM_KEYS   =       $00030004
#GLFW_KEY_REPEAT    =       $00030005

;/* GLFW_CURSOR_MODE values */
#GLFW_CURSOR_NORMAL =      $00040001
#GLFW_CURSOR_HIDDEN   =    $00040002
#GLFW_CURSOR_CAPTURED =    $00040003

;/* glfwGetJoystickParam tokens */
#GLFW_PRESENT  =            $00050001
#GLFW_AXES      =           $00050002
#GLFW_BUTTONS   =           $00050003

;/* glfwGetError/glfwErrorString tokens */
#GLFW_NO_ERROR   =          0
#GLFW_NOT_INITIALIZED   =   $00070001
#GLFW_NO_CURRENT_WINDOW  =  $00070002
#GLFW_INVALID_ENUM  =       $00070003
#GLFW_INVALID_VALUE    =    $00070004
#GLFW_OUT_OF_MEMORY   =     $00070005
#GLFW_OPENGL_UNAVAILABLE  = $00070006
#GLFW_VERSION_UNAVAILABLE = $00070007
#GLFW_PLATFORM_ERROR   =    $00070008
#GLFW_WINDOW_NOT_ACTIVE  =  $00070009
#GLFW_FORMAT_UNAVAILABLE =  $0007000A

;/* Gamma ramps */
#GLFW_GAMMA_RAMP_SIZE  =    256

;/*************************************************************************
; * Typedefs
; *************************************************************************/

; ;/* Window handle type */
; typedef void* ;
; 
; ;/* Function pointer types */
; typedef void (* GLFWerrorfun)(int,const char*);
; typedef void (* sizefun)(,int,int);
; typedef Int  (* closefun)();
; typedef void (* refreshfun)();
; typedef void (* focusfun)(,int);
; typedef void (* iconifyfun)(,int);
; typedef void (* GLFWmousebuttonfun)(,int,int);
; typedef void (* GLFWmouseposfun)(,int,int);
; typedef void (* GLFWcursorenterfun)(,int);
; typedef void (* GLFWscrollfun)(,double,double);
; typedef void (* GLFWkeyfun)(,int,int);
; typedef void (* GLFWcharfun)(,int);

;/* The video mode Structure used by glfwGetVideoModes */
Structure GLFWvidmode;
  Width.l
  Height.l;
  RedBits.l
  BlueBits.l
  GreenBits.l
EndStructure 
     

Structure GLFWgammaramp;
  red.u[#GLFW_GAMMA_RAMP_SIZE];
  green.u[#GLFW_GAMMA_RAMP_SIZE];
  blue.u[#GLFW_GAMMA_RAMP_SIZE];
EndStructure

#static = 1

CompilerIf  #Static 

ImportC "-lGLU" : EndImport 


ImportC "./src/libglfw.a"
 glfwInit();
 glfwTerminate();
 glfwGetVersion(*major,*minor,*rev);
 glfwGetVersionString();

;/* Error handling */
 glfwGetError();
 glfwErrorString(error.i);
 glfwSetErrorCallback(*cbfun);

;/* Video mode functions */
 glfwGetVideoModes(*GLFWvidmode,maxcount.i);
 glfwGetDesktopMode(*GLFWvidmode);

;/* Gamma ramp functions */
 glfwSetGamma(gamma.f);
 glfwGetGammaRamp(*GLFWgammaramp);
 glfwSetGammaRamp(*GLFWgammaramp);

;/* Window handling */
 glfwOpenWindow(width.i,height.i,mode.i,title.s,share.i);
 glfwOpenWindowHint(target.i,hint.i);
  glfwIsWindow(window.i);
 glfwCloseWindow(window.i);
 glfwSetWindowTitle(title.s);
 glfwGetWindowSize(*width,*height);
 glfwSetWindowSize(width,height);
 glfwGetWindowPos(*xpos,*ypos);
 glfwSetWindowPos(xpos,ypos);
 glfwIconifyWindow(window);
 glfwRestoreWindow(window);
  glfwGetWindowParam(window,param);
 glfwSetWindowUserPointer(window,*pointer);
 glfwGetWindowUserPointer(window);
 glfwSetWindowSizeCallback(*cbfun);
 glfwSetWindowCloseCallback(*cbfun);
 glfwSetWindowRefreshCallback(*cbfun);
 glfwSetWindowFocusCallback(*cbfun);
 glfwSetWindowIconifyCallback(*cbfun);

;/* Event handling */
 glfwPollEvents();
 glfwWaitEvents();

;/* Input handling */
 glfwGetInputMode(window.i, mode.i);
 glfwSetInputMode( window.i, mode.i,value.i);
 glfwGetKey( window.i,key.i);
 glfwGetMouseButton( window.i, button.i);
 glfwGetMousePos( window.i, *xpos,*ypos);
 glfwSetMousePos( window.i, xpos.i,ypos.i);
 glfwGetScrollOffset( window.i, *xoffset.Double, *yoffset.Double);
 glfwSetKeyCallback(cbfun.i);
 glfwSetCharCallback(cbfun.i);
 glfwSetMouseButtonCallback(cbfun.i);
 glfwSetMousePosCallback(cbfun.i);
 glfwSetCursorEnterCallback(cbfun.i);
 glfwSetScrollCallback(cbfun.i);

;/* Joystick input */
 glfwGetJoystickParam(joy.i,param.i);
 glfwGetJoystickPos(joy.i, *pos.float,numaxes.i);
 glfwGetJoystickButtons(joy,*buttons.string,numbuttons.i);

;/* Clipboard */
 glfwSetClipboardString(window.i,string.s);
 glfwGetClipboardString( window.i);

;/* Time */
 glfwGetTime();
 glfwSetTime(time.d);

;/* OpenGL support */
 glfwMakeContextCurrent(window.i);
  glfwGetCurrentContext();
  glfwSwapBuffers();
  glfwSwapInterval(interval.i);
  glfwExtensionSupported(extension.s);
  glfwGetProcAddress(procname.s);
  glfwCopyContext(src.i,dst.i,mask.i);
EndImport 

CompilerElse 

;/*************************************************************************
; * Prototypes
; *************************************************************************/

;/* Initialization, termination And version querying */
PrototypeC glfwInit();
PrototypeC glfwTerminate();
PrototypeC glfwGetVersion(*major,*minor,*rev);
PrototypeC.s glfwGetVersionString();

;/* Error handling */
PrototypeC glfwGetError();
PrototypeC.s glfwErrorString(error.i);
PrototypeC glfwSetErrorCallback(*cbfun);

;/* Video mode functions */
PrototypeC glfwGetVideoModes(*GLFWvidmode,maxcount.i);
PrototypeC glfwGetDesktopMode(*GLFWvidmode);

;/* Gamma ramp functions */
PrototypeC glfwSetGamma(gamma.f);
PrototypeC glfwGetGammaRamp(*GLFWgammaramp);
PrototypeC glfwSetGammaRamp(*GLFWgammaramp);

;/* Window handling */
PrototypeC glfwOpenWindow(width.i,height.i,mode.i,title.s,share.i);
PrototypeC glfwOpenWindowHint(target.i,hint.i);
PrototypeC  glfwIsWindow(window.i);
PrototypeC glfwCloseWindow(window.i);
PrototypeC glfwSetWindowTitle(title.s);
PrototypeC glfwGetWindowSize(*width,*height);
PrototypeC glfwSetWindowSize(width,height);
PrototypeC glfwGetWindowPos(*xpos,*ypos);
PrototypeC glfwSetWindowPos(xpos,ypos);
PrototypeC glfwIconifyWindow(window);
PrototypeC glfwRestoreWindow(window);
PrototypeC  glfwGetWindowParam(window,param);
PrototypeC glfwSetWindowUserPointer(window,*pointer);
PrototypeC glfwGetWindowUserPointer(window);
PrototypeC glfwSetWindowSizeCallback(*cbfun);
PrototypeC glfwSetWindowCloseCallback(*cbfun);
PrototypeC glfwSetWindowRefreshCallback(*cbfun);
PrototypeC glfwSetWindowFocusCallback(*cbfun);
PrototypeC glfwSetWindowIconifyCallback(*cbfun);

;/* Event handling */
PrototypeC glfwPollEvents();
PrototypeC glfwWaitEvents();

;/* Input handling */
PrototypeC glfwGetInputMode(window.i, mode.i);
PrototypeC glfwSetInputMode( window.i, mode.i,value.i);
PrototypeC glfwGetKey( window.i,key.i);
PrototypeC glfwGetMouseButton( window.i, button.i);
PrototypeC glfwGetMousePos( window.i, *xpos,*ypos);
PrototypeC glfwSetMousePos( window.i, xpos.i,ypos.i);
PrototypeC glfwGetScrollOffset( window.i, *xoffset.Double, *yoffset.Double);
PrototypeC glfwSetKeyCallback(cbfun.i);
PrototypeC glfwSetCharCallback(cbfun.i);
PrototypeC glfwSetMouseButtonCallback(cbfun.i);
PrototypeC glfwSetMousePosCallback(cbfun.i);
PrototypeC glfwSetCursorEnterCallback(cbfun.i);
PrototypeC glfwSetScrollCallback(cbfun.i);

;/* Joystick input */
PrototypeC glfwGetJoystickParam(joy.i,param.i);
PrototypeC glfwGetJoystickPos(joy.i, *pos.float,numaxes.i);
PrototypeC glfwGetJoystickButtons(joy,*buttons.string,numbuttons.i);

;/* Clipboard */
PrototypeC glfwSetClipboardString(window.i,string.s);
PrototypeC.s glfwGetClipboardString( window.i);

;/* Time */
PrototypeC.d glfwGetTime();
PrototypeC glfwSetTime(time.d);

;/* OpenGL support */
PrototypeC glfwMakeContextCurrent(window.i);
PrototypeC  glfwGetCurrentContext();
PrototypeC  glfwSwapBuffers();
PrototypeC  glfwSwapInterval(interval.i);
PrototypeC  glfwExtensionSupported(extension.s);
PrototypeC  glfwGetProcAddress(procname.s);
PrototypeC  glfwCopyContext(src.i,dst.i,mask.i);


;===
CompilerSelect #PB_Compiler_OS
   CompilerCase #PB_OS_Linux 
      #libGLFWExtention = ".so"
   CompilerCase #PB_OS_Windows 
      #libGLFWExtention = ".dll"
   CompilerCase #PB_OS_MacOS 
      #libGLFWExtention = ".dylib"
CompilerEndSelect


Global libGLFW, libpath.s 

libGLFW = OpenLibrary(#PB_Any,"libglfw" + #libGLFWExtention)
If libGLFW


Global glfwInit.glfwInit = GetFunction(libGLFW,"glfwInit");
Global glfwTerminate.glfwTerminate = GetFunction(libGLFW,"glfwTerminate");
Global glfwGetVersion.glfwGetVersion = GetFunction(libGLFW,"glfwGetVersion")
Global glfwGetVersionString.glfwGetVersionString = GetFunction(libGLFW,"glfwGetVersionString");

;/* Error handling */
Global glfwGetError.glfwGetError = GetFunction(libGLFW,"glfwGetError");
Global glfwErrorStringGetFunction.glfwErrorString = GetFunction(libGLFW,"glfwErrorStringGetFunction")
Global glfwSetErrorCallback. glfwSetErrorCallback = GetFunction(libGLFW,"glfwSetErrorCallback");

;/* Video mode functions */
Global glfwGetVideoModes.glfwGetVideoModes = GetFunction(libGLFW,"glfwGetVideoModes");
Global glfwGetDesktopMode. glfwGetDesktopMode = GetFunction(libGLFW,"glfwGetDesktopMode");

;/* Gamma ramp functions */
Global glfwSetGamma.glfwSetGamma = GetFunction(libGLFW,"glfwSetGamma")
Global glfwGetGammaRamp.glfwGetGammaRamp = GetFunction(libGLFW,"glfwGetGammaRamp");
Global glfwSetGammaRamp.glfwSetGammaRamp = GetFunction(libGLFW,"glfwSetGammaRamp");

;/* Window handling */
Global glfwOpenWindow.glfwOpenWindow = GetFunction(libGLFW,"glfwOpenWindow");
Global glfwOpenWindowHint.glfwOpenWindowHint = GetFunction(libGLFW,"glfwOpenWindowHint")
Global  glfwIsWindow.glfwIsWindow = GetFunction(libGLFW,"glfwIsWindow")
Global glfwCloseWindow.glfwCloseWindow = GetFunction(libGLFW,"glfwCloseWindow")
Global glfwSetWindowTitle.glfwSetWindowTitle = GetFunction(libGLFW,"glfwSetWindowTitle");
Global glfwGetWindowSize.glfwGetWindowSize = GetFunction(libGLFW,"glfwGetWindowSize");
Global glfwSetWindowSize.glfwSetWindowSize = GetFunction(libGLFW,"glfwSetWindowSize");
Global glfwGetWindowPos.glfwGetWindowPos = GetFunction(libGLFW,"glfwGetWindowPos")
Global glfwSetWindowPos.glfwSetWindowPos = GetFunction(libGLFW,"glfwSetWindowPos");
Global glfwIconifyWindow.glfwIconifyWindow = GetFunction(libGLFW,"glfwIconifyWindow")
Global glfwRestoreWindow.glfwRestoreWindow = GetFunction(libGLFW,"glfwRestoreWindow")
Global  glfwGetWindowParam. glfwGetWindowParam = GetFunction(libGLFW," glfwGetWindowParam")
Global glfwSetWindowUserPointer.glfwSetWindowUserPointer = GetFunction(libGLFW,"glfwSetWindowUserPointer");
Global glfwGetWindowUserPointer.glfwGetWindowUserPointer = GetFunction(libGLFW,"glfwGetWindowUserPointer");
Global glfwSetWindowSizeCallback.glfwSetWindowSizeCallback = GetFunction(libGLFW,"glfwSetWindowSizeCallback");
Global glfwSetWindowCloseCallback.glfwSetWindowCloseCallback = GetFunction(libGLFW,"glfwSetWindowCloseCallback");
Global glfwSetWindowRefreshCallback.glfwSetWindowRefreshCallback = GetFunction(libGLFW,"glfwSetWindowRefreshCallback");
Global glfwSetWindowFocusCallback.glfwSetWindowFocusCallback = GetFunction(libGLFW,glfwSetWindowFocusCallback")
Global glfwSetWindowIconifyCallback. glfwSetWindowIconifyCallback GetFunction(libGLFW," glfwSetWindowIconifyCallback")

;/* Event handling */
Global glfwPollEvents.glfwPollEvents  = GetFunction(libGLFW,"glfwPollEvents");
Global glfwWaitEvents.glfwWaitEvents = GetFunction(libGLFW,"glfwWaitEvents")

;/* Input handling */
Global  glfwGetInputMode.glfwGetInputMode =GetFunction(libGLFW,"glfwGetInputMode");
Global glfwSetInputMode.glfwSetInputMode = GetFunction(libGLFW,"glfwSetInputMode");
Global  glfwGetKey.glfwGetKey = GetFunction(libGLFW,"glfwGetKey")
Global  glfwGetMouseButton. glfwGetMouseButton = GetFunction(libGLFW,"glfwGetMouseButton")
Global glfwGetMousePos.glfwGetMousePos = GetFunction(libGLFW,"glfwGetMousePos")
Global glfwSetMousePos.glfwSetMousePos = GetFunction(libGLFW,"glfwSetMousePos");
Global glfwGetScrollOffset.glfwGetScrollOffset = GetFunction(libGLFW,"glfwGetScrollOffset")
Global glfwSetKeyCallback.glfwSetKeyCallback = GetFunction(libGLFW,"glfwSetKeyCallback");
Global glfwSetCharCallback.glfwSetCharCallback = GetFunction(libGLFW,"glfwSetCharCallback")
Global glfwSetMouseButtonCallback. glfwSetMouseButtonCallback = GetFunction(libGLFW," glfwSetMouseButtonCallback")
Global glfwSetMousePosCallback.glfwSetMousePosCallback = GetFunction(libGLFW,"glfwSetMousePosCallback")
Global glfwSetCursorEnterCallback. glfwSetCursorEnterCallback = GetFunction(libGLFW," glfwSetCursorEnterCallback")
Global glfwSetScrollCallback.glfwSetScrollCallback = GetFunction(libGLFW,"glfwSetScrollCallback")

;/* Joystick input */
Global glfwGetJoystickParam.glfwGetJoystickParam = GetFunction(libGLFW,"glfwGetJoystickParam")
Global glfwGetJoystickButtons.glfwGetJoystickButtons = GetFunction(libGLFW,"glfwGetJoystickButtons")

;/* Clipboard */
Global glfwSetClipboardString.glfwSetClipboardString = GetFunction(libGLFW,"glfwSetClipboardString")
Global glfwGetClipboardString.glfwGetClipboardString = GetFunction(libGLFW,"glfwGetClipboardString")

;/* Time */
Global glfwGetTime.glfwGetTime = GetFunction(libGLFW,"glfwGetTime");
Global glfwSetTime.glfwSetTime = GetFunction(libGLFW,"glfwSetTime")

;/* OpenGL support */
Global glfwMakeContextCurrent.glfwMakeContextCurrent = GetFunction(libGLFW,"glfwMakeContextCurrent")
Global  glfwGetCurrentContext.glfwGetCurrentContext = GetFunction(libGLFW,"glfwGetCurrentContext");
Global  glfwSwapBuffers.glfwSwapBuffers  = GetFunction(libGLFW,"glfwSwapBuffers");
Global  glfwSwapInterval. glfwSwapInterval = GetFunction(libGLFW," glfwSwapInterval");
Global  glfwExtensionSupported.glfwExtensionSupported  =GetFunction(libGLFW,"glfwExtensionSupported");
Global  glfwGetProcAddress.glfwGetProcAddress = GetFunction(libGLFW,"glfwGetProcAddress")
Global  glfwCopyContext.glfwCopyContext = GetFunction(libGLFW," glfwCopyContext");

EndIf 

CompilerEndIf 


Windows 11, Manjaro, Raspberry Pi OS
Image
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Re: GLFW header

Post by eesau »

I uploaded the Windows version with the DLL and LIB files included here.
Post Reply