It is currently Fri Nov 15, 2019 3:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [INCLUDE] GLFW 3.3 Library
PostPosted: Sun Jun 23, 2019 9:23 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 562
I created an Include for the current GLFW 3.3 Library (Released on April 15, 2019) :)
Link: https://www.glfw.org

About GLFW:
Quote:
GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop.
It provides a simple API for creating windows, contexts and surfaces, receiving input and events.
GLFW is written in C and supports Windows, macOS, the X Window System and the Wayland protocol.


Include (x86 & x64):
Code:
;GLFW 3.3 include for PureBasic
;Created by Mijikai
;Tested on Win 7 & 10 (x64 & x86)

;{ GLFW 3.3 LICENSE AND COPYRIGHT NOTICE }
;*************************************************************************
;* GLFW 3.3 - www.glfw.org
;* A library for OpenGL, window and input
;*------------------------------------------------------------------------
;* Copyright (c) 2002-2006 Marcus Geelnard
;* Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.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.
;*
;*************************************************************************
;}

CompilerIf  #PB_Compiler_Processor = #PB_Processor_x86
  ImportC "glfw3dll.lib"
    glfwInit.i()
    glfwTerminate.i()
    glfwInitHint.i(hint.i,value.i)
    glfwGetVersion.i(*major,*minor,*rev)
    glfwGetVersionString.i()
    glfwGetError.i(*description)
    glfwSetErrorCallback.i(*cbfun)
    glfwGetMonitors.i(*count)
    glfwGetPrimaryMonitor.i()
    glfwGetMonitorPos.i(*monitor,*xpos,*ypos)
    glfwGetMonitorWorkarea.i(*monitor,*xpos,*ypos,*width,*height)
    glfwGetMonitorPhysicalSize.i(*monitor,*widthMM,*heightMM)
    glfwGetMonitorContentScale.i(*monitor,*xscale,*yscale)
    glfwGetMonitorName.i(*monitor)
    glfwSetMonitorUserPointer.i(*monitor,*pointer)
    glfwGetMonitorUserPointer.i(*monitor)
    glfwSetMonitorCallback.i(*cbfun)
    glfwGetVideoModes.i(*monitor,*count)
    glfwGetVideoMode.i(*monitor)
    glfwSetGamma.i(*monitor,gamma.f)
    glfwGetGammaRamp.i(*monitor)
    glfwSetGammaRamp.i(*monitor,*ramp)
    glfwDefaultWindowHints.i()
    glfwWindowHint.i(hint.i,value.i)
    glfwWindowHintString.i(int.i,str.p-ascii)
    glfwCreateWindow.i(width.i,height.i,title.p-ascii,*monitor,*share)
    glfwDestroyWindow.i(*window)
    glfwWindowShouldClose.i(*window)
    glfwSetWindowShouldClose.i(*window,value.i)
    glfwSetWindowTitle.i(*window,title.p-ascii)
    glfwSetWindowIcon.i(*window,count.i,*images)
    glfwGetWindowPos.i(*window,*xpos,*ypos)
    glfwSetWindowPos.i(*window,xpos.i,ypos.i)
    glfwGetWindowSize.i(*window,*width,*height)
    glfwSetWindowSizeLimits.i(*window,minwidth.i,minheight.i,maxwidth.i,maxheight.i)
    glfwSetWindowAspectRatio.i(*window,numer.i,denom.i)
    glfwSetWindowSize.i(*window,width.i,height.i)
    glfwGetFramebufferSize.i(*window,*width,*height)
    glfwGetWindowFrameSize.i(*window,*left,*top,*right,*bottom)
    glfwGetWindowContentScale.i(*window,*xscale,*yscale)
    glfwGetWindowOpacity.f(*window)
    glfwSetWindowOpacity.i(*window,opacity.f)
    glfwIconifyWindow.i(*window)
    glfwRestoreWindow.i(*window)
    glfwMaximizeWindow.i(*window)
    glfwShowWindow.i(*window)
    glfwHideWindow.i(*window)
    glfwFocusWindow.i(*window)
    glfwRequestWindowAttention.i(*window)
    glfwGetWindowMonitor.i(*window)
    glfwSetWindowMonitor.i(*window,*monitor,xpos.i,ypos.i,width.i,height.i,refreshRate.i)
    glfwGetWindowAttrib.i(*window,attrib.i)
    glfwSetWindowAttrib.i(*window,attrib.i,value.i)
    glfwSetWindowUserPointer.i(*window,*pointer)
    glfwGetWindowUserPointer.i(*window)
    glfwSetWindowPosCallback.i(*window,*cbfun)
    glfwSetWindowSizeCallback.i(*window,*cbfun)
    glfwSetWindowCloseCallback.i(*window,*cbfun)
    glfwSetWindowRefreshCallback.i(*window,*cbfun)
    glfwSetWindowFocusCallback.i(*window,*cbfun)
    glfwSetWindowIconifyCallback.i(*window,*cbfun)
    glfwSetWindowMaximizeCallback.i(*window,*cbfun)
    glfwSetFramebufferSizeCallback.i(*window,*cbfun)
    glfwSetWindowContentScaleCallback.i(*window,*cbfun)
    glfwPollEvents.i()
    glfwWaitEvents.i()
    glfwWaitEventsTimeout.i(timeout.d)
    glfwPostEmptyEvent.i()
    glfwGetInputMode.i(*window,mode.i)
    glfwSetInputMode.i(*window,mode.i,value.i)
    glfwRawMouseMotionSupported.i()
    glfwGetKeyName.i(key.i,scancode.i)
    glfwGetKeyScancode.i(key.i)
    glfwGetKey.i(*window,key.i)
    glfwGetMouseButton.i(*window,button.i)
    glfwGetCursorPos.i(*window,*xpos,*ypos)
    glfwSetCursorPos.i(*window,xpos.d,ypos.d)
    glfwCreateCursor.i(*image,xhot.i,yhot.i)
    glfwCreateStandardCursor.i(shape.i)
    glfwDestroyCursor.i(*cursor)
    glfwSetCursor.i(*window,*cursor)
    glfwSetKeyCallback.i(*window,*cbfun)
    glfwSetCharCallback.i(*window,*cbfun)
    glfwSetCharModsCallback.i(*window,*cbfun)
    glfwSetMouseButtonCallback.i(*window,*cbfun)
    glfwSetCursorPosCallback.i(*window,*cbfun)
    glfwSetCursorEnterCallback.i(*window,*cbfun)
    glfwSetScrollCallback.i(*window,*cbfun)
    glfwSetDropCallback.i(*window,*cbfun)
    glfwJoystickPresent.i(jid.i)
    glfwGetJoystickAxes.i(jid.i,*count)
    glfwGetJoystickButtons.i(jid.i,*count)
    glfwGetJoystickHats.i(jid.i,*count)
    glfwGetJoystickName.i(jid.i)
    glfwGetJoystickGUID.i(jid.i)
    glfwSetJoystickUserPointer.i(jid.i,*pointer)
    glfwGetJoystickUserPointer.i(jid.i)
    glfwJoystickIsGamepad.i(jid.i)
    glfwSetJoystickCallback.i(*cbfun)
    glfwUpdateGamepadMappings.i(str.p-ascii)
    glfwGetGamepadName.i(jid.i)
    glfwGetGamepadState.i(jid.i,*state)
    glfwSetClipboardString.i(*window,str.p-ascii)
    glfwGetClipboardString.i(*window)
    glfwGetTime.d()
    glfwSetTime.i(time.d)
    glfwGetTimerValue.i()
    glfwGetTimerFrequency.i()
    glfwMakeContextCurrent.i(*window)
    glfwGetCurrentContext.i()
    glfwSwapBuffers.i(*window)
    glfwSwapInterval.i(interval.i)
    glfwExtensionSupported.i(extension.p-ascii)
    glfwGetProcAddress.i(procname.p-ascii)
    glfwVulkanSupported.i()
    glfwGetRequiredInstanceExtensions.i(*count)
    glfwGetInstanceProcAddress.i(instance.i,procname.p-ascii)
    glfwGetPhysicalDevicePresentationSupport.i(instance.i,device.i,queuefamily.i)
    glfwCreateWindowSurface.i(instance.i,*window,*allocator,*surface)
    glfwGetWin32Window.i(*window)
  EndImport
CompilerElse
  Import "glfw3dll.lib"
    glfwInit.i()
    glfwTerminate.i()
    glfwInitHint.i(hint.i,value.i)
    glfwGetVersion.i(*major,*minor,*rev)
    glfwGetVersionString.i()
    glfwGetError.i(*description)
    glfwSetErrorCallback.i(*cbfun)
    glfwGetMonitors.i(*count)
    glfwGetPrimaryMonitor.i()
    glfwGetMonitorPos.i(*monitor,*xpos,*ypos)
    glfwGetMonitorWorkarea.i(*monitor,*xpos,*ypos,*width,*height)
    glfwGetMonitorPhysicalSize.i(*monitor,*widthMM,*heightMM)
    glfwGetMonitorContentScale.i(*monitor,*xscale,*yscale)
    glfwGetMonitorName.i(*monitor)
    glfwSetMonitorUserPointer.i(*monitor,*pointer)
    glfwGetMonitorUserPointer.i(*monitor)
    glfwSetMonitorCallback.i(*cbfun)
    glfwGetVideoModes.i(*monitor,*count)
    glfwGetVideoMode.i(*monitor)
    glfwSetGamma.i(*monitor,gamma.f)
    glfwGetGammaRamp.i(*monitor)
    glfwSetGammaRamp.i(*monitor,*ramp)
    glfwDefaultWindowHints.i()
    glfwWindowHint.i(hint.i,value.i)
    glfwWindowHintString.i(int.i,str.p-ascii)
    glfwCreateWindow.i(width.i,height.i,title.p-ascii,*monitor,*share)
    glfwDestroyWindow.i(*window)
    glfwWindowShouldClose.i(*window)
    glfwSetWindowShouldClose.i(*window,value.i)
    glfwSetWindowTitle.i(*window,title.p-ascii)
    glfwSetWindowIcon.i(*window,count.i,*images)
    glfwGetWindowPos.i(*window,*xpos,*ypos)
    glfwSetWindowPos.i(*window,xpos.i,ypos.i)
    glfwGetWindowSize.i(*window,*width,*height)
    glfwSetWindowSizeLimits.i(*window,minwidth.i,minheight.i,maxwidth.i,maxheight.i)
    glfwSetWindowAspectRatio.i(*window,numer.i,denom.i)
    glfwSetWindowSize.i(*window,width.i,height.i)
    glfwGetFramebufferSize.i(*window,*width,*height)
    glfwGetWindowFrameSize.i(*window,*left,*top,*right,*bottom)
    glfwGetWindowContentScale.i(*window,*xscale,*yscale)
    glfwGetWindowOpacity.f(*window)
    glfwSetWindowOpacity.i(*window,opacity.f)
    glfwIconifyWindow.i(*window)
    glfwRestoreWindow.i(*window)
    glfwMaximizeWindow.i(*window)
    glfwShowWindow.i(*window)
    glfwHideWindow.i(*window)
    glfwFocusWindow.i(*window)
    glfwRequestWindowAttention.i(*window)
    glfwGetWindowMonitor.i(*window)
    glfwSetWindowMonitor.i(*window,*monitor,xpos.i,ypos.i,width.i,height.i,refreshRate.i)
    glfwGetWindowAttrib.i(*window,attrib.i)
    glfwSetWindowAttrib.i(*window,attrib.i,value.i)
    glfwSetWindowUserPointer.i(*window,*pointer)
    glfwGetWindowUserPointer.i(*window)
    glfwSetWindowPosCallback.i(*window,*cbfun)
    glfwSetWindowSizeCallback.i(*window,*cbfun)
    glfwSetWindowCloseCallback.i(*window,*cbfun)
    glfwSetWindowRefreshCallback.i(*window,*cbfun)
    glfwSetWindowFocusCallback.i(*window,*cbfun)
    glfwSetWindowIconifyCallback.i(*window,*cbfun)
    glfwSetWindowMaximizeCallback.i(*window,*cbfun)
    glfwSetFramebufferSizeCallback.i(*window,*cbfun)
    glfwSetWindowContentScaleCallback.i(*window,*cbfun)
    glfwPollEvents.i()
    glfwWaitEvents.i()
    glfwWaitEventsTimeout.i(timeout.d)
    glfwPostEmptyEvent.i()
    glfwGetInputMode.i(*window,mode.i)
    glfwSetInputMode.i(*window,mode.i,value.i)
    glfwRawMouseMotionSupported.i()
    glfwGetKeyName.i(key.i,scancode.i)
    glfwGetKeyScancode.i(key.i)
    glfwGetKey.i(*window,key.i)
    glfwGetMouseButton.i(*window,button.i)
    glfwGetCursorPos.i(*window,*xpos,*ypos)
    glfwSetCursorPos.i(*window,xpos.d,ypos.d)
    glfwCreateCursor.i(*image,xhot.i,yhot.i)
    glfwCreateStandardCursor.i(shape.i)
    glfwDestroyCursor.i(*cursor)
    glfwSetCursor.i(*window,*cursor)
    glfwSetKeyCallback.i(*window,*cbfun)
    glfwSetCharCallback.i(*window,*cbfun)
    glfwSetCharModsCallback.i(*window,*cbfun)
    glfwSetMouseButtonCallback.i(*window,*cbfun)
    glfwSetCursorPosCallback.i(*window,*cbfun)
    glfwSetCursorEnterCallback.i(*window,*cbfun)
    glfwSetScrollCallback.i(*window,*cbfun)
    glfwSetDropCallback.i(*window,*cbfun)
    glfwJoystickPresent.i(jid.i)
    glfwGetJoystickAxes.i(jid.i,*count)
    glfwGetJoystickButtons.i(jid.i,*count)
    glfwGetJoystickHats.i(jid.i,*count)
    glfwGetJoystickName.i(jid.i)
    glfwGetJoystickGUID.i(jid.i)
    glfwSetJoystickUserPointer.i(jid.i,*pointer)
    glfwGetJoystickUserPointer.i(jid.i)
    glfwJoystickIsGamepad.i(jid.i)
    glfwSetJoystickCallback.i(*cbfun)
    glfwUpdateGamepadMappings.i(str.p-ascii)
    glfwGetGamepadName.i(jid.i)
    glfwGetGamepadState.i(jid.i,*state)
    glfwSetClipboardString.i(*window,str.p-ascii)
    glfwGetClipboardString.i(*window)
    glfwGetTime.d()
    glfwSetTime.i(time.d)
    glfwGetTimerValue.i()
    glfwGetTimerFrequency.i()
    glfwMakeContextCurrent.i(*window)
    glfwGetCurrentContext.i()
    glfwSwapBuffers.i(*window)
    glfwSwapInterval.i(interval.i)
    glfwExtensionSupported.i(extension.p-ascii)
    glfwGetProcAddress.i(procname.p-ascii)
    glfwVulkanSupported.i()
    glfwGetRequiredInstanceExtensions.i(*count)
    glfwGetInstanceProcAddress.i(instance.i,procname.p-ascii)
    glfwGetPhysicalDevicePresentationSupport.i(instance.i,device.i,queuefamily.i)
    glfwCreateWindowSurface.i(instance.i,*window,*allocator,*surface)
    glfwGetWin32Window.i(*window)
  EndImport
