lib/glfw.rb in glfw-0.1.0 vs lib/glfw.rb in glfw-0.9.8
- old
+ new
@@ -1,138 +1,32 @@
-require_relative 'glfw/version'
+require_relative "glfw/version"
+require_relative "glfw/glfw"
-require 'fiddle'
-require 'fiddle/import'
-
module GLFW
- extend Fiddle::Importer
- dlload File.expand_path('./glfw3.dll')
- typealias 'window', 'void*'
- typealias 'monitor', 'void*'
- typealias 'string', 'const char*'
- typealias 'bool', 'int'
+ p self.init
- extern 'bool glfwInit(void)'
- extern 'window glfwCreateWindow(int, int, string, monitor, window)'
- extern 'void glfwShowWindow(window)'
- extern 'bool glfwWindowShouldClose(window)'
- extern 'void glfwWaitEvents(window)'
+ p Vulkan.supported?
+
- puts glfwInit != 0
+ Window.new(800, 600, "Hello, World!") do |window|
- window = self.glfwCreateWindow(640, 480, "HOWDY".encode('utf-8'), nil, nil)
+ window.make_current
+ self.swap_interval(1)
+ pixels32 = [0, 0, 255, 255].pack('C*') * (32 * 32)
+ pixels16 = [0, 255, 255, 255].pack('C*') * (16 * 16)
+ window.set_icon(Image.new(32, 32, pixels32), Image.new(16, 16, pixels16))
- glfwShowWindow(window)
+ until window.closing?
+ self.poll_events
+ window.swap_buffers
+ end
- while glfwWindowShouldClose(window) == 0
-
- glfwWaitEvents(window)
-
end
- p window
-
-
- # glfwCreateCursor
- # glfwCreateStandardCursor
- # glfwCreateWindowSurface
- # glfwDefaultWindowHints
- # glfwDestroyCursor
- # glfwDestroyWindow
- # glfwExtensionSupported
- # glfwFocusWindow
- # glfwGetClipboardString
- # glfwGetCurrentContext
- # glfwGetCursorPos
- # glfwGetEGLContext
- # glfwGetEGLDisplay
- # glfwGetEGLSurface
- # glfwGetFramebufferSize
- # glfwGetGammaRamp
- # glfwGetInputMode
- # glfwGetInstanceProcAddress
- # glfwGetJoystickAxes
- # glfwGetJoystickButtons
- # glfwGetJoystickName
- # glfwGetKey
- # glfwGetKeyName
- # glfwGetMonitorName
- # glfwGetMonitorPhysicalSize
- # glfwGetMonitorPos
- # glfwGetMonitors
- # glfwGetMouseButton
- # glfwGetPhysicalDevicePresentationSupport
- # glfwGetPrimaryMonitor
- # glfwGetProcAddress
- # glfwGetRequiredInstanceExtensions
- # glfwGetTime
- # glfwGetTimerFrequency
- # glfwGetTimerValue
- # glfwGetVersion
- # glfwGetVersionString
- # glfwGetVideoMode
- # glfwGetVideoModes
- # glfwGetWGLContext
- # glfwGetWin32Adapter
- # glfwGetWin32Monitor
- # glfwGetWin32Window
- # glfwGetWindowAttrib
- # glfwGetWindowFrameSize
- # glfwGetWindowMonitor
- # glfwGetWindowPos
- # glfwGetWindowSize
- # glfwGetWindowUserPointer
- # glfwHideWindow
- # glfwIconifyWindow
- # glfwJoystickPresent
- # glfwMakeContextCurrent
- # glfwMaximizeWindow
- # glfwPollEvents
- # glfwPostEmptyEvent
- # glfwRestoreWindow
- # glfwSetCharCallback
- # glfwSetCharModsCallback
- # glfwSetClipboardString
- # glfwSetCursor
- # glfwSetCursorEnterCallback
- # glfwSetCursorPos
- # glfwSetCursorPosCallback
- # glfwSetDropCallback
- # glfwSetErrorCallback
- # glfwSetFramebufferSizeCallback
- # glfwSetGamma
- # glfwSetGammaRamp
- # glfwSetInputMode
- # glfwSetJoystickCallback
- # glfwSetKeyCallback
- # glfwSetMonitorCallback
- # glfwSetMouseButtonCallback
- # glfwSetScrollCallback
- # glfwSetTime
- # glfwSetWindowAspectRatio
- # glfwSetWindowCloseCallback
- # glfwSetWindowFocusCallback
- # glfwSetWindowIcon
- # glfwSetWindowIconifyCallback
- # glfwSetWindowMonitor
- # glfwSetWindowPos
- # glfwSetWindowPosCallback
- # glfwSetWindowRefreshCallback
- # glfwSetWindowShouldClose
- # glfwSetWindowSize
- # glfwSetWindowSizeCallback
- # glfwSetWindowSizeLimits
- # glfwSetWindowTitle
- # glfwSetWindowUserPointer
- # glfwSwapBuffers
- # glfwSwapInterval
- # glfwTerminate
- # glfwVulkanSupported
- # glfwWaitEventsTimeout
- # glfwWindowHint
-
+ self.terminate
end
+