├── generateProjectFiles.bat ├── raylib ├── src │ ├── raylib.ico │ ├── raylib.rc.data │ ├── raylib.dll.rc.data │ ├── external │ │ ├── glfw │ │ │ ├── CMake │ │ │ │ ├── glfw3Config.cmake.in │ │ │ │ ├── glfw3.pc.in │ │ │ │ ├── modules │ │ │ │ │ ├── FindOSMesa.cmake │ │ │ │ │ ├── FindEpollShim.cmake │ │ │ │ │ ├── FindWaylandProtocols.cmake │ │ │ │ │ └── FindXKBCommon.cmake │ │ │ │ ├── i686-w64-mingw32.cmake │ │ │ │ ├── i686-w64-mingw32-clang.cmake │ │ │ │ ├── x86_64-w64-mingw32.cmake │ │ │ │ ├── x86_64-w64-mingw32-clang.cmake │ │ │ │ ├── GenerateMappings.cmake │ │ │ │ ├── cmake_uninstall.cmake.in │ │ │ │ ├── Info.plist.in │ │ │ │ └── MacOSXBundleInfo.plist.in │ │ │ ├── .mailmap │ │ │ ├── src │ │ │ │ ├── glfw.rc.in │ │ │ │ ├── xkb_unicode.h │ │ │ │ ├── null_joystick.h │ │ │ │ ├── posix_time.h │ │ │ │ ├── posix_thread.h │ │ │ │ ├── cocoa_joystick.h │ │ │ │ ├── null_joystick.c │ │ │ │ ├── win32_joystick.h │ │ │ │ ├── null_init.c │ │ │ │ ├── linux_joystick.h │ │ │ │ ├── cocoa_time.c │ │ │ │ ├── nsgl_context.h │ │ │ │ ├── glfw_config.h.in │ │ │ │ ├── win32_time.c │ │ │ │ ├── posix_time.c │ │ │ │ ├── null_platform.h │ │ │ │ ├── win32_thread.c │ │ │ │ ├── posix_thread.c │ │ │ │ ├── osmesa_context.h │ │ │ │ ├── mappings.h.in │ │ │ │ ├── null_monitor.c │ │ │ │ ├── wgl_context.h │ │ │ │ ├── cocoa_platform.h │ │ │ │ ├── glx_context.h │ │ │ │ ├── wl_monitor.c │ │ │ │ └── egl_context.h │ │ │ ├── LICENSE.md │ │ │ └── deps │ │ │ │ ├── getopt.h │ │ │ │ ├── glad │ │ │ │ ├── vk_platform.h │ │ │ │ └── khrplatform.h │ │ │ │ ├── mingw │ │ │ │ ├── _mingw_dxhelper.h │ │ │ │ └── xinput.h │ │ │ │ ├── vs2008 │ │ │ │ └── stdint.h │ │ │ │ └── getopt.c │ │ └── dirent.h │ ├── raylib.dll.rc │ ├── raylib.rc │ ├── utils.h │ ├── minshell.html │ ├── build.zig │ ├── CMakeLists.txt │ ├── rglfw.c │ └── extras │ │ └── easings.h ├── LICENSE ├── premake5.lua └── .gitignore ├── TextEditor ├── include │ ├── ListNode.h │ ├── Page.h │ └── TextLine.h └── src │ ├── Page.cpp │ ├── TextLine.cpp │ └── main.cpp ├── .gitignore ├── LICENSE └── premake5.lua /generateProjectFiles.bat: -------------------------------------------------------------------------------- 1 | premake5.exe vs2022 -------------------------------------------------------------------------------- /raylib/src/raylib.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vedangjavdekar/Raylib-Text-Editor/HEAD/raylib/src/raylib.ico -------------------------------------------------------------------------------- /raylib/src/raylib.rc.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vedangjavdekar/Raylib-Text-Editor/HEAD/raylib/src/raylib.rc.data -------------------------------------------------------------------------------- /raylib/src/raylib.dll.rc.data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vedangjavdekar/Raylib-Text-Editor/HEAD/raylib/src/raylib.dll.rc.data -------------------------------------------------------------------------------- /TextEditor/include/ListNode.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct ListNode 4 | { 5 | char c = 0; 6 | ListNode* next = nullptr; 7 | ListNode* prev = nullptr; 8 | }; -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/glfw3Config.cmake.in: -------------------------------------------------------------------------------- 1 | include(CMakeFindDependencyMacro) 2 | find_dependency(Threads) 3 | include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake") 4 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/.mailmap: -------------------------------------------------------------------------------- 1 | Camilla Löwy 2 | Camilla Löwy 3 | Camilla Löwy 4 | 5 | Emmanuel Gil Peyrot 6 | 7 | Marcus Geelnard 8 | Marcus Geelnard 9 | Marcus Geelnard 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # Folders 35 | bin/ 36 | bin-int/ 37 | build/ -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/glfw3.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ 4 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 5 | 6 | Name: GLFW 7 | Description: A multi-platform library for OpenGL, window and input 8 | Version: @GLFW_VERSION@ 9 | URL: https://www.glfw.org/ 10 | Requires.private: @GLFW_PKG_DEPS@ 11 | Libs: -L${libdir} -l@GLFW_LIB_NAME@ 12 | Libs.private: @GLFW_PKG_LIBS@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/modules/FindOSMesa.cmake: -------------------------------------------------------------------------------- 1 | # Try to find OSMesa on a Unix system 2 | # 3 | # This will define: 4 | # 5 | # OSMESA_LIBRARIES - Link these to use OSMesa 6 | # OSMESA_INCLUDE_DIR - Include directory for OSMesa 7 | # 8 | # Copyright (c) 2014 Brandon Schaefer 9 | 10 | if (NOT WIN32) 11 | 12 | find_package (PkgConfig) 13 | pkg_check_modules (PKG_OSMESA QUIET osmesa) 14 | 15 | set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS}) 16 | set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES}) 17 | 18 | endif () 19 | -------------------------------------------------------------------------------- /TextEditor/include/Page.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "TextLine.h" 5 | 6 | class Page 7 | { 8 | public: 9 | void AddCharToCurrentLine(char c); 10 | void HandleNewLine(); 11 | void DeleteCurrentLine(); 12 | void MoveCursorLeft(); 13 | void MoveCursorRight(); 14 | void MoveDownLine(); 15 | void MoveUpLine(); 16 | 17 | void DeleteCharacterAfterCursor(); 18 | void DeleteCharacterAtCursor(); 19 | 20 | void GetCursorXY(int& x, int& y); 21 | void Draw(); 22 | private: 23 | int m_LineIndex = -1; 24 | std::vector> m_Lines; 25 | 26 | }; -------------------------------------------------------------------------------- /TextEditor/include/TextLine.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "ListNode.h" 4 | 5 | class TextLine 6 | { 7 | public: 8 | TextLine(); 9 | ~TextLine(); 10 | 11 | void InsertCharacterAtCursor(char c); 12 | void DeleteCharacterAfterCursor(); 13 | void DeleteCharacterAtCursor(); 14 | 15 | void MoveCursorLeft(); 16 | void MoveCursorRight(); 17 | 18 | std::string ToString() const; 19 | const int CursorIndex()const; 20 | inline const int Size() const { return m_Size; } 21 | private: 22 | ListNode* m_Head = nullptr; 23 | ListNode* m_Tail = nullptr; 24 | ListNode* m_Cursor = nullptr; 25 | int m_Size = 0; 26 | }; -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/i686-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/i686-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 32-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/x86_64-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 GCC 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/x86_64-w64-mingw32-clang.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross-compiling with 64-bit MinGW-w64 Clang 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/modules/FindEpollShim.cmake: -------------------------------------------------------------------------------- 1 | # Find EpollShim 2 | # Once done, this will define 3 | # 4 | # EPOLLSHIM_FOUND - System has EpollShim 5 | # EPOLLSHIM_INCLUDE_DIRS - The EpollShim include directories 6 | # EPOLLSHIM_LIBRARIES - The libraries needed to use EpollShim 7 | 8 | find_path(EPOLLSHIM_INCLUDE_DIRS NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim) 9 | find_library(EPOLLSHIM_LIBRARIES NAMES epoll-shim libepoll-shim HINTS /usr/local/lib) 10 | 11 | if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 12 | set(EPOLLSHIM_FOUND TRUE) 13 | endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES) 14 | 15 | include(FindPackageHandleStandardArgs) 16 | find_package_handle_standard_args(EPOLLSHIM DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS) 17 | mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES) 18 | -------------------------------------------------------------------------------- /raylib/src/raylib.dll.rc: -------------------------------------------------------------------------------- 1 | GLFW_ICON ICON "raylib.ico" 2 | 3 | 1 VERSIONINFO 4 | FILEVERSION 4,0,0,0 5 | PRODUCTVERSION 4,0,0,0 6 | BEGIN 7 | BLOCK "StringFileInfo" 8 | BEGIN 9 | //BLOCK "080904E4" // English UK 10 | BLOCK "040904E4" // English US 11 | BEGIN 12 | //VALUE "CompanyName", "raylib technologies" 13 | VALUE "FileDescription", "raylib dynamic library (www.raylib.com)" 14 | VALUE "FileVersion", "4.0.0" 15 | VALUE "InternalName", "raylib.dll" 16 | VALUE "LegalCopyright", "(c) 2022 Ramon Santamaria (@raysan5)" 17 | VALUE "OriginalFilename", "raylib.dll" 18 | VALUE "ProductName", "raylib" 19 | VALUE "ProductVersion", "4.0.0" 20 | END 21 | END 22 | BLOCK "VarFileInfo" 23 | BEGIN 24 | //VALUE "Translation", 0x809, 1252 // English UK 25 | VALUE "Translation", 0x409, 1252 // English US 26 | END 27 | END 28 | -------------------------------------------------------------------------------- /raylib/src/raylib.rc: -------------------------------------------------------------------------------- 1 | GLFW_ICON ICON "raylib.ico" 2 | 3 | 1 VERSIONINFO 4 | FILEVERSION 4,0,0,0 5 | PRODUCTVERSION 4,0,0,0 6 | BEGIN 7 | BLOCK "StringFileInfo" 8 | BEGIN 9 | //BLOCK "080904E4" // English UK 10 | BLOCK "040904E4" // English US 11 | BEGIN 12 | //VALUE "CompanyName", "raylib technologies" 13 | VALUE "FileDescription", "raylib application (www.raylib.com)" 14 | VALUE "FileVersion", "4.0.0" 15 | VALUE "InternalName", "raylib app" 16 | VALUE "LegalCopyright", "(c) 2022 Ramon Santamaria (@raysan5)" 17 | //VALUE "OriginalFilename", "raylib_app.exe" 18 | VALUE "ProductName", "raylib app" 19 | VALUE "ProductVersion", "4.0.0" 20 | END 21 | END 22 | BLOCK "VarFileInfo" 23 | BEGIN 24 | //VALUE "Translation", 0x809, 1252 // English UK 25 | VALUE "Translation", 0x409, 1252 // English US 26 | END 27 | END 28 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/glfw.rc.in: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0 6 | PRODUCTVERSION @GLFW_VERSION_MAJOR@,@GLFW_VERSION_MINOR@,@GLFW_VERSION_PATCH@,0 7 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 8 | FILEFLAGS 0 9 | FILEOS VOS_NT_WINDOWS32 10 | FILETYPE VFT_DLL 11 | FILESUBTYPE 0 12 | { 13 | BLOCK "StringFileInfo" 14 | { 15 | BLOCK "040904B0" 16 | { 17 | VALUE "CompanyName", "GLFW" 18 | VALUE "FileDescription", "GLFW @GLFW_VERSION@ DLL" 19 | VALUE "FileVersion", "@GLFW_VERSION@" 20 | VALUE "OriginalFilename", "glfw3.dll" 21 | VALUE "ProductName", "GLFW" 22 | VALUE "ProductVersion", "@GLFW_VERSION@" 23 | } 24 | } 25 | BLOCK "VarFileInfo" 26 | { 27 | VALUE "Translation", 0x409, 1200 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /raylib/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2022 Ramon Santamaria (@raysan5) 2 | 3 | This software is provided "as-is", without any express or implied warranty. In no event 4 | will the authors be held liable for any damages arising from the use of this software. 5 | 6 | Permission is granted to anyone to use this software for any purpose, including commercial 7 | applications, and to alter it and redistribute it freely, subject to the following restrictions: 8 | 9 | 1. The origin of this software must not be misrepresented; you must not claim that you 10 | wrote the original software. If you use this software in a product, an acknowledgment 11 | in the product documentation would be appreciated but is not required. 12 | 13 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented 14 | as being the original software. 15 | 16 | 3. This notice may not be removed or altered from any source distribution. 17 | -------------------------------------------------------------------------------- /raylib/src/external/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 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/modules/FindWaylandProtocols.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig) 2 | 3 | pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION}) 4 | 5 | execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols 6 | OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR 7 | RESULT_VARIABLE _pkgconfig_failed) 8 | if (_pkgconfig_failed) 9 | message(FATAL_ERROR "Missing wayland-protocols pkgdatadir") 10 | endif() 11 | 12 | string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}") 13 | 14 | find_package_handle_standard_args(WaylandProtocols 15 | FOUND_VAR 16 | WaylandProtocols_FOUND 17 | REQUIRED_VARS 18 | WaylandProtocols_PKGDATADIR 19 | VERSION_VAR 20 | WaylandProtocols_VERSION 21 | HANDLE_COMPONENTS 22 | ) 23 | 24 | set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND}) 25 | set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR}) 26 | set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION}) 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Vedang Javdekar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /premake5.lua: -------------------------------------------------------------------------------- 1 | workspace "TextEditor" 2 | configurations { "Debug", "Release" } 3 | architecture "x86_64" 4 | location "build" 5 | 6 | include "raylib/" 7 | 8 | project "TextEditor" 9 | kind "ConsoleApp" 10 | language "C++" 11 | cppdialect "C++17" 12 | staticruntime "off" 13 | 14 | targetdir "bin/%{prj.name}/%{cfg.buildcfg}" 15 | debugdir "bin/%{prj.name}/%{cfg.buildcfg}" 16 | objdir "bin-int/%{prj.name}/%{cfg.buildcfg}" 17 | location "build/%{prj.name}" 18 | 19 | dependson {"raylib"} 20 | links{"raylib"} 21 | 22 | defines{ 23 | "PLATFORM_DESKTOP", 24 | "GRAPHICS_API_OPENGL_43" 25 | } 26 | 27 | libdirs{ 28 | "bin/raylib/%{cfg.buildcfg}" 29 | } 30 | files { 31 | "%{prj.name}/include/**.h", 32 | "%{prj.name}/include/**.hpp", 33 | "%{prj.name}/src/**.cpp" 34 | } 35 | 36 | includedirs { 37 | "%{prj.name}/include/", 38 | "raylib/src/" 39 | } 40 | 41 | filter "configurations:Debug" 42 | defines { "DEBUG" } 43 | symbols "On" 44 | 45 | filter "configurations:Release" 46 | defines { "NDEBUG" } 47 | optimize "On" 48 | 49 | filter "action:vs*" 50 | links{"raylib.lib"} -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/GenerateMappings.cmake: -------------------------------------------------------------------------------- 1 | # Usage: 2 | # cmake -P GenerateMappings.cmake 3 | 4 | set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt") 5 | set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt") 6 | set(template_path "${CMAKE_ARGV3}") 7 | set(target_path "${CMAKE_ARGV4}") 8 | 9 | if (NOT EXISTS "${template_path}") 10 | message(FATAL_ERROR "Failed to find template file ${template_path}") 11 | endif() 12 | 13 | file(DOWNLOAD "${source_url}" "${source_path}" 14 | STATUS download_status 15 | TLS_VERIFY on) 16 | 17 | list(GET download_status 0 status_code) 18 | list(GET download_status 1 status_message) 19 | 20 | if (status_code) 21 | message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}") 22 | endif() 23 | 24 | file(STRINGS "${source_path}" lines) 25 | foreach(line ${lines}) 26 | if ("${line}" MATCHES "^[0-9a-fA-F].*$") 27 | set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n") 28 | endif() 29 | endforeach() 30 | 31 | configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX) 32 | file(REMOVE "${source_path}") 33 | 34 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/modules/FindXKBCommon.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find XKBCommon 2 | # Once done, this will define 3 | # 4 | # XKBCOMMON_FOUND - System has XKBCommon 5 | # XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories 6 | # XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon 7 | # XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon 8 | 9 | find_package(PkgConfig) 10 | pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) 11 | set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) 12 | 13 | find_path(XKBCOMMON_INCLUDE_DIR 14 | NAMES xkbcommon/xkbcommon.h 15 | HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS} 16 | ) 17 | 18 | find_library(XKBCOMMON_LIBRARY 19 | NAMES xkbcommon 20 | HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS} 21 | ) 22 | 23 | set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) 24 | set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS}) 25 | set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR}) 26 | 27 | include(FindPackageHandleStandardArgs) 28 | find_package_handle_standard_args(XKBCommon DEFAULT_MSG 29 | XKBCOMMON_LIBRARY 30 | XKBCOMMON_INCLUDE_DIR 31 | ) 32 | 33 | mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR) 34 | 35 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt") 3 | message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"") 4 | endif() 5 | 6 | file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files) 7 | string(REGEX REPLACE "\n" ";" files "${files}") 8 | 9 | foreach (file ${files}) 10 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | if (EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval) 15 | if (NOT "${rm_retval}" STREQUAL 0) 16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif() 18 | elseif (IS_SYMLINK "$ENV{DESTDIR}${file}") 19 | EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 20 | OUTPUT_VARIABLE rm_out 21 | RETURN_VALUE rm_retval) 22 | if (NOT "${rm_retval}" STREQUAL 0) 23 | message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"") 24 | endif() 25 | else() 26 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 27 | endif() 28 | endforeach() 29 | 30 | -------------------------------------------------------------------------------- /raylib/premake5.lua: -------------------------------------------------------------------------------- 1 | project "raylib" 2 | kind "StaticLib" 3 | staticruntime "off" 4 | 5 | defines{ 6 | "PLATFORM_DESKTOP", 7 | "GRAPHICS_API_OPENGL_43" 8 | } 9 | 10 | language "C" 11 | location "%{_MAIN_SCRIPT_DIR}/build/%{prj.name}" 12 | 13 | targetdir "%{_MAIN_SCRIPT_DIR}/bin/%{prj.name}/%{cfg.buildcfg}" 14 | objdir "%{_MAIN_SCRIPT_DIR}/bin-int/%{prj.name}/%{cfg.buildcfg}" 15 | debugdir "%{_MAIN_SCRIPT_DIR}/" 16 | 17 | includedirs { 18 | "src", 19 | "src/external/glfw/include", 20 | "src/extras" 21 | } 22 | 23 | vpaths 24 | { 25 | ["Header Files"] = { "src/**.h"}, 26 | ["Source Files/*"] = {"src/**.c"}, 27 | } 28 | 29 | files { 30 | "src/*.h", 31 | "src/*.c" 32 | } 33 | 34 | filter "action:vs*" 35 | defines{ 36 | "_WINSOCK_DEPRECATED_NO_WARNINGS", 37 | "_CRT_SECURE_NO_WARNINGS" 38 | } 39 | characterset ("MBCS") 40 | 41 | filter "system:windows" 42 | defines{"_WIN32"} 43 | links {"winmm"} 44 | 45 | filter "configurations:Debug" 46 | defines { "DEBUG" } 47 | symbols "On" 48 | 49 | filter "configurations:Release" 50 | defines { "NDEBUG" } 51 | optimize "On" -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | long _glfwKeySym2Unicode(unsigned int keysym); 28 | 29 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${MACOSX_BUNDLE_INFO_STRING} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | ${MACOSX_BUNDLE_LONG_VERSION_STRING} 19 | CFBundleName 20 | ${MACOSX_BUNDLE_BUNDLE_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 29 | CSResourcesFileMapped 30 | 31 | LSRequiresCarbon 32 | 33 | NSHumanReadableCopyright 34 | ${MACOSX_BUNDLE_COPYRIGHT} 35 | NSHighResolutionCapable 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/CMake/MacOSXBundleInfo.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${MACOSX_BUNDLE_INFO_STRING} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | ${MACOSX_BUNDLE_LONG_VERSION_STRING} 19 | CFBundleName 20 | ${MACOSX_BUNDLE_BUNDLE_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 29 | CSResourcesFileMapped 30 | 31 | LSRequiresCarbon 32 | 33 | NSHumanReadableCopyright 34 | ${MACOSX_BUNDLE_COPYRIGHT} 35 | NSHighResolutionCapable 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/null_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - 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 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | 40 | } _GLFWtimerPOSIX; 41 | 42 | 43 | void _glfwInitTimerPOSIX(void); 44 | 45 | -------------------------------------------------------------------------------- /raylib/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore generated files 2 | # ... 3 | 4 | # Ignore VIM's backup generated files 5 | *.swp 6 | *.swo 7 | *~ 8 | 9 | # Ignore thumbnails created by windows 10 | Thumbs.db 11 | 12 | # Ignore files build by Visual Studio 13 | # *.obj --> Can be confused with 3d model! 14 | *.pdb 15 | *.aps 16 | *.user 17 | # *.vcproj 18 | # *.vcxproj* 19 | # *.sln 20 | *.vspscc 21 | *_i.c 22 | *.i 23 | *.icf 24 | *_p.c 25 | *.ncb 26 | *.suo 27 | *.tlb 28 | *.tlh 29 | *.bak 30 | *.cache 31 | *.ilk 32 | *.log 33 | .vs 34 | 35 | [Bb]in 36 | [Dd]ebug/ 37 | *.sbr 38 | *.sdf 39 | obj/ 40 | [R]elease/ 41 | _ReSharper*/ 42 | [Tt]est[Rr]esult* 43 | ipch/ 44 | *.opensdf 45 | *.db 46 | *.opendb 47 | packages/ 48 | !examples/models/resources/models/obj/ 49 | 50 | # Ignore compiled binaries 51 | *.o 52 | *.exe 53 | *.a 54 | *.bc 55 | *.so 56 | *.so.* 57 | 58 | # Ignore wasm data in examples/ 59 | examples/**/*.wasm 60 | examples/**/*.data 61 | examples/**/*.js 62 | examples/**/*.html 63 | 64 | # Ignore files build by xcode 65 | *.mode*v* 66 | *.pbxuser 67 | *.xcbkptlist 68 | *.xcscheme 69 | *.xcworkspacedata 70 | *.xcuserstate 71 | *.xccheckout 72 | xcschememanagement.plist 73 | .DS_Store 74 | ._.* 75 | xcuserdata/ 76 | DerivedData/ 77 | 78 | # Jetbrains project 79 | .idea/ 80 | cmake-build-*/ 81 | 82 | # CMake stuff 83 | CMakeCache.txt 84 | CMakeFiles 85 | CMakeScripts 86 | Testing 87 | cmake_install.cmake 88 | install_manifest.txt 89 | compile_commands.json 90 | CTestTestfile.cmake 91 | build 92 | 93 | # Ignore GNU global tags 94 | GPATH 95 | GRTAGS 96 | GTAGS 97 | 98 | # Zig programming language 99 | zig-cache/ 100 | zig-out/ 101 | build/ 102 | build-*/ 103 | docgen_tmp/ 104 | 105 | # Parser stuff 106 | parser/raylib_parser 107 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/posix_thread.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | 41 | } _GLFWtlsPOSIX; 42 | 43 | // POSIX-specific mutex data 44 | // 45 | typedef struct _GLFWmutexPOSIX 46 | { 47 | GLFWbool allocated; 48 | pthread_mutex_t handle; 49 | 50 | } _GLFWmutexPOSIX; 51 | 52 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/cocoa_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | 37 | // Cocoa-specific per-joystick data 38 | // 39 | typedef struct _GLFWjoystickNS 40 | { 41 | IOHIDDeviceRef device; 42 | CFMutableArrayRef axes; 43 | CFMutableArrayRef buttons; 44 | CFMutableArrayRef hats; 45 | } _GLFWjoystickNS; 46 | 47 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/null_joystick.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - 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 | GLFWbool _glfwPlatformInitJoysticks(void) 37 | { 38 | return GLFW_TRUE; 39 | } 40 | 41 | void _glfwPlatformTerminateJoysticks(void) 42 | { 43 | } 44 | 45 | int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) 46 | { 47 | return GLFW_FALSE; 48 | } 49 | 50 | void _glfwPlatformUpdateGamepadGUID(char* guid) 51 | { 52 | } 53 | 54 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/win32_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | 32 | // Joystick element (axis, button or slider) 33 | // 34 | typedef struct _GLFWjoyobjectWin32 35 | { 36 | int offset; 37 | int type; 38 | } _GLFWjoyobjectWin32; 39 | 40 | // Win32-specific per-joystick data 41 | // 42 | typedef struct _GLFWjoystickWin32 43 | { 44 | _GLFWjoyobjectWin32* objects; 45 | int objectCount; 46 | IDirectInputDevice8W* device; 47 | DWORD index; 48 | GUID guid; 49 | } _GLFWjoystickWin32; 50 | 51 | void _glfwDetectJoystickConnectionWin32(void); 52 | void _glfwDetectJoystickDisconnectionWin32(void); 53 | 54 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/null_init.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - 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 | #include 33 | 34 | 35 | ////////////////////////////////////////////////////////////////////////// 36 | ////// GLFW platform API ////// 37 | ////////////////////////////////////////////////////////////////////////// 38 | 39 | int _glfwPlatformInit(void) 40 | { 41 | _glfwInitTimerPOSIX(); 42 | _glfwPollMonitorsNull(); 43 | 44 | return GLFW_TRUE; 45 | } 46 | 47 | void _glfwPlatformTerminate(void) 48 | { 49 | free(_glfw.null.clipboardString); 50 | _glfwTerminateOSMesa(); 51 | } 52 | 53 | const char* _glfwPlatformGetVersionString(void) 54 | { 55 | return _GLFW_VERSION_NUMBER " null OSMesa"; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/linux_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | 36 | // Linux-specific joystick data 37 | // 38 | typedef struct _GLFWjoystickLinux 39 | { 40 | int fd; 41 | char path[PATH_MAX]; 42 | int keyMap[KEY_CNT - BTN_MISC]; 43 | int absMap[ABS_CNT]; 44 | struct input_absinfo absInfo[ABS_CNT]; 45 | int hats[4][2]; 46 | } _GLFWjoystickLinux; 47 | 48 | // Linux-specific joystick API data 49 | // 50 | typedef struct _GLFWlibraryLinux 51 | { 52 | int inotify; 53 | int watch; 54 | regex_t regex; 55 | GLFWbool dropped; 56 | } _GLFWlibraryLinux; 57 | 58 | void _glfwDetectJoystickConnectionLinux(void); 59 | 60 | -------------------------------------------------------------------------------- /raylib/src/external/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 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/cocoa_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/nsgl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 the other deprecated 29 | // We use the newer names in code and these macros to handle compatibility 30 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 101400 31 | #define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval 32 | #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity 33 | #endif 34 | 35 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl 36 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl 37 | 38 | #include 39 | 40 | 41 | // NSGL-specific per-context data 42 | // 43 | typedef struct _GLFWcontextNSGL 44 | { 45 | id pixelFormat; 46 | id object; 47 | 48 | } _GLFWcontextNSGL; 49 | 50 | // NSGL-specific global data 51 | // 52 | typedef struct _GLFWlibraryNSGL 53 | { 54 | // dlopen handle for OpenGL.framework (for glfwGetProcAddress) 55 | CFBundleRef framework; 56 | 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 | -------------------------------------------------------------------------------- /TextEditor/src/Page.cpp: -------------------------------------------------------------------------------- 1 | #include "Page.h" 2 | #include "raylib.h" 3 | #include 4 | 5 | void Page::AddCharToCurrentLine(char c) 6 | { 7 | if (m_LineIndex > -1) 8 | { 9 | m_Lines[m_LineIndex]->InsertCharacterAtCursor(c); 10 | } 11 | } 12 | 13 | void Page::HandleNewLine() 14 | { 15 | if (m_LineIndex == m_Lines.size() - 1) 16 | { 17 | m_Lines.emplace_back(std::make_unique()); 18 | m_LineIndex = (int)m_Lines.size() - 1; 19 | } 20 | else 21 | { 22 | m_Lines.insert(m_Lines.begin() + m_LineIndex + 1, std::make_unique()); 23 | m_LineIndex++; 24 | } 25 | } 26 | 27 | void Page::DeleteCurrentLine() 28 | { 29 | if (m_Lines.size() > 1) 30 | { 31 | m_Lines.erase(m_Lines.begin() + m_LineIndex); 32 | if (m_LineIndex == m_Lines.size()) 33 | { 34 | m_LineIndex--; 35 | } 36 | } 37 | } 38 | 39 | void Page::MoveCursorLeft() 40 | { 41 | if (m_LineIndex > -1) 42 | { 43 | m_Lines[m_LineIndex]->MoveCursorLeft(); 44 | } 45 | } 46 | 47 | void Page::MoveCursorRight() 48 | { 49 | if (m_LineIndex > -1) 50 | { 51 | m_Lines[m_LineIndex]->MoveCursorRight(); 52 | } 53 | } 54 | 55 | void Page::MoveDownLine() 56 | { 57 | if (m_LineIndex < m_Lines.size() - 1) 58 | { 59 | m_LineIndex++; 60 | } 61 | } 62 | 63 | void Page::MoveUpLine() 64 | { 65 | if (m_LineIndex > 0) 66 | { 67 | m_LineIndex--; 68 | } 69 | } 70 | 71 | void Page::DeleteCharacterAfterCursor() 72 | { 73 | if (m_LineIndex > -1) 74 | { 75 | if (m_Lines[m_LineIndex]->Size() == 0) 76 | { 77 | DeleteCurrentLine(); 78 | return; 79 | } 80 | m_Lines[m_LineIndex]->DeleteCharacterAfterCursor(); 81 | } 82 | } 83 | 84 | void Page::DeleteCharacterAtCursor() 85 | { 86 | if (m_LineIndex > -1) 87 | { 88 | if (m_Lines[m_LineIndex]->Size() == 0) 89 | { 90 | DeleteCurrentLine(); 91 | return; 92 | } 93 | m_Lines[m_LineIndex]->DeleteCharacterAtCursor(); 94 | } 95 | } 96 | 97 | void Page::Draw() 98 | { 99 | static char buffer[20]; 100 | DrawRectangle(0, 0, 20, 720, LIGHTGRAY); 101 | for (int i = 0; i < m_Lines.size(); ++i) 102 | { 103 | const char* lineNumber = _itoa(i + 1, buffer, 10); 104 | int width = MeasureText(lineNumber, 20); 105 | DrawText(lineNumber, 15 - width, 10 + i * 20, 20, GRAY); 106 | } 107 | 108 | for (int i = 0; i < m_Lines.size(); ++i) 109 | { 110 | std::string text = m_Lines[i]->ToString(); 111 | DrawText(text.c_str(), 20, 10 + i * 20, 20, DARKGRAY); 112 | } 113 | } 114 | 115 | void Page::GetCursorXY(int& x, int& y) 116 | { 117 | if (m_LineIndex > -1) 118 | { 119 | std::string text = m_Lines[m_LineIndex]->ToString(); 120 | x = MeasureText(text.substr(0, m_Lines[m_LineIndex]->CursorIndex()).c_str(), 20); 121 | y = m_LineIndex * 20; 122 | } 123 | else 124 | { 125 | x = 0; 126 | y = 0; 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /TextEditor/src/TextLine.cpp: -------------------------------------------------------------------------------- 1 | #include "TextLine.h" 2 | #include 3 | 4 | TextLine::TextLine() 5 | { 6 | m_Head = new ListNode(); 7 | m_Tail = new ListNode(); 8 | 9 | m_Head->next = m_Tail; 10 | m_Tail->prev = m_Head; 11 | m_Cursor = m_Tail; 12 | m_Size = 0; 13 | } 14 | 15 | TextLine::~TextLine() 16 | { 17 | if (m_Head->next != m_Tail) 18 | { 19 | ListNode* node = m_Head->next; 20 | while (node != m_Tail) 21 | { 22 | ListNode* toRemove = node; 23 | node = node->next; 24 | delete toRemove; 25 | } 26 | } 27 | 28 | delete m_Head; 29 | delete m_Tail; 30 | } 31 | 32 | void TextLine::InsertCharacterAtCursor(char c) 33 | { 34 | ListNode* prev = m_Cursor->prev; 35 | ListNode* node = new ListNode(); 36 | node->c = c; 37 | node->prev = prev; 38 | prev->next = node; 39 | node->next = m_Cursor; 40 | m_Cursor->prev = node; 41 | m_Size++; 42 | } 43 | 44 | void TextLine::DeleteCharacterAfterCursor() 45 | { 46 | if (m_Cursor != m_Tail && m_Cursor->next != m_Tail) 47 | { 48 | ListNode* nextNext = m_Cursor->next->next; 49 | ListNode* next = m_Cursor->next; 50 | m_Cursor->next = nextNext; 51 | nextNext->prev = m_Cursor; 52 | delete next; 53 | m_Size--; 54 | } 55 | else if (m_Size == 1) 56 | { 57 | ListNode* node = m_Head->next; 58 | m_Head->next = m_Tail; 59 | m_Tail->prev = m_Head; 60 | m_Cursor = m_Tail; 61 | m_Size = 0; 62 | delete node; 63 | } 64 | } 65 | 66 | void TextLine::DeleteCharacterAtCursor() 67 | { 68 | if (m_Cursor->prev != m_Head) 69 | { 70 | ListNode* prev = m_Cursor->prev; 71 | ListNode* prevPrev = m_Cursor->prev->prev; 72 | m_Cursor->prev = prevPrev; 73 | prevPrev->next = m_Cursor; 74 | delete prev; 75 | m_Size--; 76 | } 77 | else if (m_Size == 1) 78 | { 79 | ListNode* node = m_Head->next; 80 | m_Head->next = m_Tail; 81 | m_Tail->prev = m_Head; 82 | m_Cursor = m_Tail; 83 | m_Size = 0; 84 | delete node; 85 | } 86 | } 87 | 88 | void TextLine::MoveCursorLeft() 89 | { 90 | if (m_Cursor->prev != m_Head) 91 | { 92 | m_Cursor = m_Cursor->prev; 93 | } 94 | } 95 | 96 | void TextLine::MoveCursorRight() 97 | { 98 | if (m_Cursor != m_Tail) 99 | { 100 | m_Cursor = m_Cursor->next; 101 | } 102 | } 103 | 104 | std::string TextLine::ToString() const 105 | { 106 | if (m_Head->next != m_Tail) 107 | { 108 | std::stringstream ss; 109 | ListNode* node = m_Head->next; 110 | while (node != m_Tail) 111 | { 112 | ss << node->c; 113 | node = node->next; 114 | } 115 | ss << '\0'; 116 | return ss.str(); 117 | } 118 | return ""; 119 | } 120 | 121 | const int TextLine::CursorIndex() const 122 | { 123 | int index = 0; 124 | ListNode* node = m_Head; 125 | while (node->next != m_Cursor) 126 | { 127 | node = node->next; 128 | index++; 129 | 130 | } 131 | return index; 132 | } 133 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/glfw_config.h.in: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2010-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 | // As glfw_config.h.in, this file is used by CMake to produce the 27 | // glfw_config.h configuration header file. If you are adding a feature 28 | // requiring conditional compilation, this is where to add the macro. 29 | //======================================================================== 30 | // As glfw_config.h, this file defines compile-time option macros for a 31 | // specific platform and development environment. If you are using the 32 | // GLFW CMake files, modify glfw_config.h.in instead of this file. If you 33 | // are using your own build system, make this file define the appropriate 34 | // macros in whatever way is suitable. 35 | //======================================================================== 36 | 37 | // Define this to 1 if building GLFW for X11 38 | #cmakedefine _GLFW_X11 39 | // Define this to 1 if building GLFW for Win32 40 | #cmakedefine _GLFW_WIN32 41 | // Define this to 1 if building GLFW for Cocoa 42 | #cmakedefine _GLFW_COCOA 43 | // Define this to 1 if building GLFW for Wayland 44 | #cmakedefine _GLFW_WAYLAND 45 | // Define this to 1 if building GLFW for OSMesa 46 | #cmakedefine _GLFW_OSMESA 47 | 48 | // Define this to 1 to use Vulkan loader linked statically into application 49 | #cmakedefine _GLFW_VULKAN_STATIC 50 | 51 | // Define this to 1 to force use of high-performance GPU on hybrid systems 52 | #cmakedefine _GLFW_USE_HYBRID_HPG 53 | 54 | // Define this to 1 if xkbcommon supports the compose key 55 | #cmakedefine HAVE_XKBCOMMON_COMPOSE_H 56 | // Define this to 1 if the libc supports memfd_create() 57 | #cmakedefine HAVE_MEMFD_CREATE 58 | 59 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/win32_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | uint64_t frequency; 42 | 43 | if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) 44 | { 45 | _glfw.timer.win32.hasPC = GLFW_TRUE; 46 | _glfw.timer.win32.frequency = frequency; 47 | } 48 | else 49 | { 50 | _glfw.timer.win32.hasPC = GLFW_FALSE; 51 | _glfw.timer.win32.frequency = 1000; 52 | } 53 | } 54 | 55 | 56 | ////////////////////////////////////////////////////////////////////////// 57 | ////// GLFW platform API ////// 58 | ////////////////////////////////////////////////////////////////////////// 59 | 60 | uint64_t _glfwPlatformGetTimerValue(void) 61 | { 62 | if (_glfw.timer.win32.hasPC) 63 | { 64 | uint64_t value; 65 | QueryPerformanceCounter((LARGE_INTEGER*) &value); 66 | return value; 67 | } 68 | else 69 | return (uint64_t) timeGetTime(); 70 | } 71 | 72 | uint64_t _glfwPlatformGetTimerFrequency(void) 73 | { 74 | return _glfw.timer.win32.frequency; 75 | } 76 | 77 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/posix_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | #define _POSIX_C_SOURCE 199309L 31 | 32 | #include "internal.h" 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | 39 | ////////////////////////////////////////////////////////////////////////// 40 | ////// GLFW internal API ////// 41 | ////////////////////////////////////////////////////////////////////////// 42 | 43 | // Initialise timer 44 | // 45 | void _glfwInitTimerPOSIX(void) 46 | { 47 | #if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) 48 | struct timespec ts; 49 | 50 | if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 51 | { 52 | _glfw.timer.posix.monotonic = GLFW_TRUE; 53 | _glfw.timer.posix.frequency = 1000000000; 54 | } 55 | else 56 | #endif 57 | { 58 | _glfw.timer.posix.monotonic = GLFW_FALSE; 59 | _glfw.timer.posix.frequency = 1000000; 60 | } 61 | } 62 | 63 | 64 | ////////////////////////////////////////////////////////////////////////// 65 | ////// GLFW platform API ////// 66 | ////////////////////////////////////////////////////////////////////////// 67 | 68 | uint64_t _glfwPlatformGetTimerValue(void) 69 | { 70 | #if defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK) 71 | if (_glfw.timer.posix.monotonic) 72 | { 73 | struct timespec ts; 74 | clock_gettime(CLOCK_MONOTONIC, &ts); 75 | return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec; 76 | } 77 | else 78 | #endif 79 | { 80 | struct timeval tv; 81 | gettimeofday(&tv, NULL); 82 | return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec; 83 | } 84 | } 85 | 86 | uint64_t _glfwPlatformGetTimerFrequency(void) 87 | { 88 | return _glfw.timer.posix.frequency; 89 | } 90 | 91 | -------------------------------------------------------------------------------- /TextEditor/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "raylib.h" 2 | #include "Page.h" 3 | 4 | int main() 5 | { 6 | const int screenWidth = 1280; 7 | const int screenHeight = 720; 8 | const int blinkAfterFrames = 30; 9 | const int blinkTime = 30; 10 | bool isBlinking = false; 11 | int frameCounter = 0; 12 | 13 | 14 | InitWindow(screenWidth, screenHeight, "Text Editor"); 15 | SetTargetFPS(60); 16 | 17 | 18 | Page page; 19 | page.HandleNewLine(); 20 | 21 | while (!WindowShouldClose()) 22 | { 23 | // Update 24 | //---------------------------------------------------------------------------------- 25 | int key = GetCharPressed(); 26 | 27 | // Check if more characters have been pressed on the same frame 28 | while (key > 0) 29 | { 30 | // NOTE: Only allow keys in range [32..125] 31 | if ((key >= 32) && (key <= 125)) 32 | { 33 | page.AddCharToCurrentLine((char)key); 34 | isBlinking = false; 35 | frameCounter = 0; 36 | } 37 | 38 | key = GetCharPressed(); // Check next character in the queue 39 | } 40 | 41 | if (IsKeyPressed(KEY_RIGHT)) 42 | { 43 | page.MoveCursorRight(); 44 | isBlinking = false; 45 | frameCounter = 0; 46 | } 47 | 48 | if (IsKeyPressed(KEY_LEFT)) 49 | { 50 | page.MoveCursorLeft(); 51 | isBlinking = false; 52 | frameCounter = 0; 53 | } 54 | 55 | if (IsKeyPressed(KEY_UP)) 56 | { 57 | page.MoveUpLine(); 58 | isBlinking = false; 59 | frameCounter = 0; 60 | } 61 | 62 | if (IsKeyPressed(KEY_DOWN)) 63 | { 64 | page.MoveDownLine(); 65 | isBlinking = false; 66 | frameCounter = 0; 67 | } 68 | 69 | if (IsKeyPressed(KEY_DELETE)) 70 | { 71 | page.DeleteCharacterAfterCursor(); 72 | isBlinking = false; 73 | frameCounter = 0; 74 | } 75 | 76 | if (IsKeyPressed(KEY_BACKSPACE)) 77 | { 78 | page.DeleteCharacterAtCursor(); 79 | isBlinking = false; 80 | frameCounter = 0; 81 | } 82 | 83 | if (IsKeyPressed(KEY_ENTER)) 84 | { 85 | page.HandleNewLine(); 86 | isBlinking = false; 87 | frameCounter = 0; 88 | } 89 | 90 | frameCounter++; 91 | if (!isBlinking && frameCounter > blinkAfterFrames) 92 | { 93 | isBlinking = true; 94 | frameCounter = 0; 95 | } 96 | 97 | if (isBlinking) 98 | { 99 | frameCounter = frameCounter % (2 * blinkTime); 100 | } 101 | // Draw 102 | //---------------------------------------------------------------------------------- 103 | BeginDrawing(); 104 | ClearBackground(RAYWHITE); 105 | 106 | int cursorX = 0, cursorY = 0; 107 | page.GetCursorXY(cursorX, cursorY); 108 | if (isBlinking) 109 | { 110 | if (frameCounter < blinkTime) 111 | { 112 | DrawRectangle(20 + cursorX, 10 + cursorY, 12, 20, LIGHTGRAY); 113 | } 114 | } 115 | else 116 | { 117 | DrawRectangle(20 + cursorX, 10 + cursorY, 12, 20, LIGHTGRAY); 118 | } 119 | page.Draw(); 120 | EndDrawing(); 121 | //---------------------------------------------------------------------------------- 122 | 123 | } 124 | 125 | // De-Initialization 126 | //-------------------------------------------------------------------------------------- 127 | CloseWindow(); // Close window and OpenGL context 128 | //-------------------------------------------------------------------------------------- 129 | 130 | 131 | 132 | return 0; 133 | } -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/null_platform.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - 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 | #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNull null 32 | #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorNull null 33 | 34 | #define _GLFW_PLATFORM_CONTEXT_STATE struct { int dummyContext; } 35 | #define _GLFW_PLATFORM_CURSOR_STATE struct { int dummyCursor; } 36 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE struct { int dummyLibraryContext; } 37 | 38 | #include "posix_time.h" 39 | #include "posix_thread.h" 40 | #include "null_joystick.h" 41 | 42 | #if defined(_GLFW_WIN32) 43 | #define _glfw_dlopen(name) LoadLibraryA(name) 44 | #define _glfw_dlclose(handle) FreeLibrary((HMODULE) handle) 45 | #define _glfw_dlsym(handle, name) GetProcAddress((HMODULE) handle, name) 46 | #else 47 | #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) 48 | #define _glfw_dlclose(handle) dlclose(handle) 49 | #define _glfw_dlsym(handle, name) dlsym(handle, name) 50 | #endif 51 | 52 | // Null-specific per-window data 53 | // 54 | typedef struct _GLFWwindowNull 55 | { 56 | int xpos; 57 | int ypos; 58 | int width; 59 | int height; 60 | char* title; 61 | GLFWbool visible; 62 | GLFWbool iconified; 63 | GLFWbool maximized; 64 | GLFWbool resizable; 65 | GLFWbool decorated; 66 | GLFWbool floating; 67 | GLFWbool transparent; 68 | float opacity; 69 | } _GLFWwindowNull; 70 | 71 | // Null-specific per-monitor data 72 | // 73 | typedef struct _GLFWmonitorNull 74 | { 75 | GLFWgammaramp ramp; 76 | } _GLFWmonitorNull; 77 | 78 | // Null-specific global data 79 | // 80 | typedef struct _GLFWlibraryNull 81 | { 82 | int xcursor; 83 | int ycursor; 84 | char* clipboardString; 85 | _GLFWwindow* focusedWindow; 86 | } _GLFWlibraryNull; 87 | 88 | void _glfwPollMonitorsNull(void); 89 | 90 | -------------------------------------------------------------------------------- /raylib/src/utils.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | * 3 | * raylib.utils - Some common utility functions 4 | * 5 | * 6 | * LICENSE: zlib/libpng 7 | * 8 | * Copyright (c) 2014-2022 Ramon Santamaria (@raysan5) 9 | * 10 | * This software is provided "as-is", without any express or implied warranty. In no event 11 | * will the authors be held liable for any damages arising from the use of this software. 12 | * 13 | * Permission is granted to anyone to use this software for any purpose, including commercial 14 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 15 | * 16 | * 1. The origin of this software must not be misrepresented; you must not claim that you 17 | * wrote the original software. If you use this software in a product, an acknowledgment 18 | * in the product documentation would be appreciated but is not required. 19 | * 20 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 21 | * as being the original software. 22 | * 23 | * 3. This notice may not be removed or altered from any source distribution. 24 | * 25 | **********************************************************************************************/ 26 | 27 | #ifndef UTILS_H 28 | #define UTILS_H 29 | 30 | #if defined(PLATFORM_ANDROID) 31 | #include // Required for: FILE 32 | #include // Required for: AAssetManager 33 | #endif 34 | 35 | #if defined(SUPPORT_TRACELOG) 36 | #define TRACELOG(level, ...) TraceLog(level, __VA_ARGS__) 37 | 38 | #if defined(SUPPORT_TRACELOG_DEBUG) 39 | #define TRACELOGD(...) TraceLog(LOG_DEBUG, __VA_ARGS__) 40 | #else 41 | #define TRACELOGD(...) (void)0 42 | #endif 43 | #else 44 | #define TRACELOG(level, ...) (void)0 45 | #define TRACELOGD(...) (void)0 46 | #endif 47 | 48 | //---------------------------------------------------------------------------------- 49 | // Some basic Defines 50 | //---------------------------------------------------------------------------------- 51 | #if defined(PLATFORM_ANDROID) 52 | #define fopen(name, mode) android_fopen(name, mode) 53 | #endif 54 | 55 | //---------------------------------------------------------------------------------- 56 | // Types and Structures Definition 57 | //---------------------------------------------------------------------------------- 58 | //... 59 | 60 | //---------------------------------------------------------------------------------- 61 | // Global Variables Definition 62 | //---------------------------------------------------------------------------------- 63 | // Nop... 64 | 65 | //---------------------------------------------------------------------------------- 66 | // Module Functions Declaration 67 | //---------------------------------------------------------------------------------- 68 | #ifdef __cplusplus 69 | extern "C" { // Prevents name mangling of functions 70 | #endif 71 | 72 | #if defined(PLATFORM_ANDROID) 73 | void InitAssetManager(AAssetManager *manager, const char *dataPath); // Initialize asset manager from android app 74 | FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() -> Read-only! 75 | #endif 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif // UTILS_H 82 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/deps/glad/vk_platform.h: -------------------------------------------------------------------------------- 1 | /* */ 2 | /* File: vk_platform.h */ 3 | /* */ 4 | /* 5 | ** Copyright (c) 2014-2017 The Khronos Group Inc. 6 | ** 7 | ** Licensed under the Apache License, Version 2.0 (the "License"); 8 | ** you may not use this file except in compliance with the License. 9 | ** You may obtain a copy of the License at 10 | ** 11 | ** http://www.apache.org/licenses/LICENSE-2.0 12 | ** 13 | ** Unless required by applicable law or agreed to in writing, software 14 | ** distributed under the License is distributed on an "AS IS" BASIS, 15 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | ** See the License for the specific language governing permissions and 17 | ** limitations under the License. 18 | */ 19 | 20 | 21 | #ifndef VK_PLATFORM_H_ 22 | #define VK_PLATFORM_H_ 23 | 24 | #ifdef __cplusplus 25 | extern "C" 26 | { 27 | #endif /* __cplusplus */ 28 | 29 | /* 30 | *************************************************************************************************** 31 | * Platform-specific directives and type declarations 32 | *************************************************************************************************** 33 | */ 34 | 35 | /* Platform-specific calling convention macros. 36 | * 37 | * Platforms should define these so that Vulkan clients call Vulkan commands 38 | * with the same calling conventions that the Vulkan implementation expects. 39 | * 40 | * VKAPI_ATTR - Placed before the return type in function declarations. 41 | * Useful for C++11 and GCC/Clang-style function attribute syntax. 42 | * VKAPI_CALL - Placed after the return type in function declarations. 43 | * Useful for MSVC-style calling convention syntax. 44 | * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. 45 | * 46 | * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); 47 | * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); 48 | */ 49 | #if defined(_WIN32) 50 | /* On Windows, Vulkan commands use the stdcall convention */ 51 | #define VKAPI_ATTR 52 | #define VKAPI_CALL __stdcall 53 | #define VKAPI_PTR VKAPI_CALL 54 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 55 | #error "Vulkan isn't supported for the 'armeabi' NDK ABI" 56 | #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) 57 | /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */ 58 | /* calling convention, i.e. float parameters are passed in registers. This */ 59 | /* is true even if the rest of the application passes floats on the stack, */ 60 | /* as it does by default when compiling for the armeabi-v7a NDK ABI. */ 61 | #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) 62 | #define VKAPI_CALL 63 | #define VKAPI_PTR VKAPI_ATTR 64 | #else 65 | /* On other platforms, use the default calling convention */ 66 | #define VKAPI_ATTR 67 | #define VKAPI_CALL 68 | #define VKAPI_PTR 69 | #endif 70 | 71 | #include 72 | 73 | #if !defined(VK_NO_STDINT_H) 74 | #if defined(_MSC_VER) && (_MSC_VER < 1600) 75 | typedef signed __int8 int8_t; 76 | typedef unsigned __int8 uint8_t; 77 | typedef signed __int16 int16_t; 78 | typedef unsigned __int16 uint16_t; 79 | typedef signed __int32 int32_t; 80 | typedef unsigned __int32 uint32_t; 81 | typedef signed __int64 int64_t; 82 | typedef unsigned __int64 uint64_t; 83 | #else 84 | #include 85 | #endif 86 | #endif /* !defined(VK_NO_STDINT_H) */ 87 | 88 | #ifdef __cplusplus 89 | } /* extern "C" */ 90 | #endif /* __cplusplus */ 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/win32_thread.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | #include 33 | 34 | 35 | ////////////////////////////////////////////////////////////////////////// 36 | ////// GLFW platform API ////// 37 | ////////////////////////////////////////////////////////////////////////// 38 | 39 | GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls) 40 | { 41 | assert(tls->win32.allocated == GLFW_FALSE); 42 | 43 | tls->win32.index = TlsAlloc(); 44 | if (tls->win32.index == TLS_OUT_OF_INDEXES) 45 | { 46 | _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, 47 | "Win32: Failed to allocate TLS index"); 48 | return GLFW_FALSE; 49 | } 50 | 51 | tls->win32.allocated = GLFW_TRUE; 52 | return GLFW_TRUE; 53 | } 54 | 55 | void _glfwPlatformDestroyTls(_GLFWtls* tls) 56 | { 57 | if (tls->win32.allocated) 58 | TlsFree(tls->win32.index); 59 | memset(tls, 0, sizeof(_GLFWtls)); 60 | } 61 | 62 | void* _glfwPlatformGetTls(_GLFWtls* tls) 63 | { 64 | assert(tls->win32.allocated == GLFW_TRUE); 65 | return TlsGetValue(tls->win32.index); 66 | } 67 | 68 | void _glfwPlatformSetTls(_GLFWtls* tls, void* value) 69 | { 70 | assert(tls->win32.allocated == GLFW_TRUE); 71 | TlsSetValue(tls->win32.index, value); 72 | } 73 | 74 | GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex) 75 | { 76 | assert(mutex->win32.allocated == GLFW_FALSE); 77 | InitializeCriticalSection(&mutex->win32.section); 78 | return mutex->win32.allocated = GLFW_TRUE; 79 | } 80 | 81 | void _glfwPlatformDestroyMutex(_GLFWmutex* mutex) 82 | { 83 | if (mutex->win32.allocated) 84 | DeleteCriticalSection(&mutex->win32.section); 85 | memset(mutex, 0, sizeof(_GLFWmutex)); 86 | } 87 | 88 | void _glfwPlatformLockMutex(_GLFWmutex* mutex) 89 | { 90 | assert(mutex->win32.allocated == GLFW_TRUE); 91 | EnterCriticalSection(&mutex->win32.section); 92 | } 93 | 94 | void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) 95 | { 96 | assert(mutex->win32.allocated == GLFW_TRUE); 97 | LeaveCriticalSection(&mutex->win32.section); 98 | } 99 | 100 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/deps/mingw/_mingw_dxhelper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * This file has no copyright assigned and is placed in the Public Domain. 3 | * This file is part of the mingw-w64 runtime package. 4 | * No warranty is given; refer to the file DISCLAIMER within this package. 5 | */ 6 | 7 | #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS) 8 | #define NONAMELESSUNION 1 9 | #endif 10 | #if defined(NONAMELESSSTRUCT) && \ 11 | !defined(NONAMELESSUNION) 12 | #define NONAMELESSUNION 1 13 | #endif 14 | #if defined(NONAMELESSUNION) && \ 15 | !defined(NONAMELESSSTRUCT) 16 | #define NONAMELESSSTRUCT 1 17 | #endif 18 | #if !defined(__GNU_EXTENSION) 19 | #if defined(__GNUC__) || defined(__GNUG__) 20 | #define __GNU_EXTENSION __extension__ 21 | #else 22 | #define __GNU_EXTENSION 23 | #endif 24 | #endif /* __extension__ */ 25 | 26 | #ifndef __ANONYMOUS_DEFINED 27 | #define __ANONYMOUS_DEFINED 28 | #if defined(__GNUC__) || defined(__GNUG__) 29 | #define _ANONYMOUS_UNION __extension__ 30 | #define _ANONYMOUS_STRUCT __extension__ 31 | #else 32 | #define _ANONYMOUS_UNION 33 | #define _ANONYMOUS_STRUCT 34 | #endif 35 | #ifndef NONAMELESSUNION 36 | #define _UNION_NAME(x) 37 | #define _STRUCT_NAME(x) 38 | #else /* NONAMELESSUNION */ 39 | #define _UNION_NAME(x) x 40 | #define _STRUCT_NAME(x) x 41 | #endif 42 | #endif /* __ANONYMOUS_DEFINED */ 43 | 44 | #ifndef DUMMYUNIONNAME 45 | # ifdef NONAMELESSUNION 46 | # define DUMMYUNIONNAME u 47 | # define DUMMYUNIONNAME1 u1 /* Wine uses this variant */ 48 | # define DUMMYUNIONNAME2 u2 49 | # define DUMMYUNIONNAME3 u3 50 | # define DUMMYUNIONNAME4 u4 51 | # define DUMMYUNIONNAME5 u5 52 | # define DUMMYUNIONNAME6 u6 53 | # define DUMMYUNIONNAME7 u7 54 | # define DUMMYUNIONNAME8 u8 55 | # define DUMMYUNIONNAME9 u9 56 | # else /* NONAMELESSUNION */ 57 | # define DUMMYUNIONNAME 58 | # define DUMMYUNIONNAME1 /* Wine uses this variant */ 59 | # define DUMMYUNIONNAME2 60 | # define DUMMYUNIONNAME3 61 | # define DUMMYUNIONNAME4 62 | # define DUMMYUNIONNAME5 63 | # define DUMMYUNIONNAME6 64 | # define DUMMYUNIONNAME7 65 | # define DUMMYUNIONNAME8 66 | # define DUMMYUNIONNAME9 67 | # endif 68 | #endif /* DUMMYUNIONNAME */ 69 | 70 | #if !defined(DUMMYUNIONNAME1) /* MinGW does not define this one */ 71 | # ifdef NONAMELESSUNION 72 | # define DUMMYUNIONNAME1 u1 /* Wine uses this variant */ 73 | # else 74 | # define DUMMYUNIONNAME1 /* Wine uses this variant */ 75 | # endif 76 | #endif /* DUMMYUNIONNAME1 */ 77 | 78 | #ifndef DUMMYSTRUCTNAME 79 | # ifdef NONAMELESSUNION 80 | # define DUMMYSTRUCTNAME s 81 | # define DUMMYSTRUCTNAME1 s1 /* Wine uses this variant */ 82 | # define DUMMYSTRUCTNAME2 s2 83 | # define DUMMYSTRUCTNAME3 s3 84 | # define DUMMYSTRUCTNAME4 s4 85 | # define DUMMYSTRUCTNAME5 s5 86 | # else 87 | # define DUMMYSTRUCTNAME 88 | # define DUMMYSTRUCTNAME1 /* Wine uses this variant */ 89 | # define DUMMYSTRUCTNAME2 90 | # define DUMMYSTRUCTNAME3 91 | # define DUMMYSTRUCTNAME4 92 | # define DUMMYSTRUCTNAME5 93 | # endif 94 | #endif /* DUMMYSTRUCTNAME */ 95 | 96 | /* These are for compatibility with the Wine source tree */ 97 | 98 | #ifndef WINELIB_NAME_AW 99 | # ifdef __MINGW_NAME_AW 100 | # define WINELIB_NAME_AW __MINGW_NAME_AW 101 | # else 102 | # ifdef UNICODE 103 | # define WINELIB_NAME_AW(func) func##W 104 | # else 105 | # define WINELIB_NAME_AW(func) func##A 106 | # endif 107 | # endif 108 | #endif /* WINELIB_NAME_AW */ 109 | 110 | #ifndef DECL_WINELIB_TYPE_AW 111 | # ifdef __MINGW_TYPEDEF_AW 112 | # define DECL_WINELIB_TYPE_AW __MINGW_TYPEDEF_AW 113 | # else 114 | # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; 115 | # endif 116 | #endif /* DECL_WINELIB_TYPE_AW */ 117 | 118 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/posix_thread.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 platform API ////// 38 | ////////////////////////////////////////////////////////////////////////// 39 | 40 | GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls) 41 | { 42 | assert(tls->posix.allocated == GLFW_FALSE); 43 | 44 | if (pthread_key_create(&tls->posix.key, NULL) != 0) 45 | { 46 | _glfwInputError(GLFW_PLATFORM_ERROR, 47 | "POSIX: Failed to create context TLS"); 48 | return GLFW_FALSE; 49 | } 50 | 51 | tls->posix.allocated = GLFW_TRUE; 52 | return GLFW_TRUE; 53 | } 54 | 55 | void _glfwPlatformDestroyTls(_GLFWtls* tls) 56 | { 57 | if (tls->posix.allocated) 58 | pthread_key_delete(tls->posix.key); 59 | memset(tls, 0, sizeof(_GLFWtls)); 60 | } 61 | 62 | void* _glfwPlatformGetTls(_GLFWtls* tls) 63 | { 64 | assert(tls->posix.allocated == GLFW_TRUE); 65 | return pthread_getspecific(tls->posix.key); 66 | } 67 | 68 | void _glfwPlatformSetTls(_GLFWtls* tls, void* value) 69 | { 70 | assert(tls->posix.allocated == GLFW_TRUE); 71 | pthread_setspecific(tls->posix.key, value); 72 | } 73 | 74 | GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex) 75 | { 76 | assert(mutex->posix.allocated == GLFW_FALSE); 77 | 78 | if (pthread_mutex_init(&mutex->posix.handle, NULL) != 0) 79 | { 80 | _glfwInputError(GLFW_PLATFORM_ERROR, "POSIX: Failed to create mutex"); 81 | return GLFW_FALSE; 82 | } 83 | 84 | return mutex->posix.allocated = GLFW_TRUE; 85 | } 86 | 87 | void _glfwPlatformDestroyMutex(_GLFWmutex* mutex) 88 | { 89 | if (mutex->posix.allocated) 90 | pthread_mutex_destroy(&mutex->posix.handle); 91 | memset(mutex, 0, sizeof(_GLFWmutex)); 92 | } 93 | 94 | void _glfwPlatformLockMutex(_GLFWmutex* mutex) 95 | { 96 | assert(mutex->posix.allocated == GLFW_TRUE); 97 | pthread_mutex_lock(&mutex->posix.handle); 98 | } 99 | 100 | void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) 101 | { 102 | assert(mutex->posix.allocated == GLFW_TRUE); 103 | pthread_mutex_unlock(&mutex->posix.handle); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/osmesa_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 OSMesa - 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 | #define OSMESA_RGBA 0x1908 29 | #define OSMESA_FORMAT 0x22 30 | #define OSMESA_DEPTH_BITS 0x30 31 | #define OSMESA_STENCIL_BITS 0x31 32 | #define OSMESA_ACCUM_BITS 0x32 33 | #define OSMESA_PROFILE 0x33 34 | #define OSMESA_CORE_PROFILE 0x34 35 | #define OSMESA_COMPAT_PROFILE 0x35 36 | #define OSMESA_CONTEXT_MAJOR_VERSION 0x36 37 | #define OSMESA_CONTEXT_MINOR_VERSION 0x37 38 | 39 | typedef void* OSMesaContext; 40 | typedef void (*OSMESAproc)(void); 41 | 42 | typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext); 43 | typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext); 44 | typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext); 45 | typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int); 46 | typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**); 47 | typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**); 48 | typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*); 49 | #define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt 50 | #define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs 51 | #define OSMesaDestroyContext _glfw.osmesa.DestroyContext 52 | #define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent 53 | #define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer 54 | #define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer 55 | #define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress 56 | 57 | // OSMesa-specific per-context data 58 | // 59 | typedef struct _GLFWcontextOSMesa 60 | { 61 | OSMesaContext handle; 62 | int width; 63 | int height; 64 | void* buffer; 65 | 66 | } _GLFWcontextOSMesa; 67 | 68 | // OSMesa-specific global data 69 | // 70 | typedef struct _GLFWlibraryOSMesa 71 | { 72 | void* handle; 73 | 74 | PFN_OSMesaCreateContextExt CreateContextExt; 75 | PFN_OSMesaCreateContextAttribs CreateContextAttribs; 76 | PFN_OSMesaDestroyContext DestroyContext; 77 | PFN_OSMesaMakeCurrent MakeCurrent; 78 | PFN_OSMesaGetColorBuffer GetColorBuffer; 79 | PFN_OSMesaGetDepthBuffer GetDepthBuffer; 80 | PFN_OSMesaGetProcAddress GetProcAddress; 81 | 82 | } _GLFWlibraryOSMesa; 83 | 84 | 85 | GLFWbool _glfwInitOSMesa(void); 86 | void _glfwTerminateOSMesa(void); 87 | GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, 88 | const _GLFWctxconfig* ctxconfig, 89 | const _GLFWfbconfig* fbconfig); 90 | 91 | -------------------------------------------------------------------------------- /raylib/src/minshell.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | raylib web game 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 37 | 38 | 56 | 57 | 58 | 59 |