CompilerEndIf

Structure GLFWmonitor
EndStructure
 
Structure GLFWwindow
EndStructure
 
Structure GLFWcursor
EndStructure

Structure GLFWvidmode
  width.l
  height.l
  redBits.l
  greenBits.l
  blueBits.l
  refreshRate.l
EndStructure

Structure GLFWimage
  width.l
  height.l
  *pixels
EndStructure

Structure GLFWgammaramp
  *red
  *green
  *blue
  size.l
EndStructure

#GLFW_VERSION_MAJOR = 3
#GLFW_VERSION_MINOR = 3
#GLFW_VERSION_REVISION = 0
#GLFW_TRUE = 1
#GLFW_FALSE = 0
#GLFW_RELEASE = 0
#GLFW_PRESS = 1
#GLFW_REPEAT = 2
#GLFW_HAT_CENTERED = 0
#GLFW_HAT_UP = 1
#GLFW_HAT_RIGHT = 2
#GLFW_HAT_DOWN = 4
#GLFW_HAT_LEFT = 8
#GLFW_HAT_RIGHT_UP = (#GLFW_HAT_RIGHT|#GLFW_HAT_UP)
#GLFW_HAT_RIGHT_DOWN = (#GLFW_HAT_RIGHT|#GLFW_HAT_DOWN)
#GLFW_HAT_LEFT_UP = (#GLFW_HAT_LEFT|#GLFW_HAT_UP)
#GLFW_HAT_LEFT_DOWN = (#GLFW_HAT_LEFT|#GLFW_HAT_DOWN)
#GLFW_KEY_UNKNOWN = -1
#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 = */
#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_MOD_SHIFT = $0001
#GLFW_MOD_CONTROL = $0002
#GLFW_MOD_ALT = $0004
#GLFW_MOD_SUPER = $0008
#GLFW_MOD_CAPS_LOCK = $0010
#GLFW_MOD_NUM_LOCK = $0020
#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
#GLFW_MOUSE_BUTTON_LEFT = #GLFW_MOUSE_BUTTON_1
#GLFW_MOUSE_BUTTON_RIGHT = #GLFW_MOUSE_BUTTON_2
#GLFW_MOUSE_BUTTON_MIDDLE = #GLFW_MOUSE_BUTTON_3
#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
#GLFW_GAMEPAD_BUTTON_A = 0
#GLFW_GAMEPAD_BUTTON_B = 1
#GLFW_GAMEPAD_BUTTON_X = 2
#GLFW_GAMEPAD_BUTTON_Y = 3
#GLFW_GAMEPAD_BUTTON_LEFT_BUMPER = 4
#GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER = 5
#GLFW_GAMEPAD_BUTTON_BACK = 6
#GLFW_GAMEPAD_BUTTON_START = 7
#GLFW_GAMEPAD_BUTTON_GUIDE = 8
#GLFW_GAMEPAD_BUTTON_LEFT_THUMB = 9
#GLFW_GAMEPAD_BUTTON_RIGHT_THUMB = 10
#GLFW_GAMEPAD_BUTTON_DPAD_UP = 11
#GLFW_GAMEPAD_BUTTON_DPAD_RIGHT = 12
#GLFW_GAMEPAD_BUTTON_DPAD_DOWN = 13
#GLFW_GAMEPAD_BUTTON_DPAD_LEFT = 14
#GLFW_GAMEPAD_BUTTON_LAST = #GLFW_GAMEPAD_BUTTON_DPAD_LEFT
#GLFW_GAMEPAD_BUTTON_CROSS = #GLFW_GAMEPAD_BUTTON_A
#GLFW_GAMEPAD_BUTTON_CIRCLE = #GLFW_GAMEPAD_BUTTON_B
#GLFW_GAMEPAD_BUTTON_SQUARE = #GLFW_GAMEPAD_BUTTON_X
#GLFW_GAMEPAD_BUTTON_TRIANGLE = #GLFW_GAMEPAD_BUTTON_Y
#GLFW_GAMEPAD_AXIS_LEFT_X = 0
#GLFW_GAMEPAD_AXIS_LEFT_Y = 1
#GLFW_GAMEPAD_AXIS_RIGHT_X = 2
#GLFW_GAMEPAD_AXIS_RIGHT_Y = 3
#GLFW_GAMEPAD_AXIS_LEFT_TRIGGER = 4
#GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER = 5
#GLFW_GAMEPAD_AXIS_LAST = #GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
#GLFW_NO_ERROR = 0
#GLFW_NOT_INITIALIZED = $00010001
#GLFW_NO_CURRENT_CONTEXT = $00010002
#GLFW_INVALID_ENUM = $00010003
#GLFW_INVALID_VALUE = $00010004
#GLFW_OUT_OF_MEMORY = $00010005
#GLFW_API_UNAVAILABLE = $00010006
#GLFW_VERSION_UNAVAILABLE = $00010007
#GLFW_PLATFORM_ERROR = $00010008
#GLFW_FORMAT_UNAVAILABLE = $00010009
#GLFW_NO_WINDOW_CONTEXT = $0001000A
#GLFW_FOCUSED = $00020001
#GLFW_ICONIFIED = $00020002
#GLFW_RESIZABLE = $00020003
#GLFW_VISIBLE = $00020004
#GLFW_DECORATED = $00020005
#GLFW_AUTO_ICONIFY = $00020006
#GLFW_FLOATING = $00020007
#GLFW_MAXIMIZED = $00020008
#GLFW_CENTER_CURSOR = $00020009
#GLFW_TRANSPARENT_FRAMEBUFFER = $0002000A
#GLFW_HOVERED = $0002000B
#GLFW_FOCUS_ON_SHOW = $0002000C
#GLFW_RED_BITS = $00021001
#GLFW_GREEN_BITS = $00021002
#GLFW_BLUE_BITS = $00021003
#GLFW_ALPHA_BITS = $00021004
#GLFW_DEPTH_BITS = $00021005
#GLFW_STENCIL_BITS = $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_SAMPLES = $0002100D
#GLFW_SRGB_CAPABLE = $0002100E
#GLFW_REFRESH_RATE = $0002100F
#GLFW_DOUBLEBUFFER = $00021010
#GLFW_CLIENT_API = $00022001
#GLFW_CONTEXT_VERSION_MAJOR = $00022002
#GLFW_CONTEXT_VERSION_MINOR = $00022003
#GLFW_CONTEXT_REVISION = $00022004
#GLFW_CONTEXT_ROBUSTNESS = $00022005
#GLFW_OPENGL_FORWARD_COMPAT = $00022006
#GLFW_OPENGL_DEBUG_CONTEXT = $00022007
#GLFW_OPENGL_PROFILE = $00022008
#GLFW_CONTEXT_RELEASE_BEHAVIOR = $00022009
#GLFW_CONTEXT_NO_ERROR = $0002200A
#GLFW_CONTEXT_CREATION_API = $0002200B
#GLFW_SCALE_TO_MONITOR = $0002200C
#GLFW_COCOA_RETINA_FRAMEBUFFER = $00023001
#GLFW_COCOA_FRAME_NAME = $00023002
#GLFW_COCOA_GRAPHICS_SWITCHING = $00023003
#GLFW_X11_CLASS_NAME = $00024001
#GLFW_X11_INSTANCE_NAME = $00024002
#GLFW_NO_API = 0
#GLFW_OPENGL_API = $00030001
#GLFW_OPENGL_ES_API = $00030002
#GLFW_NO_ROBUSTNESS = 0
#GLFW_NO_RESET_NOTIFICATION = $00031001
#GLFW_LOSE_CONTEXT_ON_RESET = $00031002
#GLFW_OPENGL_ANY_PROFILE = 0
#GLFW_OPENGL_CORE_PROFILE = $00032001
#GLFW_OPENGL_COMPAT_PROFILE = $00032002
#GLFW_CURSOR = $00033001
#GLFW_STICKY_KEYS = $00033002
#GLFW_STICKY_MOUSE_BUTTONS = $00033003
#GLFW_LOCK_KEY_MODS = $00033004
#GLFW_RAW_MOUSE_MOTION = $00033005
#GLFW_CURSOR_NORMAL = $00034001
#GLFW_CURSOR_HIDDEN = $00034002
#GLFW_CURSOR_DISABLED = $00034003
#GLFW_ANY_RELEASE_BEHAVIOR = 0
#GLFW_RELEASE_BEHAVIOR_FLUSH = $00035001
#GLFW_RELEASE_BEHAVIOR_NONE = $00035002
#GLFW_NATIVE_CONTEXT_API = $00036001
#GLFW_EGL_CONTEXT_API = $00036002
#GLFW_OSMESA_CONTEXT_API = $00036003
#GLFW_ARROW_CURSOR = $00036001
#GLFW_IBEAM_CURSOR = $00036002
#GLFW_CROSSHAIR_CURSOR = $00036003
#GLFW_HAND_CURSOR = $00036004
#GLFW_HRESIZE_CURSOR = $00036005
#GLFW_VRESIZE_CURSOR = $00036006
#GLFW_CONNECTED = $00040001
#GLFW_DISCONNECTED = $00040002
#GLFW_JOYSTICK_HAT_BUTTONS = $00050001
#GLFW_COCOA_CHDIR_RESOURCES = $00051001
#GLFW_COCOA_MENUBAR = $00051002
#GLFW_DONT_CARE = -1


