Merge branch 'master' of https://github.com/raysan5/raylib into dr/mini_al
This commit is contained in:
commit
6d8cc250bd
212 changed files with 50102 additions and 6037 deletions
28
.gitignore
vendored
28
.gitignore
vendored
|
|
@ -13,9 +13,10 @@ Thumbs.db
|
||||||
# *.obj --> Can be confused with 3d model!
|
# *.obj --> Can be confused with 3d model!
|
||||||
*.pdb
|
*.pdb
|
||||||
*.aps
|
*.aps
|
||||||
*.vcproj.*.user
|
*.user
|
||||||
*.vcxproj*
|
# *.vcproj
|
||||||
*.sln
|
# *.vcxproj*
|
||||||
|
# *.sln
|
||||||
*.vspscc
|
*.vspscc
|
||||||
*_i.c
|
*_i.c
|
||||||
*.i
|
*.i
|
||||||
|
|
@ -41,11 +42,12 @@ _ReSharper*/
|
||||||
[Tt]est[Rr]esult*
|
[Tt]est[Rr]esult*
|
||||||
ipch/
|
ipch/
|
||||||
*.opensdf
|
*.opensdf
|
||||||
|
*.db
|
||||||
|
*.opendb
|
||||||
|
|
||||||
# Ignore compiled binaries
|
# Ignore compiled binaries
|
||||||
*.o
|
*.o
|
||||||
*.exe
|
*.exe
|
||||||
!tools/rREM/rrem.exe
|
|
||||||
|
|
||||||
# Ignore all examples files
|
# Ignore all examples files
|
||||||
examples/*
|
examples/*
|
||||||
|
|
@ -84,21 +86,10 @@ xcuserdata/
|
||||||
DerivedData/
|
DerivedData/
|
||||||
|
|
||||||
# Visual Studio project
|
# Visual Studio project
|
||||||
project/vs2015/*.db
|
project/VS2015.UWP/packages
|
||||||
project/vs2015/*.opendb
|
project/VS2017/packages
|
||||||
project/vs2015.UWP/packages
|
|
||||||
project/vs2015.UWP/*.db
|
|
||||||
!project/vs2015/raylib.sln
|
|
||||||
!project/vs2015/raylib/*.vcxproj
|
|
||||||
!project/vs2015/examples/*.vcxproj
|
|
||||||
!project/vs2017/raylib.sln
|
|
||||||
!project/vs2017/raylib/*.vcxproj
|
|
||||||
!project/vs2017/examples/*.vcxproj
|
|
||||||
!project/vs2015.UWP/raylib/*.vcxproj
|
|
||||||
!project/vs2015.UWP/*.sln
|
|
||||||
!project/vs2015.UWP/raylib.App.UWP/*.vcxproj
|
|
||||||
|
|
||||||
# Web examples
|
# Web examples
|
||||||
docs/examples/web/*.html
|
docs/examples/web/*.html
|
||||||
docs/examples/web/*/*.html
|
docs/examples/web/*/*.html
|
||||||
!docs/examples/web/loader.html
|
!docs/examples/web/loader.html
|
||||||
|
|
@ -116,6 +107,7 @@ CMakeCache.txt
|
||||||
CMakeFiles
|
CMakeFiles
|
||||||
CMakeScripts
|
CMakeScripts
|
||||||
Testing
|
Testing
|
||||||
|
TestingIfSymlinkWorks
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
install_manifest.txt
|
install_manifest.txt
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
|
|
|
||||||
85
.travis.yml
85
.travis.yml
|
|
@ -5,7 +5,8 @@ git:
|
||||||
depth: 3
|
depth: 3
|
||||||
|
|
||||||
# TODO we could use a 32 bit Docker container for running true 32-bit tests
|
# TODO we could use a 32 bit Docker container for running true 32-bit tests
|
||||||
# services: - docker
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
|
@ -15,39 +16,87 @@ matrix:
|
||||||
- os: linux
|
- os: linux
|
||||||
env: ARCH=amd64
|
env: ARCH=amd64
|
||||||
sudo: required
|
sudo: required
|
||||||
|
- os: linux
|
||||||
|
env: ARCH=amd64 GLFW=SYSTEM RELEASE=NO
|
||||||
|
sudo: required
|
||||||
|
- os: linux
|
||||||
|
env: USE_WAYLAND=ON ARCH=amd64 RELEASE=NO
|
||||||
|
sudo: required
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libwayland-dev
|
||||||
|
- libxkbcommon-dev
|
||||||
|
- libegl1-mesa-dev
|
||||||
- os: osx
|
- os: osx
|
||||||
env: ARCH=universal
|
env: ARCH=universal
|
||||||
|
- os: linux
|
||||||
|
env: ARCH=arm64-android RELEASE=NO
|
||||||
|
sudo: required
|
||||||
|
- os: linux
|
||||||
|
env: ARCH=html5 RELEASE=NO
|
||||||
|
sudo: required
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
||||||
sudo apt-get install -y gcc-multilib
|
if [[ "$ARCH" == *-android ]]; then
|
||||||
libasound2-dev:$ARCH
|
export RAYLIB_PACKAGE_SUFFIX="-Android-arm64";
|
||||||
libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH
|
wget https://dl.google.com/android/repository/android-ndk-r17-linux-x86_64.zip;
|
||||||
libx11-dev:$ARCH libxrandr-dev:$ARCH libxi-dev:$ARCH
|
unzip -qq android-ndk*.zip;
|
||||||
libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH;
|
android-ndk*/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 --install-dir /tmp/android-toolchain;
|
||||||
export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH";
|
export PATH=/tmp/android-toolchain/bin:$PATH;
|
||||||
if [ "$ARCH" == "i386" ]; then export CFLAGS="-m32"; fi;
|
export CMAKE_ARCH_ARGS='-DPLATFORM=Android';
|
||||||
if [ "$ARCH" == "amd64" ]; then export CFLAGS="-m64"; fi;
|
export CC=aarch64-linux-android-clang;
|
||||||
if [ "$GLFW" == "SYSTEM" ]; then
|
export CXX=aarch64-linux-android-clang++;
|
||||||
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3_3.2.1-1_amd64.deb';
|
elif [ "$ARCH" == "html5" ]; then
|
||||||
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3-dev_3.2.1-1_amd64.deb';
|
export RAYLIB_PACKAGE_SUFFIX="-html5";
|
||||||
sudo dpkg -i libglfw3_3.2.1-1_amd64.deb libglfw3-dev_3.2.1-1_amd64.deb;
|
docker run --privileged=true -dit --name emscripten -v $(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash;
|
||||||
|
export CMAKE_ARCH_ARGS='-DPLATFORM=Web -DCMAKE_TOOLCHAIN_FILE=../cmake/emscripten.cmake';
|
||||||
|
export RUNNER='docker exec -it emscripten cmake -E chdir build';
|
||||||
|
else
|
||||||
|
sudo apt-get install -y gcc-multilib
|
||||||
|
libasound2-dev:$ARCH
|
||||||
|
libxcursor-dev:$ARCH libxinerama-dev:$ARCH mesa-common-dev:$ARCH
|
||||||
|
libx11-dev:$ARCH libxrandr-dev:$ARCH libxrandr2:$ARCH libxi-dev:$ARCH
|
||||||
|
libgl1-mesa-dev:$ARCH libglu1-mesa-dev:$ARCH;
|
||||||
|
if [ "$ARCH" == "i386" ]; then
|
||||||
|
export CMAKE_ARCH_ARGS='-DCMAKE_C_FLAGS=-m32 -DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/i386-linux-gnu';
|
||||||
|
fi;
|
||||||
|
export RAYLIB_PACKAGE_SUFFIX="-Linux-$ARCH";
|
||||||
|
if [ "$GLFW" == "SYSTEM" ]; then
|
||||||
|
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3_3.2.1-1_amd64.deb';
|
||||||
|
wget 'http://ftp.de.debian.org/debian/pool/main/g/glfw3/libglfw3-dev_3.2.1-1_amd64.deb';
|
||||||
|
sudo dpkg -i libglfw3_3.2.1-1_amd64.deb libglfw3-dev_3.2.1-1_amd64.deb;
|
||||||
|
fi;
|
||||||
fi;
|
fi;
|
||||||
fi
|
fi
|
||||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||||
export RAYLIB_PACKAGE_SUFFIX="-macOS";
|
export RAYLIB_PACKAGE_SUFFIX="-macOS";
|
||||||
if [ "$GLFW" == "SYSTEM" ]; then brew update; brew install glfw; fi;
|
if [ "$GLFW" == "SYSTEM" ]; then brew update; brew install glfw; fi;
|
||||||
fi
|
fi
|
||||||
- "$CC --version"
|
- mkdir build
|
||||||
|
- $RUNNER $CC --version
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- mkdir build
|
|
||||||
- cd build
|
- cd build
|
||||||
- cmake -DMACOS_FATLIB=ON -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE ..
|
- if test -n "${USE_WAYLAND}";
|
||||||
- make VERBOSE=1
|
then wget https://mirrors.kernel.org/ubuntu/pool/universe/e/extra-cmake-modules/extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb;
|
||||||
- make package
|
sudo dpkg -i extra-cmake-modules_5.38.0a-0ubuntu1_amd64.deb;
|
||||||
|
git clone git://anongit.freedesktop.org/wayland/wayland-protocols;
|
||||||
|
pushd wayland-protocols;
|
||||||
|
git checkout 1.12 && ./autogen.sh --prefix=/usr && make && sudo make install;
|
||||||
|
popd;
|
||||||
|
fi
|
||||||
|
- $RUNNER cmake $CMAKE_ARCH_ARGS -DMACOS_FATLIB=ON -DSTATIC=ON -DSHARED=ON -DBUILD_EXAMPLES=ON -DBUILD_GAMES=ON -DUSE_EXTERNAL_GLFW=IF_POSSIBLE -DUSE_WAYLAND=${USE_WAYLAND} ..
|
||||||
|
- $RUNNER make VERBOSE=1
|
||||||
|
- if [ "$RELEASE" != "NO" ]; then $RUNNER make package; fi;
|
||||||
|
- sudo $RUNNER make install
|
||||||
|
- if [[ "$ARCH" != *-android && "$ARCH" != html5 ]]; then
|
||||||
|
pkg-config --static --libs raylib;
|
||||||
|
nm -g release/libraylib.a | grep glfwGetProcAddress || (echo "libraylib.a doesn't contain GLFW symbols! Aborting..." && false);
|
||||||
|
fi
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
|
|
|
||||||
98
CHANGELOG
98
CHANGELOG
|
|
@ -3,6 +3,104 @@ changelog
|
||||||
|
|
||||||
Current Release: raylib 1.8.0 (Oct 2017)
|
Current Release: raylib 1.8.0 (Oct 2017)
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
Release: raylib 2.0 (June 2017 ?)
|
||||||
|
-----------------------------------------------
|
||||||
|
KEY CHANGES:
|
||||||
|
- Removed external dependencies (GLFW3 and OpenAL)
|
||||||
|
- Complete redesign of audio module to use mini_al audio library
|
||||||
|
- Support AppVeyor and Travis CI (continuous integration) build
|
||||||
|
- Reviewed raymath.h for better consistency and performance (inlining)
|
||||||
|
- Refactor all #define SUPPORT_* into a single config.h
|
||||||
|
- Support TCC compiler
|
||||||
|
|
||||||
|
Detailed changes:
|
||||||
|
[build] REMOVED: GitHub develop branch
|
||||||
|
[build] ADDED: FreeBSD OS support
|
||||||
|
[build] ADDED: Universal Windows Platform (UWP) support
|
||||||
|
[build] ADDED: Wayland Linux desktop support
|
||||||
|
[build] REMOVED: External dependencies GLFW and OpenAL
|
||||||
|
[build] ADDED: AppVeyor CI for automatic Windows builds
|
||||||
|
[build] ADDED: Travis CI for automatic Linux/macOS builds
|
||||||
|
[build] ADDED: rglfw (GLFW3 module) to avoid external dependency
|
||||||
|
[build] ADDED: VS2017 UWP project
|
||||||
|
[build] ADDED: Builder project template
|
||||||
|
[build] REVIEWED: VS2015 and VS2017 projects
|
||||||
|
[build] ADDED: Compiler memory sanitizer for better debug
|
||||||
|
[build] Setup CMake package target and CI auto-deploy tags
|
||||||
|
[build] Support DEBUG library building
|
||||||
|
[core] Unified InitWindow() between platforms
|
||||||
|
[core] Export Android main entry point
|
||||||
|
[core] RENAMED: Begin3dMode() to BeginMode3D()
|
||||||
|
[core] RENAMED: End3dMode() to EndMode3D()
|
||||||
|
[core] RENAMED: Begin2dMode() to BeginMode2D()
|
||||||
|
[core] RENAMED: End2dMode() to EndMode2D()
|
||||||
|
[core] RENAMED: struct Camera to Camera3D
|
||||||
|
[core] RENAMED: struct SpriteFont to Font -> plus all required functions!
|
||||||
|
[core] RENAMED: enum TextureFormat to PixelFormat
|
||||||
|
[core] REVIEWED: Rectangle params int to float
|
||||||
|
[core] REVIEWED: timming system for macOS
|
||||||
|
[core] REMOVED: ColorToFloat()
|
||||||
|
[core] ADDED: GetCurrentTime() on macOS
|
||||||
|
[core] ADDED: GetTime()
|
||||||
|
[core] ADDED: struct Vector4
|
||||||
|
[core] ADDED: SetTraceLog() to define trace log messages type
|
||||||
|
[core] ADDED: GetFileName() to get filename from path string
|
||||||
|
[core] ADDED: ColorToHSV()
|
||||||
|
[core] ADDED: ColorNormalize()
|
||||||
|
[core] ADDED: SetWindowSize() to scale Windows in runtime
|
||||||
|
[core] ADDED: SetMouseScale() to scale mouse input
|
||||||
|
[core] ADDED: key definitions - KEY_GRAVE, KEY_SLASH, KEY_BACKSLASH
|
||||||
|
[core] RENAMED: GetHexValue() to ColorToInt()
|
||||||
|
[core] REVIEWED: Fade()
|
||||||
|
[core] REVIEWED: InitWindow() to avoid void pointer (safety)
|
||||||
|
[core] Support camera 3d orthographic projection mode
|
||||||
|
[shapes] ADDED: DrawRectangleLinesEx()
|
||||||
|
[textures] Improved pixel formats support (32bit channels)
|
||||||
|
[textures] Improved textures support for OpenGL 2.1
|
||||||
|
[textures] REMOVED: DrawRectangleT() --> Added support to DrawRectangle()
|
||||||
|
[textures] ADDED: GetPixelDataSize(); pixel data size in bytes (image or texture)
|
||||||
|
[textures] ADDED: ImageAlphaClear() --> Clear alpha channel to desired color
|
||||||
|
[textures] ADDED: ImageAlphaCrop() --> Crop image depending on alpha value
|
||||||
|
[textures] ADDED: ImageAlphaPremultiply() --> Premultiply alpha channel
|
||||||
|
[textures] ADDED: ImageDrawRectangle()
|
||||||
|
[textures] ADDED: ImageMipmaps()
|
||||||
|
[textures] ADDED: GenImageColor()
|
||||||
|
[textures] ADDED: GetPixelDataSize()
|
||||||
|
[textures] REVIEWED: GenImagePerlinNoise()
|
||||||
|
[textures] REVIEWED: ImageTextEx() to support UTF8 basic characters
|
||||||
|
[textures] REVIEWED: GetTextureData() for RPI - requires some work
|
||||||
|
[textures] Added new example: text drawing on image
|
||||||
|
[text] Corrected issue with ttf font y-offset
|
||||||
|
[text] REVIEWED: DrawTextEx() - avoid rendering SPACE character!
|
||||||
|
[rlgl] ADDED: LoadShaderCode()
|
||||||
|
[rlgl] ADDED: GetMatrixModelview()
|
||||||
|
[rlgl] ADDED: SetVrDistortionShader(Shader shader)
|
||||||
|
[rlgl] REVIEWED: rlLoadTexture() - added mipmaps support, improved compressed textures loading
|
||||||
|
[rlgl] REVIEWED: rlReadTexturePixels()
|
||||||
|
[models] Support 4 components mesh.tangent data
|
||||||
|
[models] Removed tangents generation from LoadOBJ()
|
||||||
|
[models] ADDED: MeshTangents()
|
||||||
|
[models] ADDED: MeshBinormals()
|
||||||
|
[models] ADDED: ExportMesh()
|
||||||
|
[models] ADDED: GetCollisionRayModel()
|
||||||
|
[models] RENAMED: CalculateBoundingBox() to MeshBoundingBox()
|
||||||
|
[models] REMOVED: GetCollisionRayMesh() - does not consider model transform
|
||||||
|
[models] REVIEWED: LoadMesh() - fallback to default cube mesh if loading fails
|
||||||
|
[audio] ADDED: IsAudioStreamPlaying()
|
||||||
|
[audio] ADDED: SetAudioStreamVolume()
|
||||||
|
[audio] ADDED: SetAudioStreamPitch()
|
||||||
|
[utils] Corrected issue with SaveImageAs()
|
||||||
|
[utils] RENAMED: SaveImageAs() to ExportImage()
|
||||||
|
[utils] REMOVED: rres support - moved to external library (rres.h)
|
||||||
|
[shaders] REVIEWED: GLSL 120 shaders
|
||||||
|
[raymath] REVIEWED: math usage to reduce temp variables
|
||||||
|
[raymath] REVIEWED: Avoid pointer-based parameters for API consistency
|
||||||
|
[physac] REVIEWED: physac.h timming system
|
||||||
|
[games] ADDED: GGJ18 game - transmission mission
|
||||||
|
[*] Updated external libraries to latest version
|
||||||
|
[*] Multiple bugs corrected (check github issues)
|
||||||
|
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
Release: raylib 1.8.0 (Oct 2017)
|
Release: raylib 1.8.0 (Oct 2017)
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
|
|
||||||
35
CMakeLists.txt
Executable file → Normal file
35
CMakeLists.txt
Executable file → Normal file
|
|
@ -1,4 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
# Config options
|
# Config options
|
||||||
option(BUILD_EXAMPLES "Build the examples." ON)
|
option(BUILD_EXAMPLES "Build the examples." ON)
|
||||||
|
|
@ -15,35 +16,25 @@ else()
|
||||||
set (CMAKE_C_STANDARD 99)
|
set (CMAKE_C_STANDARD 99)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckCCompilerFlag)
|
include(AddIfFlagCompiles)
|
||||||
function(add_if_flag_works flag)
|
add_if_flag_compiles(-Werror=pointer-arith CMAKE_C_FLAGS)
|
||||||
CHECK_C_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
|
add_if_flag_compiles(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
|
||||||
set(outcome "Failed")
|
|
||||||
if(COMPILER_HAS_THOSE_TOGGLES)
|
|
||||||
foreach(var ${ARGN})
|
|
||||||
set(${var} "${flag} ${${var}}" PARENT_SCOPE)
|
|
||||||
endforeach()
|
|
||||||
set(outcome "works")
|
|
||||||
endif()
|
|
||||||
message(STATUS "Testing if ${flag} can be used -- ${outcome}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
add_if_flag_works(-Werror=pointer-arith CMAKE_C_FLAGS)
|
|
||||||
add_if_flag_works(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
|
|
||||||
# src/external/jar_xm.h does shady stuff
|
# src/external/jar_xm.h does shady stuff
|
||||||
add_if_flag_works(-fno-strict-aliasing CMAKE_C_FLAGS)
|
add_if_flag_compiles(-fno-strict-aliasing CMAKE_C_FLAGS)
|
||||||
|
|
||||||
|
include(CheckFileSystemSymlinkSupport)
|
||||||
|
|
||||||
if (ENABLE_ASAN)
|
if (ENABLE_ASAN)
|
||||||
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
add_if_flag_works(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fsanitize=address CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
if (ENABLE_UBSAN)
|
if (ENABLE_UBSAN)
|
||||||
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
add_if_flag_works(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fsanitize=undefined CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
if (ENABLE_MSAN)
|
if (ENABLE_MSAN)
|
||||||
add_if_flag_works(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fno-omit-frame-pointer CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
add_if_flag_works(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
add_if_flag_compiles(-fsanitize=memory CMAKE_C_FLAGS CMAKE_LINKER_FLAGS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ENABLE_MSAN AND ENABLE_ASAN)
|
if (ENABLE_MSAN AND ENABLE_ASAN)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ The following help is highly appreciated:
|
||||||
- Testers of current features and multiple systems - Can you find some bug on raylib?
|
- Testers of current features and multiple systems - Can you find some bug on raylib?
|
||||||
|
|
||||||
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
|
If you can not help on any of the above points but you still want to contribute in some way... please, consider helping
|
||||||
with a small [donation](http://www.raylib.com/helpme.html) or contributing with [raylib patreon](https://www.patreon.com/raysan5). It will really motivate to continue improving this project...
|
with a small [donation](http://www.raylib.com/helpme.html) or contributing with [raylib patreon](https://www.patreon.com/raylib). It will really motivate to continue improving this project...
|
||||||
|
|
||||||
raylib philosophy
|
raylib philosophy
|
||||||
------------------
|
------------------
|
||||||
|
|
@ -32,6 +32,6 @@ contact
|
||||||
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
||||||
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||||
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
|
* Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||||
|
|
||||||
[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
|
[raysan5]: mailto:ray@raylib.com "Ramon Santamaria - Ray San"
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ contact
|
||||||
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
* Facebook: [http://www.facebook.com/raylibgames](http://www.facebook.com/raylibgames)
|
||||||
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
* Reddit: [https://www.reddit.com/r/raylib](https://www.reddit.com/r/raylib)
|
||||||
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
* Twitch: [http://www.twitch.tv/raysan5](http://www.twitch.tv/raysan5)
|
||||||
* Patreon: [https://www.patreon.com/raysan5](https://www.patreon.com/raysan5)
|
* Patreon: [https://www.patreon.com/raylib](https://www.patreon.com/raylib)
|
||||||
* YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/channel/UC8WIBkhYb5sBNqXO1mZ7WSQ)
|
* YouTube: [https://www.youtube.com/channel/raylib](https://www.youtube.com/channel/UC8WIBkhYb5sBNqXO1mZ7WSQ)
|
||||||
|
|
||||||
If you are using raylib and you enjoy it, please, [let me know][raysan5].
|
If you are using raylib and you enjoy it, please, [let me know][raysan5].
|
||||||
|
|
|
||||||
12
cmake/AddIfFlagCompiles.cmake
Normal file
12
cmake/AddIfFlagCompiles.cmake
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
function(add_if_flag_compiles flag)
|
||||||
|
CHECK_C_COMPILER_FLAG("${flag}" COMPILER_HAS_THOSE_TOGGLES)
|
||||||
|
set(outcome "Failed")
|
||||||
|
if(COMPILER_HAS_THOSE_TOGGLES)
|
||||||
|
foreach(var ${ARGN})
|
||||||
|
set(${var} "${flag} ${${var}}" PARENT_SCOPE)
|
||||||
|
endforeach()
|
||||||
|
set(outcome "compiles")
|
||||||
|
endif()
|
||||||
|
message(STATUS "Testing if ${flag} can be used -- ${outcome}")
|
||||||
|
endfunction()
|
||||||
43
cmake/BuildType.cmake
Normal file
43
cmake/BuildType.cmake
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Set a default build type if none was specified
|
||||||
|
set(default_build_type "Release")
|
||||||
|
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||||
|
set(default_build_type "Debug")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
|
||||||
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
||||||
|
STRING "Choose the type of build." FORCE)
|
||||||
|
# Set the possible values of build type for cmake-gui
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
|
||||||
|
"MinSizeRel" "RelWithDebInfo")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Taken from the https://github.com/OpenChemistry/tomviz project
|
||||||
|
# Copyright (c) 2014-2017, Kitware, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
13
cmake/CheckFileSystemSymlinkSupport.cmake
Normal file
13
cmake/CheckFileSystemSymlinkSupport.cmake
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Populates a ${FILESYSTEM_LACKS_SYMLINKS} variable
|
||||||
|
message(STATUS "Testing if file system supports symlinks")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E create_symlink CMakeLists.txt "${CMAKE_CURRENT_BINARY_DIR}/TestingIfSymlinkWorks"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
RESULT_VARIABLE FILESYSTEM_LACKS_SYMLINKS
|
||||||
|
)
|
||||||
|
If (FILESYSTEM_LACKS_SYMLINKS)
|
||||||
|
message(STATUS "Testing if file system supports symlinks -- unsupported")
|
||||||
|
else()
|
||||||
|
message(STATUS "Testing if file system supports symlinks -- supported")
|
||||||
|
endif()
|
||||||
|
|
||||||
15
cmake/emscripten.cmake
Normal file
15
cmake/emscripten.cmake
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
SET(CMAKE_SYSTEM_NAME Linux)
|
||||||
|
|
||||||
|
SET(CMAKE_C_COMPILER emcc)
|
||||||
|
SET(CMAKE_CXX_COMPILER em++)
|
||||||
|
if(NOT DEFINED CMAKE_AR)
|
||||||
|
find_program(CMAKE_AR NAMES emar)
|
||||||
|
endif()
|
||||||
|
if(NOT DEFINED CMAKE_RANLIB)
|
||||||
|
find_program(CMAKE_RANLIB NAMES emranlib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||||
97
cmake/utils.cmake
Executable file
97
cmake/utils.cmake
Executable file
|
|
@ -0,0 +1,97 @@
|
||||||
|
# All sorts of things that we need cross project
|
||||||
|
cmake_minimum_required(VERSION 2.8.0)
|
||||||
|
|
||||||
|
add_definitions("-DRAYLIB_CMAKE=1")
|
||||||
|
|
||||||
|
# Linking for OS X -framework options
|
||||||
|
# Will do nothing on other OSes
|
||||||
|
if(${PLATFORM} MATCHES "Android")
|
||||||
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
|
set(LIBS_PRIVATE m log android EGL GLESv2 OpenSLES atomic c)
|
||||||
|
elseif(${PLATFORM} MATCHES "Web")
|
||||||
|
elseif(APPLE)
|
||||||
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
|
find_library(COCOA_LIBRARY Cocoa)
|
||||||
|
find_library(IOKIT_LIBRARY IOKit)
|
||||||
|
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
||||||
|
find_library(COREVIDEO_LIBRARY CoreVideo)
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE ${OPENGL_LIBRARY} ${COCOA_LIBRARY}
|
||||||
|
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY} ${COREVIDEO_LIBRARY})
|
||||||
|
elseif(WIN32)
|
||||||
|
# no pkg-config --static on Windows yet...
|
||||||
|
else()
|
||||||
|
find_library(pthread NAMES pthread)
|
||||||
|
find_package(OpenGL QUIET)
|
||||||
|
if ("${OPENGL_LIBRARIES}" STREQUAL "")
|
||||||
|
set(OPENGL_LIBRARIES "GL")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(${OPENGL_INCLUDE_DIR})
|
||||||
|
|
||||||
|
if ("${CMAKE_SYSTEM_NAME}" MATCHES "(Net|Open)BSD")
|
||||||
|
find_library(OSS_LIBRARY ossaudio)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LIBS_PRIVATE m pthread ${OPENGL_LIBRARIES} ${OSS_LIBRARY})
|
||||||
|
# TODO: maybe read those out of glfw's cmake config?
|
||||||
|
if(USE_WAYLAND)
|
||||||
|
set(LIBS_PRIVATE ${LIBS_PRIVATE} wayland-client wayland-cursor wayland-egl)
|
||||||
|
else()
|
||||||
|
set(LIBS_PRIVATE ${LIBS_PRIVATE} X11 Xrandr Xinerama Xi Xxf86vm Xcursor)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${PLATFORM} MATCHES "Desktop")
|
||||||
|
if(USE_EXTERNAL_GLFW STREQUAL "ON")
|
||||||
|
find_package(glfw3 3.2.1 REQUIRED)
|
||||||
|
elseif(USE_EXTERNAL_GLFW STREQUAL "IF_POSSIBLE")
|
||||||
|
find_package(glfw3 3.2.1 QUIET)
|
||||||
|
endif()
|
||||||
|
if (glfw3_FOUND)
|
||||||
|
set(LIBS_PRIVATE ${LIBS_PRIVATE} glfw)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||||
|
set(LINUX TRUE)
|
||||||
|
set(LIBS_PRIVATE dl ${LIBS_PRIVATE})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(L ${LIBS_PRIVATE})
|
||||||
|
get_filename_component(DIR ${L} PATH)
|
||||||
|
get_filename_component(LIBFILE ${L} NAME_WE)
|
||||||
|
STRING(REGEX REPLACE "^lib" "" FILE ${LIBFILE})
|
||||||
|
|
||||||
|
if (${L} MATCHES "[.]framework$")
|
||||||
|
set(FILE_OPT "-framework ${FILE}")
|
||||||
|
set(DIR_OPT "-F${DIR}")
|
||||||
|
else()
|
||||||
|
set(FILE_OPT "-l${FILE}")
|
||||||
|
set(DIR_OPT "-L${DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ("${DIR}" STREQUAL "" OR "${DIR}" STREQUAL "${LASTDIR}")
|
||||||
|
set (DIR_OPT "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LASTDIR ${DIR})
|
||||||
|
|
||||||
|
set(__PKG_CONFIG_LIBS_PRIVATE ${__PKG_CONFIG_LIBS_PRIVATE} ${DIR_OPT} ${FILE_OPT})
|
||||||
|
string (REPLACE ";" " " __PKG_CONFIG_LIBS_PRIVATE "${__PKG_CONFIG_LIBS_PRIVATE}")
|
||||||
|
endforeach(L)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Do the linking for executables that are meant to link raylib
|
||||||
|
function(link_libraries_to_executable executable)
|
||||||
|
# Link raylib
|
||||||
|
if (TARGET raylib_shared)
|
||||||
|
target_link_libraries(${executable} raylib_shared)
|
||||||
|
elseif(${PLATFORM} MATCHES "Web")
|
||||||
|
target_link_libraries(${executable} ${__PKG_CONFIG_LIBS_PRIVATE})
|
||||||
|
target_link_libraries(${executable} raylib)
|
||||||
|
else()
|
||||||
|
target_link_libraries(${executable} raylib ${__PKG_CONFIG_LIBS_PRIVATE})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Setup the project and settings
|
# Setup the project and settings
|
||||||
project(examples)
|
project(examples)
|
||||||
|
|
||||||
include("../utils.cmake")
|
include("../cmake/utils.cmake")
|
||||||
|
|
||||||
# Make sure raylib has been built
|
# Make sure raylib has been built
|
||||||
# TODO `build` directory should maybe be something else...
|
# TODO `build` directory should maybe be something else...
|
||||||
|
|
@ -40,6 +40,29 @@ if(NOT HAVE_OCULUS_CAPI)
|
||||||
endif()
|
endif()
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
|
||||||
|
|
||||||
|
if(${PLATFORM} MATCHES "Android")
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_first_person.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_world_screen.c)
|
||||||
|
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_material_pbr.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_cubicmap.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_skybox.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_picking.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_mesh_generation.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_heightmap.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_billboard.c)
|
||||||
|
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
|
||||||
|
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# Do each example
|
# Do each example
|
||||||
foreach(example_source ${example_sources})
|
foreach(example_source ${example_sources})
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
# Define required raylib variables
|
# Define required raylib variables
|
||||||
PROJECT_NAME ?= raylib_examples
|
PROJECT_NAME ?= raylib_examples
|
||||||
RAYLIB_VERSION ?= 1.9.7
|
RAYLIB_VERSION ?= 2.0.0
|
||||||
RAYLIB_API_VERSION ?= 1
|
RAYLIB_API_VERSION ?= 1
|
||||||
RAYLIB_PATH ?= ..
|
RAYLIB_PATH ?= ..
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
# resources file contains windows exe icon
|
# resources file contains windows exe icon
|
||||||
# -Wl,--subsystem,windows hides the console window
|
# -Wl,--subsystem,windows hides the console window
|
||||||
CFLAGS += $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
|
CFLAGS += $(RAYLIB_PATH)/src/raylib_icon -Wl,--subsystem,windows
|
||||||
endif
|
endif
|
||||||
ifeq ($(PLATFORM_OS),LINUX)
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
||||||
|
|
@ -215,7 +215,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
#CC = clang
|
#CC = clang
|
||||||
endif
|
endif
|
||||||
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
ifeq ($(RAYLIB_LIBTYPE),STATIC)
|
||||||
CFLAGS += -no-pie -D_DEFAULT_SOURCE
|
CFLAGS += -D_DEFAULT_SOURCE
|
||||||
endif
|
endif
|
||||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||||
# Explicitly enable runtime link to libraylib.so
|
# Explicitly enable runtime link to libraylib.so
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin2dMode(camera);
|
BeginMode2D(camera);
|
||||||
|
|
||||||
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
|
DrawRectangle(-6000, 320, 13000, 8000, DARKGRAY);
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ int main()
|
||||||
DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN);
|
DrawRectangle(camera.target.x, -500, 1, screenHeight*4, GREEN);
|
||||||
DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN);
|
DrawRectangle(-500, camera.target.y, screenWidth*4, 1, GREEN);
|
||||||
|
|
||||||
End2dMode();
|
EndMode2D();
|
||||||
|
|
||||||
DrawText("SCREEN AREA", 640, 10, 20, RED);
|
DrawText("SCREEN AREA", 640, 10, 20, RED);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin3dMode(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
|
DrawPlane((Vector3){ 0.0f, 0.0f, 0.0f }, (Vector2){ 32.0f, 32.0f }, LIGHTGRAY); // Draw ground
|
||||||
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
|
DrawCube((Vector3){ -16.0f, 2.5f, 0.0f }, 1.0f, 5.0f, 32.0f, BLUE); // Draw a blue wall
|
||||||
|
|
@ -75,7 +75,7 @@ int main()
|
||||||
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
|
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, MAROON);
|
||||||
}
|
}
|
||||||
|
|
||||||
End3dMode();
|
EndMode3D();
|
||||||
|
|
||||||
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f));
|
DrawRectangle( 10, 10, 220, 70, Fade(SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines( 10, 10, 220, 70, BLUE);
|
DrawRectangleLines( 10, 10, 220, 70, BLUE);
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera;
|
Camera3D camera;
|
||||||
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
|
camera.position = (Vector3){ 10.0f, 10.0f, 10.0f }; // Camera position
|
||||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
|
@ -50,14 +51,14 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin3dMode(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
EndMode3D();
|
||||||
|
|
||||||
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
|
DrawRectangle( 10, 10, 320, 133, Fade(SKYBLUE, 0.5f));
|
||||||
DrawRectangleLines( 10, 10, 320, 133, BLUE);
|
DrawRectangleLines( 10, 10, 320, 133, BLUE);
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,12 @@ int main()
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
|
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode");
|
||||||
|
|
||||||
// Define the camera to look into our 3d world
|
// Define the camera to look into our 3d world
|
||||||
Camera camera;
|
Camera3D camera;
|
||||||
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
|
camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position
|
||||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
|
|
@ -46,14 +47,14 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin3dMode(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
|
DrawText("Welcome to the third dimension!", 10, 40, 20, DARKGRAY);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ int main()
|
||||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||||
|
camera.type = CAMERA_PERSPECTIVE; // Camera mode type
|
||||||
|
|
||||||
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
|
Vector3 cubePosition = { 0.0f, 1.0f, 0.0f };
|
||||||
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
|
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
|
||||||
|
|
@ -63,7 +64,7 @@ int main()
|
||||||
|
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
Begin3dMode(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
if (collision)
|
if (collision)
|
||||||
{
|
{
|
||||||
|
|
@ -81,7 +82,7 @@ int main()
|
||||||
DrawRay(ray, MAROON);
|
DrawRay(ray, MAROON);
|
||||||
DrawGrid(10, 1.0f);
|
DrawGrid(10, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
EndMode3D();
|
||||||
|
|
||||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ int main()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 0.8f;
|
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 2.0f;
|
||||||
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 0.8f;
|
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 2.0f;
|
||||||
if (IsKeyDown(KEY_UP)) ballPosition.y -= 0.8f;
|
if (IsKeyDown(KEY_UP)) ballPosition.y -= 2.0f;
|
||||||
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 0.8f;
|
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 2.0f;
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,14 @@ int main()
|
||||||
|
|
||||||
BeginVrDrawing();
|
BeginVrDrawing();
|
||||||
|
|
||||||
Begin3dMode(camera);
|
BeginMode3D(camera);
|
||||||
|
|
||||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
|
||||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
|
||||||
|
|
||||||
DrawGrid(40, 1.0f);
|
DrawGrid(40, 1.0f);
|
||||||
|
|
||||||
End3dMode();
|
EndMode3D();
|
||||||
|
|
||||||
EndVrDrawing();
|
EndVrDrawing();
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue