├── .github └── workflows │ ├── analysis.yml │ └── tests.yml ├── AUTHORS ├── LICENSE ├── README.md ├── go.mod ├── scripts ├── generate-wayland-protocols.sh ├── glfw_tree_rebuild.sh └── grab-upstream.sh ├── v3.0 └── glfw │ ├── clipboard.go │ ├── context.go │ ├── error.c │ ├── error.go │ ├── glfw.go │ ├── input.c │ ├── input.go │ ├── monitor.c │ ├── monitor.go │ ├── native_darwin.go │ ├── native_linbsd.go │ ├── native_windows.go │ ├── time.go │ ├── util.go │ ├── window.c │ └── window.go ├── v3.1 └── glfw │ ├── GLFW_C_REVISION.txt │ ├── build.go │ ├── cocoainit_darwin.go │ ├── cocoamonitor_darwin.go │ ├── cocoawindow_darwin.go │ ├── context.go │ ├── error.c │ ├── error.go │ ├── glfw.go │ ├── glfw │ ├── COPYING.txt │ ├── deps │ │ ├── EGL │ │ │ └── eglext.h │ │ ├── GL │ │ │ ├── glext.h │ │ │ ├── glxext.h │ │ │ └── wglext.h │ │ ├── KHR │ │ │ └── khrplatform.h │ │ ├── getopt.c │ │ ├── getopt.h │ │ ├── glad.c │ │ ├── glad │ │ │ └── glad.h │ │ ├── linmath.h │ │ ├── tinycthread.c │ │ └── tinycthread.h │ ├── include │ │ └── GLFW │ │ │ ├── glfw3.h │ │ │ └── glfw3native.h │ └── src │ │ ├── cocoa_init.m │ │ ├── cocoa_monitor.m │ │ ├── cocoa_platform.h │ │ ├── cocoa_window.m │ │ ├── context.c │ │ ├── egl_context.c │ │ ├── egl_context.h │ │ ├── glx_context.c │ │ ├── glx_context.h │ │ ├── init.c │ │ ├── input.c │ │ ├── internal.h │ │ ├── iokit_joystick.h │ │ ├── iokit_joystick.m │ │ ├── linux_joystick.c │ │ ├── linux_joystick.h │ │ ├── mach_time.c │ │ ├── mir_init.c │ │ ├── mir_monitor.c │ │ ├── mir_platform.h │ │ ├── mir_window.c │ │ ├── monitor.c │ │ ├── nsgl_context.h │ │ ├── nsgl_context.m │ │ ├── posix_time.c │ │ ├── posix_time.h │ │ ├── posix_tls.c │ │ ├── posix_tls.h │ │ ├── wgl_context.c │ │ ├── wgl_context.h │ │ ├── win32_init.c │ │ ├── win32_monitor.c │ │ ├── win32_platform.h │ │ ├── win32_time.c │ │ ├── win32_tls.c │ │ ├── win32_tls.h │ │ ├── win32_window.c │ │ ├── window.c │ │ ├── winmm_joystick.c │ │ ├── winmm_joystick.h │ │ ├── wl_init.c │ │ ├── wl_monitor.c │ │ ├── wl_platform.h │ │ ├── wl_window.c │ │ ├── x11_init.c │ │ ├── x11_monitor.c │ │ ├── x11_platform.h │ │ ├── x11_window.c │ │ ├── xkb_unicode.c │ │ └── xkb_unicode.h │ ├── glfw_context.c │ ├── glfw_egl_context.c │ ├── glfw_glx_context.c │ ├── glfw_init.c │ ├── glfw_input.c │ ├── glfw_linux_joystick.c │ ├── glfw_mach_time.c │ ├── glfw_monitor.c │ ├── glfw_posix_time.c │ ├── glfw_posix_tls.c │ ├── glfw_wgl_context.c │ ├── glfw_win32_init.c │ ├── glfw_win32_monitor.c │ ├── glfw_win32_time.c │ ├── glfw_win32_tls.c │ ├── glfw_win32_window.c │ ├── glfw_window.c │ ├── glfw_winmm_joystick.c │ ├── glfw_wl_init.c │ ├── glfw_wl_monitor.c │ ├── glfw_wl_window.c │ ├── glfw_x11_init.c │ ├── glfw_x11_monitor.c │ ├── glfw_x11_window.c │ ├── glfw_xkb_unicode.c │ ├── input.c │ ├── input.go │ ├── iokitjoystick_darwin.go │ ├── monitor.c │ ├── monitor.go │ ├── native_darwin.go │ ├── native_linbsd.go │ ├── native_windows.go │ ├── nsglcontext_darwin.go │ ├── testdata │ └── customcursor │ │ └── main.go │ ├── time.go │ ├── util.go │ ├── window.c │ └── window.go ├── v3.2 └── glfw │ ├── GLFW_C_REVISION.txt │ ├── build.go │ ├── build_cgo_hack.go │ ├── c_glfw.go │ ├── c_glfw_darwin.go │ ├── c_glfw_linbsd.go │ ├── c_glfw_windows.go │ ├── context.go │ ├── error.c │ ├── error.go │ ├── glfw.go │ ├── glfw │ ├── COPYING.txt │ ├── deps │ │ ├── KHR │ │ │ ├── dummy.go │ │ │ └── khrplatform.h │ │ ├── dummy.go │ │ ├── getopt.c │ │ ├── getopt.h │ │ ├── glad.c │ │ ├── glad │ │ │ ├── dummy.go │ │ │ └── glad.h │ │ ├── linmath.h │ │ ├── mingw │ │ │ ├── _mingw_dxhelper.h │ │ │ ├── dinput.h │ │ │ ├── dummy.go │ │ │ └── xinput.h │ │ ├── tinycthread.c │ │ ├── tinycthread.h │ │ └── vulkan │ │ │ ├── dummy.go │ │ │ ├── vk_platform.h │ │ │ └── vulkan.h │ ├── include │ │ ├── GLFW │ │ │ ├── dummy.go │ │ │ ├── glfw3.h │ │ │ └── glfw3native.h │ │ └── dummy.go │ └── src │ │ ├── cocoa_init.m │ │ ├── cocoa_joystick.h │ │ ├── cocoa_joystick.m │ │ ├── cocoa_monitor.m │ │ ├── cocoa_platform.h │ │ ├── cocoa_time.c │ │ ├── cocoa_window.m │ │ ├── context.c │ │ ├── dummy.go │ │ ├── egl_context.c │ │ ├── egl_context.h │ │ ├── glx_context.c │ │ ├── glx_context.h │ │ ├── init.c │ │ ├── input.c │ │ ├── internal.h │ │ ├── linux_joystick.c │ │ ├── linux_joystick.h │ │ ├── mir_init.c │ │ ├── mir_monitor.c │ │ ├── mir_platform.h │ │ ├── mir_window.c │ │ ├── monitor.c │ │ ├── nsgl_context.h │ │ ├── nsgl_context.m │ │ ├── posix_time.c │ │ ├── posix_time.h │ │ ├── posix_tls.c │ │ ├── posix_tls.h │ │ ├── vulkan.c │ │ ├── wayland-idle-inhibit-unstable-v1-client-protocol.c │ │ ├── wayland-idle-inhibit-unstable-v1-client-protocol.h │ │ ├── wayland-pointer-constraints-unstable-v1-client-protocol.c │ │ ├── wayland-pointer-constraints-unstable-v1-client-protocol.h │ │ ├── wayland-relative-pointer-unstable-v1-client-protocol.c │ │ ├── wayland-relative-pointer-unstable-v1-client-protocol.h │ │ ├── wayland-viewporter-client-protocol.c │ │ ├── wayland-viewporter-client-protocol.h │ │ ├── wayland-xdg-decoration-client-protocol.h │ │ ├── wayland-xdg-decoration-unstable-v1-client-protocol.c │ │ ├── wayland-xdg-shell-client-protocol.c │ │ ├── wayland-xdg-shell-client-protocol.h │ │ ├── wgl_context.c │ │ ├── wgl_context.h │ │ ├── win32_init.c │ │ ├── win32_joystick.c │ │ ├── win32_joystick.h │ │ ├── win32_monitor.c │ │ ├── win32_platform.h │ │ ├── win32_time.c │ │ ├── win32_tls.c │ │ ├── win32_window.c │ │ ├── window.c │ │ ├── wl_init.c │ │ ├── wl_monitor.c │ │ ├── wl_platform.h │ │ ├── wl_window.c │ │ ├── x11_init.c │ │ ├── x11_monitor.c │ │ ├── x11_platform.h │ │ ├── x11_window.c │ │ ├── xkb_unicode.c │ │ └── xkb_unicode.h │ ├── input.c │ ├── input.go │ ├── monitor.c │ ├── monitor.go │ ├── native_darwin.go │ ├── native_linbsd.go │ ├── native_windows.go │ ├── testdata │ └── customcursor │ │ └── main.go │ ├── time.go │ ├── util.go │ ├── vulkan.go │ ├── window.c │ └── window.go └── v3.3 └── glfw ├── GLFW_C_REVISION.txt ├── build.go ├── build_cgo_hack.go ├── c_glfw.go ├── c_glfw_bsd.go ├── c_glfw_darwin.go ├── c_glfw_lin.go ├── c_glfw_windows.go ├── context.go ├── error.c ├── error.go ├── glfw.go ├── glfw ├── LICENSE.md ├── deps │ ├── dummy.go │ ├── getopt.c │ ├── getopt.h │ ├── glad │ │ ├── dummy.go │ │ ├── gl.h │ │ ├── khrplatform.h │ │ ├── vk_platform.h │ │ └── vulkan.h │ ├── glad_gl.c │ ├── glad_vulkan.c │ ├── linmath.h │ ├── mingw │ │ ├── _mingw_dxhelper.h │ │ ├── dinput.h │ │ ├── dummy.go │ │ └── xinput.h │ ├── nuklear.h │ ├── nuklear_glfw_gl2.h │ ├── stb_image_write.h │ ├── tinycthread.c │ ├── tinycthread.h │ └── vs2008 │ │ ├── dummy.go │ │ └── stdint.h ├── include │ ├── GLFW │ │ ├── dummy.go │ │ ├── glfw3.h │ │ └── glfw3native.h │ └── dummy.go └── src │ ├── cocoa_init.m │ ├── cocoa_joystick.h │ ├── cocoa_joystick.m │ ├── cocoa_monitor.m │ ├── cocoa_platform.h │ ├── cocoa_time.c │ ├── cocoa_window.m │ ├── context.c │ ├── dummy.go │ ├── egl_context.c │ ├── egl_context.h │ ├── glx_context.c │ ├── glx_context.h │ ├── init.c │ ├── input.c │ ├── internal.h │ ├── linux_joystick.c │ ├── linux_joystick.h │ ├── mappings.h │ ├── monitor.c │ ├── nsgl_context.h │ ├── nsgl_context.m │ ├── null_init.c │ ├── null_joystick.c │ ├── null_joystick.h │ ├── null_monitor.c │ ├── null_platform.h │ ├── null_window.c │ ├── osmesa_context.c │ ├── osmesa_context.h │ ├── posix_thread.c │ ├── posix_thread.h │ ├── posix_time.c │ ├── posix_time.h │ ├── vulkan.c │ ├── wayland-idle-inhibit-unstable-v1-client-protocol.c │ ├── wayland-idle-inhibit-unstable-v1-client-protocol.h │ ├── wayland-pointer-constraints-unstable-v1-client-protocol.c │ ├── wayland-pointer-constraints-unstable-v1-client-protocol.h │ ├── wayland-relative-pointer-unstable-v1-client-protocol.c │ ├── wayland-relative-pointer-unstable-v1-client-protocol.h │ ├── wayland-viewporter-client-protocol.c │ ├── wayland-viewporter-client-protocol.h │ ├── wayland-xdg-decoration-client-protocol.h │ ├── wayland-xdg-decoration-unstable-v1-client-protocol.c │ ├── wayland-xdg-shell-client-protocol.c │ ├── wayland-xdg-shell-client-protocol.h │ ├── wgl_context.c │ ├── wgl_context.h │ ├── win32_init.c │ ├── win32_joystick.c │ ├── win32_joystick.h │ ├── win32_monitor.c │ ├── win32_platform.h │ ├── win32_thread.c │ ├── win32_time.c │ ├── win32_window.c │ ├── window.c │ ├── wl_init.c │ ├── wl_monitor.c │ ├── wl_platform.h │ ├── wl_window.c │ ├── x11_init.c │ ├── x11_monitor.c │ ├── x11_platform.h │ ├── x11_window.c │ ├── xkb_unicode.c │ └── xkb_unicode.h ├── glfw_tree_rebuild.go ├── go.mod ├── input.c ├── input.go ├── monitor.c ├── monitor.go ├── native_darwin.go ├── native_linbsd_wayland.go ├── native_linbsd_x11.go ├── native_windows.go ├── testdata └── customcursor │ └── main.go ├── time.go ├── util.go ├── vulkan.go ├── window.c └── window.go /.github/workflows/analysis.yml: -------------------------------------------------------------------------------- 1 | name: Static Analysis 2 | on: [push, pull_request] 3 | permissions: 4 | contents: read 5 | 6 | jobs: 7 | static_analysis: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v4 12 | with: 13 | persist-credentials: false 14 | - uses: actions/setup-go@v5 15 | with: 16 | go-version: 'stable' 17 | 18 | - name: Install analysis tools 19 | run: | 20 | go install github.com/fzipp/gocyclo/cmd/gocyclo@latest 21 | go install honnef.co/go/tools/cmd/staticcheck@latest 22 | 23 | - name: Get dependencies 24 | run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev 25 | 26 | - name: Vet 27 | run: | 28 | cd v3.3/glfw && go vet ./... 29 | 30 | - name: Formatting 31 | run: | 32 | cd v3.3/glfw && test -z "$(gofmt -e -d . | tee /dev/stderr)" 33 | 34 | - name: Gocyclo 35 | run: | 36 | cd v3.3/glfw && gocyclo -over 30 . 37 | 38 | - name: Staticcheck 39 | run: | 40 | cd v3.3/glfw && staticcheck ./... 41 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: [push, pull_request] 3 | permissions: 4 | contents: read 5 | 6 | jobs: 7 | tests: 8 | runs-on: ubuntu-latest 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | go-version: ['', 'stable'] 13 | 14 | steps: 15 | - uses: actions/checkout@v4 16 | with: 17 | persist-credentials: false 18 | - uses: actions/setup-go@v5 19 | with: 20 | go-version: ${{ matrix.go-version }} 21 | go-version-file: 'go.mod' 22 | 23 | - name: Get dependencies 24 | run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev 25 | 26 | - name: Tests 27 | run: | 28 | cd v3.3/glfw && go test -race ./... 29 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the official list of glfw3-go authors for copyright purposes. 2 | 3 | # Please keep the list sorted. 4 | 5 | Champion Pierre 6 | Coşku Baş 7 | Dmitri Shuralyov 8 | Geert-Johan Riemer 9 | James Gray 10 | Peter Waller (github:pwaller) 11 | Robin Eklind 12 | Stephen Gutekanst 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The glfw3-go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/go-gl/glfw 2 | 3 | go 1.19 4 | -------------------------------------------------------------------------------- /scripts/generate-wayland-protocols.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | TMP_CLONE_DIR="$(mktemp -d)" 6 | GLGLFW_PATH="$1" 7 | 8 | if [ "$GLGLFW_PATH" = "" ]; then 9 | echo "no glfw destination path set." 10 | echo "sample: generate-wayland-protocols.sh ../v3.2/glfw/glfw/src" 11 | exit 1 12 | fi 13 | 14 | git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git $TMP_CLONE_DIR 15 | 16 | generate() { 17 | HEADER=$1 18 | VER=$2 19 | 20 | if [ "$VER" = "stable" ]; then 21 | NAME="$HEADER" 22 | GROUP="stable" 23 | else 24 | NAME="$HEADER"-unstable-$VER 25 | GROUP="unstable" 26 | fi 27 | 28 | WAYLAND_CLIENT_C="$GLGLFW_PATH/wayland-$NAME-client-protocol.c" 29 | WAYLAND_CLIENT_H="$GLGLFW_PATH/wayland-$NAME-client-protocol.h" 30 | 31 | rm -f "$WAYLAND_CLIENT_C" "$WAYLAND_CLIENT_H" 32 | 33 | wayland-scanner private-code $TMP_CLONE_DIR/"$GROUP"/"$HEADER"/"$NAME".xml "$WAYLAND_CLIENT_C" 34 | wayland-scanner client-header $TMP_CLONE_DIR/"$GROUP"/"$HEADER"/"$NAME".xml "$WAYLAND_CLIENT_H" 35 | 36 | # Go modules don't support symbolic links. 37 | # This removes the "wayland-xdg-decoration-client-protocol.h" 38 | # link and moves the original file in place. 39 | if [ "$HEADER" = "xdg-decoration" ]; then 40 | mv "$WAYLAND_CLIENT_H" "$GLGLFW_PATH/wayland-xdg-decoration-client-protocol.h" 41 | fi 42 | } 43 | 44 | generate "pointer-constraints" "v1" 45 | generate "relative-pointer" "v1" 46 | generate "idle-inhibit" "v1" 47 | generate "xdg-shell" "stable" 48 | generate "xdg-decoration" "v1" 49 | generate "viewporter" "stable" 50 | 51 | rm -rf "${TMP_CLONE_DIR}" 52 | -------------------------------------------------------------------------------- /scripts/glfw_tree_rebuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script computes the hash of the directory called "glfw", relative to $PWD 4 | # at time of invocation, and writes it into the upstreamTreeSHA constant in 5 | # glfw_tree_rebuild.go. Invoke this in a directory containing 6 | # glfw_tree_rebuild.go. 7 | 8 | set -e 9 | 10 | export GIT_INDEX_FILE=$(mktemp) 11 | rm $GIT_INDEX_FILE 12 | git update-index 13 | git add glfw 14 | HASH=$(git write-tree) 15 | rm $GIT_INDEX_FILE 16 | 17 | sed -Ei 's/const upstreamTreeSHA = "[0-9a-f]+"/const upstreamTreeSHA = "'${HASH}'"/' glfw_tree_rebuild.go 18 | -------------------------------------------------------------------------------- /scripts/grab-upstream.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script fetches the glfw sources from upstream and verifies that the files 4 | # committed are the same. 5 | 6 | # Files we don't want in the downstream go-gl/glfw repository. 7 | # Users can get these from upstream if needed. 8 | excludes=( 9 | --exclude=glfw-*/.appveyor.yml 10 | --exclude=glfw-*/.github 11 | --exclude=glfw-*/.gitignore 12 | --exclude=glfw-*/.mailmap 13 | --exclude=glfw-*/.travis.yml 14 | --exclude=glfw-*/*.in 15 | --exclude=glfw-*/CMake 16 | --exclude=glfw-*/CMakeLists.txt 17 | --exclude=glfw-*/docs 18 | --exclude=glfw-*/examples 19 | --exclude=glfw-*/README.md 20 | --exclude=glfw-*/CONTRIBUTORS.md 21 | --exclude=glfw-*/src/*.in 22 | --exclude=glfw-*/src/CMakeLists.txt 23 | --exclude=glfw-*/tests 24 | ) 25 | 26 | set -e 27 | 28 | grab-upstream() { 29 | local godir=$1 30 | if [[ ! -d "$godir" ]]; then 31 | echo "Run with top-level directory as working directory." 1>&2 32 | exit 1 33 | fi 34 | local rev="$(cat "$godir"/GLFW_C_REVISION.txt)" 35 | local target=$godir/glfw 36 | 37 | rm -r "$target" 38 | mkdir "$target" 39 | 40 | curl -s -L "https://github.com/glfw/glfw/archive/${rev}.tar.gz" | 41 | tar xz \ 42 | --strip-components=1 \ 43 | --directory="$target" \ 44 | "${excludes[@]}" 45 | 46 | # Place a dummy go file in each directory. 47 | find "$target/deps" "$target/include" "$target/src" -type d -print0 | 48 | while IFS= read -r -d $'\0' D 49 | do 50 | cat > "$D"/dummy.go < v3.3/glfw/glfw/deps/dummy.go <&2 103 | exit 1 104 | fi 105 | -------------------------------------------------------------------------------- /v3.0/glfw/clipboard.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include 4 | //#define GLFW_INCLUDE_NONE 5 | //#include 6 | import "C" 7 | 8 | import ( 9 | "errors" 10 | "unsafe" 11 | ) 12 | 13 | // SetClipboardString sets the system clipboard to the specified UTF-8 encoded 14 | // string. 15 | // 16 | // This function may only be called from the main thread. See 17 | // https://code.google.com/p/go-wiki/wiki/LockOSThread 18 | func (w *Window) SetClipboardString(str string) { 19 | cp := C.CString(str) 20 | defer C.free(unsafe.Pointer(cp)) 21 | 22 | C.glfwSetClipboardString(w.data, cp) 23 | } 24 | 25 | // GetClipboardString returns the contents of the system clipboard, if it 26 | // contains or is convertible to a UTF-8 encoded string. 27 | // 28 | // This function may only be called from the main thread. See 29 | // https://code.google.com/p/go-wiki/wiki/LockOSThread 30 | func (w *Window) GetClipboardString() (string, error) { 31 | cs := C.glfwGetClipboardString(w.data) 32 | if cs == nil { 33 | return "", errors.New("Can't get clipboard string.") 34 | } 35 | 36 | return C.GoString(cs), nil 37 | } 38 | -------------------------------------------------------------------------------- /v3.0/glfw/error.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwErrorCB(int code, const char *desc) { 4 | goErrorCB(code, (char*)desc); 5 | } 6 | 7 | void glfwSetErrorCallbackCB() { 8 | glfwSetErrorCallback(glfwErrorCB); 9 | } 10 | -------------------------------------------------------------------------------- /v3.0/glfw/error.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include 5 | //void glfwSetErrorCallbackCB(); 6 | import "C" 7 | 8 | // ErrorCode corresponds to an error code. 9 | type ErrorCode int 10 | 11 | // Error codes. 12 | const ( 13 | NotInitialized ErrorCode = C.GLFW_NOT_INITIALIZED //GLFW has not been initialized. 14 | NoCurrentContext ErrorCode = C.GLFW_NO_CURRENT_CONTEXT //No context is current. 15 | InvalidEnum ErrorCode = C.GLFW_INVALID_ENUM //One of the enum parameters for the function was given an invalid enum. 16 | InvalidValue ErrorCode = C.GLFW_INVALID_VALUE //One of the parameters for the function was given an invalid value. 17 | OutOfMemory ErrorCode = C.GLFW_OUT_OF_MEMORY //A memory allocation failed. 18 | ApiUnavailable ErrorCode = C.GLFW_API_UNAVAILABLE //GLFW could not find support for the requested client API on the system. 19 | VersionUnavailable ErrorCode = C.GLFW_VERSION_UNAVAILABLE //The requested client API version is not available. 20 | PlatformError ErrorCode = C.GLFW_PLATFORM_ERROR //A platform-specific error occurred that does not match any of the more specific categories. 21 | FormatUnavailable ErrorCode = C.GLFW_FORMAT_UNAVAILABLE //The clipboard did not contain data in the requested format. 22 | ) 23 | 24 | var fErrorHolder func(code ErrorCode, desc string) 25 | 26 | //export goErrorCB 27 | func goErrorCB(code C.int, desc *C.char) { 28 | fErrorHolder(ErrorCode(code), C.GoString(desc)) 29 | } 30 | 31 | // SetErrorCallback sets the error callback, which is called with an error code 32 | // and a human-readable description each time a GLFW error occurs. 33 | // 34 | // This function may be called before Init. 35 | func SetErrorCallback(cbfun func(code ErrorCode, desc string)) { 36 | if cbfun == nil { 37 | C.glfwSetErrorCallback(nil) 38 | } else { 39 | fErrorHolder = cbfun 40 | C.glfwSetErrorCallbackCB() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /v3.0/glfw/input.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwMouseButtonCB(GLFWwindow* window, int button, int action, int mods) { 4 | goMouseButtonCB(window, button, action, mods); 5 | } 6 | 7 | void glfwCursorPosCB(GLFWwindow* window, double xpos, double ypos) { 8 | goCursorPosCB(window, xpos, ypos); 9 | } 10 | 11 | void glfwCursorEnterCB(GLFWwindow* window, int entered) { 12 | goCursorEnterCB(window, entered); 13 | } 14 | 15 | void glfwScrollCB(GLFWwindow* window, double xoff, double yoff) { 16 | goScrollCB(window, xoff, yoff); 17 | } 18 | 19 | void glfwKeyCB(GLFWwindow* window, int key, int scancode, int action, int mods) { 20 | goKeyCB(window, key, scancode, action, mods); 21 | } 22 | 23 | void glfwCharCB(GLFWwindow* window, unsigned int character) { 24 | goCharCB(window, character); 25 | } 26 | 27 | void glfwSetKeyCallbackCB(GLFWwindow *window) { 28 | glfwSetKeyCallback(window, glfwKeyCB); 29 | } 30 | 31 | void glfwSetCharCallbackCB(GLFWwindow *window) { 32 | glfwSetCharCallback(window, glfwCharCB); 33 | } 34 | 35 | void glfwSetMouseButtonCallbackCB(GLFWwindow *window) { 36 | glfwSetMouseButtonCallback(window, glfwMouseButtonCB); 37 | } 38 | 39 | void glfwSetCursorPosCallbackCB(GLFWwindow *window) { 40 | glfwSetCursorPosCallback(window, glfwCursorPosCB); 41 | } 42 | 43 | void glfwSetCursorEnterCallbackCB(GLFWwindow *window) { 44 | glfwSetCursorEnterCallback(window, glfwCursorEnterCB); 45 | } 46 | 47 | void glfwSetScrollCallbackCB(GLFWwindow *window) { 48 | glfwSetScrollCallback(window, glfwScrollCB); 49 | } 50 | 51 | float GetAxisAtIndex(float *axis, int i) { 52 | return axis[i]; 53 | } 54 | 55 | unsigned char GetButtonsAtIndex(unsigned char *buttons, int i) { 56 | return buttons[i]; 57 | } 58 | -------------------------------------------------------------------------------- /v3.0/glfw/monitor.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) { 4 | return monitors[index]; 5 | } 6 | 7 | GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) { 8 | return vidmodes[index]; 9 | } 10 | 11 | void glfwMonitorCB(GLFWmonitor* monitor, int event) { 12 | goMonitorCB(monitor, event); 13 | } 14 | 15 | void glfwSetMonitorCallbackCB() { 16 | glfwSetMonitorCallback(glfwMonitorCB); 17 | } 18 | 19 | unsigned int GetGammaAtIndex(unsigned short *color, int i) { 20 | return color[i]; 21 | } 22 | 23 | void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) { 24 | color[i] = value; 25 | } 26 | -------------------------------------------------------------------------------- /v3.0/glfw/native_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_EXPOSE_NATIVE_COCOA 4 | //#define GLFW_EXPOSE_NATIVE_NSGL 5 | //#include 6 | //#include 7 | import "C" 8 | 9 | func (w *Window) GetCocoaWindow() C.id { 10 | return C.glfwGetCocoaWindow(w.data) 11 | } 12 | 13 | func (w *Window) GetNSGLContext() C.id { 14 | return C.glfwGetNSGLContext(w.data) 15 | } 16 | -------------------------------------------------------------------------------- /v3.0/glfw/native_linbsd.go: -------------------------------------------------------------------------------- 1 | //go:build linux || freebsd 2 | // +build linux freebsd 3 | 4 | package glfw 5 | 6 | //#define GLFW_EXPOSE_NATIVE_X11 7 | //#define GLFW_EXPOSE_NATIVE_GLX 8 | //#include 9 | //#define GLFW_INCLUDE_NONE 10 | //#include 11 | //#include 12 | import "C" 13 | 14 | func (w *Window) GetX11Window() C.Window { 15 | return C.glfwGetX11Window(w.data) 16 | } 17 | 18 | func (w *Window) GetGLXContext() C.GLXContext { 19 | return C.glfwGetGLXContext(w.data) 20 | } 21 | 22 | func GetX11Display() *C.Display { 23 | return C.glfwGetX11Display() 24 | } 25 | -------------------------------------------------------------------------------- /v3.0/glfw/native_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_EXPOSE_NATIVE_WIN32 4 | //#define GLFW_EXPOSE_NATIVE_WGL 5 | //#define GLFW_INCLUDE_NONE 6 | //#include 7 | //#include 8 | import "C" 9 | 10 | func (w *Window) GetWin32Window() C.HWND { 11 | return C.glfwGetWin32Window(w.data) 12 | } 13 | 14 | func (w *Window) GetWGLContext() C.HGLRC { 15 | return C.glfwGetWGLContext(w.data) 16 | } 17 | -------------------------------------------------------------------------------- /v3.0/glfw/time.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include 5 | import "C" 6 | 7 | // GetTime returns the value of the GLFW timer. Unless the timer has been set 8 | // using SetTime, the timer measures time elapsed since GLFW was initialized. 9 | // 10 | // The resolution of the timer is system dependent, but is usually on the order 11 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 12 | // source on each supported platform. 13 | func GetTime() float64 { 14 | return float64(C.glfwGetTime()) 15 | } 16 | 17 | // SetTime sets the value of the GLFW timer. It then continues to count up from 18 | // that value. 19 | // 20 | // The resolution of the timer is system dependent, but is usually on the order 21 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 22 | // source on each supported platform. 23 | func SetTime(time float64) { 24 | C.glfwSetTime(C.double(time)) 25 | } 26 | -------------------------------------------------------------------------------- /v3.0/glfw/util.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include 5 | import "C" 6 | 7 | func glfwbool(b C.int) bool { 8 | return b == C.int(True) 9 | } 10 | -------------------------------------------------------------------------------- /v3.0/glfw/window.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwWindowPosCB(GLFWwindow* window, int xpos, int ypos) { 4 | goWindowPosCB(window, xpos, ypos); 5 | } 6 | 7 | void glfwWindowSizeCB(GLFWwindow* window, int width, int height) { 8 | goWindowSizeCB(window, width, height); 9 | } 10 | 11 | void glfwFramebufferSizeCB(GLFWwindow* window, int width, int height) { 12 | goFramebufferSizeCB(window, width, height); 13 | } 14 | 15 | void glfwWindowCloseCB(GLFWwindow* window) { 16 | goWindowCloseCB(window); 17 | } 18 | 19 | void glfwWindowRefreshCB(GLFWwindow* window) { 20 | goWindowRefreshCB(window); 21 | } 22 | 23 | void glfwWindowFocusCB(GLFWwindow* window, int focused) { 24 | goWindowFocusCB(window, focused); 25 | } 26 | 27 | void glfwWindowIconifyCB(GLFWwindow* window, int iconified) { 28 | goWindowIconifyCB(window, iconified); 29 | } 30 | 31 | void glfwSetWindowPosCallbackCB(GLFWwindow* window) { 32 | glfwSetWindowPosCallback(window, glfwWindowPosCB); 33 | } 34 | 35 | void glfwSetWindowSizeCallbackCB(GLFWwindow* window) { 36 | glfwSetWindowSizeCallback(window, glfwWindowSizeCB); 37 | } 38 | 39 | void glfwSetFramebufferSizeCallbackCB(GLFWwindow* window) { 40 | glfwSetFramebufferSizeCallback(window, glfwFramebufferSizeCB); 41 | } 42 | 43 | void glfwSetWindowCloseCallbackCB(GLFWwindow* window) { 44 | glfwSetWindowCloseCallback(window, glfwWindowCloseCB); 45 | } 46 | 47 | void glfwSetWindowRefreshCallbackCB(GLFWwindow* window) { 48 | glfwSetWindowRefreshCallback(window, glfwWindowRefreshCB); 49 | } 50 | 51 | void glfwSetWindowFocusCallbackCB(GLFWwindow* window) { 52 | glfwSetWindowFocusCallback(window, glfwWindowFocusCB); 53 | } 54 | 55 | void glfwSetWindowIconifyCallbackCB(GLFWwindow* window) { 56 | glfwSetWindowIconifyCallback(window, glfwWindowIconifyCB); 57 | } 58 | -------------------------------------------------------------------------------- /v3.1/glfw/GLFW_C_REVISION.txt: -------------------------------------------------------------------------------- 1 | 30306e54705c3adae9fe082c816a3be71963485c 2 | -------------------------------------------------------------------------------- /v3.1/glfw/build.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | // Standard OpenGL client is used on 386 and amd64 architectures, except when 5 | // explicitly asked for gles2 or wayland. 6 | #cgo 386,!gles2,!wayland CFLAGS: -D_GLFW_USE_OPENGL 7 | #cgo amd64,!gles2,!wayland CFLAGS: -D_GLFW_USE_OPENGL 8 | 9 | // Choose OpenGL ES V2 on arm, or when explicitly asked for gles2/wayland. 10 | #cgo arm gles2 wayland CFLAGS: -D_GLFW_USE_GLESV2 11 | 12 | 13 | // Windows Build Tags 14 | // ---------------- 15 | // GLFW Options: 16 | #cgo windows CFLAGS: -D_GLFW_WIN32 -D_GLFW_WGL 17 | 18 | // Linker Options: 19 | #cgo windows LDFLAGS: -lopengl32 -lgdi32 20 | 21 | 22 | // Darwin Build Tags 23 | // ---------------- 24 | // GLFW Options: 25 | #cgo darwin CFLAGS: -D_GLFW_COCOA -D_GLFW_NSGL -D_GLFW_USE_CHDIR -D_GLFW_USE_MENUBAR -D_GLFW_USE_RETINA -Wno-deprecated-declarations 26 | 27 | // Linker Options: 28 | #cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo 29 | 30 | 31 | // Linux Build Tags 32 | // ---------------- 33 | // GLFW Options: 34 | #cgo linux,!wayland CFLAGS: -D_GLFW_X11 -D_GLFW_GLX 35 | #cgo linux,wayland CFLAGS: -D_GLFW_WAYLAND -D_GLFW_EGL 36 | 37 | // Linker Options: 38 | #cgo linux,!gles1,!gles2,!gles3 LDFLAGS: -lGL 39 | #cgo linux,gles1 LDFLAGS: -lGLESv1 40 | #cgo linux,gles2 LDFLAGS: -lGLESv2 41 | #cgo linux,gles3 LDFLAGS: -lGLESv3 42 | #cgo linux,!wayland LDFLAGS: -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt 43 | #cgo linux,wayland LDFLAGS: -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt 44 | 45 | 46 | // FreeBSD Build Tags 47 | // ---------------- 48 | // GLFW Options: 49 | #cgo freebsd,!wayland CFLAGS: -D_GLFW_X11 -D_GLFW_GLX -D_GLFW_HAS_GLXGETPROCADDRESSARB -D_GLFW_HAS_DLOPEN 50 | #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND -D_GLFW_EGL -D_GLFW_HAS_DLOPEN 51 | 52 | // Linker Options: 53 | #cgo freebsd,!wayland LDFLAGS: -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama 54 | #cgo freebsd,wayland LDFLAGS: -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama 55 | */ 56 | import "C" 57 | -------------------------------------------------------------------------------- /v3.1/glfw/cocoainit_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #ifdef _GLFW_COCOA 6 | #include "glfw/src/cocoa_init.m" 7 | #endif 8 | */ 9 | import "C" 10 | -------------------------------------------------------------------------------- /v3.1/glfw/cocoamonitor_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #ifdef _GLFW_COCOA 6 | #include "glfw/src/cocoa_monitor.m" 7 | #endif 8 | */ 9 | import "C" 10 | -------------------------------------------------------------------------------- /v3.1/glfw/cocoawindow_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #ifdef _GLFW_COCOA 6 | #include "glfw/src/cocoa_window.m" 7 | #endif 8 | */ 9 | import "C" 10 | -------------------------------------------------------------------------------- /v3.1/glfw/error.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwErrorCB(int code, const char *desc) { 4 | goErrorCB(code, (char*)desc); 5 | } 6 | 7 | void glfwSetErrorCallbackCB() { 8 | glfwSetErrorCallback(glfwErrorCB); 9 | } 10 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | const ( 8 | VersionMajor = C.GLFW_VERSION_MAJOR // This is incremented when the API is changed in non-compatible ways. 9 | VersionMinor = C.GLFW_VERSION_MINOR // This is incremented when features are added to the API but it remains backward-compatible. 10 | VersionRevision = C.GLFW_VERSION_REVISION // This is incremented when a bug fix release is made that does not contain any API changes. 11 | ) 12 | 13 | // Init initializes the GLFW library. Before most GLFW functions can be used, 14 | // GLFW must be initialized, and before a program terminates GLFW should be 15 | // terminated in order to free any resources allocated during or after 16 | // initialization. 17 | // 18 | // If this function fails, it calls Terminate before returning. If it succeeds, 19 | // you should call Terminate before the program exits. 20 | // 21 | // Additional calls to this function after successful initialization but before 22 | // termination will succeed but will do nothing. 23 | // 24 | // This function may take several seconds to complete on some systems, while on 25 | // other systems it may take only a fraction of a second to complete. 26 | // 27 | // On Mac OS X, this function will change the current directory of the 28 | // application to the Contents/Resources subdirectory of the application's 29 | // bundle, if present. 30 | // 31 | // This function may only be called from the main thread. 32 | func Init() error { 33 | C.glfwInit() 34 | return acceptError(APIUnavailable) 35 | } 36 | 37 | // Terminate destroys all remaining windows, frees any allocated resources and 38 | // sets the library to an uninitialized state. Once this is called, you must 39 | // again call Init successfully before you will be able to use most GLFW 40 | // functions. 41 | // 42 | // If GLFW has been successfully initialized, this function should be called 43 | // before the program exits. If initialization fails, there is no need to call 44 | // this function, as it is called by Init before it returns failure. 45 | // 46 | // This function may only be called from the main thread. 47 | func Terminate() { 48 | flushErrors() 49 | C.glfwTerminate() 50 | } 51 | 52 | // GetVersion retrieves the major, minor and revision numbers of the GLFW 53 | // library. It is intended for when you are using GLFW as a shared library and 54 | // want to ensure that you are using the minimum required version. 55 | // 56 | // This function may be called before Init. 57 | func GetVersion() (major, minor, revision int) { 58 | var ( 59 | maj C.int 60 | min C.int 61 | rev C.int 62 | ) 63 | 64 | C.glfwGetVersion(&maj, &min, &rev) 65 | return int(maj), int(min), int(rev) 66 | } 67 | 68 | // GetVersionString returns a static string generated at compile-time according 69 | // to which configuration macros were defined. This is intended for use when 70 | // submitting bug reports, to allow developers to see which code paths are 71 | // enabled in a binary. 72 | // 73 | // This function may be called before Init. 74 | func GetVersionString() string { 75 | return C.GoString(C.glfwGetVersionString()) 76 | } 77 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2010 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/deps/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Kim Gräsman 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * * Neither the name of Kim Gräsman nor the names of contributors may be used 12 | * to endorse or promote products derived from this software without specific 13 | * prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef INCLUDED_GETOPT_PORT_H 28 | #define INCLUDED_GETOPT_PORT_H 29 | 30 | #if defined(__cplusplus) 31 | extern "C" { 32 | #endif 33 | 34 | extern const int no_argument; 35 | extern const int required_argument; 36 | extern const int optional_argument; 37 | 38 | extern char* optarg; 39 | extern int optind, opterr, optopt; 40 | 41 | struct option { 42 | const char* name; 43 | int has_arg; 44 | int* flag; 45 | int val; 46 | }; 47 | 48 | int getopt(int argc, char* const argv[], const char* optstring); 49 | 50 | int getopt_long(int argc, char* const argv[], 51 | const char* optstring, const struct option* longopts, int* longindex); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif // INCLUDED_GETOPT_PORT_H 58 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/iokit_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 IOKit - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2014 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_iokit_joystick_h_ 28 | #define _glfw3_iokit_joystick_h_ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 36 | _GLFWjoystickIOKit iokit_js 37 | 38 | 39 | // IOKit-specific per-joystick data 40 | // 41 | typedef struct _GLFWjoydevice 42 | { 43 | int present; 44 | char name[256]; 45 | 46 | IOHIDDeviceRef deviceRef; 47 | 48 | CFMutableArrayRef axisElements; 49 | CFMutableArrayRef buttonElements; 50 | CFMutableArrayRef hatElements; 51 | 52 | float* axes; 53 | unsigned char* buttons; 54 | } _GLFWjoydevice; 55 | 56 | // IOKit-specific joystick API data 57 | // 58 | typedef struct _GLFWjoystickIOKit 59 | { 60 | _GLFWjoydevice devices[GLFW_JOYSTICK_LAST + 1]; 61 | 62 | IOHIDManagerRef managerRef; 63 | } _GLFWjoystickIOKit; 64 | 65 | void _glfwInitJoysticks(void); 66 | void _glfwTerminateJoysticks(void); 67 | 68 | #endif // _glfw3_iokit_joystick_h_ 69 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/linux_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_linux_joystick_h_ 28 | #define _glfw3_linux_joystick_h_ 29 | 30 | #include 31 | 32 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 33 | _GLFWjoystickLinux linux_js 34 | 35 | 36 | // Linux-specific joystick API data 37 | // 38 | typedef struct _GLFWjoystickLinux 39 | { 40 | struct 41 | { 42 | int present; 43 | int fd; 44 | float* axes; 45 | int axisCount; 46 | unsigned char* buttons; 47 | int buttonCount; 48 | char* name; 49 | char* path; 50 | } js[GLFW_JOYSTICK_LAST + 1]; 51 | 52 | #if defined(__linux__) 53 | int inotify; 54 | int watch; 55 | regex_t regex; 56 | #endif /*__linux__*/ 57 | } _GLFWjoystickLinux; 58 | 59 | 60 | int _glfwInitJoysticks(void); 61 | void _glfwTerminateJoysticks(void); 62 | 63 | #endif // _glfw3_linux_joystick_h_ 64 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/mach_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2010 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | #include 30 | 31 | 32 | // Return raw time 33 | // 34 | static uint64_t getRawTime(void) 35 | { 36 | return mach_absolute_time(); 37 | } 38 | 39 | 40 | ////////////////////////////////////////////////////////////////////////// 41 | ////// GLFW internal API ////// 42 | ////////////////////////////////////////////////////////////////////////// 43 | 44 | // Initialise timer 45 | // 46 | void _glfwInitTimer(void) 47 | { 48 | mach_timebase_info_data_t info; 49 | mach_timebase_info(&info); 50 | 51 | _glfw.ns_time.resolution = (double) info.numer / (info.denom * 1.0e9); 52 | _glfw.ns_time.base = getRawTime(); 53 | } 54 | 55 | 56 | ////////////////////////////////////////////////////////////////////////// 57 | ////// GLFW platform API ////// 58 | ////////////////////////////////////////////////////////////////////////// 59 | 60 | double _glfwPlatformGetTime(void) 61 | { 62 | return (double) (getRawTime() - _glfw.ns_time.base) * 63 | _glfw.ns_time.resolution; 64 | } 65 | 66 | void _glfwPlatformSetTime(double time) 67 | { 68 | _glfw.ns_time.base = getRawTime() - 69 | (uint64_t) (time / _glfw.ns_time.resolution); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/nsgl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2010 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_nsgl_context_h_ 28 | #define _glfw3_nsgl_context_h_ 29 | 30 | #define _GLFW_PLATFORM_FBCONFIG 31 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl 32 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl 33 | 34 | 35 | // NSGL-specific per-context data 36 | // 37 | typedef struct _GLFWcontextNSGL 38 | { 39 | id pixelFormat; 40 | id context; 41 | 42 | } _GLFWcontextNSGL; 43 | 44 | 45 | // NSGL-specific global data 46 | // 47 | typedef struct _GLFWlibraryNSGL 48 | { 49 | // dlopen handle for OpenGL.framework (for glfwGetProcAddress) 50 | void* framework; 51 | 52 | } _GLFWlibraryNSGL; 53 | 54 | 55 | int _glfwInitContextAPI(void); 56 | void _glfwTerminateContextAPI(void); 57 | int _glfwCreateContext(_GLFWwindow* window, 58 | const _GLFWctxconfig* ctxconfig, 59 | const _GLFWfbconfig* fbconfig); 60 | void _glfwDestroyContext(_GLFWwindow* window); 61 | 62 | #endif // _glfw3_nsgl_context_h_ 63 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_time_h_ 29 | #define _glfw3_posix_time_h_ 30 | 31 | #define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimePOSIX posix_time 32 | 33 | #include 34 | 35 | 36 | // POSIX-specific global timer data 37 | // 38 | typedef struct _GLFWtimePOSIX 39 | { 40 | GLboolean monotonic; 41 | double resolution; 42 | uint64_t base; 43 | 44 | } _GLFWtimePOSIX; 45 | 46 | 47 | void _glfwInitTimer(void); 48 | 49 | #endif // _glfw3_posix_time_h_ 50 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/posix_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | int _glfwCreateContextTLS(void) 36 | { 37 | if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0) 38 | { 39 | _glfwInputError(GLFW_PLATFORM_ERROR, 40 | "POSIX: Failed to create context TLS"); 41 | return GL_FALSE; 42 | } 43 | 44 | return GL_TRUE; 45 | } 46 | 47 | void _glfwDestroyContextTLS(void) 48 | { 49 | pthread_key_delete(_glfw.posix_tls.context); 50 | } 51 | 52 | void _glfwSetContextTLS(_GLFWwindow* context) 53 | { 54 | pthread_setspecific(_glfw.posix_tls.context, context); 55 | } 56 | 57 | 58 | ////////////////////////////////////////////////////////////////////////// 59 | ////// GLFW platform API ////// 60 | ////////////////////////////////////////////////////////////////////////// 61 | 62 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 63 | { 64 | return pthread_getspecific(_glfw.posix_tls.context); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/posix_tls.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_tls_h_ 29 | #define _glfw3_posix_tls_h_ 30 | 31 | #include 32 | 33 | #define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls 34 | 35 | 36 | // POSIX-specific global TLS data 37 | // 38 | typedef struct _GLFWtlsPOSIX 39 | { 40 | pthread_key_t context; 41 | 42 | } _GLFWtlsPOSIX; 43 | 44 | 45 | int _glfwCreateContextTLS(void); 46 | void _glfwDestroyContextTLS(void); 47 | void _glfwSetContextTLS(_GLFWwindow* context); 48 | 49 | #endif // _glfw3_posix_tls_h_ 50 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/win32_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | // Return raw time 32 | // 33 | static unsigned __int64 getRawTime(void) 34 | { 35 | if (_glfw.win32_time.hasPC) 36 | { 37 | unsigned __int64 time; 38 | QueryPerformanceCounter((LARGE_INTEGER*) &time); 39 | return time; 40 | } 41 | else 42 | return (unsigned __int64) _glfw_timeGetTime(); 43 | } 44 | 45 | 46 | ////////////////////////////////////////////////////////////////////////// 47 | ////// GLFW internal API ////// 48 | ////////////////////////////////////////////////////////////////////////// 49 | 50 | // Initialise timer 51 | // 52 | void _glfwInitTimer(void) 53 | { 54 | unsigned __int64 frequency; 55 | 56 | if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) 57 | { 58 | _glfw.win32_time.hasPC = GL_TRUE; 59 | _glfw.win32_time.resolution = 1.0 / (double) frequency; 60 | } 61 | else 62 | { 63 | _glfw.win32_time.hasPC = GL_FALSE; 64 | _glfw.win32_time.resolution = 0.001; // winmm resolution is 1 ms 65 | } 66 | 67 | _glfw.win32_time.base = getRawTime(); 68 | } 69 | 70 | 71 | ////////////////////////////////////////////////////////////////////////// 72 | ////// GLFW platform API ////// 73 | ////////////////////////////////////////////////////////////////////////// 74 | 75 | double _glfwPlatformGetTime(void) 76 | { 77 | return (double) (getRawTime() - _glfw.win32_time.base) * 78 | _glfw.win32_time.resolution; 79 | } 80 | 81 | void _glfwPlatformSetTime(double time) 82 | { 83 | _glfw.win32_time.base = getRawTime() - 84 | (unsigned __int64) (time / _glfw.win32_time.resolution); 85 | } 86 | 87 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/win32_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | int _glfwCreateContextTLS(void) 36 | { 37 | _glfw.win32_tls.context = TlsAlloc(); 38 | if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES) 39 | { 40 | _glfwInputError(GLFW_PLATFORM_ERROR, 41 | "Win32: Failed to allocate TLS index"); 42 | return GL_FALSE; 43 | } 44 | 45 | _glfw.win32_tls.allocated = GL_TRUE; 46 | return GL_TRUE; 47 | } 48 | 49 | void _glfwDestroyContextTLS(void) 50 | { 51 | if (_glfw.win32_tls.allocated) 52 | TlsFree(_glfw.win32_tls.context); 53 | } 54 | 55 | void _glfwSetContextTLS(_GLFWwindow* context) 56 | { 57 | TlsSetValue(_glfw.win32_tls.context, context); 58 | } 59 | 60 | 61 | ////////////////////////////////////////////////////////////////////////// 62 | ////// GLFW platform API ////// 63 | ////////////////////////////////////////////////////////////////////////// 64 | 65 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 66 | { 67 | return TlsGetValue(_glfw.win32_tls.context); 68 | } 69 | 70 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/win32_tls.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_win32_tls_h_ 29 | #define _glfw3_win32_tls_h_ 30 | 31 | #define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsWin32 win32_tls 32 | 33 | 34 | // Win32-specific global TLS data 35 | // 36 | typedef struct _GLFWtlsWin32 37 | { 38 | GLboolean allocated; 39 | DWORD context; 40 | 41 | } _GLFWtlsWin32; 42 | 43 | 44 | int _glfwCreateContextTLS(void); 45 | void _glfwDestroyContextTLS(void); 46 | void _glfwSetContextTLS(_GLFWwindow* context); 47 | 48 | #endif // _glfw3_win32_tls_h_ 49 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/winmm_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 WinMM - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2014 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_winmm_joystick_h_ 28 | #define _glfw3_winmm_joystick_h_ 29 | 30 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 31 | _GLFWjoystickWinMM winmm_js[GLFW_JOYSTICK_LAST + 1] 32 | 33 | 34 | // WinMM-specific per-joystick data 35 | // 36 | typedef struct _GLFWjoystickWinMM 37 | { 38 | float axes[6]; 39 | unsigned char buttons[36]; // 32 buttons plus one hat 40 | char* name; 41 | } _GLFWjoystickWinMM; 42 | 43 | 44 | void _glfwInitJoysticks(void); 45 | void _glfwTerminateJoysticks(void); 46 | 47 | #endif // _glfw3_winmm_joystick_h_ 48 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_xkb_unicode_h_ 28 | #define _glfw3_xkb_unicode_h_ 29 | 30 | 31 | long _glfwKeySym2Unicode(unsigned int keysym); 32 | 33 | #endif // _glfw3_xkb_unicode_h_ 34 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_context.c: -------------------------------------------------------------------------------- 1 | #include "glfw/src/context.c" 2 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_egl_context.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_EGL 2 | #include "glfw/src/egl_context.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_glx_context.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_GLX 2 | #include "glfw/src/glx_context.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_init.c: -------------------------------------------------------------------------------- 1 | #include "glfw/src/init.c" 2 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_input.c: -------------------------------------------------------------------------------- 1 | #include "glfw/src/input.c" 2 | 3 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_linux_joystick.c: -------------------------------------------------------------------------------- 1 | #if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) 2 | #include "glfw/src/linux_joystick.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_mach_time.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_COCOA 2 | #include "glfw/src/mach_time.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_monitor.c: -------------------------------------------------------------------------------- 1 | #include "glfw/src/monitor.c" 2 | 3 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_posix_time.c: -------------------------------------------------------------------------------- 1 | #if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) 2 | #include "glfw/src/posix_time.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_posix_tls.c: -------------------------------------------------------------------------------- 1 | #if defined(_GLFW_COCOA) || defined(_GLFW_X11) || defined(_GLFW_WAYLAND) 2 | #include "glfw/src/posix_tls.c" 3 | #endif 4 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_wgl_context.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WGL 2 | #include "glfw/src/wgl_context.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_win32_init.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WIN32 2 | 3 | // Bug fix for 6l/8l on Windows, see: 4 | // https://github.com/go-gl/glfw3/issues/82#issuecomment-53859967 5 | #include 6 | #include 7 | 8 | #ifndef strdup 9 | char *strdup (const char *str) { 10 | char *new = malloc(strlen(str) + 1); 11 | strcpy(new, str); 12 | return new; 13 | } 14 | #endif 15 | 16 | // _get_output_format is described at MSDN: 17 | // http://msdn.microsoft.com/en-us/library/571yb472.aspx 18 | // 19 | // MinGW32 does not define it. But MinGW-W64 does. Unlike strdup above 20 | // compilers don't #define _get_output_format if it exists. 21 | #ifndef __MINGW64__ 22 | unsigned int _get_output_format(void) { 23 | return 0; 24 | }; 25 | #endif 26 | 27 | #include "glfw/src/win32_init.c" 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_win32_monitor.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WIN32 2 | #include "glfw/src/win32_monitor.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_win32_time.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WIN32 2 | #include "glfw/src/win32_time.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_win32_tls.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WIN32 2 | #include "glfw/src/win32_tls.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_win32_window.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WIN32 2 | #include "glfw/src/win32_window.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_window.c: -------------------------------------------------------------------------------- 1 | #include "glfw/src/window.c" 2 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_winmm_joystick.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WIN32 2 | #include "glfw/src/winmm_joystick.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_wl_init.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WAYLAND 2 | #include "glfw/src/wl_init.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_wl_monitor.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WAYLAND 2 | #include "glfw/src/wl_monitor.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_wl_window.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_WAYLAND 2 | #include "glfw/src/wl_window.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_x11_init.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_X11 2 | #include "glfw/src/x11_init.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_x11_monitor.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_X11 2 | #include "glfw/src/x11_monitor.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_x11_window.c: -------------------------------------------------------------------------------- 1 | #ifdef _GLFW_X11 2 | #include "glfw/src/x11_window.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/glfw_xkb_unicode.c: -------------------------------------------------------------------------------- 1 | #if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) 2 | #include "glfw/src/xkb_unicode.c" 3 | #endif 4 | 5 | -------------------------------------------------------------------------------- /v3.1/glfw/input.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwMouseButtonCB(GLFWwindow* window, int button, int action, int mods) { 4 | goMouseButtonCB(window, button, action, mods); 5 | } 6 | 7 | void glfwCursorPosCB(GLFWwindow* window, double xpos, double ypos) { 8 | goCursorPosCB(window, xpos, ypos); 9 | } 10 | 11 | void glfwCursorEnterCB(GLFWwindow* window, int entered) { 12 | goCursorEnterCB(window, entered); 13 | } 14 | 15 | void glfwScrollCB(GLFWwindow* window, double xoff, double yoff) { 16 | goScrollCB(window, xoff, yoff); 17 | } 18 | 19 | void glfwKeyCB(GLFWwindow* window, int key, int scancode, int action, int mods) { 20 | goKeyCB(window, key, scancode, action, mods); 21 | } 22 | 23 | void glfwCharCB(GLFWwindow* window, unsigned int character) { 24 | goCharCB(window, character); 25 | } 26 | 27 | void glfwCharModsCB(GLFWwindow* window, unsigned int character, int mods) { 28 | goCharModsCB(window, character, mods); 29 | } 30 | 31 | void glfwDropCB(GLFWwindow* window, int count, const char **names) { 32 | goDropCB(window, count, (char**)names); 33 | } 34 | 35 | void glfwSetKeyCallbackCB(GLFWwindow *window) { 36 | glfwSetKeyCallback(window, glfwKeyCB); 37 | } 38 | 39 | void glfwSetCharCallbackCB(GLFWwindow *window) { 40 | glfwSetCharCallback(window, glfwCharCB); 41 | } 42 | 43 | void glfwSetCharModsCallbackCB(GLFWwindow *window) { 44 | glfwSetCharModsCallback(window, glfwCharModsCB); 45 | } 46 | 47 | void glfwSetMouseButtonCallbackCB(GLFWwindow *window) { 48 | glfwSetMouseButtonCallback(window, glfwMouseButtonCB); 49 | } 50 | 51 | void glfwSetCursorPosCallbackCB(GLFWwindow *window) { 52 | glfwSetCursorPosCallback(window, glfwCursorPosCB); 53 | } 54 | 55 | void glfwSetCursorEnterCallbackCB(GLFWwindow *window) { 56 | glfwSetCursorEnterCallback(window, glfwCursorEnterCB); 57 | } 58 | 59 | void glfwSetScrollCallbackCB(GLFWwindow *window) { 60 | glfwSetScrollCallback(window, glfwScrollCB); 61 | } 62 | 63 | void glfwSetDropCallbackCB(GLFWwindow *window) { 64 | glfwSetDropCallback(window, glfwDropCB); 65 | } 66 | 67 | float GetAxisAtIndex(float *axis, int i) { 68 | return axis[i]; 69 | } 70 | 71 | unsigned char GetButtonsAtIndex(unsigned char *buttons, int i) { 72 | return buttons[i]; 73 | } 74 | -------------------------------------------------------------------------------- /v3.1/glfw/iokitjoystick_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #ifdef _GLFW_COCOA 6 | #include "glfw/src/iokit_joystick.m" 7 | #endif 8 | */ 9 | import "C" 10 | -------------------------------------------------------------------------------- /v3.1/glfw/monitor.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) { 4 | return monitors[index]; 5 | } 6 | 7 | GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) { 8 | return vidmodes[index]; 9 | } 10 | 11 | void glfwMonitorCB(GLFWmonitor* monitor, int event) { 12 | goMonitorCB(monitor, event); 13 | } 14 | 15 | void glfwSetMonitorCallbackCB() { 16 | glfwSetMonitorCallback(glfwMonitorCB); 17 | } 18 | 19 | unsigned int GetGammaAtIndex(unsigned short *color, int i) { 20 | return color[i]; 21 | } 22 | 23 | void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) { 24 | color[i] = value; 25 | } 26 | -------------------------------------------------------------------------------- /v3.1/glfw/native_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #define GLFW_EXPOSE_NATIVE_COCOA 5 | #define GLFW_EXPOSE_NATIVE_NSGL 6 | #include "glfw/include/GLFW/glfw3.h" 7 | #include "glfw/include/GLFW/glfw3native.h" 8 | 9 | // workaround wrappers needed due to a cgo and/or LLVM bug. 10 | // See: https://github.com/go-gl/glfw/issues/136 11 | void *workaround_glfwGetCocoaWindow(GLFWwindow *w) { 12 | return (void *)glfwGetCocoaWindow(w); 13 | } 14 | void *workaround_glfwGetNSGLContext(GLFWwindow *w) { 15 | return (void *)glfwGetNSGLContext(w); 16 | } 17 | */ 18 | import "C" 19 | 20 | func (w *Window) GetCocoaWindow() uintptr { 21 | ret := uintptr(C.workaround_glfwGetCocoaWindow(w.data)) 22 | panicError() 23 | return ret 24 | } 25 | 26 | func (w *Window) GetNSGLContext() uintptr { 27 | ret := uintptr(C.workaround_glfwGetNSGLContext(w.data)) 28 | panicError() 29 | return ret 30 | } 31 | -------------------------------------------------------------------------------- /v3.1/glfw/native_linbsd.go: -------------------------------------------------------------------------------- 1 | //go:build linux || freebsd 2 | // +build linux freebsd 3 | 4 | package glfw 5 | 6 | //#define GLFW_EXPOSE_NATIVE_X11 7 | //#define GLFW_EXPOSE_NATIVE_GLX 8 | //#define GLFW_INCLUDE_NONE 9 | //#include "glfw/include/GLFW/glfw3.h" 10 | //#include "glfw/include/GLFW/glfw3native.h" 11 | import "C" 12 | 13 | func (w *Window) GetX11Window() C.Window { 14 | ret := C.glfwGetX11Window(w.data) 15 | panicError() 16 | return ret 17 | } 18 | 19 | func (w *Window) GetGLXContext() C.GLXContext { 20 | ret := C.glfwGetGLXContext(w.data) 21 | panicError() 22 | return ret 23 | } 24 | 25 | func GetX11Display() *C.Display { 26 | ret := C.glfwGetX11Display() 27 | panicError() 28 | return ret 29 | } 30 | -------------------------------------------------------------------------------- /v3.1/glfw/native_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_EXPOSE_NATIVE_WIN32 4 | //#define GLFW_EXPOSE_NATIVE_WGL 5 | //#define GLFW_INCLUDE_NONE 6 | //#include "glfw/include/GLFW/glfw3.h" 7 | //#include "glfw/include/GLFW/glfw3native.h" 8 | import "C" 9 | 10 | func (w *Window) GetWin32Window() C.HWND { 11 | ret := C.glfwGetWin32Window(w.data) 12 | panicError() 13 | return ret 14 | } 15 | 16 | func (w *Window) GetWGLContext() C.HGLRC { 17 | ret := C.glfwGetWGLContext(w.data) 18 | panicError() 19 | return ret 20 | } 21 | -------------------------------------------------------------------------------- /v3.1/glfw/nsglcontext_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #ifdef _GLFW_NSGL 6 | #include "glfw/src/nsgl_context.m" 7 | #endif 8 | */ 9 | import "C" 10 | -------------------------------------------------------------------------------- /v3.1/glfw/testdata/customcursor/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "image" 5 | "image/color" 6 | "runtime" 7 | 8 | "github.com/go-gl/glfw/v3.1/glfw" 9 | ) 10 | 11 | func init() { 12 | // This is needed to arrange that main() runs on main thread. 13 | // See documentation for functions that are only allowed to be called from the main thread. 14 | runtime.LockOSThread() 15 | } 16 | 17 | func main() { 18 | err := glfw.Init() 19 | if err != nil { 20 | panic(err) 21 | } 22 | defer glfw.Terminate() 23 | 24 | window, err := glfw.CreateWindow(640, 480, "Custom Cursor", nil, nil) 25 | if err != nil { 26 | panic(err) 27 | } 28 | 29 | window.MakeContextCurrent() 30 | 31 | // Creating a custom cursor. 32 | cursor := glfw.CreateCursor(whiteTriangle, 0, 0) 33 | window.SetCursor(cursor) 34 | 35 | for !window.ShouldClose() { 36 | // Do OpenGL stuff. 37 | window.SwapBuffers() 38 | glfw.PollEvents() 39 | } 40 | } 41 | 42 | var whiteTriangle = func() *image.NRGBA { 43 | c := color.NRGBA{R: 0xFF, G: 0xFF, B: 0xFF, A: 0xFF} 44 | const size = 16 45 | m := image.NewNRGBA(image.Rect(0, 0, size, size)) 46 | for y := 0; y < size; y++ { 47 | for x := 0; x < size-y; x++ { 48 | m.SetNRGBA(x, y, c) 49 | } 50 | } 51 | return m 52 | }() 53 | -------------------------------------------------------------------------------- /v3.1/glfw/time.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | // GetTime returns the value of the GLFW timer. Unless the timer has been set 8 | // using SetTime, the timer measures time elapsed since GLFW was initialized. 9 | // 10 | // The resolution of the timer is system dependent, but is usually on the order 11 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 12 | // source on each supported platform. 13 | func GetTime() float64 { 14 | ret := float64(C.glfwGetTime()) 15 | panicError() 16 | return ret 17 | } 18 | 19 | // SetTime sets the value of the GLFW timer. It then continues to count up from 20 | // that value. 21 | // 22 | // The resolution of the timer is system dependent, but is usually on the order 23 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 24 | // source on each supported platform. 25 | func SetTime(time float64) { 26 | C.glfwSetTime(C.double(time)) 27 | panicError() 28 | } 29 | -------------------------------------------------------------------------------- /v3.1/glfw/util.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include 4 | //#define GLFW_INCLUDE_NONE 5 | //#include "glfw/include/GLFW/glfw3.h" 6 | import "C" 7 | 8 | import ( 9 | "image" 10 | "image/draw" 11 | ) 12 | 13 | func glfwbool(b C.int) bool { 14 | return b == C.int(True) 15 | } 16 | 17 | func bytes(origin []byte) (pointer *uint8, free func()) { 18 | n := len(origin) 19 | if n == 0 { 20 | return nil, func() {} 21 | } 22 | 23 | ptr := C.CBytes(origin) 24 | return (*uint8)(ptr), func() { C.free(ptr) } 25 | } 26 | 27 | // imageToGLFW converts img to be compatible with C.GLFWimage. 28 | func imageToGLFW(img image.Image) (r C.GLFWimage, free func()) { 29 | b := img.Bounds() 30 | 31 | r.width = C.int(b.Dx()) 32 | r.height = C.int(b.Dy()) 33 | 34 | var pixels []byte 35 | if m, ok := img.(*image.NRGBA); ok && m.Stride == b.Dx()*4 { 36 | pixels = m.Pix[:m.PixOffset(m.Rect.Min.X, m.Rect.Max.Y)] 37 | } else { 38 | m := image.NewNRGBA(image.Rect(0, 0, b.Dx(), b.Dy())) 39 | draw.Draw(m, m.Bounds(), img, b.Min, draw.Src) 40 | pixels = m.Pix 41 | } 42 | 43 | pix, free := bytes(pixels) 44 | r.pixels = (*C.uchar)(pix) 45 | return r, free 46 | } 47 | -------------------------------------------------------------------------------- /v3.1/glfw/window.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwWindowPosCB(GLFWwindow* window, int xpos, int ypos) { 4 | goWindowPosCB(window, xpos, ypos); 5 | } 6 | 7 | void glfwWindowSizeCB(GLFWwindow* window, int width, int height) { 8 | goWindowSizeCB(window, width, height); 9 | } 10 | 11 | void glfwFramebufferSizeCB(GLFWwindow* window, int width, int height) { 12 | goFramebufferSizeCB(window, width, height); 13 | } 14 | 15 | void glfwWindowCloseCB(GLFWwindow* window) { 16 | goWindowCloseCB(window); 17 | } 18 | 19 | void glfwWindowRefreshCB(GLFWwindow* window) { 20 | goWindowRefreshCB(window); 21 | } 22 | 23 | void glfwWindowFocusCB(GLFWwindow* window, int focused) { 24 | goWindowFocusCB(window, focused); 25 | } 26 | 27 | void glfwWindowIconifyCB(GLFWwindow* window, int iconified) { 28 | goWindowIconifyCB(window, iconified); 29 | } 30 | 31 | void glfwSetWindowPosCallbackCB(GLFWwindow* window) { 32 | glfwSetWindowPosCallback(window, glfwWindowPosCB); 33 | } 34 | 35 | void glfwSetWindowSizeCallbackCB(GLFWwindow* window) { 36 | glfwSetWindowSizeCallback(window, glfwWindowSizeCB); 37 | } 38 | 39 | void glfwSetFramebufferSizeCallbackCB(GLFWwindow* window) { 40 | glfwSetFramebufferSizeCallback(window, glfwFramebufferSizeCB); 41 | } 42 | 43 | void glfwSetWindowCloseCallbackCB(GLFWwindow* window) { 44 | glfwSetWindowCloseCallback(window, glfwWindowCloseCB); 45 | } 46 | 47 | void glfwSetWindowRefreshCallbackCB(GLFWwindow* window) { 48 | glfwSetWindowRefreshCallback(window, glfwWindowRefreshCB); 49 | } 50 | 51 | void glfwSetWindowFocusCallbackCB(GLFWwindow* window) { 52 | glfwSetWindowFocusCallback(window, glfwWindowFocusCB); 53 | } 54 | 55 | void glfwSetWindowIconifyCallbackCB(GLFWwindow* window) { 56 | glfwSetWindowIconifyCallback(window, glfwWindowIconifyCB); 57 | } 58 | -------------------------------------------------------------------------------- /v3.2/glfw/GLFW_C_REVISION.txt: -------------------------------------------------------------------------------- 1 | 999f3556fdd80983b10051746264489f2cb1ef16 2 | -------------------------------------------------------------------------------- /v3.2/glfw/build.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | // Windows Build Tags 5 | // ---------------- 6 | // GLFW Options: 7 | #cgo windows CFLAGS: -D_GLFW_WIN32 -Iglfw/deps/mingw 8 | 9 | // Linker Options: 10 | #cgo windows LDFLAGS: -lopengl32 -lgdi32 11 | 12 | 13 | // Darwin Build Tags 14 | // ---------------- 15 | // GLFW Options: 16 | #cgo darwin CFLAGS: -D_GLFW_COCOA -D_GLFW_USE_CHDIR -D_GLFW_USE_MENUBAR -D_GLFW_USE_RETINA -Wno-deprecated-declarations 17 | 18 | // Linker Options: 19 | #cgo darwin LDFLAGS: -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo 20 | 21 | 22 | // Linux Build Tags 23 | // ---------------- 24 | // GLFW Options: 25 | #cgo linux,!wayland CFLAGS: -D_GLFW_X11 -D_GNU_SOURCE 26 | #cgo linux,wayland CFLAGS: -D_GLFW_WAYLAND -D_GNU_SOURCE 27 | 28 | // Linker Options: 29 | #cgo linux,!gles1,!gles2,!gles3,!vulkan LDFLAGS: -lGL 30 | #cgo linux,gles1 LDFLAGS: -lGLESv1 31 | #cgo linux,gles2 LDFLAGS: -lGLESv2 32 | #cgo linux,gles3 LDFLAGS: -lGLESv3 33 | #cgo linux,vulkan LDFLAGS: -lvulkan 34 | #cgo linux,!wayland LDFLAGS: -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt 35 | #cgo linux,wayland LDFLAGS: -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon -lm -ldl -lrt 36 | 37 | // FreeBSD Build Tags 38 | // ---------------- 39 | // GLFW Options: 40 | #cgo freebsd pkg-config: glfw3 41 | #cgo freebsd CFLAGS: -D_GLFW_HAS_DLOPEN 42 | #cgo freebsd,!wayland CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB 43 | #cgo freebsd,wayland CFLAGS: -D_GLFW_WAYLAND 44 | 45 | // Linker Options: 46 | #cgo freebsd,!wayland LDFLAGS: -lm -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lXinerama 47 | #cgo freebsd,wayland LDFLAGS: -lm -lGL -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon 48 | */ 49 | import "C" 50 | -------------------------------------------------------------------------------- /v3.2/glfw/build_cgo_hack.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | package glfw 5 | 6 | // This file exists purely to prevent the golang toolchain from stripping 7 | // away the c source directories and files when `go mod vendor` is used 8 | // to populate a `vendor/` directory of a project depending on `go-gl/glfw`. 9 | // 10 | // How it works: 11 | // - every directory which only includes c source files receives a dummy.go file. 12 | // - every directory we want to preserve is included here as a _ import. 13 | // - this file is given a build to exclude it from the regular build. 14 | import ( 15 | // Prevent go tooling from stripping out the c source files. 16 | _ "github.com/go-gl/glfw/v3.2/glfw/glfw/deps" 17 | _ "github.com/go-gl/glfw/v3.2/glfw/glfw/include/GLFW" 18 | _ "github.com/go-gl/glfw/v3.2/glfw/glfw/src" 19 | ) 20 | -------------------------------------------------------------------------------- /v3.2/glfw/c_glfw.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #include "glfw/src/context.c" 5 | #include "glfw/src/init.c" 6 | #include "glfw/src/input.c" 7 | #include "glfw/src/monitor.c" 8 | #include "glfw/src/vulkan.c" 9 | #include "glfw/src/window.c" 10 | */ 11 | import "C" 12 | -------------------------------------------------------------------------------- /v3.2/glfw/c_glfw_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #include "glfw/src/cocoa_init.m" 6 | #include "glfw/src/cocoa_joystick.m" 7 | #include "glfw/src/cocoa_monitor.m" 8 | #include "glfw/src/cocoa_window.m" 9 | #include "glfw/src/cocoa_time.c" 10 | #include "glfw/src/posix_tls.c" 11 | #include "glfw/src/nsgl_context.m" 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /v3.2/glfw/c_glfw_linbsd.go: -------------------------------------------------------------------------------- 1 | //go:build linux || freebsd 2 | // +build linux freebsd 3 | 4 | package glfw 5 | 6 | /* 7 | #ifdef _GLFW_MIR 8 | #include "glfw/src/mir_init.c" 9 | #include "glfw/src/mir_monitor.c" 10 | #include "glfw/src/mir_window.c" 11 | #endif 12 | #ifdef _GLFW_WAYLAND 13 | #include "glfw/src/wl_init.c" 14 | #include "glfw/src/wl_monitor.c" 15 | #include "glfw/src/wl_window.c" 16 | #include "glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.c" 17 | #include "glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c" 18 | #endif 19 | #ifdef _GLFW_X11 20 | #include "glfw/src/x11_init.c" 21 | #include "glfw/src/x11_monitor.c" 22 | #include "glfw/src/x11_window.c" 23 | #include "glfw/src/glx_context.c" 24 | #endif 25 | #include "glfw/src/linux_joystick.c" 26 | #include "glfw/src/posix_time.c" 27 | #include "glfw/src/posix_tls.c" 28 | #include "glfw/src/xkb_unicode.c" 29 | #include "glfw/src/egl_context.c" 30 | */ 31 | import "C" 32 | -------------------------------------------------------------------------------- /v3.2/glfw/c_glfw_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #include "glfw/src/win32_init.c" 5 | #include "glfw/src/win32_joystick.c" 6 | #include "glfw/src/win32_monitor.c" 7 | #include "glfw/src/win32_time.c" 8 | #include "glfw/src/win32_tls.c" 9 | #include "glfw/src/win32_window.c" 10 | #include "glfw/src/wgl_context.c" 11 | #include "glfw/src/egl_context.c" 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /v3.2/glfw/error.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwErrorCB(int code, const char *desc) { 4 | goErrorCB(code, (char*)desc); 5 | } 6 | 7 | void glfwSetErrorCallbackCB() { 8 | glfwSetErrorCallback(glfwErrorCB); 9 | } 10 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | // Version constants. 8 | const ( 9 | VersionMajor = C.GLFW_VERSION_MAJOR // This is incremented when the API is changed in non-compatible ways. 10 | VersionMinor = C.GLFW_VERSION_MINOR // This is incremented when features are added to the API but it remains backward-compatible. 11 | VersionRevision = C.GLFW_VERSION_REVISION // This is incremented when a bug fix release is made that does not contain any API changes. 12 | ) 13 | 14 | // Init initializes the GLFW library. Before most GLFW functions can be used, 15 | // GLFW must be initialized, and before a program terminates GLFW should be 16 | // terminated in order to free any resources allocated during or after 17 | // initialization. 18 | // 19 | // If this function fails, it calls Terminate before returning. If it succeeds, 20 | // you should call Terminate before the program exits. 21 | // 22 | // Additional calls to this function after successful initialization but before 23 | // termination will succeed but will do nothing. 24 | // 25 | // This function may take several seconds to complete on some systems, while on 26 | // other systems it may take only a fraction of a second to complete. 27 | // 28 | // On Mac OS X, this function will change the current directory of the 29 | // application to the Contents/Resources subdirectory of the application's 30 | // bundle, if present. 31 | // 32 | // This function may only be called from the main thread. 33 | func Init() error { 34 | C.glfwInit() 35 | return acceptError(APIUnavailable) 36 | } 37 | 38 | // Terminate destroys all remaining windows, frees any allocated resources and 39 | // sets the library to an uninitialized state. Once this is called, you must 40 | // again call Init successfully before you will be able to use most GLFW 41 | // functions. 42 | // 43 | // If GLFW has been successfully initialized, this function should be called 44 | // before the program exits. If initialization fails, there is no need to call 45 | // this function, as it is called by Init before it returns failure. 46 | // 47 | // This function may only be called from the main thread. 48 | func Terminate() { 49 | flushErrors() 50 | C.glfwTerminate() 51 | } 52 | 53 | // GetVersion retrieves the major, minor and revision numbers of the GLFW 54 | // library. It is intended for when you are using GLFW as a shared library and 55 | // want to ensure that you are using the minimum required version. 56 | // 57 | // This function may be called before Init. 58 | func GetVersion() (major, minor, revision int) { 59 | var ( 60 | maj C.int 61 | min C.int 62 | rev C.int 63 | ) 64 | 65 | C.glfwGetVersion(&maj, &min, &rev) 66 | return int(maj), int(min), int(rev) 67 | } 68 | 69 | // GetVersionString returns a static string generated at compile-time according 70 | // to which configuration macros were defined. This is intended for use when 71 | // submitting bug reports, to allow developers to see which code paths are 72 | // enabled in a binary. 73 | // 74 | // This function may be called before Init. 75 | func GetVersionString() string { 76 | return C.GoString(C.glfwGetVersionString()) 77 | } 78 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2016 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/deps/KHR/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/deps/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | 7 | import ( 8 | // Prevent go tooling from stripping out the c source files. 9 | _ "github.com/go-gl/glfw/v3.2/glfw/glfw/deps/KHR" 10 | _ "github.com/go-gl/glfw/v3.2/glfw/glfw/deps/glad" 11 | _ "github.com/go-gl/glfw/v3.2/glfw/glfw/deps/mingw" 12 | _ "github.com/go-gl/glfw/v3.2/glfw/glfw/deps/vulkan" 13 | ) 14 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/deps/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Kim Gräsman 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * * Neither the name of Kim Gräsman nor the names of contributors may be used 12 | * to endorse or promote products derived from this software without specific 13 | * prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef INCLUDED_GETOPT_PORT_H 28 | #define INCLUDED_GETOPT_PORT_H 29 | 30 | #if defined(__cplusplus) 31 | extern "C" { 32 | #endif 33 | 34 | extern const int no_argument; 35 | extern const int required_argument; 36 | extern const int optional_argument; 37 | 38 | extern char* optarg; 39 | extern int optind, opterr, optopt; 40 | 41 | struct option { 42 | const char* name; 43 | int has_arg; 44 | int* flag; 45 | int val; 46 | }; 47 | 48 | int getopt(int argc, char* const argv[], const char* optstring); 49 | 50 | int getopt_long(int argc, char* const argv[], 51 | const char* optstring, const struct option* longopts, int* longindex); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif // INCLUDED_GETOPT_PORT_H 58 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/deps/glad/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/deps/mingw/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/deps/vulkan/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/include/GLFW/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/include/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/cocoa_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Cocoa - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_cocoa_joystick_h_ 28 | #define _glfw3_cocoa_joystick_h_ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 36 | _GLFWjoystickNS ns_js[GLFW_JOYSTICK_LAST + 1] 37 | 38 | 39 | // Cocoa-specific per-joystick data 40 | // 41 | typedef struct _GLFWjoystickNS 42 | { 43 | GLFWbool present; 44 | char name[256]; 45 | 46 | IOHIDDeviceRef deviceRef; 47 | 48 | CFMutableArrayRef axisElements; 49 | CFMutableArrayRef buttonElements; 50 | CFMutableArrayRef hatElements; 51 | 52 | float* axes; 53 | unsigned char* buttons; 54 | } _GLFWjoystickNS; 55 | 56 | 57 | void _glfwInitJoysticksNS(void); 58 | void _glfwTerminateJoysticksNS(void); 59 | 60 | #endif // _glfw3_cocoa_joystick_h_ 61 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/cocoa_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | #include 30 | 31 | 32 | ////////////////////////////////////////////////////////////////////////// 33 | ////// GLFW internal API ////// 34 | ////////////////////////////////////////////////////////////////////////// 35 | 36 | // Initialise timer 37 | // 38 | void _glfwInitTimerNS(void) 39 | { 40 | mach_timebase_info_data_t info; 41 | mach_timebase_info(&info); 42 | 43 | _glfw.ns_time.frequency = (info.denom * 1e9) / info.numer; 44 | } 45 | 46 | 47 | ////////////////////////////////////////////////////////////////////////// 48 | ////// GLFW platform API ////// 49 | ////////////////////////////////////////////////////////////////////////// 50 | 51 | uint64_t _glfwPlatformGetTimerValue(void) 52 | { 53 | return mach_absolute_time(); 54 | } 55 | 56 | uint64_t _glfwPlatformGetTimerFrequency(void) 57 | { 58 | return _glfw.ns_time.frequency; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/linux_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_linux_joystick_h_ 28 | #define _glfw3_linux_joystick_h_ 29 | 30 | #include 31 | 32 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWjoylistLinux linux_js 33 | 34 | 35 | // Linux-specific joystick data 36 | // 37 | typedef struct _GLFWjoystickLinux 38 | { 39 | GLFWbool present; 40 | int fd; 41 | float* axes; 42 | int axisCount; 43 | unsigned char* buttons; 44 | int buttonCount; 45 | char* name; 46 | char* path; 47 | } _GLFWjoystickLinux; 48 | 49 | // Linux-specific joystick API data 50 | // 51 | typedef struct _GLFWjoylistLinux 52 | { 53 | _GLFWjoystickLinux js[GLFW_JOYSTICK_LAST + 1]; 54 | 55 | #if defined(__linux__) 56 | int inotify; 57 | int watch; 58 | regex_t regex; 59 | #endif /*__linux__*/ 60 | } _GLFWjoylistLinux; 61 | 62 | 63 | GLFWbool _glfwInitJoysticksLinux(void); 64 | void _glfwTerminateJoysticksLinux(void); 65 | 66 | void _glfwPollJoystickEvents(void); 67 | 68 | #endif // _glfw3_linux_joystick_h_ 69 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/nsgl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_nsgl_context_h_ 28 | #define _glfw3_nsgl_context_h_ 29 | 30 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl 31 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl 32 | 33 | 34 | // NSGL-specific per-context data 35 | // 36 | typedef struct _GLFWcontextNSGL 37 | { 38 | id pixelFormat; 39 | id object; 40 | 41 | } _GLFWcontextNSGL; 42 | 43 | // NSGL-specific global data 44 | // 45 | typedef struct _GLFWlibraryNSGL 46 | { 47 | // dlopen handle for OpenGL.framework (for glfwGetProcAddress) 48 | CFBundleRef framework; 49 | 50 | } _GLFWlibraryNSGL; 51 | 52 | 53 | GLFWbool _glfwInitNSGL(void); 54 | void _glfwTerminateNSGL(void); 55 | GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, 56 | const _GLFWctxconfig* ctxconfig, 57 | const _GLFWfbconfig* fbconfig); 58 | void _glfwDestroyContextNSGL(_GLFWwindow* window); 59 | 60 | #endif // _glfw3_nsgl_context_h_ 61 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/posix_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | ////////////////////////////////////////////////////////////////////////// 35 | ////// GLFW internal API ////// 36 | ////////////////////////////////////////////////////////////////////////// 37 | 38 | // Initialise timer 39 | // 40 | void _glfwInitTimerPOSIX(void) 41 | { 42 | #if defined(CLOCK_MONOTONIC) 43 | struct timespec ts; 44 | 45 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 46 | { 47 | _glfw.posix_time.monotonic = GLFW_TRUE; 48 | _glfw.posix_time.frequency = 1000000000; 49 | } 50 | else 51 | #endif 52 | { 53 | _glfw.posix_time.monotonic = GLFW_FALSE; 54 | _glfw.posix_time.frequency = 1000000; 55 | } 56 | } 57 | 58 | 59 | ////////////////////////////////////////////////////////////////////////// 60 | ////// GLFW platform API ////// 61 | ////////////////////////////////////////////////////////////////////////// 62 | 63 | uint64_t _glfwPlatformGetTimerValue(void) 64 | { 65 | #if defined(CLOCK_MONOTONIC) 66 | if (_glfw.posix_time.monotonic) 67 | { 68 | struct timespec ts; 69 | clock_gettime(CLOCK_MONOTONIC, &ts); 70 | return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec; 71 | } 72 | else 73 | #endif 74 | { 75 | struct timeval tv; 76 | gettimeofday(&tv, NULL); 77 | return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec; 78 | } 79 | } 80 | 81 | uint64_t _glfwPlatformGetTimerFrequency(void) 82 | { 83 | return _glfw.posix_time.frequency; 84 | } 85 | 86 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_time_h_ 29 | #define _glfw3_posix_time_h_ 30 | 31 | #define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimePOSIX posix_time 32 | 33 | #include 34 | 35 | 36 | // POSIX-specific global timer data 37 | // 38 | typedef struct _GLFWtimePOSIX 39 | { 40 | GLFWbool monotonic; 41 | uint64_t frequency; 42 | 43 | } _GLFWtimePOSIX; 44 | 45 | 46 | void _glfwInitTimerPOSIX(void); 47 | 48 | #endif // _glfw3_posix_time_h_ 49 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/posix_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | GLFWbool _glfwInitThreadLocalStoragePOSIX(void) 36 | { 37 | if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0) 38 | { 39 | _glfwInputError(GLFW_PLATFORM_ERROR, 40 | "POSIX: Failed to create context TLS"); 41 | return GLFW_FALSE; 42 | } 43 | 44 | _glfw.posix_tls.allocated = GLFW_TRUE; 45 | return GLFW_TRUE; 46 | } 47 | 48 | void _glfwTerminateThreadLocalStoragePOSIX(void) 49 | { 50 | if (_glfw.posix_tls.allocated) 51 | pthread_key_delete(_glfw.posix_tls.context); 52 | } 53 | 54 | 55 | ////////////////////////////////////////////////////////////////////////// 56 | ////// GLFW platform API ////// 57 | ////////////////////////////////////////////////////////////////////////// 58 | 59 | void _glfwPlatformSetCurrentContext(_GLFWwindow* context) 60 | { 61 | pthread_setspecific(_glfw.posix_tls.context, context); 62 | } 63 | 64 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 65 | { 66 | return pthread_getspecific(_glfw.posix_tls.context); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/posix_tls.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_tls_h_ 29 | #define _glfw3_posix_tls_h_ 30 | 31 | #include 32 | 33 | #define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls 34 | 35 | 36 | // POSIX-specific global TLS data 37 | // 38 | typedef struct _GLFWtlsPOSIX 39 | { 40 | GLFWbool allocated; 41 | pthread_key_t context; 42 | 43 | } _GLFWtlsPOSIX; 44 | 45 | 46 | GLFWbool _glfwInitThreadLocalStoragePOSIX(void); 47 | void _glfwTerminateThreadLocalStoragePOSIX(void); 48 | 49 | #endif // _glfw3_posix_tls_h_ 50 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner */ 2 | 3 | /* 4 | * Copyright © 2015 Samsung Electronics Co., Ltd 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include "wayland-util.h" 29 | 30 | #ifndef __has_attribute 31 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 32 | #endif 33 | 34 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 35 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 36 | #else 37 | #define WL_PRIVATE 38 | #endif 39 | 40 | extern const struct wl_interface wl_surface_interface; 41 | extern const struct wl_interface zwp_idle_inhibitor_v1_interface; 42 | 43 | static const struct wl_interface *idle_inhibit_unstable_v1_types[] = { 44 | &zwp_idle_inhibitor_v1_interface, 45 | &wl_surface_interface, 46 | }; 47 | 48 | static const struct wl_message zwp_idle_inhibit_manager_v1_requests[] = { 49 | { "destroy", "", idle_inhibit_unstable_v1_types + 0 }, 50 | { "create_inhibitor", "no", idle_inhibit_unstable_v1_types + 0 }, 51 | }; 52 | 53 | WL_PRIVATE const struct wl_interface zwp_idle_inhibit_manager_v1_interface = { 54 | "zwp_idle_inhibit_manager_v1", 1, 55 | 2, zwp_idle_inhibit_manager_v1_requests, 56 | 0, NULL, 57 | }; 58 | 59 | static const struct wl_message zwp_idle_inhibitor_v1_requests[] = { 60 | { "destroy", "", idle_inhibit_unstable_v1_types + 0 }, 61 | }; 62 | 63 | WL_PRIVATE const struct wl_interface zwp_idle_inhibitor_v1_interface = { 64 | "zwp_idle_inhibitor_v1", 1, 65 | 1, zwp_idle_inhibitor_v1_requests, 66 | 0, NULL, 67 | }; 68 | 69 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner */ 2 | 3 | /* 4 | * Copyright © 2014 Jonas Ådahl 5 | * Copyright © 2015 Red Hat Inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the next 15 | * paragraph) shall be included in all copies or substantial portions of the 16 | * Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | * DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include "wayland-util.h" 30 | 31 | #ifndef __has_attribute 32 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 33 | #endif 34 | 35 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 36 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 37 | #else 38 | #define WL_PRIVATE 39 | #endif 40 | 41 | extern const struct wl_interface wl_pointer_interface; 42 | extern const struct wl_interface zwp_relative_pointer_v1_interface; 43 | 44 | static const struct wl_interface *relative_pointer_unstable_v1_types[] = { 45 | NULL, 46 | NULL, 47 | NULL, 48 | NULL, 49 | NULL, 50 | NULL, 51 | &zwp_relative_pointer_v1_interface, 52 | &wl_pointer_interface, 53 | }; 54 | 55 | static const struct wl_message zwp_relative_pointer_manager_v1_requests[] = { 56 | { "destroy", "", relative_pointer_unstable_v1_types + 0 }, 57 | { "get_relative_pointer", "no", relative_pointer_unstable_v1_types + 6 }, 58 | }; 59 | 60 | WL_PRIVATE const struct wl_interface zwp_relative_pointer_manager_v1_interface = { 61 | "zwp_relative_pointer_manager_v1", 1, 62 | 2, zwp_relative_pointer_manager_v1_requests, 63 | 0, NULL, 64 | }; 65 | 66 | static const struct wl_message zwp_relative_pointer_v1_requests[] = { 67 | { "destroy", "", relative_pointer_unstable_v1_types + 0 }, 68 | }; 69 | 70 | static const struct wl_message zwp_relative_pointer_v1_events[] = { 71 | { "relative_motion", "uuffff", relative_pointer_unstable_v1_types + 0 }, 72 | }; 73 | 74 | WL_PRIVATE const struct wl_interface zwp_relative_pointer_v1_interface = { 75 | "zwp_relative_pointer_v1", 1, 76 | 1, zwp_relative_pointer_v1_requests, 77 | 1, zwp_relative_pointer_v1_events, 78 | }; 79 | 80 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/wayland-viewporter-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner */ 2 | 3 | /* 4 | * Copyright © 2013-2016 Collabora, Ltd. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include "wayland-util.h" 29 | 30 | #ifndef __has_attribute 31 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 32 | #endif 33 | 34 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 35 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 36 | #else 37 | #define WL_PRIVATE 38 | #endif 39 | 40 | extern const struct wl_interface wl_surface_interface; 41 | extern const struct wl_interface wp_viewport_interface; 42 | 43 | static const struct wl_interface *viewporter_types[] = { 44 | NULL, 45 | NULL, 46 | NULL, 47 | NULL, 48 | &wp_viewport_interface, 49 | &wl_surface_interface, 50 | }; 51 | 52 | static const struct wl_message wp_viewporter_requests[] = { 53 | { "destroy", "", viewporter_types + 0 }, 54 | { "get_viewport", "no", viewporter_types + 4 }, 55 | }; 56 | 57 | WL_PRIVATE const struct wl_interface wp_viewporter_interface = { 58 | "wp_viewporter", 1, 59 | 2, wp_viewporter_requests, 60 | 0, NULL, 61 | }; 62 | 63 | static const struct wl_message wp_viewport_requests[] = { 64 | { "destroy", "", viewporter_types + 0 }, 65 | { "set_source", "ffff", viewporter_types + 0 }, 66 | { "set_destination", "ii", viewporter_types + 0 }, 67 | }; 68 | 69 | WL_PRIVATE const struct wl_interface wp_viewport_interface = { 70 | "wp_viewport", 1, 71 | 3, wp_viewport_requests, 72 | 0, NULL, 73 | }; 74 | 75 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/wayland-xdg-decoration-unstable-v1-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner */ 2 | 3 | /* 4 | * Copyright © 2018 Simon Ser 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include "wayland-util.h" 29 | 30 | #ifndef __has_attribute 31 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 32 | #endif 33 | 34 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 35 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 36 | #else 37 | #define WL_PRIVATE 38 | #endif 39 | 40 | extern const struct wl_interface xdg_toplevel_interface; 41 | extern const struct wl_interface zxdg_toplevel_decoration_v1_interface; 42 | 43 | static const struct wl_interface *xdg_decoration_unstable_v1_types[] = { 44 | NULL, 45 | &zxdg_toplevel_decoration_v1_interface, 46 | &xdg_toplevel_interface, 47 | }; 48 | 49 | static const struct wl_message zxdg_decoration_manager_v1_requests[] = { 50 | { "destroy", "", xdg_decoration_unstable_v1_types + 0 }, 51 | { "get_toplevel_decoration", "no", xdg_decoration_unstable_v1_types + 1 }, 52 | }; 53 | 54 | WL_PRIVATE const struct wl_interface zxdg_decoration_manager_v1_interface = { 55 | "zxdg_decoration_manager_v1", 1, 56 | 2, zxdg_decoration_manager_v1_requests, 57 | 0, NULL, 58 | }; 59 | 60 | static const struct wl_message zxdg_toplevel_decoration_v1_requests[] = { 61 | { "destroy", "", xdg_decoration_unstable_v1_types + 0 }, 62 | { "set_mode", "u", xdg_decoration_unstable_v1_types + 0 }, 63 | { "unset_mode", "", xdg_decoration_unstable_v1_types + 0 }, 64 | }; 65 | 66 | static const struct wl_message zxdg_toplevel_decoration_v1_events[] = { 67 | { "configure", "u", xdg_decoration_unstable_v1_types + 0 }, 68 | }; 69 | 70 | WL_PRIVATE const struct wl_interface zxdg_toplevel_decoration_v1_interface = { 71 | "zxdg_toplevel_decoration_v1", 1, 72 | 3, zxdg_toplevel_decoration_v1_requests, 73 | 1, zxdg_toplevel_decoration_v1_events, 74 | }; 75 | 76 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/win32_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2016 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_win32_joystick_h_ 28 | #define _glfw3_win32_joystick_h_ 29 | 30 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 31 | _GLFWjoystickWin32 win32_js[GLFW_JOYSTICK_LAST + 1] 32 | 33 | // Joystick element (axis, button or slider) 34 | // 35 | typedef struct _GLFWjoyobjectWin32 36 | { 37 | int offset; 38 | int type; 39 | } _GLFWjoyobjectWin32; 40 | 41 | // Win32-specific per-joystick data 42 | // 43 | typedef struct _GLFWjoystickWin32 44 | { 45 | GLFWbool present; 46 | float* axes; 47 | int axisCount; 48 | unsigned char* buttons; 49 | int buttonCount; 50 | _GLFWjoyobjectWin32* objects; 51 | int objectCount; 52 | char* name; 53 | IDirectInputDevice8W* device; 54 | DWORD index; 55 | GUID guid; 56 | } _GLFWjoystickWin32; 57 | 58 | 59 | void _glfwInitJoysticksWin32(void); 60 | void _glfwTerminateJoysticksWin32(void); 61 | void _glfwDetectJoystickConnectionWin32(void); 62 | void _glfwDetectJoystickDisconnectionWin32(void); 63 | 64 | #endif // _glfw3_win32_joystick_h_ 65 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/win32_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | // Initialise timer 36 | // 37 | void _glfwInitTimerWin32(void) 38 | { 39 | uint64_t frequency; 40 | 41 | if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) 42 | { 43 | _glfw.win32_time.hasPC = GLFW_TRUE; 44 | _glfw.win32_time.frequency = frequency; 45 | } 46 | else 47 | { 48 | _glfw.win32_time.hasPC = GLFW_FALSE; 49 | _glfw.win32_time.frequency = 1000; 50 | } 51 | } 52 | 53 | 54 | ////////////////////////////////////////////////////////////////////////// 55 | ////// GLFW platform API ////// 56 | ////////////////////////////////////////////////////////////////////////// 57 | 58 | uint64_t _glfwPlatformGetTimerValue(void) 59 | { 60 | if (_glfw.win32_time.hasPC) 61 | { 62 | uint64_t value; 63 | QueryPerformanceCounter((LARGE_INTEGER*) &value); 64 | return value; 65 | } 66 | else 67 | return (uint64_t) _glfw_timeGetTime(); 68 | } 69 | 70 | uint64_t _glfwPlatformGetTimerFrequency(void) 71 | { 72 | return _glfw.win32_time.frequency; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/win32_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2016 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | GLFWbool _glfwInitThreadLocalStorageWin32(void) 36 | { 37 | _glfw.win32_tls.context = TlsAlloc(); 38 | if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES) 39 | { 40 | _glfwInputError(GLFW_PLATFORM_ERROR, 41 | "Win32: Failed to allocate TLS index"); 42 | return GLFW_FALSE; 43 | } 44 | 45 | _glfw.win32_tls.allocated = GLFW_TRUE; 46 | return GLFW_TRUE; 47 | } 48 | 49 | void _glfwTerminateThreadLocalStorageWin32(void) 50 | { 51 | if (_glfw.win32_tls.allocated) 52 | TlsFree(_glfw.win32_tls.context); 53 | } 54 | 55 | 56 | ////////////////////////////////////////////////////////////////////////// 57 | ////// GLFW platform API ////// 58 | ////////////////////////////////////////////////////////////////////////// 59 | 60 | void _glfwPlatformSetCurrentContext(_GLFWwindow* context) 61 | { 62 | TlsSetValue(_glfw.win32_tls.context, context); 63 | } 64 | 65 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 66 | { 67 | return TlsGetValue(_glfw.win32_tls.context); 68 | } 69 | 70 | -------------------------------------------------------------------------------- /v3.2/glfw/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.2 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_xkb_unicode_h_ 28 | #define _glfw3_xkb_unicode_h_ 29 | 30 | 31 | long _glfwKeySym2Unicode(unsigned int keysym); 32 | 33 | #endif // _glfw3_xkb_unicode_h_ 34 | -------------------------------------------------------------------------------- /v3.2/glfw/input.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwJoystickCB(int joy, int event) { 4 | goJoystickCB(joy, event); 5 | } 6 | 7 | void glfwMouseButtonCB(GLFWwindow* window, int button, int action, int mods) { 8 | goMouseButtonCB(window, button, action, mods); 9 | } 10 | 11 | void glfwCursorPosCB(GLFWwindow* window, double xpos, double ypos) { 12 | goCursorPosCB(window, xpos, ypos); 13 | } 14 | 15 | void glfwCursorEnterCB(GLFWwindow* window, int entered) { 16 | goCursorEnterCB(window, entered); 17 | } 18 | 19 | void glfwScrollCB(GLFWwindow* window, double xoff, double yoff) { 20 | goScrollCB(window, xoff, yoff); 21 | } 22 | 23 | void glfwKeyCB(GLFWwindow* window, int key, int scancode, int action, int mods) { 24 | goKeyCB(window, key, scancode, action, mods); 25 | } 26 | 27 | void glfwCharCB(GLFWwindow* window, unsigned int character) { 28 | goCharCB(window, character); 29 | } 30 | 31 | void glfwCharModsCB(GLFWwindow* window, unsigned int character, int mods) { 32 | goCharModsCB(window, character, mods); 33 | } 34 | 35 | void glfwDropCB(GLFWwindow* window, int count, const char **names) { 36 | goDropCB(window, count, (char**)names); 37 | } 38 | 39 | void glfwSetJoystickCallbackCB() { 40 | glfwSetJoystickCallback(glfwJoystickCB); 41 | } 42 | 43 | void glfwSetKeyCallbackCB(GLFWwindow *window) { 44 | glfwSetKeyCallback(window, glfwKeyCB); 45 | } 46 | 47 | void glfwSetCharCallbackCB(GLFWwindow *window) { 48 | glfwSetCharCallback(window, glfwCharCB); 49 | } 50 | 51 | void glfwSetCharModsCallbackCB(GLFWwindow *window) { 52 | glfwSetCharModsCallback(window, glfwCharModsCB); 53 | } 54 | 55 | void glfwSetMouseButtonCallbackCB(GLFWwindow *window) { 56 | glfwSetMouseButtonCallback(window, glfwMouseButtonCB); 57 | } 58 | 59 | void glfwSetCursorPosCallbackCB(GLFWwindow *window) { 60 | glfwSetCursorPosCallback(window, glfwCursorPosCB); 61 | } 62 | 63 | void glfwSetCursorEnterCallbackCB(GLFWwindow *window) { 64 | glfwSetCursorEnterCallback(window, glfwCursorEnterCB); 65 | } 66 | 67 | void glfwSetScrollCallbackCB(GLFWwindow *window) { 68 | glfwSetScrollCallback(window, glfwScrollCB); 69 | } 70 | 71 | void glfwSetDropCallbackCB(GLFWwindow *window) { 72 | glfwSetDropCallback(window, glfwDropCB); 73 | } 74 | 75 | float GetAxisAtIndex(float *axis, int i) { 76 | return axis[i]; 77 | } 78 | 79 | unsigned char GetButtonsAtIndex(unsigned char *buttons, int i) { 80 | return buttons[i]; 81 | } 82 | -------------------------------------------------------------------------------- /v3.2/glfw/monitor.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) { 4 | return monitors[index]; 5 | } 6 | 7 | GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) { 8 | return vidmodes[index]; 9 | } 10 | 11 | void glfwMonitorCB(GLFWmonitor* monitor, int event) { 12 | goMonitorCB(monitor, event); 13 | } 14 | 15 | void glfwSetMonitorCallbackCB() { 16 | glfwSetMonitorCallback(glfwMonitorCB); 17 | } 18 | 19 | unsigned int GetGammaAtIndex(unsigned short *color, int i) { 20 | return color[i]; 21 | } 22 | 23 | void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) { 24 | color[i] = value; 25 | } 26 | -------------------------------------------------------------------------------- /v3.2/glfw/native_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #define GLFW_EXPOSE_NATIVE_COCOA 5 | #define GLFW_EXPOSE_NATIVE_NSGL 6 | #include "glfw/include/GLFW/glfw3.h" 7 | #include "glfw/include/GLFW/glfw3native.h" 8 | 9 | // workaround wrappers needed due to a cgo and/or LLVM bug. 10 | // See: https://github.com/go-gl/glfw/issues/136 11 | void *workaround_glfwGetCocoaWindow(GLFWwindow *w) { 12 | return (void *)glfwGetCocoaWindow(w); 13 | } 14 | void *workaround_glfwGetNSGLContext(GLFWwindow *w) { 15 | return (void *)glfwGetNSGLContext(w); 16 | } 17 | */ 18 | import "C" 19 | 20 | // GetCocoaMonitor returns the CGDirectDisplayID of the monitor. 21 | func (m *Monitor) GetCocoaMonitor() uintptr { 22 | ret := uintptr(C.glfwGetCocoaMonitor(m.data)) 23 | panicError() 24 | return ret 25 | } 26 | 27 | // GetCocoaWindow returns the NSWindow of the window. 28 | func (w *Window) GetCocoaWindow() uintptr { 29 | ret := uintptr(C.workaround_glfwGetCocoaWindow(w.data)) 30 | panicError() 31 | return ret 32 | } 33 | 34 | // GetNSGLContext returns the NSOpenGLContext of the window. 35 | func (w *Window) GetNSGLContext() uintptr { 36 | ret := uintptr(C.workaround_glfwGetNSGLContext(w.data)) 37 | panicError() 38 | return ret 39 | } 40 | -------------------------------------------------------------------------------- /v3.2/glfw/native_linbsd.go: -------------------------------------------------------------------------------- 1 | //go:build (linux && !wayland) || (freebsd && !wayland) 2 | // +build linux,!wayland freebsd,!wayland 3 | 4 | package glfw 5 | 6 | //#define GLFW_EXPOSE_NATIVE_X11 7 | //#define GLFW_EXPOSE_NATIVE_GLX 8 | //#define GLFW_INCLUDE_NONE 9 | //#include "glfw/include/GLFW/glfw3.h" 10 | //#include "glfw/include/GLFW/glfw3native.h" 11 | import "C" 12 | 13 | func GetX11Display() *C.Display { 14 | ret := C.glfwGetX11Display() 15 | panicError() 16 | return ret 17 | } 18 | 19 | // GetX11Adapter returns the RRCrtc of the monitor. 20 | func (m *Monitor) GetX11Adapter() C.RRCrtc { 21 | ret := C.glfwGetX11Adapter(m.data) 22 | panicError() 23 | return ret 24 | } 25 | 26 | // GetX11Monitor returns the RROutput of the monitor. 27 | func (m *Monitor) GetX11Monitor() C.RROutput { 28 | ret := C.glfwGetX11Monitor(m.data) 29 | panicError() 30 | return ret 31 | } 32 | 33 | // GetX11Window returns the Window of the window. 34 | func (w *Window) GetX11Window() C.Window { 35 | ret := C.glfwGetX11Window(w.data) 36 | panicError() 37 | return ret 38 | } 39 | 40 | // GetGLXContext returns the GLXContext of the window. 41 | func (w *Window) GetGLXContext() C.GLXContext { 42 | ret := C.glfwGetGLXContext(w.data) 43 | panicError() 44 | return ret 45 | } 46 | 47 | // GetGLXWindow returns the GLXWindow of the window. 48 | func (w *Window) GetGLXWindow() C.GLXWindow { 49 | ret := C.glfwGetGLXWindow(w.data) 50 | panicError() 51 | return ret 52 | } 53 | -------------------------------------------------------------------------------- /v3.2/glfw/native_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_EXPOSE_NATIVE_WIN32 4 | //#define GLFW_EXPOSE_NATIVE_WGL 5 | //#define GLFW_INCLUDE_NONE 6 | //#include "glfw/include/GLFW/glfw3.h" 7 | //#include "glfw/include/GLFW/glfw3native.h" 8 | import "C" 9 | 10 | // GetWin32Adapter returns the adapter device name of the monitor. 11 | func (m *Monitor) GetWin32Adapter() string { 12 | ret := C.glfwGetWin32Adapter(m.data) 13 | panicError() 14 | return C.GoString(ret) 15 | } 16 | 17 | // GetWin32Monitor returns the display device name of the monitor. 18 | func (m *Monitor) GetWin32Monitor() string { 19 | ret := C.glfwGetWin32Monitor(m.data) 20 | panicError() 21 | return C.GoString(ret) 22 | } 23 | 24 | // GetWin32Window returns the HWND of the window. 25 | func (w *Window) GetWin32Window() C.HWND { 26 | ret := C.glfwGetWin32Window(w.data) 27 | panicError() 28 | return ret 29 | } 30 | 31 | // GetWGLContext returns the HGLRC of the window. 32 | func (w *Window) GetWGLContext() C.HGLRC { 33 | ret := C.glfwGetWGLContext(w.data) 34 | panicError() 35 | return ret 36 | } 37 | -------------------------------------------------------------------------------- /v3.2/glfw/testdata/customcursor/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "image" 5 | "image/color" 6 | "runtime" 7 | 8 | "github.com/go-gl/glfw/v3.2/glfw" 9 | ) 10 | 11 | func init() { 12 | // This is needed to arrange that main() runs on main thread. 13 | // See documentation for functions that are only allowed to be called from the main thread. 14 | runtime.LockOSThread() 15 | } 16 | 17 | func main() { 18 | err := glfw.Init() 19 | if err != nil { 20 | panic(err) 21 | } 22 | defer glfw.Terminate() 23 | 24 | window, err := glfw.CreateWindow(640, 480, "Custom Cursor", nil, nil) 25 | if err != nil { 26 | panic(err) 27 | } 28 | 29 | window.MakeContextCurrent() 30 | 31 | // Creating a custom cursor. 32 | cursor := glfw.CreateCursor(whiteTriangle, 0, 0) 33 | window.SetCursor(cursor) 34 | 35 | // Setting a custom cursor. 36 | window.SetIcon([]image.Image{whiteTriangle}) 37 | 38 | for !window.ShouldClose() { 39 | // Do OpenGL stuff. 40 | window.SwapBuffers() 41 | glfw.PollEvents() 42 | } 43 | } 44 | 45 | var whiteTriangle = func() *image.NRGBA { 46 | c := color.NRGBA{R: 0xFF, G: 0xFF, B: 0xFF, A: 0xFF} 47 | const size = 16 48 | m := image.NewNRGBA(image.Rect(0, 0, size, size)) 49 | for y := 0; y < size; y++ { 50 | for x := 0; x < size-y; x++ { 51 | m.SetNRGBA(x, y, c) 52 | } 53 | } 54 | return m 55 | }() 56 | -------------------------------------------------------------------------------- /v3.2/glfw/time.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | // GetTime returns the value of the GLFW timer. Unless the timer has been set 8 | // using SetTime, the timer measures time elapsed since GLFW was initialized. 9 | // 10 | // The resolution of the timer is system dependent, but is usually on the order 11 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 12 | // source on each supported platform. 13 | func GetTime() float64 { 14 | ret := float64(C.glfwGetTime()) 15 | panicError() 16 | return ret 17 | } 18 | 19 | // SetTime sets the value of the GLFW timer. It then continues to count up from 20 | // that value. 21 | // 22 | // The resolution of the timer is system dependent, but is usually on the order 23 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 24 | // source on each supported platform. 25 | func SetTime(time float64) { 26 | C.glfwSetTime(C.double(time)) 27 | panicError() 28 | } 29 | 30 | // GetTimerFrequency returns frequency of the timer, in Hz, or zero if an error occurred. 31 | func GetTimerFrequency() uint64 { 32 | ret := uint64(C.glfwGetTimerFrequency()) 33 | panicError() 34 | return ret 35 | } 36 | 37 | // GetTimerValue returns the current value of the raw timer, measured in 1 / frequency seconds. 38 | func GetTimerValue() uint64 { 39 | ret := uint64(C.glfwGetTimerValue()) 40 | panicError() 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /v3.2/glfw/util.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include 4 | //#define GLFW_INCLUDE_NONE 5 | //#include "glfw/include/GLFW/glfw3.h" 6 | import "C" 7 | 8 | import ( 9 | "image" 10 | "image/draw" 11 | ) 12 | 13 | func glfwbool(b C.int) bool { 14 | return b == C.int(True) 15 | } 16 | 17 | func bytes(origin []byte) (pointer *uint8, free func()) { 18 | n := len(origin) 19 | if n == 0 { 20 | return nil, func() {} 21 | } 22 | 23 | ptr := C.CBytes(origin) 24 | return (*uint8)(ptr), func() { C.free(ptr) } 25 | } 26 | 27 | // imageToGLFW converts img to be compatible with C.GLFWimage. 28 | func imageToGLFW(img image.Image) (r C.GLFWimage, free func()) { 29 | b := img.Bounds() 30 | 31 | r.width = C.int(b.Dx()) 32 | r.height = C.int(b.Dy()) 33 | 34 | var pixels []byte 35 | if m, ok := img.(*image.NRGBA); ok && m.Stride == b.Dx()*4 { 36 | pixels = m.Pix[:m.PixOffset(m.Rect.Min.X, m.Rect.Max.Y)] 37 | } else { 38 | m := image.NewNRGBA(image.Rect(0, 0, b.Dx(), b.Dy())) 39 | draw.Draw(m, m.Bounds(), img, b.Min, draw.Src) 40 | pixels = m.Pix 41 | } 42 | 43 | pix, free := bytes(pixels) 44 | r.pixels = (*C.uchar)(pix) 45 | return r, free 46 | } 47 | -------------------------------------------------------------------------------- /v3.2/glfw/vulkan.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | // VulkanSupported reports whether the Vulkan loader has been found. This check is performed by Init. 8 | // 9 | // The availability of a Vulkan loader does not by itself guarantee that window surface creation or 10 | // even device creation is possible. Call GetRequiredInstanceExtensions to check whether the 11 | // extensions necessary for Vulkan surface creation are available and GetPhysicalDevicePresentationSupport 12 | // to check whether a queue family of a physical device supports image presentation. 13 | func VulkanSupported() bool { 14 | return glfwbool(C.glfwVulkanSupported()) 15 | } 16 | -------------------------------------------------------------------------------- /v3.2/glfw/window.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwWindowPosCB(GLFWwindow* window, int xpos, int ypos) { 4 | goWindowPosCB(window, xpos, ypos); 5 | } 6 | 7 | void glfwWindowSizeCB(GLFWwindow* window, int width, int height) { 8 | goWindowSizeCB(window, width, height); 9 | } 10 | 11 | void glfwFramebufferSizeCB(GLFWwindow* window, int width, int height) { 12 | goFramebufferSizeCB(window, width, height); 13 | } 14 | 15 | void glfwWindowCloseCB(GLFWwindow* window) { 16 | goWindowCloseCB(window); 17 | } 18 | 19 | void glfwWindowRefreshCB(GLFWwindow* window) { 20 | goWindowRefreshCB(window); 21 | } 22 | 23 | void glfwWindowFocusCB(GLFWwindow* window, int focused) { 24 | goWindowFocusCB(window, focused); 25 | } 26 | 27 | void glfwWindowIconifyCB(GLFWwindow* window, int iconified) { 28 | goWindowIconifyCB(window, iconified); 29 | } 30 | 31 | void glfwSetWindowPosCallbackCB(GLFWwindow* window) { 32 | glfwSetWindowPosCallback(window, glfwWindowPosCB); 33 | } 34 | 35 | void glfwSetWindowSizeCallbackCB(GLFWwindow* window) { 36 | glfwSetWindowSizeCallback(window, glfwWindowSizeCB); 37 | } 38 | 39 | void glfwSetFramebufferSizeCallbackCB(GLFWwindow* window) { 40 | glfwSetFramebufferSizeCallback(window, glfwFramebufferSizeCB); 41 | } 42 | 43 | void glfwSetWindowCloseCallbackCB(GLFWwindow* window) { 44 | glfwSetWindowCloseCallback(window, glfwWindowCloseCB); 45 | } 46 | 47 | void glfwSetWindowRefreshCallbackCB(GLFWwindow* window) { 48 | glfwSetWindowRefreshCallback(window, glfwWindowRefreshCB); 49 | } 50 | 51 | void glfwSetWindowFocusCallbackCB(GLFWwindow* window) { 52 | glfwSetWindowFocusCallback(window, glfwWindowFocusCB); 53 | } 54 | 55 | void glfwSetWindowIconifyCallbackCB(GLFWwindow* window) { 56 | glfwSetWindowIconifyCallback(window, glfwWindowIconifyCB); 57 | } 58 | -------------------------------------------------------------------------------- /v3.3/glfw/GLFW_C_REVISION.txt: -------------------------------------------------------------------------------- 1 | dc46d3f8129712e42856c20e99a604a3b08ad581 2 | -------------------------------------------------------------------------------- /v3.3/glfw/build.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | // Windows Build Tags 5 | // ---------------- 6 | // GLFW Options: 7 | #cgo windows CFLAGS: -D_GLFW_WIN32 -Iglfw/deps/mingw 8 | 9 | // Linker Options: 10 | #cgo windows LDFLAGS: -lgdi32 11 | 12 | #cgo !gles2,windows LDFLAGS: -lopengl32 13 | #cgo gles2,windows LDFLAGS: -lGLESv2 14 | 15 | // Darwin Build Tags 16 | // ---------------- 17 | // GLFW Options: 18 | #cgo darwin CFLAGS: -D_GLFW_COCOA -Wno-deprecated-declarations 19 | 20 | // Linker Options: 21 | #cgo darwin LDFLAGS: -framework Cocoa -framework IOKit -framework CoreVideo 22 | 23 | #cgo !gles2,darwin LDFLAGS: -framework OpenGL 24 | #cgo gles2,darwin LDFLAGS: -lGLESv2 25 | 26 | // Linux Build Tags 27 | // ---------------- 28 | // GLFW Options: 29 | #cgo linux,!wayland CFLAGS: -D_GLFW_X11 30 | #cgo linux,wayland CFLAGS: -D_GLFW_WAYLAND -D_GNU_SOURCE 31 | 32 | // Linker Options: 33 | #cgo linux,!gles1,!gles2,!gles3,!vulkan LDFLAGS: -lGL 34 | #cgo linux,gles1 LDFLAGS: -lGLESv1 35 | #cgo linux,gles2 LDFLAGS: -lGLESv2 36 | #cgo linux,gles3 LDFLAGS: -lGLESv3 37 | #cgo linux,vulkan LDFLAGS: -lvulkan 38 | #cgo linux,!wayland LDFLAGS: -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt 39 | #cgo linux,wayland LDFLAGS: -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon -lm -ldl -lrt 40 | 41 | // BSD Build Tags 42 | // ---------------- 43 | // GLFW Options: 44 | #cgo freebsd,!wayland netbsd,!wayland openbsd pkg-config: x11 xau xcb xdmcp 45 | #cgo freebsd,wayland netbsd,wayland pkg-config: wayland-client wayland-cursor wayland-egl epoll-shim 46 | #cgo freebsd netbsd openbsd CFLAGS: -D_GLFW_HAS_DLOPEN 47 | #cgo freebsd,!wayland netbsd,!wayland openbsd CFLAGS: -D_GLFW_X11 -D_GLFW_HAS_GLXGETPROCADDRESSARB 48 | #cgo freebsd,wayland netbsd,wayland CFLAGS: -D_GLFW_WAYLAND 49 | 50 | // Linker Options: 51 | #cgo freebsd netbsd openbsd LDFLAGS: -lm 52 | */ 53 | import "C" 54 | -------------------------------------------------------------------------------- /v3.3/glfw/build_cgo_hack.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | 3 | package glfw 4 | 5 | // This file exists purely to prevent the golang toolchain from stripping 6 | // away the c source directories and files when `go mod vendor` is used 7 | // to populate a `vendor/` directory of a project depending on `go-gl/glfw`. 8 | // 9 | // How it works: 10 | // - every directory which only includes c source files receives a dummy.go file. 11 | // - every directory we want to preserve is included here as a _ import. 12 | // - this file is given a build to exclude it from the regular build. 13 | import ( 14 | // Prevent go tooling from stripping out the c source files. 15 | _ "github.com/go-gl/glfw/v3.3/glfw/glfw/deps" 16 | _ "github.com/go-gl/glfw/v3.3/glfw/glfw/include/GLFW" 17 | _ "github.com/go-gl/glfw/v3.3/glfw/glfw/src" 18 | ) 19 | -------------------------------------------------------------------------------- /v3.3/glfw/c_glfw.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #include "glfw/src/context.c" 5 | #include "glfw/src/init.c" 6 | #include "glfw/src/input.c" 7 | #include "glfw/src/monitor.c" 8 | #include "glfw/src/vulkan.c" 9 | #include "glfw/src/window.c" 10 | #include "glfw/src/osmesa_context.c" 11 | */ 12 | import "C" 13 | -------------------------------------------------------------------------------- /v3.3/glfw/c_glfw_bsd.go: -------------------------------------------------------------------------------- 1 | //go:build freebsd || netbsd || openbsd 2 | 3 | package glfw 4 | 5 | /* 6 | #ifdef _GLFW_WAYLAND 7 | #include "glfw/src/wl_init.c" 8 | #include "glfw/src/wl_monitor.c" 9 | #include "glfw/src/wl_window.c" 10 | #include "glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.c" 11 | #include "glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.c" 12 | #include "glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c" 13 | #include "glfw/src/wayland-viewporter-client-protocol.c" 14 | #include "glfw/src/wayland-xdg-decoration-unstable-v1-client-protocol.c" 15 | #include "glfw/src/wayland-xdg-shell-client-protocol.c" 16 | #endif 17 | #ifdef _GLFW_X11 18 | #include "glfw/src/x11_init.c" 19 | #include "glfw/src/x11_monitor.c" 20 | #include "glfw/src/x11_window.c" 21 | #include "glfw/src/glx_context.c" 22 | #endif 23 | #include "glfw/src/null_joystick.c" 24 | #include "glfw/src/posix_time.c" 25 | #include "glfw/src/posix_thread.c" 26 | #include "glfw/src/xkb_unicode.c" 27 | #include "glfw/src/egl_context.c" 28 | */ 29 | import "C" 30 | -------------------------------------------------------------------------------- /v3.3/glfw/c_glfw_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #cgo CFLAGS: -x objective-c 5 | #include "glfw/src/cocoa_init.m" 6 | #include "glfw/src/cocoa_joystick.m" 7 | #include "glfw/src/cocoa_monitor.m" 8 | #include "glfw/src/cocoa_window.m" 9 | #include "glfw/src/cocoa_time.c" 10 | #include "glfw/src/posix_thread.c" 11 | #include "glfw/src/nsgl_context.m" 12 | #include "glfw/src/egl_context.c" 13 | */ 14 | import "C" 15 | -------------------------------------------------------------------------------- /v3.3/glfw/c_glfw_lin.go: -------------------------------------------------------------------------------- 1 | //go:build linux 2 | 3 | package glfw 4 | 5 | /* 6 | #ifdef _GLFW_WAYLAND 7 | #include "glfw/src/wl_init.c" 8 | #include "glfw/src/wl_monitor.c" 9 | #include "glfw/src/wl_window.c" 10 | #include "glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.c" 11 | #include "glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.c" 12 | #include "glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c" 13 | #include "glfw/src/wayland-viewporter-client-protocol.c" 14 | #include "glfw/src/wayland-xdg-decoration-unstable-v1-client-protocol.c" 15 | #include "glfw/src/wayland-xdg-shell-client-protocol.c" 16 | #endif 17 | #ifdef _GLFW_X11 18 | #include "glfw/src/x11_window.c" 19 | #include "glfw/src/x11_init.c" 20 | #include "glfw/src/x11_monitor.c" 21 | #include "glfw/src/glx_context.c" 22 | #endif 23 | #include "glfw/src/linux_joystick.c" 24 | #include "glfw/src/posix_time.c" 25 | #include "glfw/src/posix_thread.c" 26 | #include "glfw/src/xkb_unicode.c" 27 | #include "glfw/src/egl_context.c" 28 | */ 29 | import "C" 30 | -------------------------------------------------------------------------------- /v3.3/glfw/c_glfw_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #include "glfw/src/win32_init.c" 5 | #include "glfw/src/win32_joystick.c" 6 | #include "glfw/src/win32_monitor.c" 7 | #include "glfw/src/win32_time.c" 8 | #include "glfw/src/win32_thread.c" 9 | #include "glfw/src/win32_window.c" 10 | #include "glfw/src/wgl_context.c" 11 | #include "glfw/src/egl_context.c" 12 | */ 13 | import "C" 14 | -------------------------------------------------------------------------------- /v3.3/glfw/error.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwSetErrorCallbackCB() { glfwSetErrorCallback((GLFWerrorfun)goErrorCB); } 4 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | 3 | Copyright (c) 2006-2019 Camilla Löwy 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the authors be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would 16 | be appreciated but is not required. 17 | 18 | 2. Altered source versions must be plainly marked as such, and must not 19 | be misrepresented as being the original software. 20 | 21 | 3. This notice may not be removed or altered from any source 22 | distribution. 23 | 24 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/deps/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | 7 | import ( 8 | // Prevent go tooling from stripping out the c source files. 9 | _ "github.com/go-gl/glfw/v3.3/glfw/glfw/deps/glad" 10 | _ "github.com/go-gl/glfw/v3.3/glfw/glfw/deps/mingw" 11 | _ "github.com/go-gl/glfw/v3.3/glfw/glfw/deps/vs2008" 12 | ) 13 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/deps/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Kim Gräsman 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * * Neither the name of Kim Gräsman nor the names of contributors may be used 12 | * to endorse or promote products derived from this software without specific 13 | * prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef INCLUDED_GETOPT_PORT_H 28 | #define INCLUDED_GETOPT_PORT_H 29 | 30 | #if defined(__cplusplus) 31 | extern "C" { 32 | #endif 33 | 34 | extern const int no_argument; 35 | extern const int required_argument; 36 | extern const int optional_argument; 37 | 38 | extern char* optarg; 39 | extern int optind, opterr, optopt; 40 | 41 | struct option { 42 | const char* name; 43 | int has_arg; 44 | int* flag; 45 | int val; 46 | }; 47 | 48 | int getopt(int argc, char* const argv[], const char* optstring); 49 | 50 | int getopt_long(int argc, char* const argv[], 51 | const char* optstring, const struct option* longopts, int* longindex); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif // INCLUDED_GETOPT_PORT_H 58 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/deps/glad/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/deps/glad/vk_platform.h: -------------------------------------------------------------------------------- 1 | /* */ 2 | /* File: vk_platform.h */ 3 | /* */ 4 | /* 5 | ** Copyright 2014-2022 The Khronos Group Inc. 6 | ** 7 | ** SPDX-License-Identifier: Apache-2.0 8 | */ 9 | 10 | 11 | #ifndef VK_PLATFORM_H_ 12 | #define VK_PLATFORM_H_ 13 | 14 | #ifdef __cplusplus 15 | extern "C" 16 | { 17 | #endif /* __cplusplus */ 18 | 19 | /* 20 | *************************************************************************************************** 21 | * Platform-specific directives and type declarations 22 | *************************************************************************************************** 23 | */ 24 | 25 | /* Platform-specific calling convention macros. 26 | * 27 | * Platforms should define these so that Vulkan clients call Vulkan commands 28 | * with the same calling conventions that the Vulkan implementation expects. 29 | * 30 | * VKAPI_ATTR - Placed before the return type in function declarations. 31 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 32 | * VKAPI_CALL - Placed after the return type in function declarations. 33 | * Useful for MSVC-style calling convention syntax. 34 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 35 | * 36 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 37 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 38 | */ 39 | #if defined(_WIN32) 40 | /* On Windows, Vulkan commands use the stdcall convention */ 41 | #define VKAPI_ATTR 42 | #define VKAPI_CALL __stdcall 43 | #define VKAPI_PTR VKAPI_CALL 44 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 45 | #error "Vulkan is not supported for the 'armeabi' NDK ABI" 46 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 47 | /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */ 48 | /* calling convention, i.e. float parameters are passed in registers. This */ 49 | /* is true even if the rest of the application passes floats on the stack, */ 50 | /* as it does by default when compiling for the armeabi-v7a NDK ABI. */ 51 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 52 | #define VKAPI_CALL 53 | #define VKAPI_PTR VKAPI_ATTR 54 | #else 55 | /* On other platforms, use the default calling convention */ 56 | #define VKAPI_ATTR 57 | #define VKAPI_CALL 58 | #define VKAPI_PTR 59 | #endif 60 | 61 | #if !defined(VK_NO_STDDEF_H) 62 | #include 63 | #endif /* !defined(VK_NO_STDDEF_H) */ 64 | 65 | #if !defined(VK_NO_STDINT_H) 66 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 67 | typedef signed __int8 int8_t; 68 | typedef unsigned __int8 uint8_t; 69 | typedef signed __int16 int16_t; 70 | typedef unsigned __int16 uint16_t; 71 | typedef signed __int32 int32_t; 72 | typedef unsigned __int32 uint32_t; 73 | typedef signed __int64 int64_t; 74 | typedef unsigned __int64 uint64_t; 75 | #else 76 | #include 77 | #endif 78 | #endif /* !defined(VK_NO_STDINT_H) */ 79 | 80 | #ifdef __cplusplus 81 | } /* extern "C" */ 82 | #endif /* __cplusplus */ 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/deps/mingw/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/deps/vs2008/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/include/GLFW/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/include/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/cocoa_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 Cocoa - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns 33 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; } 34 | 35 | #define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X" 36 | #define GLFW_BUILD_COCOA_MAPPINGS 37 | 38 | // Cocoa-specific per-joystick data 39 | // 40 | typedef struct _GLFWjoystickNS 41 | { 42 | IOHIDDeviceRef device; 43 | CFMutableArrayRef axes; 44 | CFMutableArrayRef buttons; 45 | CFMutableArrayRef hats; 46 | } _GLFWjoystickNS; 47 | 48 | 49 | void _glfwInitJoysticksNS(void); 50 | void _glfwTerminateJoysticksNS(void); 51 | 52 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/cocoa_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 macOS - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2016 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | // It is fine to use C99 in this file because it will not be built with VS 27 | //======================================================================== 28 | 29 | #include "internal.h" 30 | 31 | #include 32 | 33 | 34 | ////////////////////////////////////////////////////////////////////////// 35 | ////// GLFW internal API ////// 36 | ////////////////////////////////////////////////////////////////////////// 37 | 38 | // Initialise timer 39 | // 40 | void _glfwInitTimerNS(void) 41 | { 42 | mach_timebase_info_data_t info; 43 | mach_timebase_info(&info); 44 | 45 | _glfw.timer.ns.frequency = (info.denom * 1e9) / info.numer; 46 | } 47 | 48 | 49 | ////////////////////////////////////////////////////////////////////////// 50 | ////// GLFW platform API ////// 51 | ////////////////////////////////////////////////////////////////////////// 52 | 53 | uint64_t _glfwPlatformGetTimerValue(void) 54 | { 55 | return mach_absolute_time(); 56 | } 57 | 58 | uint64_t _glfwPlatformGetTimerFrequency(void) 59 | { 60 | return _glfw.timer.ns.frequency; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/dummy.go: -------------------------------------------------------------------------------- 1 | //go:build required 2 | // +build required 3 | 4 | // Package dummy prevents go tooling from stripping the c dependencies. 5 | package dummy 6 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/linux_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickLinux linjs 32 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs 33 | 34 | #define _GLFW_PLATFORM_MAPPING_NAME "Linux" 35 | #define GLFW_BUILD_LINUX_MAPPINGS 36 | 37 | // Linux-specific joystick data 38 | // 39 | typedef struct _GLFWjoystickLinux 40 | { 41 | int fd; 42 | char path[PATH_MAX]; 43 | int keyMap[KEY_CNT - BTN_MISC]; 44 | int absMap[ABS_CNT]; 45 | struct input_absinfo absInfo[ABS_CNT]; 46 | int hats[4][2]; 47 | } _GLFWjoystickLinux; 48 | 49 | // Linux-specific joystick API data 50 | // 51 | typedef struct _GLFWlibraryLinux 52 | { 53 | int inotify; 54 | int watch; 55 | regex_t regex; 56 | GLFWbool regexCompiled; 57 | GLFWbool dropped; 58 | } _GLFWlibraryLinux; 59 | 60 | 61 | GLFWbool _glfwInitJoysticksLinux(void); 62 | void _glfwTerminateJoysticksLinux(void); 63 | void _glfwDetectJoystickConnectionLinux(void); 64 | 65 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/nsgl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 macOS - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2019 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | // NOTE: Many Cocoa enum values have been renamed and we need to build across 28 | // SDK versions where one is unavailable or deprecated. 29 | // We use the newer names in code and replace them with the older names if 30 | // the base SDK does not provide the newer names. 31 | 32 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 101400 33 | #define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval 34 | #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity 35 | #endif 36 | 37 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl 38 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl 39 | 40 | #include 41 | 42 | 43 | // NSGL-specific per-context data 44 | // 45 | typedef struct _GLFWcontextNSGL 46 | { 47 | id pixelFormat; 48 | id object; 49 | } _GLFWcontextNSGL; 50 | 51 | // NSGL-specific global data 52 | // 53 | typedef struct _GLFWlibraryNSGL 54 | { 55 | // dlopen handle for OpenGL.framework (for glfwGetProcAddress) 56 | CFBundleRef framework; 57 | } _GLFWlibraryNSGL; 58 | 59 | 60 | GLFWbool _glfwInitNSGL(void); 61 | void _glfwTerminateNSGL(void); 62 | GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, 63 | const _GLFWctxconfig* ctxconfig, 64 | const _GLFWfbconfig* fbconfig); 65 | void _glfwDestroyContextNSGL(_GLFWwindow* window); 66 | 67 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/null_init.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2016 Google Inc. 5 | // Copyright (c) 2016-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | // It is fine to use C99 in this file because it will not be built with VS 28 | //======================================================================== 29 | 30 | #include "internal.h" 31 | 32 | 33 | ////////////////////////////////////////////////////////////////////////// 34 | ////// GLFW platform API ////// 35 | ////////////////////////////////////////////////////////////////////////// 36 | 37 | int _glfwPlatformInit(void) 38 | { 39 | _glfwInitTimerPOSIX(); 40 | return GLFW_TRUE; 41 | } 42 | 43 | void _glfwPlatformTerminate(void) 44 | { 45 | _glfwTerminateOSMesa(); 46 | } 47 | 48 | const char* _glfwPlatformGetVersionString(void) 49 | { 50 | return _GLFW_VERSION_NUMBER " null OSMesa"; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/null_joystick.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2016-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | // It is fine to use C99 in this file because it will not be built with VS 27 | //======================================================================== 28 | 29 | #include "internal.h" 30 | 31 | 32 | ////////////////////////////////////////////////////////////////////////// 33 | ////// GLFW platform API ////// 34 | ////////////////////////////////////////////////////////////////////////// 35 | 36 | int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) 37 | { 38 | return GLFW_FALSE; 39 | } 40 | 41 | void _glfwPlatformUpdateGamepadGUID(char* guid) 42 | { 43 | } 44 | 45 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/null_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define _GLFW_PLATFORM_JOYSTICK_STATE struct { int dummyJoystick; } 28 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } 29 | 30 | #define _GLFW_PLATFORM_MAPPING_NAME "" 31 | 32 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/null_monitor.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2016 Google Inc. 5 | // Copyright (c) 2016-2019 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | // It is fine to use C99 in this file because it will not be built with VS 28 | //======================================================================== 29 | 30 | #include "internal.h" 31 | 32 | 33 | ////////////////////////////////////////////////////////////////////////// 34 | ////// GLFW platform API ////// 35 | ////////////////////////////////////////////////////////////////////////// 36 | 37 | void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) 38 | { 39 | } 40 | 41 | void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) 42 | { 43 | } 44 | 45 | void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, 46 | float* xscale, float* yscale) 47 | { 48 | if (xscale) 49 | *xscale = 1.f; 50 | if (yscale) 51 | *yscale = 1.f; 52 | } 53 | 54 | void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, 55 | int* xpos, int* ypos, 56 | int* width, int* height) 57 | { 58 | } 59 | 60 | GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) 61 | { 62 | return NULL; 63 | } 64 | 65 | void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) 66 | { 67 | } 68 | 69 | GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) 70 | { 71 | return GLFW_FALSE; 72 | } 73 | 74 | void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) 75 | { 76 | } 77 | 78 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/null_platform.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2016 Google Inc. 5 | // Copyright (c) 2016-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include 29 | 30 | #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNull null 31 | 32 | #define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; } 33 | #define _GLFW_PLATFORM_MONITOR_STATE struct { int dummyMonitor; } 34 | #define _GLFW_PLATFORM_CURSOR_STATE struct { int dummyCursor; } 35 | #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE struct { int dummyLibraryWindow; } 36 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; } 37 | #define _GLFW_EGL_CONTEXT_STATE struct { int dummyEGLContext; } 38 | #define _GLFW_EGL_LIBRARY_CONTEXT_STATE struct { int dummyEGLLibraryContext; } 39 | 40 | #include "osmesa_context.h" 41 | #include "posix_time.h" 42 | #include "posix_thread.h" 43 | #include "null_joystick.h" 44 | 45 | #if defined(_GLFW_WIN32) 46 | #define _glfw_dlopen(name) LoadLibraryA(name) 47 | #define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle) 48 | #define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name) 49 | #else 50 | #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) 51 | #define _glfw_dlclose(handle) dlclose(handle) 52 | #define _glfw_dlsym(handle, name) dlsym(handle, name) 53 | #endif 54 | 55 | // Null-specific per-window data 56 | // 57 | typedef struct _GLFWwindowNull 58 | { 59 | int width; 60 | int height; 61 | } _GLFWwindowNull; 62 | 63 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/posix_thread.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include 29 | 30 | #define _GLFW_PLATFORM_TLS_STATE _GLFWtlsPOSIX posix 31 | #define _GLFW_PLATFORM_MUTEX_STATE _GLFWmutexPOSIX posix 32 | 33 | 34 | // POSIX-specific thread local storage data 35 | // 36 | typedef struct _GLFWtlsPOSIX 37 | { 38 | GLFWbool allocated; 39 | pthread_key_t key; 40 | } _GLFWtlsPOSIX; 41 | 42 | // POSIX-specific mutex data 43 | // 44 | typedef struct _GLFWmutexPOSIX 45 | { 46 | GLFWbool allocated; 47 | pthread_mutex_t handle; 48 | } _GLFWmutexPOSIX; 49 | 50 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/posix_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | // It is fine to use C99 in this file because it will not be built with VS 28 | //======================================================================== 29 | 30 | #include "internal.h" 31 | 32 | #include 33 | #include 34 | 35 | 36 | ////////////////////////////////////////////////////////////////////////// 37 | ////// GLFW internal API ////// 38 | ////////////////////////////////////////////////////////////////////////// 39 | 40 | // Initialise timer 41 | // 42 | void _glfwInitTimerPOSIX(void) 43 | { 44 | #if defined(CLOCK_MONOTONIC) 45 | struct timespec ts; 46 | 47 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 48 | { 49 | _glfw.timer.posix.monotonic = GLFW_TRUE; 50 | _glfw.timer.posix.frequency = 1000000000; 51 | } 52 | else 53 | #endif 54 | { 55 | _glfw.timer.posix.monotonic = GLFW_FALSE; 56 | _glfw.timer.posix.frequency = 1000000; 57 | } 58 | } 59 | 60 | 61 | ////////////////////////////////////////////////////////////////////////// 62 | ////// GLFW platform API ////// 63 | ////////////////////////////////////////////////////////////////////////// 64 | 65 | uint64_t _glfwPlatformGetTimerValue(void) 66 | { 67 | #if defined(CLOCK_MONOTONIC) 68 | if (_glfw.timer.posix.monotonic) 69 | { 70 | struct timespec ts; 71 | clock_gettime(CLOCK_MONOTONIC, &ts); 72 | return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec; 73 | } 74 | else 75 | #endif 76 | { 77 | struct timeval tv; 78 | gettimeofday(&tv, NULL); 79 | return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec; 80 | } 81 | } 82 | 83 | uint64_t _glfwPlatformGetTimerFrequency(void) 84 | { 85 | return _glfw.timer.posix.frequency; 86 | } 87 | 88 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix 29 | 30 | #include 31 | 32 | 33 | // POSIX-specific global timer data 34 | // 35 | typedef struct _GLFWtimerPOSIX 36 | { 37 | GLFWbool monotonic; 38 | uint64_t frequency; 39 | } _GLFWtimerPOSIX; 40 | 41 | 42 | void _glfwInitTimerPOSIX(void); 43 | 44 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/wayland-idle-inhibit-unstable-v1-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner 1.22.0 */ 2 | 3 | /* 4 | * Copyright © 2015 Samsung Electronics Co., Ltd 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include "wayland-util.h" 29 | 30 | #ifndef __has_attribute 31 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 32 | #endif 33 | 34 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 35 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 36 | #else 37 | #define WL_PRIVATE 38 | #endif 39 | 40 | extern const struct wl_interface wl_surface_interface; 41 | extern const struct wl_interface zwp_idle_inhibitor_v1_interface; 42 | 43 | static const struct wl_interface *idle_inhibit_unstable_v1_types[] = { 44 | &zwp_idle_inhibitor_v1_interface, 45 | &wl_surface_interface, 46 | }; 47 | 48 | static const struct wl_message zwp_idle_inhibit_manager_v1_requests[] = { 49 | { "destroy", "", idle_inhibit_unstable_v1_types + 0 }, 50 | { "create_inhibitor", "no", idle_inhibit_unstable_v1_types + 0 }, 51 | }; 52 | 53 | WL_PRIVATE const struct wl_interface zwp_idle_inhibit_manager_v1_interface = { 54 | "zwp_idle_inhibit_manager_v1", 1, 55 | 2, zwp_idle_inhibit_manager_v1_requests, 56 | 0, NULL, 57 | }; 58 | 59 | static const struct wl_message zwp_idle_inhibitor_v1_requests[] = { 60 | { "destroy", "", idle_inhibit_unstable_v1_types + 0 }, 61 | }; 62 | 63 | WL_PRIVATE const struct wl_interface zwp_idle_inhibitor_v1_interface = { 64 | "zwp_idle_inhibitor_v1", 1, 65 | 1, zwp_idle_inhibitor_v1_requests, 66 | 0, NULL, 67 | }; 68 | 69 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner 1.22.0 */ 2 | 3 | /* 4 | * Copyright © 2014 Jonas Ådahl 5 | * Copyright © 2015 Red Hat Inc. 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a 8 | * copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 | * and/or sell copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice (including the next 15 | * paragraph) shall be included in all copies or substantial portions of the 16 | * Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | * DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #include 28 | #include 29 | #include "wayland-util.h" 30 | 31 | #ifndef __has_attribute 32 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 33 | #endif 34 | 35 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 36 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 37 | #else 38 | #define WL_PRIVATE 39 | #endif 40 | 41 | extern const struct wl_interface wl_pointer_interface; 42 | extern const struct wl_interface zwp_relative_pointer_v1_interface; 43 | 44 | static const struct wl_interface *relative_pointer_unstable_v1_types[] = { 45 | NULL, 46 | NULL, 47 | NULL, 48 | NULL, 49 | NULL, 50 | NULL, 51 | &zwp_relative_pointer_v1_interface, 52 | &wl_pointer_interface, 53 | }; 54 | 55 | static const struct wl_message zwp_relative_pointer_manager_v1_requests[] = { 56 | { "destroy", "", relative_pointer_unstable_v1_types + 0 }, 57 | { "get_relative_pointer", "no", relative_pointer_unstable_v1_types + 6 }, 58 | }; 59 | 60 | WL_PRIVATE const struct wl_interface zwp_relative_pointer_manager_v1_interface = { 61 | "zwp_relative_pointer_manager_v1", 1, 62 | 2, zwp_relative_pointer_manager_v1_requests, 63 | 0, NULL, 64 | }; 65 | 66 | static const struct wl_message zwp_relative_pointer_v1_requests[] = { 67 | { "destroy", "", relative_pointer_unstable_v1_types + 0 }, 68 | }; 69 | 70 | static const struct wl_message zwp_relative_pointer_v1_events[] = { 71 | { "relative_motion", "uuffff", relative_pointer_unstable_v1_types + 0 }, 72 | }; 73 | 74 | WL_PRIVATE const struct wl_interface zwp_relative_pointer_v1_interface = { 75 | "zwp_relative_pointer_v1", 1, 76 | 1, zwp_relative_pointer_v1_requests, 77 | 1, zwp_relative_pointer_v1_events, 78 | }; 79 | 80 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/wayland-viewporter-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner 1.22.0 */ 2 | 3 | /* 4 | * Copyright © 2013-2016 Collabora, Ltd. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include "wayland-util.h" 29 | 30 | #ifndef __has_attribute 31 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 32 | #endif 33 | 34 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 35 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 36 | #else 37 | #define WL_PRIVATE 38 | #endif 39 | 40 | extern const struct wl_interface wl_surface_interface; 41 | extern const struct wl_interface wp_viewport_interface; 42 | 43 | static const struct wl_interface *viewporter_types[] = { 44 | NULL, 45 | NULL, 46 | NULL, 47 | NULL, 48 | &wp_viewport_interface, 49 | &wl_surface_interface, 50 | }; 51 | 52 | static const struct wl_message wp_viewporter_requests[] = { 53 | { "destroy", "", viewporter_types + 0 }, 54 | { "get_viewport", "no", viewporter_types + 4 }, 55 | }; 56 | 57 | WL_PRIVATE const struct wl_interface wp_viewporter_interface = { 58 | "wp_viewporter", 1, 59 | 2, wp_viewporter_requests, 60 | 0, NULL, 61 | }; 62 | 63 | static const struct wl_message wp_viewport_requests[] = { 64 | { "destroy", "", viewporter_types + 0 }, 65 | { "set_source", "ffff", viewporter_types + 0 }, 66 | { "set_destination", "ii", viewporter_types + 0 }, 67 | }; 68 | 69 | WL_PRIVATE const struct wl_interface wp_viewport_interface = { 70 | "wp_viewport", 1, 71 | 3, wp_viewport_requests, 72 | 0, NULL, 73 | }; 74 | 75 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/wayland-xdg-decoration-unstable-v1-client-protocol.c: -------------------------------------------------------------------------------- 1 | /* Generated by wayland-scanner 1.22.0 */ 2 | 3 | /* 4 | * Copyright © 2018 Simon Ser 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a 7 | * copy of this software and associated documentation files (the "Software"), 8 | * to deal in the Software without restriction, including without limitation 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | * and/or sell copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice (including the next 14 | * paragraph) shall be included in all copies or substantial portions of the 15 | * Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | * DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | #include "wayland-util.h" 29 | 30 | #ifndef __has_attribute 31 | # define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ 32 | #endif 33 | 34 | #if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4) 35 | #define WL_PRIVATE __attribute__ ((visibility("hidden"))) 36 | #else 37 | #define WL_PRIVATE 38 | #endif 39 | 40 | extern const struct wl_interface xdg_toplevel_interface; 41 | extern const struct wl_interface zxdg_toplevel_decoration_v1_interface; 42 | 43 | static const struct wl_interface *xdg_decoration_unstable_v1_types[] = { 44 | NULL, 45 | &zxdg_toplevel_decoration_v1_interface, 46 | &xdg_toplevel_interface, 47 | }; 48 | 49 | static const struct wl_message zxdg_decoration_manager_v1_requests[] = { 50 | { "destroy", "", xdg_decoration_unstable_v1_types + 0 }, 51 | { "get_toplevel_decoration", "no", xdg_decoration_unstable_v1_types + 1 }, 52 | }; 53 | 54 | WL_PRIVATE const struct wl_interface zxdg_decoration_manager_v1_interface = { 55 | "zxdg_decoration_manager_v1", 1, 56 | 2, zxdg_decoration_manager_v1_requests, 57 | 0, NULL, 58 | }; 59 | 60 | static const struct wl_message zxdg_toplevel_decoration_v1_requests[] = { 61 | { "destroy", "", xdg_decoration_unstable_v1_types + 0 }, 62 | { "set_mode", "u", xdg_decoration_unstable_v1_types + 0 }, 63 | { "unset_mode", "", xdg_decoration_unstable_v1_types + 0 }, 64 | }; 65 | 66 | static const struct wl_message zxdg_toplevel_decoration_v1_events[] = { 67 | { "configure", "u", xdg_decoration_unstable_v1_types + 0 }, 68 | }; 69 | 70 | WL_PRIVATE const struct wl_interface zxdg_toplevel_decoration_v1_interface = { 71 | "zxdg_toplevel_decoration_v1", 1, 72 | 3, zxdg_toplevel_decoration_v1_requests, 73 | 1, zxdg_toplevel_decoration_v1_events, 74 | }; 75 | 76 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/win32_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2017 Camilla Löwy 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32 28 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } 29 | 30 | #define _GLFW_PLATFORM_MAPPING_NAME "Windows" 31 | #define GLFW_BUILD_WIN32_MAPPINGS 32 | 33 | // Joystick element (axis, button or slider) 34 | // 35 | typedef struct _GLFWjoyobjectWin32 36 | { 37 | int offset; 38 | int type; 39 | } _GLFWjoyobjectWin32; 40 | 41 | // Win32-specific per-joystick data 42 | // 43 | typedef struct _GLFWjoystickWin32 44 | { 45 | _GLFWjoyobjectWin32* objects; 46 | int objectCount; 47 | IDirectInputDevice8W* device; 48 | DWORD index; 49 | GUID guid; 50 | } _GLFWjoystickWin32; 51 | 52 | 53 | void _glfwInitJoysticksWin32(void); 54 | void _glfwTerminateJoysticksWin32(void); 55 | void _glfwDetectJoystickConnectionWin32(void); 56 | void _glfwDetectJoystickDisconnectionWin32(void); 57 | 58 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/win32_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2017 Camilla Löwy 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | // Please use C89 style variable declarations in this file because VS 2010 28 | //======================================================================== 29 | 30 | #include "internal.h" 31 | 32 | 33 | ////////////////////////////////////////////////////////////////////////// 34 | ////// GLFW internal API ////// 35 | ////////////////////////////////////////////////////////////////////////// 36 | 37 | // Initialise timer 38 | // 39 | void _glfwInitTimerWin32(void) 40 | { 41 | QueryPerformanceFrequency((LARGE_INTEGER*) &_glfw.timer.win32.frequency); 42 | } 43 | 44 | 45 | ////////////////////////////////////////////////////////////////////////// 46 | ////// GLFW platform API ////// 47 | ////////////////////////////////////////////////////////////////////////// 48 | 49 | uint64_t _glfwPlatformGetTimerValue(void) 50 | { 51 | uint64_t value; 52 | QueryPerformanceCounter((LARGE_INTEGER*) &value); 53 | return value; 54 | } 55 | 56 | uint64_t _glfwPlatformGetTimerFrequency(void) 57 | { 58 | return _glfw.timer.win32.frequency; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.3 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #define GLFW_INVALID_CODEPOINT 0xffffffffu 28 | 29 | uint32_t _glfwKeySym2Unicode(unsigned int keysym); 30 | 31 | -------------------------------------------------------------------------------- /v3.3/glfw/glfw_tree_rebuild.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //go:generate ../../scripts/glfw_tree_rebuild.sh 4 | 5 | // upstreamTreeSHA is a recursive hash of the full contents of the upstream 6 | // glfw, as generated by git (doesn't need to be committed) when you run `go 7 | // generate` on this package. This exists to invalidate the build cache (see 8 | // https://github.com/go-gl/glfw/issues/269), which is unaffected by C source 9 | // inputs. 10 | // 11 | //lint:ignore U1000 ^ 12 | const upstreamTreeSHA = "a4a3bc8c0f4e37695a4de3f51cd7123bc186043b" 13 | -------------------------------------------------------------------------------- /v3.3/glfw/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/go-gl/glfw/v3.3/glfw 2 | 3 | go 1.19 4 | -------------------------------------------------------------------------------- /v3.3/glfw/input.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwSetJoystickCallbackCB() { 4 | glfwSetJoystickCallback((GLFWjoystickfun)goJoystickCB); 5 | } 6 | 7 | void glfwSetKeyCallbackCB(GLFWwindow *window) { 8 | glfwSetKeyCallback(window, (GLFWkeyfun)goKeyCB); 9 | } 10 | 11 | void glfwSetCharCallbackCB(GLFWwindow *window) { 12 | glfwSetCharCallback(window, (GLFWcharfun)goCharCB); 13 | } 14 | 15 | void glfwSetCharModsCallbackCB(GLFWwindow *window) { 16 | glfwSetCharModsCallback(window, (GLFWcharmodsfun)goCharModsCB); 17 | } 18 | 19 | void glfwSetMouseButtonCallbackCB(GLFWwindow *window) { 20 | glfwSetMouseButtonCallback(window, (GLFWmousebuttonfun)goMouseButtonCB); 21 | } 22 | 23 | void glfwSetCursorPosCallbackCB(GLFWwindow *window) { 24 | glfwSetCursorPosCallback(window, (GLFWcursorposfun)goCursorPosCB); 25 | } 26 | 27 | void glfwSetCursorEnterCallbackCB(GLFWwindow *window) { 28 | glfwSetCursorEnterCallback(window, (GLFWcursorenterfun)goCursorEnterCB); 29 | } 30 | 31 | void glfwSetScrollCallbackCB(GLFWwindow *window) { 32 | glfwSetScrollCallback(window, (GLFWscrollfun)goScrollCB); 33 | } 34 | 35 | void glfwSetDropCallbackCB(GLFWwindow *window) { 36 | glfwSetDropCallback(window, (GLFWdropfun)goDropCB); 37 | } 38 | 39 | float GetAxisAtIndex(float *axis, int i) { return axis[i]; } 40 | 41 | unsigned char GetButtonsAtIndex(unsigned char *buttons, int i) { 42 | return buttons[i]; 43 | } 44 | 45 | unsigned char GetGamepadButtonAtIndex(GLFWgamepadstate *gp, int i) { 46 | return gp->buttons[i]; 47 | } 48 | 49 | float GetGamepadAxisAtIndex(GLFWgamepadstate *gp, int i) { return gp->axes[i]; } 50 | -------------------------------------------------------------------------------- /v3.3/glfw/monitor.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | GLFWmonitor *GetMonitorAtIndex(GLFWmonitor **monitors, int index) { 4 | return monitors[index]; 5 | } 6 | 7 | GLFWvidmode GetVidmodeAtIndex(GLFWvidmode *vidmodes, int index) { 8 | return vidmodes[index]; 9 | } 10 | 11 | void glfwSetMonitorCallbackCB() { 12 | glfwSetMonitorCallback((GLFWmonitorfun)goMonitorCB); 13 | } 14 | 15 | unsigned int GetGammaAtIndex(unsigned short *color, int i) { return color[i]; } 16 | 17 | void SetGammaAtIndex(unsigned short *color, int i, unsigned short value) { 18 | color[i] = value; 19 | } 20 | -------------------------------------------------------------------------------- /v3.3/glfw/native_darwin.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | /* 4 | #define GLFW_EXPOSE_NATIVE_COCOA 5 | #define GLFW_EXPOSE_NATIVE_NSGL 6 | #include "glfw/include/GLFW/glfw3.h" 7 | #include "glfw/include/GLFW/glfw3native.h" 8 | 9 | // workaround wrappers needed due to a cgo and/or LLVM bug. 10 | // See: https://github.com/go-gl/glfw/issues/136 11 | void *workaround_glfwGetCocoaWindow(GLFWwindow *w) { 12 | return (void *)glfwGetCocoaWindow(w); 13 | } 14 | void *workaround_glfwGetNSGLContext(GLFWwindow *w) { 15 | return (void *)glfwGetNSGLContext(w); 16 | } 17 | */ 18 | import "C" 19 | import "unsafe" 20 | 21 | // GetCocoaMonitor returns the CGDirectDisplayID of the monitor. 22 | func (m *Monitor) GetCocoaMonitor() uintptr { 23 | ret := uintptr(C.glfwGetCocoaMonitor(m.data)) 24 | panicError() 25 | return ret 26 | } 27 | 28 | // GetCocoaWindow returns the NSWindow of the window. 29 | func (w *Window) GetCocoaWindow() unsafe.Pointer { 30 | ret := C.workaround_glfwGetCocoaWindow(w.data) 31 | panicError() 32 | return ret 33 | } 34 | 35 | // GetNSGLContext returns the NSOpenGLContext of the window. 36 | func (w *Window) GetNSGLContext() unsafe.Pointer { 37 | ret := C.workaround_glfwGetNSGLContext(w.data) 38 | panicError() 39 | return ret 40 | } 41 | -------------------------------------------------------------------------------- /v3.3/glfw/native_linbsd_wayland.go: -------------------------------------------------------------------------------- 1 | //go:build (linux && wayland) || (freebsd && wayland) || (netbsd && wayland) || (openbsd && wayland) 2 | 3 | package glfw 4 | 5 | //#include 6 | //#define GLFW_EXPOSE_NATIVE_WAYLAND 7 | //#define GLFW_EXPOSE_NATIVE_EGL 8 | //#define GLFW_INCLUDE_NONE 9 | //#include "glfw/include/GLFW/glfw3.h" 10 | //#include "glfw/include/GLFW/glfw3native.h" 11 | import "C" 12 | 13 | func GetWaylandDisplay() *C.struct_wl_display { 14 | ret := C.glfwGetWaylandDisplay() 15 | panicError() 16 | return ret 17 | } 18 | 19 | func (m *Monitor) GetWaylandMonitor() *C.struct_wl_output { 20 | ret := C.glfwGetWaylandMonitor(m.data) 21 | panicError() 22 | return ret 23 | } 24 | 25 | func (w *Window) GetWaylandWindow() *C.struct_wl_surface { 26 | ret := C.glfwGetWaylandWindow(w.data) 27 | panicError() 28 | return ret 29 | } 30 | 31 | func GetEGLDisplay() C.EGLDisplay { 32 | ret := C.glfwGetEGLDisplay() 33 | panicError() 34 | return ret 35 | } 36 | 37 | func (w *Window) GetEGLContext() C.EGLContext { 38 | ret := C.glfwGetEGLContext(w.data) 39 | panicError() 40 | return ret 41 | } 42 | 43 | func (w *Window) GetEGLSurface() C.EGLSurface { 44 | ret := C.glfwGetEGLSurface(w.data) 45 | panicError() 46 | return ret 47 | } 48 | -------------------------------------------------------------------------------- /v3.3/glfw/native_linbsd_x11.go: -------------------------------------------------------------------------------- 1 | //go:build (linux && !wayland) || (freebsd && !wayland) || (netbsd && !wayland) || (openbsd && !wayland) 2 | 3 | package glfw 4 | 5 | //#include 6 | //#define GLFW_EXPOSE_NATIVE_X11 7 | //#define GLFW_EXPOSE_NATIVE_GLX 8 | //#define GLFW_INCLUDE_NONE 9 | //#include "glfw/include/GLFW/glfw3.h" 10 | //#include "glfw/include/GLFW/glfw3native.h" 11 | import "C" 12 | import "unsafe" 13 | 14 | func GetX11Display() *C.Display { 15 | ret := C.glfwGetX11Display() 16 | panicError() 17 | return ret 18 | } 19 | 20 | // GetX11Adapter returns the RRCrtc of the monitor. 21 | func (m *Monitor) GetX11Adapter() C.RRCrtc { 22 | ret := C.glfwGetX11Adapter(m.data) 23 | panicError() 24 | return ret 25 | } 26 | 27 | // GetX11Monitor returns the RROutput of the monitor. 28 | func (m *Monitor) GetX11Monitor() C.RROutput { 29 | ret := C.glfwGetX11Monitor(m.data) 30 | panicError() 31 | return ret 32 | } 33 | 34 | // GetX11Window returns the Window of the window. 35 | func (w *Window) GetX11Window() C.Window { 36 | ret := C.glfwGetX11Window(w.data) 37 | panicError() 38 | return ret 39 | } 40 | 41 | // GetGLXContext returns the GLXContext of the window. 42 | func (w *Window) GetGLXContext() C.GLXContext { 43 | ret := C.glfwGetGLXContext(w.data) 44 | panicError() 45 | return ret 46 | } 47 | 48 | // GetGLXWindow returns the GLXWindow of the window. 49 | func (w *Window) GetGLXWindow() C.GLXWindow { 50 | ret := C.glfwGetGLXWindow(w.data) 51 | panicError() 52 | return ret 53 | } 54 | 55 | // SetX11SelectionString sets the X11 selection string. 56 | func SetX11SelectionString(str string) { 57 | s := C.CString(str) 58 | defer C.free(unsafe.Pointer(s)) 59 | C.glfwSetX11SelectionString(s) 60 | } 61 | 62 | // GetX11SelectionString gets the X11 selection string. 63 | func GetX11SelectionString() string { 64 | s := C.glfwGetX11SelectionString() 65 | return C.GoString(s) 66 | } 67 | -------------------------------------------------------------------------------- /v3.3/glfw/native_windows.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_EXPOSE_NATIVE_WIN32 4 | //#define GLFW_EXPOSE_NATIVE_WGL 5 | //#define GLFW_INCLUDE_NONE 6 | //#include "glfw/include/GLFW/glfw3.h" 7 | //#include "glfw/include/GLFW/glfw3native.h" 8 | import "C" 9 | 10 | // GetWin32Adapter returns the adapter device name of the monitor. 11 | func (m *Monitor) GetWin32Adapter() string { 12 | ret := C.glfwGetWin32Adapter(m.data) 13 | panicError() 14 | return C.GoString(ret) 15 | } 16 | 17 | // GetWin32Monitor returns the display device name of the monitor. 18 | func (m *Monitor) GetWin32Monitor() string { 19 | ret := C.glfwGetWin32Monitor(m.data) 20 | panicError() 21 | return C.GoString(ret) 22 | } 23 | 24 | // GetWin32Window returns the HWND of the window. 25 | func (w *Window) GetWin32Window() C.HWND { 26 | ret := C.glfwGetWin32Window(w.data) 27 | panicError() 28 | return ret 29 | } 30 | 31 | // GetWGLContext returns the HGLRC of the window. 32 | func (w *Window) GetWGLContext() C.HGLRC { 33 | ret := C.glfwGetWGLContext(w.data) 34 | panicError() 35 | return ret 36 | } 37 | -------------------------------------------------------------------------------- /v3.3/glfw/testdata/customcursor/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "image" 5 | "image/color" 6 | "runtime" 7 | 8 | "github.com/go-gl/glfw/v3.3/glfw" 9 | ) 10 | 11 | func init() { 12 | // This is needed to arrange that main() runs on main thread. 13 | // See documentation for functions that are only allowed to be called from the main thread. 14 | runtime.LockOSThread() 15 | } 16 | 17 | func main() { 18 | err := glfw.Init() 19 | if err != nil { 20 | panic(err) 21 | } 22 | defer glfw.Terminate() 23 | 24 | window, err := glfw.CreateWindow(640, 480, "Custom Cursor", nil, nil) 25 | if err != nil { 26 | panic(err) 27 | } 28 | 29 | window.MakeContextCurrent() 30 | 31 | // Creating a custom cursor. 32 | cursor := glfw.CreateCursor(whiteTriangle, 0, 0) 33 | window.SetCursor(cursor) 34 | 35 | // Setting a custom cursor. 36 | window.SetIcon([]image.Image{whiteTriangle}) 37 | 38 | for !window.ShouldClose() { 39 | // Do OpenGL stuff. 40 | window.SwapBuffers() 41 | glfw.PollEvents() 42 | } 43 | } 44 | 45 | var whiteTriangle = func() *image.NRGBA { 46 | c := color.NRGBA{R: 0xFF, G: 0xFF, B: 0xFF, A: 0xFF} 47 | const size = 16 48 | m := image.NewNRGBA(image.Rect(0, 0, size, size)) 49 | for y := 0; y < size; y++ { 50 | for x := 0; x < size-y; x++ { 51 | m.SetNRGBA(x, y, c) 52 | } 53 | } 54 | return m 55 | }() 56 | -------------------------------------------------------------------------------- /v3.3/glfw/time.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#define GLFW_INCLUDE_NONE 4 | //#include "glfw/include/GLFW/glfw3.h" 5 | import "C" 6 | 7 | // GetTime returns the value of the GLFW timer. Unless the timer has been set 8 | // using SetTime, the timer measures time elapsed since GLFW was initialized. 9 | // 10 | // The resolution of the timer is system dependent, but is usually on the order 11 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 12 | // source on each supported platform. 13 | func GetTime() float64 { 14 | ret := float64(C.glfwGetTime()) 15 | panicError() 16 | return ret 17 | } 18 | 19 | // SetTime sets the value of the GLFW timer. It then continues to count up from 20 | // that value. 21 | // 22 | // The resolution of the timer is system dependent, but is usually on the order 23 | // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 24 | // source on each supported platform. 25 | func SetTime(time float64) { 26 | C.glfwSetTime(C.double(time)) 27 | panicError() 28 | } 29 | 30 | // GetTimerFrequency returns frequency of the timer, in Hz, or zero if an error occurred. 31 | func GetTimerFrequency() uint64 { 32 | ret := uint64(C.glfwGetTimerFrequency()) 33 | panicError() 34 | return ret 35 | } 36 | 37 | // GetTimerValue returns the current value of the raw timer, measured in 1 / frequency seconds. 38 | func GetTimerValue() uint64 { 39 | ret := uint64(C.glfwGetTimerValue()) 40 | panicError() 41 | return ret 42 | } 43 | -------------------------------------------------------------------------------- /v3.3/glfw/util.go: -------------------------------------------------------------------------------- 1 | package glfw 2 | 3 | //#include 4 | //#define GLFW_INCLUDE_NONE 5 | //#include "glfw/include/GLFW/glfw3.h" 6 | import "C" 7 | 8 | import ( 9 | "image" 10 | "image/draw" 11 | ) 12 | 13 | func glfwbool(b C.int) bool { 14 | return b == C.int(True) 15 | } 16 | 17 | func bytes(origin []byte) (pointer *uint8, free func()) { 18 | n := len(origin) 19 | if n == 0 { 20 | return nil, func() {} 21 | } 22 | 23 | ptr := C.CBytes(origin) 24 | return (*uint8)(ptr), func() { C.free(ptr) } 25 | } 26 | 27 | // imageToGLFW converts img to be compatible with C.GLFWimage. 28 | func imageToGLFW(img image.Image) (r C.GLFWimage, free func()) { 29 | b := img.Bounds() 30 | 31 | r.width = C.int(b.Dx()) 32 | r.height = C.int(b.Dy()) 33 | 34 | var pixels []byte 35 | if m, ok := img.(*image.NRGBA); ok && m.Stride == b.Dx()*4 { 36 | pixels = m.Pix[:m.PixOffset(m.Rect.Min.X, m.Rect.Max.Y)] 37 | } else { 38 | m := image.NewNRGBA(image.Rect(0, 0, b.Dx(), b.Dy())) 39 | draw.Draw(m, m.Bounds(), img, b.Min, draw.Src) 40 | pixels = m.Pix 41 | } 42 | 43 | pix, free := bytes(pixels) 44 | r.pixels = (*C.uchar)(pix) 45 | return r, free 46 | } 47 | -------------------------------------------------------------------------------- /v3.3/glfw/window.c: -------------------------------------------------------------------------------- 1 | #include "_cgo_export.h" 2 | 3 | void glfwSetWindowPosCallbackCB(GLFWwindow *window) { 4 | glfwSetWindowPosCallback(window, (GLFWwindowposfun)goWindowPosCB); 5 | } 6 | 7 | void glfwSetWindowSizeCallbackCB(GLFWwindow *window) { 8 | glfwSetWindowSizeCallback(window, (GLFWwindowsizefun)goWindowSizeCB); 9 | } 10 | 11 | void glfwSetWindowCloseCallbackCB(GLFWwindow *window) { 12 | glfwSetWindowCloseCallback(window, (GLFWwindowclosefun)goWindowCloseCB); 13 | } 14 | 15 | void glfwSetWindowRefreshCallbackCB(GLFWwindow *window) { 16 | glfwSetWindowRefreshCallback(window, (GLFWwindowrefreshfun)goWindowRefreshCB); 17 | } 18 | 19 | void glfwSetWindowFocusCallbackCB(GLFWwindow *window) { 20 | glfwSetWindowFocusCallback(window, (GLFWwindowfocusfun)goWindowFocusCB); 21 | } 22 | 23 | void glfwSetWindowIconifyCallbackCB(GLFWwindow *window) { 24 | glfwSetWindowIconifyCallback(window, (GLFWwindowiconifyfun)goWindowIconifyCB); 25 | } 26 | 27 | void glfwSetFramebufferSizeCallbackCB(GLFWwindow *window) { 28 | glfwSetFramebufferSizeCallback(window, 29 | (GLFWframebuffersizefun)goFramebufferSizeCB); 30 | } 31 | 32 | void glfwSetWindowMaximizeCallbackCB(GLFWwindow *window) { 33 | glfwSetWindowMaximizeCallback(window, 34 | (GLFWwindowmaximizefun)goWindowMaximizeCB); 35 | } 36 | 37 | void glfwSetWindowContentScaleCallbackCB(GLFWwindow *window) { 38 | glfwSetWindowContentScaleCallback( 39 | window, (GLFWwindowcontentscalefun)goWindowContentScaleCB); 40 | } 41 | --------------------------------------------------------------------------------