Have fun <)


Top
 Profile  
Reply with quote  
 Post subject: Re: [INCLUDE] GLFW 3.3 Library
PostPosted: Mon Jun 24, 2019 7:53 am 
Offline
Addict
Addict
User avatar

Joined: Wed Apr 30, 2003 8:15 am
Posts: 989
Location: Germany
@Mijikai: thanks for the include. I didn't know the GLFW yet. Is that just an OpenGl wrapper? Could you please add a an example?

Ciao Dige

_________________
"Daddy, I'll run faster, then it is not so far..."


Top
 Profile  
Reply with quote  
 Post subject: Re: [INCLUDE] GLFW 3.3 Library
PostPosted: Mon Jun 24, 2019 3:02 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1651
Location: Germany
dige wrote:
Could you please add a an example?

- For Windows download the precompiled binaries for x86 or x64 from the GLFW website
- Unzip the downloaded zip file and copy the 3 files (for example from "lib-vc2019") into a newly created folder "GLFW"
- Copy Mijikai's wrapper into that folder and name it "GLFW-Wrapper.PBI"
- Save the example code below (converted from this C sourcecode) after having modified the path to the GLFW folder.
- Start the example code. It displays an empty window with "Hello world!" in the window title.
Code:
; C sourcecode converted to PureBasic
; https://www.glfw.org/download.html