60 | 80 | {{{ SCRIPT }}} 81 | 82 | 83 | -------------------------------------------------------------------------------- /raylib/src/build.zig: -------------------------------------------------------------------------------- 1 | const std = @import("std"); 2 | 3 | pub fn Pkg(srcdir: []const u8) type { 4 | return struct { 5 | pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build.LibExeObjStep { 6 | // Standard release options allow the person running `zig build` to select 7 | // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. 8 | const mode = b.standardReleaseOptions(); 9 | 10 | const raylib_flags = &[_][]const u8{ 11 | "-std=gnu99", 12 | "-DPLATFORM_DESKTOP", 13 | "-DGL_SILENCE_DEPRECATION=199309L", 14 | "-fno-sanitize=undefined", // https://github.com/raysan5/raylib/issues/1891 15 | }; 16 | 17 | const raylib = b.addStaticLibrary("raylib", srcdir ++ "/raylib.h"); 18 | raylib.setTarget(target); 19 | raylib.setBuildMode(mode); 20 | raylib.linkLibC(); 21 | 22 | raylib.addIncludeDir(srcdir ++ "/external/glfw/include"); 23 | 24 | raylib.addCSourceFiles(&.{ 25 | srcdir ++ "/raudio.c", 26 | srcdir ++ "/rcore.c", 27 | srcdir ++ "/rmodels.c", 28 | srcdir ++ "/rshapes.c", 29 | srcdir ++ "/rtext.c", 30 | srcdir ++ "/rtextures.c", 31 | srcdir ++ "/utils.c", 32 | }, raylib_flags); 33 | 34 | switch (raylib.target.toTarget().os.tag) { 35 | .windows => { 36 | raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags); 37 | raylib.linkSystemLibrary("winmm"); 38 | raylib.linkSystemLibrary("gdi32"); 39 | raylib.linkSystemLibrary("opengl32"); 40 | raylib.addIncludeDir("external/glfw/deps/mingw"); 41 | }, 42 | .linux => { 43 | raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags); 44 | raylib.linkSystemLibrary("GL"); 45 | raylib.linkSystemLibrary("rt"); 46 | raylib.linkSystemLibrary("dl"); 47 | raylib.linkSystemLibrary("m"); 48 | raylib.linkSystemLibrary("X11"); 49 | }, 50 | .freebsd, .openbsd, .netbsd, .dragonfly => { 51 | raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags); 52 | raylib.linkSystemLibrary("GL"); 53 | raylib.linkSystemLibrary("rt"); 54 | raylib.linkSystemLibrary("dl"); 55 | raylib.linkSystemLibrary("m"); 56 | raylib.linkSystemLibrary("X11"); 57 | raylib.linkSystemLibrary("Xrandr"); 58 | raylib.linkSystemLibrary("Xinerama"); 59 | raylib.linkSystemLibrary("Xi"); 60 | raylib.linkSystemLibrary("Xxf86vm"); 61 | raylib.linkSystemLibrary("Xcursor"); 62 | }, 63 | .macos => { 64 | // On macos rglfw.c include Objective-C files. 65 | const raylib_flags_extra_macos = &[_][]const u8{ 66 | "-ObjC", 67 | }; 68 | raylib.addCSourceFiles( 69 | &.{srcdir ++ "/rglfw.c"}, 70 | raylib_flags ++ raylib_flags_extra_macos, 71 | ); 72 | raylib.linkFramework("Foundation"); 73 | }, 74 | else => { 75 | @panic("Unsupported OS"); 76 | }, 77 | } 78 | 79 | raylib.setOutputDir("./"); 80 | raylib.install(); 81 | return raylib; 82 | } 83 | }; 84 | } 85 | 86 | const lib = Pkg("."); 87 | 88 | pub fn build(b: *std.build.Builder) void { 89 | // Standard target options allows the person running `zig build` to choose 90 | // what target to build for. Here we do not override the defaults, which 91 | // means any target is allowed, and the default is native. Other options 92 | // for restricting supported target set are available. 93 | const target = b.standardTargetOptions(.{}); 94 | 95 | _ = lib.addRaylib(b, target); 96 | } 97 | -------------------------------------------------------------------------------- /raylib/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Setup the project and settings 2 | project(raylib C) 3 | set(PROJECT_VERSION 4.0.0) 4 | set(API_VERSION 400) 5 | 6 | include(GNUInstallDirs) 7 | include(JoinPaths) 8 | 9 | # Sets build type if not set by now 10 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 11 | if(RAYLIB_IS_MAIN) 12 | set(default_build_type Debug) 13 | else() 14 | message(WARNING "Default build type is not set (CMAKE_BUILD_TYPE)") 15 | endif() 16 | 17 | message(STATUS "Setting build type to '${default_build_type}' as none was specified.") 18 | 19 | set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) 20 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") 21 | endif() 22 | 23 | # Used as public API to be included into other projects 24 | set(raylib_public_headers 25 | raylib.h 26 | rlgl.h 27 | raymath.h 28 | raudio.h 29 | ) 30 | 31 | # Sources to be compiled 32 | set(raylib_sources 33 | rcore.c 34 | rmodels.c 35 | rshapes.c 36 | rtext.c 37 | rtextures.c 38 | utils.c 39 | ) 40 | 41 | # /cmake/GlfwImport.cmake handles the details around the inclusion of glfw 42 | include(GlfwImport) 43 | 44 | # Sets additional platform options and link libraries for each platform 45 | # also selects the proper graphics API and version for that platform 46 | # Produces a variable LIBS_PRIVATE that will be used later 47 | include(LibraryConfigurations) 48 | 49 | if (USE_AUDIO) 50 | MESSAGE(STATUS "Audio Backend: miniaudio") 51 | list(APPEND raylib_sources raudio.c) 52 | else () 53 | MESSAGE(STATUS "Audio Backend: None (-DUSE_AUDIO=OFF)") 54 | endif () 55 | 56 | 57 | add_library(raylib ${raylib_sources} ${raylib_public_headers}) 58 | 59 | if (NOT BUILD_SHARED_LIBS) 60 | MESSAGE(STATUS "Building raylib static library") 61 | add_library(raylib_static ALIAS raylib) 62 | else() 63 | MESSAGE(STATUS "Building raylib shared library") 64 | if (MSVC) 65 | target_compile_definitions(raylib 66 | PRIVATE $ 67 | INTERFACE $ 68 | ) 69 | endif () 70 | endif() 71 | 72 | set_target_properties(raylib PROPERTIES 73 | PUBLIC_HEADER "${raylib_public_headers}" 74 | VERSION ${PROJECT_VERSION} 75 | SOVERSION ${API_VERSION} 76 | ) 77 | 78 | if (WITH_PIC OR BUILD_SHARED_LIBS) 79 | set_property(TARGET raylib PROPERTY POSITION_INDEPENDENT_CODE ON) 80 | endif () 81 | 82 | target_link_libraries(raylib "${LIBS_PRIVATE}") 83 | 84 | # Sets some compile time definitions for the pre-processor 85 | # If CUSTOMIZE_BUILD option is on you will not use config.h by default 86 | # and you will be able to select more build options 87 | include(CompileDefinitions) 88 | 89 | # Registering include directories 90 | target_include_directories(raylib 91 | PUBLIC 92 | $ 93 | $ 94 | PRIVATE 95 | ${CMAKE_CURRENT_SOURCE_DIR} 96 | ${OPENGL_INCLUDE_DIR} 97 | ${OPENAL_INCLUDE_DIR} 98 | ) 99 | 100 | # Copy the header files to the build directory for convenience 101 | file(COPY ${raylib_public_headers} DESTINATION "include") 102 | 103 | # Includes information on how the library will be installed on the system 104 | # when cmake --install is run 105 | include(InstallConfigurations) 106 | 107 | # Print the flags for the user 108 | if (DEFINED CMAKE_BUILD_TYPE) 109 | message(STATUS "Generated build type: ${CMAKE_BUILD_TYPE}") 110 | else () 111 | message(STATUS "Generated config types: ${CMAKE_CONFIGURATION_TYPES}") 112 | endif () 113 | 114 | message(STATUS "Compiling with the flags:") 115 | message(STATUS " PLATFORM=" ${PLATFORM_CPP}) 116 | message(STATUS " GRAPHICS=" ${GRAPHICS}) 117 | 118 | # Options if you want to create an installer using CPack 119 | include(PackConfigurations) 120 | 121 | enable_testing() 122 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/mappings.h.in: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2018 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 | // As mappings.h.in, this file is used by CMake to produce the mappings.h 27 | // header file. If you are adding a GLFW specific gamepad mapping, this is 28 | // where to put it. 29 | //======================================================================== 30 | // As mappings.h, this provides all pre-defined gamepad mappings, including 31 | // all available in SDL_GameControllerDB. Do not edit this file. Any gamepad 32 | // mappings not specific to GLFW should be submitted to SDL_GameControllerDB. 33 | // This file can be re-generated from mappings.h.in and the upstream 34 | // gamecontrollerdb.txt with the GenerateMappings.cmake script. 35 | //======================================================================== 36 | 37 | // All gamepad mappings not labeled GLFW are copied from the 38 | // SDL_GameControllerDB project under the following license: 39 | // 40 | // Simple DirectMedia Layer 41 | // Copyright (C) 1997-2013 Sam Lantinga 42 | // 43 | // This software is provided 'as-is', without any express or implied warranty. 44 | // In no event will the authors be held liable for any damages arising from the 45 | // use of this software. 46 | // 47 | // Permission is granted to anyone to use this software for any purpose, 48 | // including commercial applications, and to alter it and redistribute it 49 | // freely, subject to the following restrictions: 50 | // 51 | // 1. The origin of this software must not be misrepresented; you must not 52 | // claim that you wrote the original software. If you use this software 53 | // in a product, an acknowledgment in the product documentation would 54 | // be appreciated but is not required. 55 | // 56 | // 2. Altered source versions must be plainly marked as such, and must not be 57 | // misrepresented as being the original software. 58 | // 59 | // 3. This notice may not be removed or altered from any source distribution. 60 | 61 | const char* _glfwDefaultMappings[] = 62 | { 63 | @GLFW_GAMEPAD_MAPPINGS@ 64 | "78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", 65 | "78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", 66 | "78696e70757403000000000000000000,XInput Arcade Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", 67 | "78696e70757404000000000000000000,XInput Flight Stick (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", 68 | "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", 69 | "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", 70 | "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", 71 | NULL 72 | }; 73 | 74 | -------------------------------------------------------------------------------- /raylib/src/rglfw.c: -------------------------------------------------------------------------------- 1 | /********************************************************************************************** 2 | * 3 | * rglfw - raylib GLFW single file compilation 4 | * 5 | * This file includes latest GLFW sources (https://github.com/glfw/glfw) to be compiled together 6 | * with raylib for all supported platforms, this way, no external dependencies are required. 7 | * 8 | * LICENSE: zlib/libpng 9 | * 10 | * Copyright (c) 2017-2022 Ramon Santamaria (@raysan5) 11 | * 12 | * This software is provided "as-is", without any express or implied warranty. In no event 13 | * will the authors be held liable for any damages arising from the use of this software. 14 | * 15 | * Permission is granted to anyone to use this software for any purpose, including commercial 16 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 17 | * 18 | * 1. The origin of this software must not be misrepresented; you must not claim that you 19 | * wrote the original software. If you use this software in a product, an acknowledgment 20 | * in the product documentation would be appreciated but is not required. 21 | * 22 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 23 | * as being the original software. 24 | * 25 | * 3. This notice may not be removed or altered from any source distribution. 26 | * 27 | **********************************************************************************************/ 28 | 29 | //#define _GLFW_BUILD_DLL // To build shared version 30 | // Ref: http://www.glfw.org/docs/latest/compile.html#compile_manual 31 | 32 | // Platform options: 33 | // _GLFW_WIN32 to use the Win32 API 34 | // _GLFW_X11 to use the X Window System 35 | // _GLFW_WAYLAND to use the Wayland API (experimental and incomplete) 36 | // _GLFW_COCOA to use the Cocoa frameworks 37 | // _GLFW_OSMESA to use the OSMesa API (headless and non-interactive) 38 | // _GLFW_MIR experimental, not supported at this moment 39 | 40 | #if defined(_WIN32) 41 | #define _GLFW_WIN32 42 | #endif 43 | #if defined(__linux__) 44 | #if !defined(_GLFW_WAYLAND) // Required for Wayland windowing 45 | #define _GLFW_X11 46 | #endif 47 | #endif 48 | #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) 49 | #define _GLFW_X11 50 | #endif 51 | #if defined(__APPLE__) 52 | #define _GLFW_COCOA 53 | #define _GLFW_USE_MENUBAR // To create and populate the menu bar when the first window is created 54 | #define _GLFW_USE_RETINA // To have windows use the full resolution of Retina displays 55 | #endif 56 | #if defined(__TINYC__) 57 | #define _WIN32_WINNT_WINXP 0x0501 58 | #endif 59 | 60 | // Common modules to all platforms 61 | #include "external/glfw/src/context.c" 62 | #include "external/glfw/src/init.c" 63 | #include "external/glfw/src/input.c" 64 | #include "external/glfw/src/monitor.c" 65 | #include "external/glfw/src/vulkan.c" 66 | #include "external/glfw/src/window.c" 67 | 68 | #if defined(_WIN32) 69 | #include "external/glfw/src/win32_init.c" 70 | #include "external/glfw/src/win32_joystick.c" 71 | #include "external/glfw/src/win32_monitor.c" 72 | #include "external/glfw/src/win32_time.c" 73 | #include "external/glfw/src/win32_thread.c" 74 | #include "external/glfw/src/win32_window.c" 75 | #include "external/glfw/src/wgl_context.c" 76 | #include "external/glfw/src/egl_context.c" 77 | #include "external/glfw/src/osmesa_context.c" 78 | #endif 79 | 80 | #if defined(__linux__) 81 | #if defined(_GLFW_WAYLAND) 82 | #include "external/glfw/src/wl_init.c" 83 | #include "external/glfw/src/wl_monitor.c" 84 | #include "external/glfw/src/wl_window.c" 85 | #include "external/glfw/src/wayland-pointer-constraints-unstable-v1-client-protocol.c" 86 | #include "external/glfw/src/wayland-relative-pointer-unstable-v1-client-protocol.c" 87 | #endif 88 | #if defined(_GLFW_X11) 89 | #include "external/glfw/src/x11_init.c" 90 | #include "external/glfw/src/x11_monitor.c" 91 | #include "external/glfw/src/x11_window.c" 92 | #include "external/glfw/src/glx_context.c" 93 | #endif 94 | 95 | #include "external/glfw/src/linux_joystick.c" 96 | #include "external/glfw/src/posix_thread.c" 97 | #include "external/glfw/src/posix_time.c" 98 | #include "external/glfw/src/xkb_unicode.c" 99 | #include "external/glfw/src/egl_context.c" 100 | #include "external/glfw/src/osmesa_context.c" 101 | #endif 102 | 103 | #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined( __NetBSD__) || defined(__DragonFly__) 104 | #include "external/glfw/src/x11_init.c" 105 | #include "external/glfw/src/x11_monitor.c" 106 | #include "external/glfw/src/x11_window.c" 107 | #include "external/glfw/src/xkb_unicode.c" 108 | #include "external/glfw/src/null_joystick.c" 109 | #include "external/glfw/src/posix_time.c" 110 | #include "external/glfw/src/posix_thread.c" 111 | #include "external/glfw/src/glx_context.c" 112 | #include "external/glfw/src/egl_context.c" 113 | #include "external/glfw/src/osmesa_context.c" 114 | #endif 115 | 116 | #if defined(__APPLE__) 117 | #include "external/glfw/src/cocoa_init.m" 118 | #include "external/glfw/src/cocoa_joystick.m" 119 | #include "external/glfw/src/cocoa_monitor.m" 120 | #include "external/glfw/src/cocoa_window.m" 121 | #include "external/glfw/src/cocoa_time.c" 122 | #include "external/glfw/src/posix_thread.c" 123 | #include "external/glfw/src/nsgl_context.m" 124 | #include "external/glfw/src/egl_context.c" 125 | #include "external/glfw/src/osmesa_context.c" 126 | #endif 127 | -------------------------------------------------------------------------------- /raylib/src/external/dirent.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | 3 | Declaration of POSIX directory browsing functions and types for Win32. 4 | 5 | Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) 6 | History: Created March 1997. Updated June 2003. 7 | Reviewed by Ramon Santamaria for raylib on January 2020. 8 | 9 | Copyright Kevlin Henney, 1997, 2003. All rights reserved. 10 | 11 | Permission to use, copy, modify, and distribute this software and its 12 | documentation for any purpose is hereby granted without fee, provided 13 | that this copyright and permissions notice appear in all copies and 14 | derivatives. 15 | 16 | This software is supplied "as is" without express or implied warranty. 17 | 18 | But that said, if there are any problems please get in touch. 19 | 20 | ****************************************************************************/ 21 | 22 | #ifndef DIRENT_H 23 | #define DIRENT_H 24 | 25 | // Allow custom memory allocators 26 | #ifndef DIRENT_MALLOC 27 | #define DIRENT_MALLOC(sz) malloc(sz) 28 | #endif 29 | #ifndef DIRENT_FREE 30 | #define DIRENT_FREE(p) free(p) 31 | #endif 32 | 33 | //---------------------------------------------------------------------------------- 34 | // Types and Structures Definition 35 | //---------------------------------------------------------------------------------- 36 | 37 | // Fordward declaration of DIR, implementation below 38 | typedef struct DIR DIR; 39 | 40 | struct dirent { 41 | char *d_name; 42 | }; 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | //------------------------------------------------------------------------------------ 49 | // Functions Declaration 50 | //------------------------------------------------------------------------------------ 51 | DIR *opendir(const char *name); 52 | int closedir(DIR *dir); 53 | struct dirent *readdir(DIR *dir); 54 | void rewinddir(DIR *dir); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif // DIRENT_H 61 | 62 | /**************************************************************************** 63 | 64 | Implementation of POSIX directory browsing functions and types for Win32. 65 | 66 | Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com) 67 | History: Created March 1997. Updated June 2003. 68 | Reviewed by Ramon Santamaria for raylib on January 2020. 69 | 70 | Copyright Kevlin Henney, 1997, 2003. All rights reserved. 71 | 72 | Permission to use, copy, modify, and distribute this software and its 73 | documentation for any purpose is hereby granted without fee, provided 74 | that this copyright and permissions notice appear in all copies and 75 | derivatives. 76 | 77 | This software is supplied "as is" without express or implied warranty. 78 | 79 | But that said, if there are any problems please get in touch. 80 | 81 | ****************************************************************************/ 82 | 83 | #include // _findfirst and _findnext set errno iff they return -1 84 | #include 85 | #include 86 | #include 87 | 88 | //---------------------------------------------------------------------------------- 89 | // Types and Structures Definition 90 | //---------------------------------------------------------------------------------- 91 | typedef ptrdiff_t handle_type; // C99's intptr_t not sufficiently portable 92 | 93 | struct DIR { 94 | handle_type handle; // -1 for failed rewind 95 | struct _finddata_t info; 96 | struct dirent result; // d_name null iff first time 97 | char *name; // null-terminated char string 98 | }; 99 | 100 | DIR *opendir(const char *name) 101 | { 102 | DIR *dir = 0; 103 | 104 | if (name && name[0]) 105 | { 106 | size_t base_length = strlen(name); 107 | 108 | // Search pattern must end with suitable wildcard 109 | const char *all = strchr("/\\", name[base_length - 1]) ? "*" : "/*"; 110 | 111 | if ((dir = (DIR *)DIRENT_MALLOC(sizeof *dir)) != 0 && 112 | (dir->name = (char *)DIRENT_MALLOC(base_length + strlen(all) + 1)) != 0) 113 | { 114 | strcat(strcpy(dir->name, name), all); 115 | 116 | if ((dir->handle = (handle_type) _findfirst(dir->name, &dir->info)) != -1) 117 | { 118 | dir->result.d_name = 0; 119 | } 120 | else // rollback 121 | { 122 | DIRENT_FREE(dir->name); 123 | DIRENT_FREE(dir); 124 | dir = 0; 125 | } 126 | } 127 | else // rollback 128 | { 129 | DIRENT_FREE(dir); 130 | dir = 0; 131 | errno = ENOMEM; 132 | } 133 | } 134 | else errno = EINVAL; 135 | 136 | return dir; 137 | } 138 | 139 | int closedir(DIR *dir) 140 | { 141 | int result = -1; 142 | 143 | if (dir) 144 | { 145 | if (dir->handle != -1) result = _findclose(dir->handle); 146 | 147 | DIRENT_FREE(dir->name); 148 | DIRENT_FREE(dir); 149 | } 150 | 151 | // NOTE: All errors ampped to EBADF 152 | if (result == -1) errno = EBADF; 153 | 154 | return result; 155 | } 156 | 157 | struct dirent *readdir(DIR *dir) 158 | { 159 | struct dirent *result = 0; 160 | 161 | if (dir && dir->handle != -1) 162 | { 163 | if (!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) 164 | { 165 | result = &dir->result; 166 | result->d_name = dir->info.name; 167 | } 168 | } 169 | else errno = EBADF; 170 | 171 | return result; 172 | } 173 | 174 | void rewinddir(DIR *dir) 175 | { 176 | if (dir && dir->handle != -1) 177 | { 178 | _findclose(dir->handle); 179 | dir->handle = (handle_type) _findfirst(dir->name, &dir->info); 180 | dir->result.d_name = 0; 181 | } 182 | else errno = EBADF; 183 | } 184 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/null_monitor.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 - 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 | #include 33 | #include 34 | #include 35 | 36 | // The the sole (fake) video mode of our (sole) fake monitor 37 | // 38 | static GLFWvidmode getVideoMode(void) 39 | { 40 | GLFWvidmode mode; 41 | mode.width = 1920; 42 | mode.height = 1080; 43 | mode.redBits = 8; 44 | mode.greenBits = 8; 45 | mode.blueBits = 8; 46 | mode.refreshRate = 60; 47 | return mode; 48 | } 49 | 50 | ////////////////////////////////////////////////////////////////////////// 51 | ////// GLFW internal API ////// 52 | ////////////////////////////////////////////////////////////////////////// 53 | 54 | void _glfwPollMonitorsNull(void) 55 | { 56 | const float dpi = 141.f; 57 | const GLFWvidmode mode = getVideoMode(); 58 | _GLFWmonitor* monitor = _glfwAllocMonitor("Null SuperNoop 0", 59 | (int) (mode.width * 25.4f / dpi), 60 | (int) (mode.height * 25.4f / dpi)); 61 | _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_FIRST); 62 | } 63 | 64 | ////////////////////////////////////////////////////////////////////////// 65 | ////// GLFW platform API ////// 66 | ////////////////////////////////////////////////////////////////////////// 67 | 68 | void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) 69 | { 70 | _glfwFreeGammaArrays(&monitor->null.ramp); 71 | } 72 | 73 | void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) 74 | { 75 | if (xpos) 76 | *xpos = 0; 77 | if (ypos) 78 | *ypos = 0; 79 | } 80 | 81 | void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, 82 | float* xscale, float* yscale) 83 | { 84 | if (xscale) 85 | *xscale = 1.f; 86 | if (yscale) 87 | *yscale = 1.f; 88 | } 89 | 90 | void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, 91 | int* xpos, int* ypos, 92 | int* width, int* height) 93 | { 94 | const GLFWvidmode mode = getVideoMode(); 95 | 96 | if (xpos) 97 | *xpos = 0; 98 | if (ypos) 99 | *ypos = 10; 100 | if (width) 101 | *width = mode.width; 102 | if (height) 103 | *height = mode.height - 10; 104 | } 105 | 106 | GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) 107 | { 108 | GLFWvidmode* mode = calloc(1, sizeof(GLFWvidmode)); 109 | *mode = getVideoMode(); 110 | *found = 1; 111 | return mode; 112 | } 113 | 114 | void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) 115 | { 116 | *mode = getVideoMode(); 117 | } 118 | 119 | GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) 120 | { 121 | if (!monitor->null.ramp.size) 122 | { 123 | _glfwAllocGammaArrays(&monitor->null.ramp, 256); 124 | 125 | for (unsigned int i = 0; i < monitor->null.ramp.size; i++) 126 | { 127 | const float gamma = 2.2f; 128 | float value; 129 | value = i / (float) (monitor->null.ramp.size - 1); 130 | value = powf(value, 1.f / gamma) * 65535.f + 0.5f; 131 | value = _glfw_fminf(value, 65535.f); 132 | 133 | monitor->null.ramp.red[i] = (unsigned short) value; 134 | monitor->null.ramp.green[i] = (unsigned short) value; 135 | monitor->null.ramp.blue[i] = (unsigned short) value; 136 | } 137 | } 138 | 139 | _glfwAllocGammaArrays(ramp, monitor->null.ramp.size); 140 | memcpy(ramp->red, monitor->null.ramp.red, sizeof(short) * ramp->size); 141 | memcpy(ramp->green, monitor->null.ramp.green, sizeof(short) * ramp->size); 142 | memcpy(ramp->blue, monitor->null.ramp.blue, sizeof(short) * ramp->size); 143 | return GLFW_TRUE; 144 | } 145 | 146 | void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) 147 | { 148 | if (monitor->null.ramp.size != ramp->size) 149 | { 150 | _glfwInputError(GLFW_PLATFORM_ERROR, 151 | "Null: Gamma ramp size must match current ramp size"); 152 | return; 153 | } 154 | 155 | memcpy(monitor->null.ramp.red, ramp->red, sizeof(short) * ramp->size); 156 | memcpy(monitor->null.ramp.green, ramp->green, sizeof(short) * ramp->size); 157 | memcpy(monitor->null.ramp.blue, ramp->blue, sizeof(short) * ramp->size); 158 | } 159 | 160 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/wgl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 WGL - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2018 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 WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 29 | #define WGL_SUPPORT_OPENGL_ARB 0x2010 30 | #define WGL_DRAW_TO_WINDOW_ARB 0x2001 31 | #define WGL_PIXEL_TYPE_ARB 0x2013 32 | #define WGL_TYPE_RGBA_ARB 0x202b 33 | #define WGL_ACCELERATION_ARB 0x2003 34 | #define WGL_NO_ACCELERATION_ARB 0x2025 35 | #define WGL_RED_BITS_ARB 0x2015 36 | #define WGL_RED_SHIFT_ARB 0x2016 37 | #define WGL_GREEN_BITS_ARB 0x2017 38 | #define WGL_GREEN_SHIFT_ARB 0x2018 39 | #define WGL_BLUE_BITS_ARB 0x2019 40 | #define WGL_BLUE_SHIFT_ARB 0x201a 41 | #define WGL_ALPHA_BITS_ARB 0x201b 42 | #define WGL_ALPHA_SHIFT_ARB 0x201c 43 | #define WGL_ACCUM_BITS_ARB 0x201d 44 | #define WGL_ACCUM_RED_BITS_ARB 0x201e 45 | #define WGL_ACCUM_GREEN_BITS_ARB 0x201f 46 | #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 47 | #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 48 | #define WGL_DEPTH_BITS_ARB 0x2022 49 | #define WGL_STENCIL_BITS_ARB 0x2023 50 | #define WGL_AUX_BUFFERS_ARB 0x2024 51 | #define WGL_STEREO_ARB 0x2012 52 | #define WGL_DOUBLE_BUFFER_ARB 0x2011 53 | #define WGL_SAMPLES_ARB 0x2042 54 | #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20a9 55 | #define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 56 | #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 57 | #define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 58 | #define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 59 | #define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 60 | #define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 61 | #define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 62 | #define WGL_CONTEXT_FLAGS_ARB 0x2094 63 | #define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 64 | #define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 65 | #define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 66 | #define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 67 | #define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 68 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 69 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 70 | #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 71 | #define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3 72 | #define WGL_COLORSPACE_EXT 0x309d 73 | #define WGL_COLORSPACE_SRGB_EXT 0x3089 74 | 75 | #define ERROR_INVALID_VERSION_ARB 0x2095 76 | #define ERROR_INVALID_PROFILE_ARB 0x2096 77 | #define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 78 | 79 | // WGL extension pointer typedefs 80 | typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC)(int); 81 | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC,int,int,UINT,const int*,int*); 82 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void); 83 | typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC); 84 | typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC,HGLRC,const int*); 85 | #define wglSwapIntervalEXT _glfw.wgl.SwapIntervalEXT 86 | #define wglGetPixelFormatAttribivARB _glfw.wgl.GetPixelFormatAttribivARB 87 | #define wglGetExtensionsStringEXT _glfw.wgl.GetExtensionsStringEXT 88 | #define wglGetExtensionsStringARB _glfw.wgl.GetExtensionsStringARB 89 | #define wglCreateContextAttribsARB _glfw.wgl.CreateContextAttribsARB 90 | 91 | // opengl32.dll function pointer typedefs 92 | typedef HGLRC (WINAPI * PFN_wglCreateContext)(HDC); 93 | typedef BOOL (WINAPI * PFN_wglDeleteContext)(HGLRC); 94 | typedef PROC (WINAPI * PFN_wglGetProcAddress)(LPCSTR); 95 | typedef HDC (WINAPI * PFN_wglGetCurrentDC)(void); 96 | typedef HGLRC (WINAPI * PFN_wglGetCurrentContext)(void); 97 | typedef BOOL (WINAPI * PFN_wglMakeCurrent)(HDC,HGLRC); 98 | typedef BOOL (WINAPI * PFN_wglShareLists)(HGLRC,HGLRC); 99 | #define wglCreateContext _glfw.wgl.CreateContext 100 | #define wglDeleteContext _glfw.wgl.DeleteContext 101 | #define wglGetProcAddress _glfw.wgl.GetProcAddress 102 | #define wglGetCurrentDC _glfw.wgl.GetCurrentDC 103 | #define wglGetCurrentContext _glfw.wgl.GetCurrentContext 104 | #define wglMakeCurrent _glfw.wgl.MakeCurrent 105 | #define wglShareLists _glfw.wgl.ShareLists 106 | 107 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextWGL wgl 108 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryWGL wgl 109 | 110 | 111 | // WGL-specific per-context data 112 | // 113 | typedef struct _GLFWcontextWGL 114 | { 115 | HDC dc; 116 | HGLRC handle; 117 | int interval; 118 | 119 | } _GLFWcontextWGL; 120 | 121 | // WGL-specific global data 122 | // 123 | typedef struct _GLFWlibraryWGL 124 | { 125 | HINSTANCE instance; 126 | PFN_wglCreateContext CreateContext; 127 | PFN_wglDeleteContext DeleteContext; 128 | PFN_wglGetProcAddress GetProcAddress; 129 | PFN_wglGetCurrentDC GetCurrentDC; 130 | PFN_wglGetCurrentContext GetCurrentContext; 131 | PFN_wglMakeCurrent MakeCurrent; 132 | PFN_wglShareLists ShareLists; 133 | 134 | PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT; 135 | PFNWGLGETPIXELFORMATATTRIBIVARBPROC GetPixelFormatAttribivARB; 136 | PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT; 137 | PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB; 138 | PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; 139 | GLFWbool EXT_swap_control; 140 | GLFWbool EXT_colorspace; 141 | GLFWbool ARB_multisample; 142 | GLFWbool ARB_framebuffer_sRGB; 143 | GLFWbool EXT_framebuffer_sRGB; 144 | GLFWbool ARB_pixel_format; 145 | GLFWbool ARB_create_context; 146 | GLFWbool ARB_create_context_profile; 147 | GLFWbool EXT_create_context_es2_profile; 148 | GLFWbool ARB_create_context_robustness; 149 | GLFWbool ARB_create_context_no_error; 150 | GLFWbool ARB_context_flush_control; 151 | 152 | } _GLFWlibraryWGL; 153 | 154 | 155 | GLFWbool _glfwInitWGL(void); 156 | void _glfwTerminateWGL(void); 157 | GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, 158 | const _GLFWctxconfig* ctxconfig, 159 | const _GLFWfbconfig* fbconfig); 160 | 161 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/cocoa_platform.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 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 | #include 28 | #include 29 | 30 | #include 31 | 32 | // NOTE: All of NSGL was deprecated in the 10.14 SDK 33 | // This disables the pointless warnings for every symbol we use 34 | #define GL_SILENCE_DEPRECATION 35 | 36 | #if defined(__OBJC__) 37 | #import 38 | #else 39 | typedef void* id; 40 | #endif 41 | 42 | // NOTE: Many Cocoa enum values have been renamed and we need to build across 43 | // SDK versions where one is unavailable or the other deprecated 44 | // We use the newer names in code and these macros to handle compatibility 45 | #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 46 | #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat 47 | #define NSEventMaskAny NSAnyEventMask 48 | #define NSEventMaskKeyUp NSKeyUpMask 49 | #define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask 50 | #define NSEventModifierFlagCommand NSCommandKeyMask 51 | #define NSEventModifierFlagControl NSControlKeyMask 52 | #define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask 53 | #define NSEventModifierFlagOption NSAlternateKeyMask 54 | #define NSEventModifierFlagShift NSShiftKeyMask 55 | #define NSEventTypeApplicationDefined NSApplicationDefined 56 | #define NSWindowStyleMaskBorderless NSBorderlessWindowMask 57 | #define NSWindowStyleMaskClosable NSClosableWindowMask 58 | #define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask 59 | #define NSWindowStyleMaskResizable NSResizableWindowMask 60 | #define NSWindowStyleMaskTitled NSTitledWindowMask 61 | #endif 62 | 63 | typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; 64 | typedef VkFlags VkMetalSurfaceCreateFlagsEXT; 65 | 66 | typedef struct VkMacOSSurfaceCreateInfoMVK 67 | { 68 | VkStructureType sType; 69 | const void* pNext; 70 | VkMacOSSurfaceCreateFlagsMVK flags; 71 | const void* pView; 72 | } VkMacOSSurfaceCreateInfoMVK; 73 | 74 | typedef struct VkMetalSurfaceCreateInfoEXT 75 | { 76 | VkStructureType sType; 77 | const void* pNext; 78 | VkMetalSurfaceCreateFlagsEXT flags; 79 | const void* pLayer; 80 | } VkMetalSurfaceCreateInfoEXT; 81 | 82 | typedef VkResult (APIENTRY *PFN_vkCreateMacOSSurfaceMVK)(VkInstance,const VkMacOSSurfaceCreateInfoMVK*,const VkAllocationCallbacks*,VkSurfaceKHR*); 83 | typedef VkResult (APIENTRY *PFN_vkCreateMetalSurfaceEXT)(VkInstance,const VkMetalSurfaceCreateInfoEXT*,const VkAllocationCallbacks*,VkSurfaceKHR*); 84 | 85 | #include "posix_thread.h" 86 | #include "cocoa_joystick.h" 87 | #include "nsgl_context.h" 88 | 89 | #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) 90 | #define _glfw_dlclose(handle) dlclose(handle) 91 | #define _glfw_dlsym(handle, name) dlsym(handle, name) 92 | 93 | #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowNS ns 94 | #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryNS ns 95 | #define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerNS ns 96 | #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorNS ns 97 | #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorNS ns 98 | 99 | // HIToolbox.framework pointer typedefs 100 | #define kTISPropertyUnicodeKeyLayoutData _glfw.ns.tis.kPropertyUnicodeKeyLayoutData 101 | typedef TISInputSourceRef (*PFN_TISCopyCurrentKeyboardLayoutInputSource)(void); 102 | #define TISCopyCurrentKeyboardLayoutInputSource _glfw.ns.tis.CopyCurrentKeyboardLayoutInputSource 103 | typedef void* (*PFN_TISGetInputSourceProperty)(TISInputSourceRef,CFStringRef); 104 | #define TISGetInputSourceProperty _glfw.ns.tis.GetInputSourceProperty 105 | typedef UInt8 (*PFN_LMGetKbdType)(void); 106 | #define LMGetKbdType _glfw.ns.tis.GetKbdType 107 | 108 | 109 | // Cocoa-specific per-window data 110 | // 111 | typedef struct _GLFWwindowNS 112 | { 113 | id object; 114 | id delegate; 115 | id view; 116 | id layer; 117 | 118 | GLFWbool maximized; 119 | GLFWbool occluded; 120 | GLFWbool retina; 121 | 122 | // Cached window properties to filter out duplicate events 123 | int width, height; 124 | int fbWidth, fbHeight; 125 | float xscale, yscale; 126 | 127 | // The total sum of the distances the cursor has been warped 128 | // since the last cursor motion event was processed 129 | // This is kept to counteract Cocoa doing the same internally 130 | double cursorWarpDeltaX, cursorWarpDeltaY; 131 | 132 | } _GLFWwindowNS; 133 | 134 | // Cocoa-specific global data 135 | // 136 | typedef struct _GLFWlibraryNS 137 | { 138 | CGEventSourceRef eventSource; 139 | id delegate; 140 | GLFWbool cursorHidden; 141 | TISInputSourceRef inputSource; 142 | IOHIDManagerRef hidManager; 143 | id unicodeData; 144 | id helper; 145 | id keyUpMonitor; 146 | id nibObjects; 147 | 148 | char keynames[GLFW_KEY_LAST + 1][17]; 149 | short int keycodes[256]; 150 | short int scancodes[GLFW_KEY_LAST + 1]; 151 | char* clipboardString; 152 | CGPoint cascadePoint; 153 | // Where to place the cursor when re-enabled 154 | double restoreCursorPosX, restoreCursorPosY; 155 | // The window whose disabled cursor mode is active 156 | _GLFWwindow* disabledCursorWindow; 157 | 158 | struct { 159 | CFBundleRef bundle; 160 | PFN_TISCopyCurrentKeyboardLayoutInputSource CopyCurrentKeyboardLayoutInputSource; 161 | PFN_TISGetInputSourceProperty GetInputSourceProperty; 162 | PFN_LMGetKbdType GetKbdType; 163 | CFStringRef kPropertyUnicodeKeyLayoutData; 164 | } tis; 165 | 166 | } _GLFWlibraryNS; 167 | 168 | // Cocoa-specific per-monitor data 169 | // 170 | typedef struct _GLFWmonitorNS 171 | { 172 | CGDirectDisplayID displayID; 173 | CGDisplayModeRef previousMode; 174 | uint32_t unitNumber; 175 | id screen; 176 | double fallbackRefreshRate; 177 | 178 | } _GLFWmonitorNS; 179 | 180 | // Cocoa-specific per-cursor data 181 | // 182 | typedef struct _GLFWcursorNS 183 | { 184 | id object; 185 | 186 | } _GLFWcursorNS; 187 | 188 | // Cocoa-specific global timer data 189 | // 190 | typedef struct _GLFWtimerNS 191 | { 192 | uint64_t frequency; 193 | 194 | } _GLFWtimerNS; 195 | 196 | 197 | void _glfwInitTimerNS(void); 198 | 199 | void _glfwPollMonitorsNS(void); 200 | void _glfwSetVideoModeNS(_GLFWmonitor* monitor, const GLFWvidmode* desired); 201 | void _glfwRestoreVideoModeNS(_GLFWmonitor* monitor); 202 | 203 | float _glfwTransformYNS(float y); 204 | 205 | void* _glfwLoadLocalVulkanLoaderNS(void); 206 | 207 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/glx_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 GLX - 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 GLX_VENDOR 1 29 | #define GLX_RGBA_BIT 0x00000001 30 | #define GLX_WINDOW_BIT 0x00000001 31 | #define GLX_DRAWABLE_TYPE 0x8010 32 | #define GLX_RENDER_TYPE 0x8011 33 | #define GLX_RGBA_TYPE 0x8014 34 | #define GLX_DOUBLEBUFFER 5 35 | #define GLX_STEREO 6 36 | #define GLX_AUX_BUFFERS 7 37 | #define GLX_RED_SIZE 8 38 | #define GLX_GREEN_SIZE 9 39 | #define GLX_BLUE_SIZE 10 40 | #define GLX_ALPHA_SIZE 11 41 | #define GLX_DEPTH_SIZE 12 42 | #define GLX_STENCIL_SIZE 13 43 | #define GLX_ACCUM_RED_SIZE 14 44 | #define GLX_ACCUM_GREEN_SIZE 15 45 | #define GLX_ACCUM_BLUE_SIZE 16 46 | #define GLX_ACCUM_ALPHA_SIZE 17 47 | #define GLX_SAMPLES 0x186a1 48 | #define GLX_VISUAL_ID 0x800b 49 | 50 | #define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20b2 51 | #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 52 | #define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 53 | #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 54 | #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 55 | #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 56 | #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 57 | #define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 58 | #define GLX_CONTEXT_FLAGS_ARB 0x2094 59 | #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 60 | #define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 61 | #define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 62 | #define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 63 | #define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 64 | #define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097 65 | #define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0 66 | #define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 67 | #define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31b3 68 | 69 | typedef XID GLXWindow; 70 | typedef XID GLXDrawable; 71 | typedef struct __GLXFBConfig* GLXFBConfig; 72 | typedef struct __GLXcontext* GLXContext; 73 | typedef void (*__GLXextproc)(void); 74 | 75 | typedef int (*PFNGLXGETFBCONFIGATTRIBPROC)(Display*,GLXFBConfig,int,int*); 76 | typedef const char* (*PFNGLXGETCLIENTSTRINGPROC)(Display*,int); 77 | typedef Bool (*PFNGLXQUERYEXTENSIONPROC)(Display*,int*,int*); 78 | typedef Bool (*PFNGLXQUERYVERSIONPROC)(Display*,int*,int*); 79 | typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display*,GLXContext); 80 | typedef Bool (*PFNGLXMAKECURRENTPROC)(Display*,GLXDrawable,GLXContext); 81 | typedef void (*PFNGLXSWAPBUFFERSPROC)(Display*,GLXDrawable); 82 | typedef const char* (*PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display*,int); 83 | typedef GLXFBConfig* (*PFNGLXGETFBCONFIGSPROC)(Display*,int,int*); 84 | typedef GLXContext (*PFNGLXCREATENEWCONTEXTPROC)(Display*,GLXFBConfig,int,GLXContext,Bool); 85 | typedef __GLXextproc (* PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName); 86 | typedef void (*PFNGLXSWAPINTERVALEXTPROC)(Display*,GLXDrawable,int); 87 | typedef XVisualInfo* (*PFNGLXGETVISUALFROMFBCONFIGPROC)(Display*,GLXFBConfig); 88 | typedef GLXWindow (*PFNGLXCREATEWINDOWPROC)(Display*,GLXFBConfig,Window,const int*); 89 | typedef void (*PFNGLXDESTROYWINDOWPROC)(Display*,GLXWindow); 90 | 91 | typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int); 92 | typedef int (*PFNGLXSWAPINTERVALSGIPROC)(int); 93 | typedef GLXContext (*PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display*,GLXFBConfig,GLXContext,Bool,const int*); 94 | 95 | // libGL.so function pointer typedefs 96 | #define glXGetFBConfigs _glfw.glx.GetFBConfigs 97 | #define glXGetFBConfigAttrib _glfw.glx.GetFBConfigAttrib 98 | #define glXGetClientString _glfw.glx.GetClientString 99 | #define glXQueryExtension _glfw.glx.QueryExtension 100 | #define glXQueryVersion _glfw.glx.QueryVersion 101 | #define glXDestroyContext _glfw.glx.DestroyContext 102 | #define glXMakeCurrent _glfw.glx.MakeCurrent 103 | #define glXSwapBuffers _glfw.glx.SwapBuffers 104 | #define glXQueryExtensionsString _glfw.glx.QueryExtensionsString 105 | #define glXCreateNewContext _glfw.glx.CreateNewContext 106 | #define glXGetVisualFromFBConfig _glfw.glx.GetVisualFromFBConfig 107 | #define glXCreateWindow _glfw.glx.CreateWindow 108 | #define glXDestroyWindow _glfw.glx.DestroyWindow 109 | 110 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextGLX glx 111 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryGLX glx 112 | 113 | 114 | // GLX-specific per-context data 115 | // 116 | typedef struct _GLFWcontextGLX 117 | { 118 | GLXContext handle; 119 | GLXWindow window; 120 | 121 | } _GLFWcontextGLX; 122 | 123 | // GLX-specific global data 124 | // 125 | typedef struct _GLFWlibraryGLX 126 | { 127 | int major, minor; 128 | int eventBase; 129 | int errorBase; 130 | 131 | // dlopen handle for libGL.so.1 132 | void* handle; 133 | 134 | // GLX 1.3 functions 135 | PFNGLXGETFBCONFIGSPROC GetFBConfigs; 136 | PFNGLXGETFBCONFIGATTRIBPROC GetFBConfigAttrib; 137 | PFNGLXGETCLIENTSTRINGPROC GetClientString; 138 | PFNGLXQUERYEXTENSIONPROC QueryExtension; 139 | PFNGLXQUERYVERSIONPROC QueryVersion; 140 | PFNGLXDESTROYCONTEXTPROC DestroyContext; 141 | PFNGLXMAKECURRENTPROC MakeCurrent; 142 | PFNGLXSWAPBUFFERSPROC SwapBuffers; 143 | PFNGLXQUERYEXTENSIONSSTRINGPROC QueryExtensionsString; 144 | PFNGLXCREATENEWCONTEXTPROC CreateNewContext; 145 | PFNGLXGETVISUALFROMFBCONFIGPROC GetVisualFromFBConfig; 146 | PFNGLXCREATEWINDOWPROC CreateWindow; 147 | PFNGLXDESTROYWINDOWPROC DestroyWindow; 148 | 149 | // GLX 1.4 and extension functions 150 | PFNGLXGETPROCADDRESSPROC GetProcAddress; 151 | PFNGLXGETPROCADDRESSPROC GetProcAddressARB; 152 | PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI; 153 | PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT; 154 | PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; 155 | PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB; 156 | GLFWbool SGI_swap_control; 157 | GLFWbool EXT_swap_control; 158 | GLFWbool MESA_swap_control; 159 | GLFWbool ARB_multisample; 160 | GLFWbool ARB_framebuffer_sRGB; 161 | GLFWbool EXT_framebuffer_sRGB; 162 | GLFWbool ARB_create_context; 163 | GLFWbool ARB_create_context_profile; 164 | GLFWbool ARB_create_context_robustness; 165 | GLFWbool EXT_create_context_es2_profile; 166 | GLFWbool ARB_create_context_no_error; 167 | GLFWbool ARB_context_flush_control; 168 | 169 | } _GLFWlibraryGLX; 170 | 171 | GLFWbool _glfwInitGLX(void); 172 | void _glfwTerminateGLX(void); 173 | GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, 174 | const _GLFWctxconfig* ctxconfig, 175 | const _GLFWfbconfig* fbconfig); 176 | void _glfwDestroyContextGLX(_GLFWwindow* window); 177 | GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, 178 | const _GLFWctxconfig* ctxconfig, 179 | const _GLFWfbconfig* fbconfig, 180 | Visual** visual, int* depth); 181 | 182 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/wl_monitor.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 Wayland - 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 | // 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 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | static void outputHandleGeometry(void* data, 39 | struct wl_output* output, 40 | int32_t x, 41 | int32_t y, 42 | int32_t physicalWidth, 43 | int32_t physicalHeight, 44 | int32_t subpixel, 45 | const char* make, 46 | const char* model, 47 | int32_t transform) 48 | { 49 | struct _GLFWmonitor *monitor = data; 50 | 51 | monitor->wl.x = x; 52 | monitor->wl.y = y; 53 | monitor->widthMM = physicalWidth; 54 | monitor->heightMM = physicalHeight; 55 | 56 | snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model); 57 | } 58 | 59 | static void outputHandleMode(void* data, 60 | struct wl_output* output, 61 | uint32_t flags, 62 | int32_t width, 63 | int32_t height, 64 | int32_t refresh) 65 | { 66 | struct _GLFWmonitor *monitor = data; 67 | GLFWvidmode mode; 68 | 69 | mode.width = width; 70 | mode.height = height; 71 | mode.redBits = 8; 72 | mode.greenBits = 8; 73 | mode.blueBits = 8; 74 | mode.refreshRate = (int) round(refresh / 1000.0); 75 | 76 | monitor->modeCount++; 77 | monitor->modes = 78 | realloc(monitor->modes, monitor->modeCount * sizeof(GLFWvidmode)); 79 | monitor->modes[monitor->modeCount - 1] = mode; 80 | 81 | if (flags & WL_OUTPUT_MODE_CURRENT) 82 | monitor->wl.currentMode = monitor->modeCount - 1; 83 | } 84 | 85 | static void outputHandleDone(void* data, struct wl_output* output) 86 | { 87 | struct _GLFWmonitor *monitor = data; 88 | 89 | if (monitor->widthMM <= 0 || monitor->heightMM <= 0) 90 | { 91 | // If Wayland does not provide a physical size, assume the default 96 DPI 92 | const GLFWvidmode* mode = &monitor->modes[monitor->wl.currentMode]; 93 | monitor->widthMM = (int) (mode->width * 25.4f / 96.f); 94 | monitor->heightMM = (int) (mode->height * 25.4f / 96.f); 95 | } 96 | 97 | _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); 98 | } 99 | 100 | static void outputHandleScale(void* data, 101 | struct wl_output* output, 102 | int32_t factor) 103 | { 104 | struct _GLFWmonitor *monitor = data; 105 | 106 | monitor->wl.scale = factor; 107 | } 108 | 109 | static const struct wl_output_listener outputListener = { 110 | outputHandleGeometry, 111 | outputHandleMode, 112 | outputHandleDone, 113 | outputHandleScale, 114 | }; 115 | 116 | 117 | ////////////////////////////////////////////////////////////////////////// 118 | ////// GLFW internal API ////// 119 | ////////////////////////////////////////////////////////////////////////// 120 | 121 | void _glfwAddOutputWayland(uint32_t name, uint32_t version) 122 | { 123 | _GLFWmonitor *monitor; 124 | struct wl_output *output; 125 | 126 | if (version < 2) 127 | { 128 | _glfwInputError(GLFW_PLATFORM_ERROR, 129 | "Wayland: Unsupported output interface version"); 130 | return; 131 | } 132 | 133 | // The actual name of this output will be set in the geometry handler. 134 | monitor = _glfwAllocMonitor("", 0, 0); 135 | 136 | output = wl_registry_bind(_glfw.wl.registry, 137 | name, 138 | &wl_output_interface, 139 | 2); 140 | if (!output) 141 | { 142 | _glfwFreeMonitor(monitor); 143 | return; 144 | } 145 | 146 | monitor->wl.scale = 1; 147 | monitor->wl.output = output; 148 | monitor->wl.name = name; 149 | 150 | wl_output_add_listener(output, &outputListener, monitor); 151 | } 152 | 153 | 154 | ////////////////////////////////////////////////////////////////////////// 155 | ////// GLFW platform API ////// 156 | ////////////////////////////////////////////////////////////////////////// 157 | 158 | void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor) 159 | { 160 | if (monitor->wl.output) 161 | wl_output_destroy(monitor->wl.output); 162 | } 163 | 164 | void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos) 165 | { 166 | if (xpos) 167 | *xpos = monitor->wl.x; 168 | if (ypos) 169 | *ypos = monitor->wl.y; 170 | } 171 | 172 | void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, 173 | float* xscale, float* yscale) 174 | { 175 | if (xscale) 176 | *xscale = (float) monitor->wl.scale; 177 | if (yscale) 178 | *yscale = (float) monitor->wl.scale; 179 | } 180 | 181 | void _glfwPlatformGetMonitorWorkarea(_GLFWmonitor* monitor, 182 | int* xpos, int* ypos, 183 | int* width, int* height) 184 | { 185 | if (xpos) 186 | *xpos = monitor->wl.x; 187 | if (ypos) 188 | *ypos = monitor->wl.y; 189 | if (width) 190 | *width = monitor->modes[monitor->wl.currentMode].width; 191 | if (height) 192 | *height = monitor->modes[monitor->wl.currentMode].height; 193 | } 194 | 195 | GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found) 196 | { 197 | *found = monitor->modeCount; 198 | return monitor->modes; 199 | } 200 | 201 | void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) 202 | { 203 | *mode = monitor->modes[monitor->wl.currentMode]; 204 | } 205 | 206 | GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) 207 | { 208 | _glfwInputError(GLFW_FEATURE_UNAVAILABLE, 209 | "Wayland: Gamma ramp access is not available"); 210 | return GLFW_FALSE; 211 | } 212 | 213 | void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, 214 | const GLFWgammaramp* ramp) 215 | { 216 | _glfwInputError(GLFW_FEATURE_UNAVAILABLE, 217 | "Wayland: Gamma ramp access is not available"); 218 | } 219 | 220 | 221 | ////////////////////////////////////////////////////////////////////////// 222 | ////// GLFW native API ////// 223 | ////////////////////////////////////////////////////////////////////////// 224 | 225 | GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle) 226 | { 227 | _GLFWmonitor* monitor = (_GLFWmonitor*) handle; 228 | _GLFW_REQUIRE_INIT_OR_RETURN(NULL); 229 | return monitor->wl.output; 230 | } 231 | 232 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/deps/vs2008/stdint.h: -------------------------------------------------------------------------------- 1 | // ISO C9x compliant stdint.h for Microsoft Visual Studio 2 | // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 3 | // 4 | // Copyright (c) 2006-2008 Alexander Chemeris 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // 1. Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // 12 | // 2. Redistributions in binary form must reproduce the above copyright 13 | // notice, this list of conditions and the following disclaimer in the 14 | // documentation and/or other materials provided with the distribution. 15 | // 16 | // 3. The name of the author may be used to endorse or promote products 17 | // derived from this software without specific prior written permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 20 | // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 22 | // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 | // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 | // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 | // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | /////////////////////////////////////////////////////////////////////////////// 31 | 32 | #ifndef _MSC_VER // [ 33 | #error "Use this header only with Microsoft Visual C++ compilers!" 34 | #endif // _MSC_VER ] 35 | 36 | #ifndef _MSC_STDINT_H_ // [ 37 | #define _MSC_STDINT_H_ 38 | 39 | #if _MSC_VER > 1000 40 | #pragma once 41 | #endif 42 | 43 | #include 44 | 45 | // For Visual Studio 6 in C++ mode and for many Visual Studio versions when 46 | // compiling for ARM we should wrap include with 'extern "C++" {}' 47 | // or compiler give many errors like this: 48 | // error C2733: second C linkage of overloaded function 'wmemchr' not allowed 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | # include 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | // Define _W64 macros to mark types changing their size, like intptr_t. 58 | #ifndef _W64 59 | # if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 60 | # define _W64 __w64 61 | # else 62 | # define _W64 63 | # endif 64 | #endif 65 | 66 | 67 | // 7.18.1 Integer types 68 | 69 | // 7.18.1.1 Exact-width integer types 70 | 71 | // Visual Studio 6 and Embedded Visual C++ 4 doesn't 72 | // realize that, e.g. char has the same size as __int8 73 | // so we give up on __intX for them. 74 | #if (_MSC_VER < 1300) 75 | typedef signed char int8_t; 76 | typedef signed short int16_t; 77 | typedef signed int int32_t; 78 | typedef unsigned char uint8_t; 79 | typedef unsigned short uint16_t; 80 | typedef unsigned int uint32_t; 81 | #else 82 | typedef signed __int8 int8_t; 83 | typedef signed __int16 int16_t; 84 | typedef signed __int32 int32_t; 85 | typedef unsigned __int8 uint8_t; 86 | typedef unsigned __int16 uint16_t; 87 | typedef unsigned __int32 uint32_t; 88 | #endif 89 | typedef signed __int64 int64_t; 90 | typedef unsigned __int64 uint64_t; 91 | 92 | 93 | // 7.18.1.2 Minimum-width integer types 94 | typedef int8_t int_least8_t; 95 | typedef int16_t int_least16_t; 96 | typedef int32_t int_least32_t; 97 | typedef int64_t int_least64_t; 98 | typedef uint8_t uint_least8_t; 99 | typedef uint16_t uint_least16_t; 100 | typedef uint32_t uint_least32_t; 101 | typedef uint64_t uint_least64_t; 102 | 103 | // 7.18.1.3 Fastest minimum-width integer types 104 | typedef int8_t int_fast8_t; 105 | typedef int16_t int_fast16_t; 106 | typedef int32_t int_fast32_t; 107 | typedef int64_t int_fast64_t; 108 | typedef uint8_t uint_fast8_t; 109 | typedef uint16_t uint_fast16_t; 110 | typedef uint32_t uint_fast32_t; 111 | typedef uint64_t uint_fast64_t; 112 | 113 | // 7.18.1.4 Integer types capable of holding object pointers 114 | #ifdef _WIN64 // [ 115 | typedef signed __int64 intptr_t; 116 | typedef unsigned __int64 uintptr_t; 117 | #else // _WIN64 ][ 118 | typedef _W64 signed int intptr_t; 119 | typedef _W64 unsigned int uintptr_t; 120 | #endif // _WIN64 ] 121 | 122 | // 7.18.1.5 Greatest-width integer types 123 | typedef int64_t intmax_t; 124 | typedef uint64_t uintmax_t; 125 | 126 | 127 | // 7.18.2 Limits of specified-width integer types 128 | 129 | #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 130 | 131 | // 7.18.2.1 Limits of exact-width integer types 132 | #define INT8_MIN ((int8_t)_I8_MIN) 133 | #define INT8_MAX _I8_MAX 134 | #define INT16_MIN ((int16_t)_I16_MIN) 135 | #define INT16_MAX _I16_MAX 136 | #define INT32_MIN ((int32_t)_I32_MIN) 137 | #define INT32_MAX _I32_MAX 138 | #define INT64_MIN ((int64_t)_I64_MIN) 139 | #define INT64_MAX _I64_MAX 140 | #define UINT8_MAX _UI8_MAX 141 | #define UINT16_MAX _UI16_MAX 142 | #define UINT32_MAX _UI32_MAX 143 | #define UINT64_MAX _UI64_MAX 144 | 145 | // 7.18.2.2 Limits of minimum-width integer types 146 | #define INT_LEAST8_MIN INT8_MIN 147 | #define INT_LEAST8_MAX INT8_MAX 148 | #define INT_LEAST16_MIN INT16_MIN 149 | #define INT_LEAST16_MAX INT16_MAX 150 | #define INT_LEAST32_MIN INT32_MIN 151 | #define INT_LEAST32_MAX INT32_MAX 152 | #define INT_LEAST64_MIN INT64_MIN 153 | #define INT_LEAST64_MAX INT64_MAX 154 | #define UINT_LEAST8_MAX UINT8_MAX 155 | #define UINT_LEAST16_MAX UINT16_MAX 156 | #define UINT_LEAST32_MAX UINT32_MAX 157 | #define UINT_LEAST64_MAX UINT64_MAX 158 | 159 | // 7.18.2.3 Limits of fastest minimum-width integer types 160 | #define INT_FAST8_MIN INT8_MIN 161 | #define INT_FAST8_MAX INT8_MAX 162 | #define INT_FAST16_MIN INT16_MIN 163 | #define INT_FAST16_MAX INT16_MAX 164 | #define INT_FAST32_MIN INT32_MIN 165 | #define INT_FAST32_MAX INT32_MAX 166 | #define INT_FAST64_MIN INT64_MIN 167 | #define INT_FAST64_MAX INT64_MAX 168 | #define UINT_FAST8_MAX UINT8_MAX 169 | #define UINT_FAST16_MAX UINT16_MAX 170 | #define UINT_FAST32_MAX UINT32_MAX 171 | #define UINT_FAST64_MAX UINT64_MAX 172 | 173 | // 7.18.2.4 Limits of integer types capable of holding object pointers 174 | #ifdef _WIN64 // [ 175 | # define INTPTR_MIN INT64_MIN 176 | # define INTPTR_MAX INT64_MAX 177 | # define UINTPTR_MAX UINT64_MAX 178 | #else // _WIN64 ][ 179 | # define INTPTR_MIN INT32_MIN 180 | # define INTPTR_MAX INT32_MAX 181 | # define UINTPTR_MAX UINT32_MAX 182 | #endif // _WIN64 ] 183 | 184 | // 7.18.2.5 Limits of greatest-width integer types 185 | #define INTMAX_MIN INT64_MIN 186 | #define INTMAX_MAX INT64_MAX 187 | #define UINTMAX_MAX UINT64_MAX 188 | 189 | // 7.18.3 Limits of other integer types 190 | 191 | #ifdef _WIN64 // [ 192 | # define PTRDIFF_MIN _I64_MIN 193 | # define PTRDIFF_MAX _I64_MAX 194 | #else // _WIN64 ][ 195 | # define PTRDIFF_MIN _I32_MIN 196 | # define PTRDIFF_MAX _I32_MAX 197 | #endif // _WIN64 ] 198 | 199 | #define SIG_ATOMIC_MIN INT_MIN 200 | #define SIG_ATOMIC_MAX INT_MAX 201 | 202 | #ifndef SIZE_MAX // [ 203 | # ifdef _WIN64 // [ 204 | # define SIZE_MAX _UI64_MAX 205 | # else // _WIN64 ][ 206 | # define SIZE_MAX _UI32_MAX 207 | # endif // _WIN64 ] 208 | #endif // SIZE_MAX ] 209 | 210 | // WCHAR_MIN and WCHAR_MAX are also defined in 211 | #ifndef WCHAR_MIN // [ 212 | # define WCHAR_MIN 0 213 | #endif // WCHAR_MIN ] 214 | #ifndef WCHAR_MAX // [ 215 | # define WCHAR_MAX _UI16_MAX 216 | #endif // WCHAR_MAX ] 217 | 218 | #define WINT_MIN 0 219 | #define WINT_MAX _UI16_MAX 220 | 221 | #endif // __STDC_LIMIT_MACROS ] 222 | 223 | 224 | // 7.18.4 Limits of other integer types 225 | 226 | #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 227 | 228 | // 7.18.4.1 Macros for minimum-width integer constants 229 | 230 | #define INT8_C(val) val##i8 231 | #define INT16_C(val) val##i16 232 | #define INT32_C(val) val##i32 233 | #define INT64_C(val) val##i64 234 | 235 | #define UINT8_C(val) val##ui8 236 | #define UINT16_C(val) val##ui16 237 | #define UINT32_C(val) val##ui32 238 | #define UINT64_C(val) val##ui64 239 | 240 | // 7.18.4.2 Macros for greatest-width integer constants 241 | #define INTMAX_C INT64_C 242 | #define UINTMAX_C UINT64_C 243 | 244 | #endif // __STDC_CONSTANT_MACROS ] 245 | 246 | 247 | #endif // _MSC_STDINT_H_ ] 248 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/deps/mingw/xinput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Wine project - Xinput Joystick Library 3 | * Copyright 2008 Andrew Fenn 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 | */ 19 | 20 | #ifndef __WINE_XINPUT_H 21 | #define __WINE_XINPUT_H 22 | 23 | #include 24 | 25 | /* 26 | * Bitmasks for the joysticks buttons, determines what has 27 | * been pressed on the joystick, these need to be mapped 28 | * to whatever device you're using instead of an xbox 360 29 | * joystick 30 | */ 31 | 32 | #define XINPUT_GAMEPAD_DPAD_UP 0x0001 33 | #define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 34 | #define XINPUT_GAMEPAD_DPAD_LEFT 0x0004 35 | #define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 36 | #define XINPUT_GAMEPAD_START 0x0010 37 | #define XINPUT_GAMEPAD_BACK 0x0020 38 | #define XINPUT_GAMEPAD_LEFT_THUMB 0x0040 39 | #define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 40 | #define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 41 | #define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 42 | #define XINPUT_GAMEPAD_A 0x1000 43 | #define XINPUT_GAMEPAD_B 0x2000 44 | #define XINPUT_GAMEPAD_X 0x4000 45 | #define XINPUT_GAMEPAD_Y 0x8000 46 | 47 | /* 48 | * Defines the flags used to determine if the user is pushing 49 | * down on a button, not holding a button, etc 50 | */ 51 | 52 | #define XINPUT_KEYSTROKE_KEYDOWN 0x0001 53 | #define XINPUT_KEYSTROKE_KEYUP 0x0002 54 | #define XINPUT_KEYSTROKE_REPEAT 0x0004 55 | 56 | /* 57 | * Defines the codes which are returned by XInputGetKeystroke 58 | */ 59 | 60 | #define VK_PAD_A 0x5800 61 | #define VK_PAD_B 0x5801 62 | #define VK_PAD_X 0x5802 63 | #define VK_PAD_Y 0x5803 64 | #define VK_PAD_RSHOULDER 0x5804 65 | #define VK_PAD_LSHOULDER 0x5805 66 | #define VK_PAD_LTRIGGER 0x5806 67 | #define VK_PAD_RTRIGGER 0x5807 68 | #define VK_PAD_DPAD_UP 0x5810 69 | #define VK_PAD_DPAD_DOWN 0x5811 70 | #define VK_PAD_DPAD_LEFT 0x5812 71 | #define VK_PAD_DPAD_RIGHT 0x5813 72 | #define VK_PAD_START 0x5814 73 | #define VK_PAD_BACK 0x5815 74 | #define VK_PAD_LTHUMB_PRESS 0x5816 75 | #define VK_PAD_RTHUMB_PRESS 0x5817 76 | #define VK_PAD_LTHUMB_UP 0x5820 77 | #define VK_PAD_LTHUMB_DOWN 0x5821 78 | #define VK_PAD_LTHUMB_RIGHT 0x5822 79 | #define VK_PAD_LTHUMB_LEFT 0x5823 80 | #define VK_PAD_LTHUMB_UPLEFT 0x5824 81 | #define VK_PAD_LTHUMB_UPRIGHT 0x5825 82 | #define VK_PAD_LTHUMB_DOWNRIGHT 0x5826 83 | #define VK_PAD_LTHUMB_DOWNLEFT 0x5827 84 | #define VK_PAD_RTHUMB_UP 0x5830 85 | #define VK_PAD_RTHUMB_DOWN 0x5831 86 | #define VK_PAD_RTHUMB_RIGHT 0x5832 87 | #define VK_PAD_RTHUMB_LEFT 0x5833 88 | #define VK_PAD_RTHUMB_UPLEFT 0x5834 89 | #define VK_PAD_RTHUMB_UPRIGHT 0x5835 90 | #define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 91 | #define VK_PAD_RTHUMB_DOWNLEFT 0x5837 92 | 93 | /* 94 | * Deadzones are for analogue joystick controls on the joypad 95 | * which determine when input should be assumed to be in the 96 | * middle of the pad. This is a threshold to stop a joypad 97 | * controlling the game when the player isn't touching the 98 | * controls. 99 | */ 100 | 101 | #define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849 102 | #define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689 103 | #define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30 104 | 105 | 106 | /* 107 | * Defines what type of abilities the type of joystick has 108 | * DEVTYPE_GAMEPAD is available for all joysticks, however 109 | * there may be more specific identifiers for other joysticks 110 | * which are being used. 111 | */ 112 | 113 | #define XINPUT_DEVTYPE_GAMEPAD 0x01 114 | #define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 115 | #define XINPUT_DEVSUBTYPE_WHEEL 0x02 116 | #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 117 | #define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04 118 | #define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 119 | #define XINPUT_DEVSUBTYPE_GUITAR 0x06 120 | #define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 121 | 122 | /* 123 | * These are used with the XInputGetCapabilities function to 124 | * determine the abilities to the joystick which has been 125 | * plugged in. 126 | */ 127 | 128 | #define XINPUT_CAPS_VOICE_SUPPORTED 0x0004 129 | #define XINPUT_FLAG_GAMEPAD 0x00000001 130 | 131 | /* 132 | * Defines the status of the battery if one is used in the 133 | * attached joystick. The first two define if the joystick 134 | * supports a battery. Disconnected means that the joystick 135 | * isn't connected. Wired shows that the joystick is a wired 136 | * joystick. 137 | */ 138 | 139 | #define BATTERY_DEVTYPE_GAMEPAD 0x00 140 | #define BATTERY_DEVTYPE_HEADSET 0x01 141 | #define BATTERY_TYPE_DISCONNECTED 0x00 142 | #define BATTERY_TYPE_WIRED 0x01 143 | #define BATTERY_TYPE_ALKALINE 0x02 144 | #define BATTERY_TYPE_NIMH 0x03 145 | #define BATTERY_TYPE_UNKNOWN 0xFF 146 | #define BATTERY_LEVEL_EMPTY 0x00 147 | #define BATTERY_LEVEL_LOW 0x01 148 | #define BATTERY_LEVEL_MEDIUM 0x02 149 | #define BATTERY_LEVEL_FULL 0x03 150 | 151 | /* 152 | * How many joysticks can be used with this library. Games that 153 | * use the xinput library will not go over this number. 154 | */ 155 | 156 | #define XUSER_MAX_COUNT 4 157 | #define XUSER_INDEX_ANY 0x000000FF 158 | 159 | /* 160 | * Defines the structure of an xbox 360 joystick. 161 | */ 162 | 163 | typedef struct _XINPUT_GAMEPAD { 164 | WORD wButtons; 165 | BYTE bLeftTrigger; 166 | BYTE bRightTrigger; 167 | SHORT sThumbLX; 168 | SHORT sThumbLY; 169 | SHORT sThumbRX; 170 | SHORT sThumbRY; 171 | } XINPUT_GAMEPAD, *PXINPUT_GAMEPAD; 172 | 173 | typedef struct _XINPUT_STATE { 174 | DWORD dwPacketNumber; 175 | XINPUT_GAMEPAD Gamepad; 176 | } XINPUT_STATE, *PXINPUT_STATE; 177 | 178 | /* 179 | * Defines the structure of how much vibration is set on both the 180 | * right and left motors in a joystick. If you're not using a 360 181 | * joystick you will have to map these to your device. 182 | */ 183 | 184 | typedef struct _XINPUT_VIBRATION { 185 | WORD wLeftMotorSpeed; 186 | WORD wRightMotorSpeed; 187 | } XINPUT_VIBRATION, *PXINPUT_VIBRATION; 188 | 189 | /* 190 | * Defines the structure for what kind of abilities the joystick has 191 | * such abilities are things such as if the joystick has the ability 192 | * to send and receive audio, if the joystick is in fact a driving 193 | * wheel or perhaps if the joystick is some kind of dance pad or 194 | * guitar. 195 | */ 196 | 197 | typedef struct _XINPUT_CAPABILITIES { 198 | BYTE Type; 199 | BYTE SubType; 200 | WORD Flags; 201 | XINPUT_GAMEPAD Gamepad; 202 | XINPUT_VIBRATION Vibration; 203 | } XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES; 204 | 205 | /* 206 | * Defines the structure for a joystick input event which is 207 | * retrieved using the function XInputGetKeystroke 208 | */ 209 | typedef struct _XINPUT_KEYSTROKE { 210 | WORD VirtualKey; 211 | WCHAR Unicode; 212 | WORD Flags; 213 | BYTE UserIndex; 214 | BYTE HidCode; 215 | } XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE; 216 | 217 | typedef struct _XINPUT_BATTERY_INFORMATION 218 | { 219 | BYTE BatteryType; 220 | BYTE BatteryLevel; 221 | } XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION; 222 | 223 | #ifdef __cplusplus 224 | extern "C" { 225 | #endif 226 | 227 | void WINAPI XInputEnable(WINBOOL); 228 | DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*); 229 | DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*); 230 | DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE); 231 | DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*); 232 | DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*); 233 | DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*); 234 | 235 | #ifdef __cplusplus 236 | } 237 | #endif 238 | 239 | #endif /* __WINE_XINPUT_H */ 240 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/deps/getopt.c: -------------------------------------------------------------------------------- 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 | #include "getopt.h" 28 | 29 | #include 30 | #include 31 | 32 | const int no_argument = 0; 33 | const int required_argument = 1; 34 | const int optional_argument = 2; 35 | 36 | char* optarg; 37 | int optopt; 38 | /* The variable optind [...] shall be initialized to 1 by the system. */ 39 | int optind = 1; 40 | int opterr; 41 | 42 | static char* optcursor = NULL; 43 | 44 | /* Implemented based on [1] and [2] for optional arguments. 45 | optopt is handled FreeBSD-style, per [3]. 46 | Other GNU and FreeBSD extensions are purely accidental. 47 | 48 | [1] http://pubs.opengroup.org/onlinepubs/000095399/functions/getopt.html 49 | [2] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html 50 | [3] http://www.freebsd.org/cgi/man.cgi?query=getopt&sektion=3&manpath=FreeBSD+9.0-RELEASE 51 | */ 52 | int getopt(int argc, char* const argv[], const char* optstring) { 53 | int optchar = -1; 54 | const char* optdecl = NULL; 55 | 56 | optarg = NULL; 57 | opterr = 0; 58 | optopt = 0; 59 | 60 | /* Unspecified, but we need it to avoid overrunning the argv bounds. */ 61 | if (optind >= argc) 62 | goto no_more_optchars; 63 | 64 | /* If, when getopt() is called argv[optind] is a null pointer, getopt() 65 | shall return -1 without changing optind. */ 66 | if (argv[optind] == NULL) 67 | goto no_more_optchars; 68 | 69 | /* If, when getopt() is called *argv[optind] is not the character '-', 70 | getopt() shall return -1 without changing optind. */ 71 | if (*argv[optind] != '-') 72 | goto no_more_optchars; 73 | 74 | /* If, when getopt() is called argv[optind] points to the string "-", 75 | getopt() shall return -1 without changing optind. */ 76 | if (strcmp(argv[optind], "-") == 0) 77 | goto no_more_optchars; 78 | 79 | /* If, when getopt() is called argv[optind] points to the string "--", 80 | getopt() shall return -1 after incrementing optind. */ 81 | if (strcmp(argv[optind], "--") == 0) { 82 | ++optind; 83 | goto no_more_optchars; 84 | } 85 | 86 | if (optcursor == NULL || *optcursor == '\0') 87 | optcursor = argv[optind] + 1; 88 | 89 | optchar = *optcursor; 90 | 91 | /* FreeBSD: The variable optopt saves the last known option character 92 | returned by getopt(). */ 93 | optopt = optchar; 94 | 95 | /* The getopt() function shall return the next option character (if one is 96 | found) from argv that matches a character in optstring, if there is 97 | one that matches. */ 98 | optdecl = strchr(optstring, optchar); 99 | if (optdecl) { 100 | /* [I]f a character is followed by a colon, the option takes an 101 | argument. */ 102 | if (optdecl[1] == ':') { 103 | optarg = ++optcursor; 104 | if (*optarg == '\0') { 105 | /* GNU extension: Two colons mean an option takes an 106 | optional arg; if there is text in the current argv-element 107 | (i.e., in the same word as the option name itself, for example, 108 | "-oarg"), then it is returned in optarg, otherwise optarg is set 109 | to zero. */ 110 | if (optdecl[2] != ':') { 111 | /* If the option was the last character in the string pointed to by 112 | an element of argv, then optarg shall contain the next element 113 | of argv, and optind shall be incremented by 2. If the resulting 114 | value of optind is greater than argc, this indicates a missing 115 | option-argument, and getopt() shall return an error indication. 116 | 117 | Otherwise, optarg shall point to the string following the 118 | option character in that element of argv, and optind shall be 119 | incremented by 1. 120 | */ 121 | if (++optind < argc) { 122 | optarg = argv[optind]; 123 | } else { 124 | /* If it detects a missing option-argument, it shall return the 125 | colon character ( ':' ) if the first character of optstring 126 | was a colon, or a question-mark character ( '?' ) otherwise. 127 | */ 128 | optarg = NULL; 129 | optchar = (optstring[0] == ':') ? ':' : '?'; 130 | } 131 | } else { 132 | optarg = NULL; 133 | } 134 | } 135 | 136 | optcursor = NULL; 137 | } 138 | } else { 139 | /* If getopt() encounters an option character that is not contained in 140 | optstring, it shall return the question-mark ( '?' ) character. */ 141 | optchar = '?'; 142 | } 143 | 144 | if (optcursor == NULL || *++optcursor == '\0') 145 | ++optind; 146 | 147 | return optchar; 148 | 149 | no_more_optchars: 150 | optcursor = NULL; 151 | return -1; 152 | } 153 | 154 | /* Implementation based on [1]. 155 | 156 | [1] http://www.kernel.org/doc/man-pages/online/pages/man3/getopt.3.html 157 | */ 158 | int getopt_long(int argc, char* const argv[], const char* optstring, 159 | const struct option* longopts, int* longindex) { 160 | const struct option* o = longopts; 161 | const struct option* match = NULL; 162 | int num_matches = 0; 163 | size_t argument_name_length = 0; 164 | const char* current_argument = NULL; 165 | int retval = -1; 166 | 167 | optarg = NULL; 168 | optopt = 0; 169 | 170 | if (optind >= argc) 171 | return -1; 172 | 173 | if (strlen(argv[optind]) < 3 || strncmp(argv[optind], "--", 2) != 0) 174 | return getopt(argc, argv, optstring); 175 | 176 | /* It's an option; starts with -- and is longer than two chars. */ 177 | current_argument = argv[optind] + 2; 178 | argument_name_length = strcspn(current_argument, "="); 179 | for (; o->name; ++o) { 180 | if (strncmp(o->name, current_argument, argument_name_length) == 0) { 181 | match = o; 182 | ++num_matches; 183 | } 184 | } 185 | 186 | if (num_matches == 1) { 187 | /* If longindex is not NULL, it points to a variable which is set to the 188 | index of the long option relative to longopts. */ 189 | if (longindex) 190 | *longindex = (int) (match - longopts); 191 | 192 | /* If flag is NULL, then getopt_long() shall return val. 193 | Otherwise, getopt_long() returns 0, and flag shall point to a variable 194 | which shall be set to val if the option is found, but left unchanged if 195 | the option is not found. */ 196 | if (match->flag) 197 | *(match->flag) = match->val; 198 | 199 | retval = match->flag ? 0 : match->val; 200 | 201 | if (match->has_arg != no_argument) { 202 | optarg = strchr(argv[optind], '='); 203 | if (optarg != NULL) 204 | ++optarg; 205 | 206 | if (match->has_arg == required_argument) { 207 | /* Only scan the next argv for required arguments. Behavior is not 208 | specified, but has been observed with Ubuntu and Mac OSX. */ 209 | if (optarg == NULL && ++optind < argc) { 210 | optarg = argv[optind]; 211 | } 212 | 213 | if (optarg == NULL) 214 | retval = ':'; 215 | } 216 | } else if (strchr(argv[optind], '=')) { 217 | /* An argument was provided to a non-argument option. 218 | I haven't seen this specified explicitly, but both GNU and BSD-based 219 | implementations show this behavior. 220 | */ 221 | retval = '?'; 222 | } 223 | } else { 224 | /* Unknown option or ambiguous match. */ 225 | retval = '?'; 226 | } 227 | 228 | ++optind; 229 | return retval; 230 | } 231 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/src/egl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.4 EGL - 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 | #if defined(_GLFW_WIN32) 29 | #define EGLAPIENTRY __stdcall 30 | #else 31 | #define EGLAPIENTRY 32 | #endif 33 | 34 | #define EGL_SUCCESS 0x3000 35 | #define EGL_NOT_INITIALIZED 0x3001 36 | #define EGL_BAD_ACCESS 0x3002 37 | #define EGL_BAD_ALLOC 0x3003 38 | #define EGL_BAD_ATTRIBUTE 0x3004 39 | #define EGL_BAD_CONFIG 0x3005 40 | #define EGL_BAD_CONTEXT 0x3006 41 | #define EGL_BAD_CURRENT_SURFACE 0x3007 42 | #define EGL_BAD_DISPLAY 0x3008 43 | #define EGL_BAD_MATCH 0x3009 44 | #define EGL_BAD_NATIVE_PIXMAP 0x300a 45 | #define EGL_BAD_NATIVE_WINDOW 0x300b 46 | #define EGL_BAD_PARAMETER 0x300c 47 | #define EGL_BAD_SURFACE 0x300d 48 | #define EGL_CONTEXT_LOST 0x300e 49 | #define EGL_COLOR_BUFFER_TYPE 0x303f 50 | #define EGL_RGB_BUFFER 0x308e 51 | #define EGL_SURFACE_TYPE 0x3033 52 | #define EGL_WINDOW_BIT 0x0004 53 | #define EGL_RENDERABLE_TYPE 0x3040 54 | #define EGL_OPENGL_ES_BIT 0x0001 55 | #define EGL_OPENGL_ES2_BIT 0x0004 56 | #define EGL_OPENGL_BIT 0x0008 57 | #define EGL_ALPHA_SIZE 0x3021 58 | #define EGL_BLUE_SIZE 0x3022 59 | #define EGL_GREEN_SIZE 0x3023 60 | #define EGL_RED_SIZE 0x3024 61 | #define EGL_DEPTH_SIZE 0x3025 62 | #define EGL_STENCIL_SIZE 0x3026 63 | #define EGL_SAMPLES 0x3031 64 | #define EGL_OPENGL_ES_API 0x30a0 65 | #define EGL_OPENGL_API 0x30a2 66 | #define EGL_NONE 0x3038 67 | #define EGL_RENDER_BUFFER 0x3086 68 | #define EGL_SINGLE_BUFFER 0x3085 69 | #define EGL_EXTENSIONS 0x3055 70 | #define EGL_CONTEXT_CLIENT_VERSION 0x3098 71 | #define EGL_NATIVE_VISUAL_ID 0x302e 72 | #define EGL_NO_SURFACE ((EGLSurface) 0) 73 | #define EGL_NO_DISPLAY ((EGLDisplay) 0) 74 | #define EGL_NO_CONTEXT ((EGLContext) 0) 75 | #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0) 76 | 77 | #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 78 | #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 79 | #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 80 | #define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 81 | #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd 82 | #define EGL_NO_RESET_NOTIFICATION_KHR 0x31be 83 | #define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf 84 | #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 85 | #define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 86 | #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb 87 | #define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd 88 | #define EGL_CONTEXT_FLAGS_KHR 0x30fc 89 | #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3 90 | #define EGL_GL_COLORSPACE_KHR 0x309d 91 | #define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 92 | #define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 93 | #define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 94 | #define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 95 | #define EGL_PLATFORM_X11_EXT 0x31d5 96 | #define EGL_PLATFORM_WAYLAND_EXT 0x31d8 97 | #define EGL_PLATFORM_ANGLE_ANGLE 0x3202 98 | #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203 99 | #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320d 100 | #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320e 101 | #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207 102 | #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208 103 | #define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450 104 | #define EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE 0x3489 105 | #define EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348f 106 | 107 | typedef int EGLint; 108 | typedef unsigned int EGLBoolean; 109 | typedef unsigned int EGLenum; 110 | typedef void* EGLConfig; 111 | typedef void* EGLContext; 112 | typedef void* EGLDisplay; 113 | typedef void* EGLSurface; 114 | 115 | typedef void* EGLNativeDisplayType; 116 | typedef void* EGLNativeWindowType; 117 | 118 | // EGL function pointer typedefs 119 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*); 120 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*); 121 | typedef EGLDisplay (EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType); 122 | typedef EGLint (EGLAPIENTRY * PFN_eglGetError)(void); 123 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*); 124 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay); 125 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglBindAPI)(EGLenum); 126 | typedef EGLContext (EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*); 127 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface); 128 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext); 129 | typedef EGLSurface (EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*); 130 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext); 131 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface); 132 | typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint); 133 | typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint); 134 | typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*); 135 | #define eglGetConfigAttrib _glfw.egl.GetConfigAttrib 136 | #define eglGetConfigs _glfw.egl.GetConfigs 137 | #define eglGetDisplay _glfw.egl.GetDisplay 138 | #define eglGetError _glfw.egl.GetError 139 | #define eglInitialize _glfw.egl.Initialize 140 | #define eglTerminate _glfw.egl.Terminate 141 | #define eglBindAPI _glfw.egl.BindAPI 142 | #define eglCreateContext _glfw.egl.CreateContext 143 | #define eglDestroySurface _glfw.egl.DestroySurface 144 | #define eglDestroyContext _glfw.egl.DestroyContext 145 | #define eglCreateWindowSurface _glfw.egl.CreateWindowSurface 146 | #define eglMakeCurrent _glfw.egl.MakeCurrent 147 | #define eglSwapBuffers _glfw.egl.SwapBuffers 148 | #define eglSwapInterval _glfw.egl.SwapInterval 149 | #define eglQueryString _glfw.egl.QueryString 150 | #define eglGetProcAddress _glfw.egl.GetProcAddress 151 | 152 | typedef EGLDisplay (EGLAPIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*); 153 | typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*); 154 | #define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT 155 | #define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT 156 | 157 | // EGL-specific per-context data 158 | // 159 | typedef struct _GLFWcontextEGL 160 | { 161 | EGLConfig config; 162 | EGLContext handle; 163 | EGLSurface surface; 164 | 165 | void* client; 166 | 167 | } _GLFWcontextEGL; 168 | 169 | // EGL-specific global data 170 | // 171 | typedef struct _GLFWlibraryEGL 172 | { 173 | EGLenum platform; 174 | EGLDisplay display; 175 | EGLint major, minor; 176 | GLFWbool prefix; 177 | 178 | GLFWbool KHR_create_context; 179 | GLFWbool KHR_create_context_no_error; 180 | GLFWbool KHR_gl_colorspace; 181 | GLFWbool KHR_get_all_proc_addresses; 182 | GLFWbool KHR_context_flush_control; 183 | GLFWbool EXT_client_extensions; 184 | GLFWbool EXT_platform_base; 185 | GLFWbool EXT_platform_x11; 186 | GLFWbool EXT_platform_wayland; 187 | GLFWbool ANGLE_platform_angle; 188 | GLFWbool ANGLE_platform_angle_opengl; 189 | GLFWbool ANGLE_platform_angle_d3d; 190 | GLFWbool ANGLE_platform_angle_vulkan; 191 | GLFWbool ANGLE_platform_angle_metal; 192 | 193 | void* handle; 194 | 195 | PFN_eglGetConfigAttrib GetConfigAttrib; 196 | PFN_eglGetConfigs GetConfigs; 197 | PFN_eglGetDisplay GetDisplay; 198 | PFN_eglGetError GetError; 199 | PFN_eglInitialize Initialize; 200 | PFN_eglTerminate Terminate; 201 | PFN_eglBindAPI BindAPI; 202 | PFN_eglCreateContext CreateContext; 203 | PFN_eglDestroySurface DestroySurface; 204 | PFN_eglDestroyContext DestroyContext; 205 | PFN_eglCreateWindowSurface CreateWindowSurface; 206 | PFN_eglMakeCurrent MakeCurrent; 207 | PFN_eglSwapBuffers SwapBuffers; 208 | PFN_eglSwapInterval SwapInterval; 209 | PFN_eglQueryString QueryString; 210 | PFN_eglGetProcAddress GetProcAddress; 211 | 212 | PFNEGLGETPLATFORMDISPLAYEXTPROC GetPlatformDisplayEXT; 213 | PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC CreatePlatformWindowSurfaceEXT; 214 | 215 | } _GLFWlibraryEGL; 216 | 217 | 218 | GLFWbool _glfwInitEGL(void); 219 | void _glfwTerminateEGL(void); 220 | GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, 221 | const _GLFWctxconfig* ctxconfig, 222 | const _GLFWfbconfig* fbconfig); 223 | #if defined(_GLFW_X11) 224 | GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, 225 | const _GLFWctxconfig* ctxconfig, 226 | const _GLFWfbconfig* fbconfig, 227 | Visual** visual, int* depth); 228 | #endif /*_GLFW_X11*/ 229 | 230 | -------------------------------------------------------------------------------- /raylib/src/extras/easings.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************************* 2 | * 3 | * raylib easings (header only file) 4 | * 5 | * Useful easing functions for values animation 6 | * 7 | * This header uses: 8 | * #define EASINGS_STATIC_INLINE // Inlines all functions code, so it runs faster. 9 | * // This requires lots of memory on system. 10 | * How to use: 11 | * The four inputs t,b,c,d are defined as follows: 12 | * t = current time (in any unit measure, but same unit as duration) 13 | * b = starting value to interpolate 14 | * c = the total change in value of b that needs to occur 15 | * d = total time it should take to complete (duration) 16 | * 17 | * Example: 18 | * 19 | * int currentTime = 0; 20 | * int duration = 100; 21 | * float startPositionX = 0.0f; 22 | * float finalPositionX = 30.0f; 23 | * float currentPositionX = startPositionX; 24 | * 25 | * while (currentPositionX < finalPositionX) 26 | * { 27 | * currentPositionX = EaseSineIn(currentTime, startPositionX, finalPositionX - startPositionX, duration); 28 | * currentTime++; 29 | * } 30 | * 31 | * A port of Robert Penner's easing equations to C (http://robertpenner.com/easing/) 32 | * 33 | * Robert Penner License 34 | * --------------------------------------------------------------------------------- 35 | * Open source under the BSD License. 36 | * 37 | * Copyright (c) 2001 Robert Penner. All rights reserved. 38 | * 39 | * Redistribution and use in source and binary forms, with or without modification, 40 | * are permitted provided that the following conditions are met: 41 | * 42 | * - Redistributions of source code must retain the above copyright notice, 43 | * this list of conditions and the following disclaimer. 44 | * - Redistributions in binary form must reproduce the above copyright notice, 45 | * this list of conditions and the following disclaimer in the documentation 46 | * and/or other materials provided with the distribution. 47 | * - Neither the name of the author nor the names of contributors may be used 48 | * to endorse or promote products derived from this software without specific 49 | * prior written permission. 50 | * 51 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 52 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 53 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 54 | * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 55 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 56 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 58 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 59 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 60 | * OF THE POSSIBILITY OF SUCH DAMAGE. 61 | * --------------------------------------------------------------------------------- 62 | * 63 | * Copyright (c) 2015 Ramon Santamaria 64 | * 65 | * This software is provided "as-is", without any express or implied warranty. In no event 66 | * will the authors be held liable for any damages arising from the use of this software. 67 | * 68 | * Permission is granted to anyone to use this software for any purpose, including commercial 69 | * applications, and to alter it and redistribute it freely, subject to the following restrictions: 70 | * 71 | * 1. The origin of this software must not be misrepresented; you must not claim that you 72 | * wrote the original software. If you use this software in a product, an acknowledgment 73 | * in the product documentation would be appreciated but is not required. 74 | * 75 | * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 76 | * as being the original software. 77 | * 78 | * 3. This notice may not be removed or altered from any source distribution. 79 | * 80 | **********************************************************************************************/ 81 | 82 | #ifndef EASINGS_H 83 | #define EASINGS_H 84 | 85 | #define EASINGS_STATIC_INLINE // NOTE: By default, compile functions as static inline 86 | 87 | #if defined(EASINGS_STATIC_INLINE) 88 | #define EASEDEF static inline 89 | #else 90 | #define EASEDEF extern 91 | #endif 92 | 93 | #include // Required for: sinf(), cosf(), sqrtf(), powf() 94 | 95 | #ifndef PI 96 | #define PI 3.14159265358979323846f //Required as PI is not always defined in math.h 97 | #endif 98 | 99 | #ifdef __cplusplus 100 | extern "C" { // Prevents name mangling of functions 101 | #endif 102 | 103 | // Linear Easing functions 104 | EASEDEF float EaseLinearNone(float t, float b, float c, float d) { return (c*t/d + b); } 105 | EASEDEF float EaseLinearIn(float t, float b, float c, float d) { return (c*t/d + b); } 106 | EASEDEF float EaseLinearOut(float t, float b, float c, float d) { return (c*t/d + b); } 107 | EASEDEF float EaseLinearInOut(float t,float b, float c, float d) { return (c*t/d + b); } 108 | 109 | // Sine Easing functions 110 | EASEDEF float EaseSineIn(float t, float b, float c, float d) { return (-c*cosf(t/d*(PI/2.0f)) + c + b); } 111 | EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sinf(t/d*(PI/2.0f)) + b); } 112 | EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); } 113 | 114 | // Circular Easing functions 115 | EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrtf(1.0f - t*t) - 1.0f) + b); } 116 | EASEDEF float EaseCircOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*sqrtf(1.0f - t*t) + b); } 117 | EASEDEF float EaseCircInOut(float t, float b, float c, float d) 118 | { 119 | if ((t/=d/2.0f) < 1.0f) return (-c/2.0f*(sqrtf(1.0f - t*t) - 1.0f) + b); 120 | t -= 2.0f; return (c/2.0f*(sqrtf(1.0f - t*t) + 1.0f) + b); 121 | } 122 | 123 | // Cubic Easing functions 124 | EASEDEF float EaseCubicIn(float t, float b, float c, float d) { t /= d; return (c*t*t*t + b); } 125 | EASEDEF float EaseCubicOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*(t*t*t + 1.0f) + b); } 126 | EASEDEF float EaseCubicInOut(float t, float b, float c, float d) 127 | { 128 | if ((t/=d/2.0f) < 1.0f) return (c/2.0f*t*t*t + b); 129 | t -= 2.0f; return (c/2.0f*(t*t*t + 2.0f) + b); 130 | } 131 | 132 | // Quadratic Easing functions 133 | EASEDEF float EaseQuadIn(float t, float b, float c, float d) { t /= d; return (c*t*t + b); } 134 | EASEDEF float EaseQuadOut(float t, float b, float c, float d) { t /= d; return (-c*t*(t - 2.0f) + b); } 135 | EASEDEF float EaseQuadInOut(float t, float b, float c, float d) 136 | { 137 | if ((t/=d/2) < 1) return (((c/2)*(t*t)) + b); 138 | return (-c/2.0f*(((t - 1.0f)*(t - 3.0f)) - 1.0f) + b); 139 | } 140 | 141 | // Exponential Easing functions 142 | EASEDEF float EaseExpoIn(float t, float b, float c, float d) { return (t == 0.0f) ? b : (c*powf(2.0f, 10.0f*(t/d - 1.0f)) + b); } 143 | EASEDEF float EaseExpoOut(float t, float b, float c, float d) { return (t == d) ? (b + c) : (c*(-powf(2.0f, -10.0f*t/d) + 1.0f) + b); } 144 | EASEDEF float EaseExpoInOut(float t, float b, float c, float d) 145 | { 146 | if (t == 0.0f) return b; 147 | if (t == d) return (b + c); 148 | if ((t/=d/2.0f) < 1.0f) return (c/2.0f*powf(2.0f, 10.0f*(t - 1.0f)) + b); 149 | 150 | return (c/2.0f*(-powf(2.0f, -10.0f*(t - 1.0f)) + 2.0f) + b); 151 | } 152 | 153 | // Back Easing functions 154 | EASEDEF float EaseBackIn(float t, float b, float c, float d) 155 | { 156 | float s = 1.70158f; 157 | float postFix = t/=d; 158 | return (c*(postFix)*t*((s + 1.0f)*t - s) + b); 159 | } 160 | 161 | EASEDEF float EaseBackOut(float t, float b, float c, float d) 162 | { 163 | float s = 1.70158f; 164 | t = t/d - 1.0f; 165 | return (c*(t*t*((s + 1.0f)*t + s) + 1.0f) + b); 166 | } 167 | 168 | EASEDEF float EaseBackInOut(float t, float b, float c, float d) 169 | { 170 | float s = 1.70158f; 171 | if ((t/=d/2.0f) < 1.0f) 172 | { 173 | s *= 1.525f; 174 | return (c/2.0f*(t*t*((s + 1.0f)*t - s)) + b); 175 | } 176 | 177 | float postFix = t-=2.0f; 178 | s *= 1.525f; 179 | return (c/2.0f*((postFix)*t*((s + 1.0f)*t + s) + 2.0f) + b); 180 | } 181 | 182 | // Bounce Easing functions 183 | EASEDEF float EaseBounceOut(float t, float b, float c, float d) 184 | { 185 | if ((t/=d) < (1.0f/2.75f)) 186 | { 187 | return (c*(7.5625f*t*t) + b); 188 | } 189 | else if (t < (2.0f/2.75f)) 190 | { 191 | float postFix = t-=(1.5f/2.75f); 192 | return (c*(7.5625f*(postFix)*t + 0.75f) + b); 193 | } 194 | else if (t < (2.5/2.75)) 195 | { 196 | float postFix = t-=(2.25f/2.75f); 197 | return (c*(7.5625f*(postFix)*t + 0.9375f) + b); 198 | } 199 | else 200 | { 201 | float postFix = t-=(2.625f/2.75f); 202 | return (c*(7.5625f*(postFix)*t + 0.984375f) + b); 203 | } 204 | } 205 | 206 | EASEDEF float EaseBounceIn(float t, float b, float c, float d) { return (c - EaseBounceOut(d - t, 0.0f, c, d) + b); } 207 | EASEDEF float EaseBounceInOut(float t, float b, float c, float d) 208 | { 209 | if (t < d/2.0f) return (EaseBounceIn(t*2.0f, 0.0f, c, d)*0.5f + b); 210 | else return (EaseBounceOut(t*2.0f - d, 0.0f, c, d)*0.5f + c*0.5f + b); 211 | } 212 | 213 | // Elastic Easing functions 214 | EASEDEF float EaseElasticIn(float t, float b, float c, float d) 215 | { 216 | if (t == 0.0f) return b; 217 | if ((t/=d) == 1.0f) return (b + c); 218 | 219 | float p = d*0.3f; 220 | float a = c; 221 | float s = p/4.0f; 222 | float postFix = a*powf(2.0f, 10.0f*(t-=1.0f)); 223 | 224 | return (-(postFix*sinf((t*d-s)*(2.0f*PI)/p )) + b); 225 | } 226 | 227 | EASEDEF float EaseElasticOut(float t, float b, float c, float d) 228 | { 229 | if (t == 0.0f) return b; 230 | if ((t/=d) == 1.0f) return (b + c); 231 | 232 | float p = d*0.3f; 233 | float a = c; 234 | float s = p/4.0f; 235 | 236 | return (a*powf(2.0f,-10.0f*t)*sinf((t*d-s)*(2.0f*PI)/p) + c + b); 237 | } 238 | 239 | EASEDEF float EaseElasticInOut(float t, float b, float c, float d) 240 | { 241 | if (t == 0.0f) return b; 242 | if ((t/=d/2.0f) == 2.0f) return (b + c); 243 | 244 | float p = d*(0.3f*1.5f); 245 | float a = c; 246 | float s = p/4.0f; 247 | 248 | if (t < 1.0f) 249 | { 250 | float postFix = a*powf(2.0f, 10.0f*(t-=1.0f)); 251 | return -0.5f*(postFix*sinf((t*d-s)*(2.0f*PI)/p)) + b; 252 | } 253 | 254 | float postFix = a*powf(2.0f, -10.0f*(t-=1.0f)); 255 | 256 | return (postFix*sinf((t*d-s)*(2.0f*PI)/p)*0.5f + c + b); 257 | } 258 | 259 | #ifdef __cplusplus 260 | } 261 | #endif 262 | 263 | #endif // EASINGS_H 264 | -------------------------------------------------------------------------------- /raylib/src/external/glfw/deps/glad/khrplatform.h: -------------------------------------------------------------------------------- 1 | #ifndef __khrplatform_h_ 2 | #define __khrplatform_h_ 3 | 4 | /* 5 | ** Copyright (c) 2008-2018 The Khronos Group Inc. 6 | ** 7 | ** Permission is hereby granted, free of charge, to any person obtaining a 8 | ** copy of this software and/or associated documentation files (the 9 | ** "Materials"), to deal in the Materials without restriction, including 10 | ** without limitation the rights to use, copy, modify, merge, publish, 11 | ** distribute, sublicense, and/or sell copies of the Materials, and to 12 | ** permit persons to whom the Materials are furnished to do so, subject to 13 | ** the following conditions: 14 | ** 15 | ** The above copyright notice and this permission notice shall be included 16 | ** in all copies or substantial portions of the Materials. 17 | ** 18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 25 | */ 26 | 27 | /* Khronos platform-specific types and definitions. 28 | * 29 | * The master copy of khrplatform.h is maintained in the Khronos EGL 30 | * Registry repository at https://github.com/KhronosGroup/EGL-Registry 31 | * The last semantic modification to khrplatform.h was at commit ID: 32 | * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 33 | * 34 | * Adopters may modify this file to suit their platform. Adopters are 35 | * encouraged to submit platform specific modifications to the Khronos 36 | * group so that they can be included in future versions of this file. 37 | * Please submit changes by filing pull requests or issues on 38 | * the EGL Registry repository linked above. 39 | * 40 | * 41 | * See the Implementer's Guidelines for information about where this file 42 | * should be located on your system and for more details of its use: 43 | * http://www.khronos.org/registry/implementers_guide.pdf 44 | * 45 | * This file should be included as 46 | * #include 47 | * by Khronos client API header files that use its types and defines. 48 | * 49 | * The types in khrplatform.h should only be used to define API-specific types. 50 | * 51 | * Types defined in khrplatform.h: 52 | * khronos_int8_t signed 8 bit 53 | * khronos_uint8_t unsigned 8 bit 54 | * khronos_int16_t signed 16 bit 55 | * khronos_uint16_t unsigned 16 bit 56 | * khronos_int32_t signed 32 bit 57 | * khronos_uint32_t unsigned 32 bit 58 | * khronos_int64_t signed 64 bit 59 | * khronos_uint64_t unsigned 64 bit 60 | * khronos_intptr_t signed same number of bits as a pointer 61 | * khronos_uintptr_t unsigned same number of bits as a pointer 62 | * khronos_ssize_t signed size 63 | * khronos_usize_t unsigned size 64 | * khronos_float_t signed 32 bit floating point 65 | * khronos_time_ns_t unsigned 64 bit time in nanoseconds 66 | * khronos_utime_nanoseconds_t unsigned time interval or absolute time in 67 | * nanoseconds 68 | * khronos_stime_nanoseconds_t signed time interval in nanoseconds 69 | * khronos_boolean_enum_t enumerated boolean type. This should 70 | * only be used as a base type when a client API's boolean type is 71 | * an enum. Client APIs which use an integer or other type for 72 | * booleans cannot use this as the base type for their boolean. 73 | * 74 | * Tokens defined in khrplatform.h: 75 | * 76 | * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. 77 | * 78 | * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. 79 | * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. 80 | * 81 | * Calling convention macros defined in this file: 82 | * KHRONOS_APICALL 83 | * KHRONOS_APIENTRY 84 | * KHRONOS_APIATTRIBUTES 85 | * 86 | * These may be used in function prototypes as: 87 | * 88 | * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( 89 | * int arg1, 90 | * int arg2) KHRONOS_APIATTRIBUTES; 91 | */ 92 | 93 | /*------------------------------------------------------------------------- 94 | * Definition of KHRONOS_APICALL 95 | *------------------------------------------------------------------------- 96 | * This precedes the return type of the function in the function prototype. 97 | */ 98 | #if defined(_WIN32) && !defined(__SCITECH_SNAP__) 99 | # define KHRONOS_APICALL __declspec(dllimport) 100 | #elif defined (__SYMBIAN32__) 101 | # define KHRONOS_APICALL IMPORT_C 102 | #elif defined(__ANDROID__) 103 | # define KHRONOS_APICALL __attribute__((visibility("default"))) 104 | #else 105 | # define KHRONOS_APICALL 106 | #endif 107 | 108 | /*------------------------------------------------------------------------- 109 | * Definition of KHRONOS_APIENTRY 110 | *------------------------------------------------------------------------- 111 | * This follows the return type of the function and precedes the function 112 | * name in the function prototype. 113 | */ 114 | #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) 115 | /* Win32 but not WinCE */ 116 | # define KHRONOS_APIENTRY __stdcall 117 | #else 118 | # define KHRONOS_APIENTRY 119 | #endif 120 | 121 | /*------------------------------------------------------------------------- 122 | * Definition of KHRONOS_APIATTRIBUTES 123 | *------------------------------------------------------------------------- 124 | * This follows the closing parenthesis of the function prototype arguments. 125 | */ 126 | #if defined (__ARMCC_2__) 127 | #define KHRONOS_APIATTRIBUTES __softfp 128 | #else 129 | #define KHRONOS_APIATTRIBUTES 130 | #endif 131 | 132 | /*------------------------------------------------------------------------- 133 | * basic type definitions 134 | *-----------------------------------------------------------------------*/ 135 | #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) 136 | 137 | 138 | /* 139 | * Using 140 | */ 141 | #include 142 | typedef int32_t khronos_int32_t; 143 | typedef uint32_t khronos_uint32_t; 144 | typedef int64_t khronos_int64_t; 145 | typedef uint64_t khronos_uint64_t; 146 | #define KHRONOS_SUPPORT_INT64 1 147 | #define KHRONOS_SUPPORT_FLOAT 1 148 | 149 | #elif defined(__VMS ) || defined(__sgi) 150 | 151 | /* 152 | * Using 153 | */ 154 | #include 155 | typedef int32_t khronos_int32_t; 156 | typedef uint32_t khronos_uint32_t; 157 | typedef int64_t khronos_int64_t; 158 | typedef uint64_t khronos_uint64_t; 159 | #define KHRONOS_SUPPORT_INT64 1 160 | #define KHRONOS_SUPPORT_FLOAT 1 161 | 162 | #elif defined(_WIN32) && !defined(__SCITECH_SNAP__) 163 | 164 | /* 165 | * Win32 166 | */ 167 | typedef __int32 khronos_int32_t; 168 | typedef unsigned __int32 khronos_uint32_t; 169 | typedef __int64 khronos_int64_t; 170 | typedef unsigned __int64 khronos_uint64_t; 171 | #define KHRONOS_SUPPORT_INT64 1 172 | #define KHRONOS_SUPPORT_FLOAT 1 173 | 174 | #elif defined(__sun__) || defined(__digital__) 175 | 176 | /* 177 | * Sun or Digital 178 | */ 179 | typedef int khronos_int32_t; 180 | typedef unsigned int khronos_uint32_t; 181 | #if defined(__arch64__) || defined(_LP64) 182 | typedef long int khronos_int64_t; 183 | typedef unsigned long int khronos_uint64_t; 184 | #else 185 | typedef long long int khronos_int64_t; 186 | typedef unsigned long long int khronos_uint64_t; 187 | #endif /* __arch64__ */ 188 | #define KHRONOS_SUPPORT_INT64 1 189 | #define KHRONOS_SUPPORT_FLOAT 1 190 | 191 | #elif 0 192 | 193 | /* 194 | * Hypothetical platform with no float or int64 support 195 | */ 196 | typedef int khronos_int32_t; 197 | typedef unsigned int khronos_uint32_t; 198 | #define KHRONOS_SUPPORT_INT64 0 199 | #define KHRONOS_SUPPORT_FLOAT 0 200 | 201 | #else 202 | 203 | /* 204 | * Generic fallback 205 | */ 206 | #include 207 | typedef int32_t khronos_int32_t; 208 | typedef uint32_t khronos_uint32_t; 209 | typedef int64_t khronos_int64_t; 210 | typedef uint64_t khronos_uint64_t; 211 | #define KHRONOS_SUPPORT_INT64 1 212 | #define KHRONOS_SUPPORT_FLOAT 1 213 | 214 | #endif 215 | 216 | 217 | /* 218 | * Types that are (so far) the same on all platforms 219 | */ 220 | typedef signed char khronos_int8_t; 221 | typedef unsigned char khronos_uint8_t; 222 | typedef signed short int khronos_int16_t; 223 | typedef unsigned short int khronos_uint16_t; 224 | 225 | /* 226 | * Types that differ between LLP64 and LP64 architectures - in LLP64, 227 | * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears 228 | * to be the only LLP64 architecture in current use. 229 | */ 230 | #ifdef _WIN64 231 | typedef signed long long int khronos_intptr_t; 232 | typedef unsigned long long int khronos_uintptr_t; 233 | typedef signed long long int khronos_ssize_t; 234 | typedef unsigned long long int khronos_usize_t; 235 | #else 236 | typedef signed long int khronos_intptr_t; 237 | typedef unsigned long int khronos_uintptr_t; 238 | typedef signed long int khronos_ssize_t; 239 | typedef unsigned long int khronos_usize_t; 240 | #endif 241 | 242 | #if KHRONOS_SUPPORT_FLOAT 243 | /* 244 | * Float type 245 | */ 246 | typedef float khronos_float_t; 247 | #endif 248 | 249 | #if KHRONOS_SUPPORT_INT64 250 | /* Time types 251 | * 252 | * These types can be used to represent a time interval in nanoseconds or 253 | * an absolute Unadjusted System Time. Unadjusted System Time is the number 254 | * of nanoseconds since some arbitrary system event (e.g. since the last 255 | * time the system booted). The Unadjusted System Time is an unsigned 256 | * 64 bit value that wraps back to 0 every 584 years. Time intervals 257 | * may be either signed or unsigned. 258 | */ 259 | typedef khronos_uint64_t khronos_utime_nanoseconds_t; 260 | typedef khronos_int64_t khronos_stime_nanoseconds_t; 261 | #endif 262 | 263 | /* 264 | * Dummy value used to pad enum types to 32 bits. 265 | */ 266 | #ifndef KHRONOS_MAX_ENUM 267 | #define KHRONOS_MAX_ENUM 0x7FFFFFFF 268 | #endif 269 | 270 | /* 271 | * Enumerated boolean type 272 | * 273 | * Values other than zero should be considered to be true. Therefore 274 | * comparisons should not be made against KHRONOS_TRUE. 275 | */ 276 | typedef enum { 277 | KHRONOS_FALSE = 0, 278 | KHRONOS_TRUE = 1, 279 | KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM 280 | } khronos_boolean_enum_t; 281 | 282 | #endif /* __khrplatform_h_ */ 283 | --------------------------------------------------------------------------------