EnableExplicit

IncludeFile "Path to your GLFW folder\GLFW-Wrapper.PBI"

Define Window.I

; ----- Initilize GLFW library

If glfwInit() = 0
  MessageRequester("Error",
    "Unable to initialize GLFW library!")
  End
EndIf

; ----- Create a windowed mode window

Window = glfwCreateWindow(640, 480, "Hello world!", 0, 0)

If Window = 0
  glfwTerminate()
  MessageRequester("Error",
    "Unable to create GLFW window!")
  End
EndIf

; ----- Make the window's context current

glfwMakeContextCurrent(Window)

; ----- Loop until the user closes the window

While glfwWindowShouldClose(Window) = 0
  ; ----- Render here

  glClear_(#GL_COLOR_BUFFER_BIT)

  ; ----- Swap front and back buffers

  glfwSwapBuffers(Window)

  ; ----- Poll for and process events

  glfwPollEvents()
Wend

glfwTerminate()


The following example code for Windows uses the GLFW window from the previous example and draws a triangle into it:
Code:
EnableExplicit

IncludeFile "Path to your GLFW folder\GLFW-Wrapper.PBI"

Define Window.I
Define WindowHeight,I
Define WindowWidth.I

; ----- Initilize GLFW library

If glfwInit() = 0
  MessageRequester("Error",
    "Unable to initialize GLFW library!")
  End
EndIf

; ----- Create a windowed mode window

Window = glfwCreateWindow(640, 480, "Triangle demo in GLFW window", 0, 0)

If Window = 0
  glfwTerminate()
  MessageRequester("Error",
    "Unable to create GLFW window!")
  End
EndIf

; ----- Make the window's context current

glfwMakeContextCurrent(Window)

; ----- Loop until the user closes the window

While glfwWindowShouldClose(Window) = 0
  glfwGetFramebufferSize(Window, @WindowWidth, @WindowHeight)
  glViewport_(0, 0, WindowWidth, WindowHeight)
  glClear_(#GL_COLOR_BUFFER_BIT)

  glMatrixMode_(#GL_PROJECTION)
  glLoadIdentity_()
  gluPerspective_(30.0, Abs(WindowWidth / WindowHeight), 0.1, 500.0)
  glMatrixMode_(#GL_MODELVIEW)
  glLoadIdentity_()
  glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
  glLoadIdentity_()
  glTranslatef_(0.0, 0.0, -8.0)
  glColor3f_(1.0, 1.0, 1.0)
  glBegin_(#GL_TRIANGLES)      ; Start drawing a triangle
  glColor3f_ ( 1.0,  0.0, 0.0) ; Set top point of triangle to Red
  glVertex3f_( 0.0,  1.0, 0.0) ; First point of the triangle
  glColor3f_ ( 0.0,  1.0, 0.0) ; Set left point of triangle to Green
  glVertex3f_(-1.0, -1.0, 0.0) ; Second point of the triangle
  glColor3f_ ( 0.0,  0.0, 1.0) ; Set right point of triangle to Blue
  glVertex3f_( 1.0, -1.0, 0.0) ; Third point of the triangle
  glEnd_()                     ; Done drawing the triangle

  ; ----- Swap front and back buffers

  glfwSwapBuffers(Window)

  ; ----- Poll for and process events

  glfwPollEvents()
Wend

glfwTerminate()


Top
 Profile  
Reply with quote  
 Post subject: Re: [INCLUDE] GLFW 3.3 Library
PostPosted: Mon Jun 24, 2019 8:01 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 562
Im currently not at home so i can only offer a link that to some extend
shows how GLFW and modern OpenGL can be used in PureBasic.

https://www.purebasic.fr/english/viewtopic.php?p=538014#p538014


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye