├── premake-mingw.bat
├── premake-VisualStudio.bat
├── premake5
├── premake5.exe
├── premake5.osx
├── CONTRIBUTING.md
├── LICENSE
├── cameras
├── README.md
├── rlTPCamera
│ ├── README.md
│ ├── samples
│ │ └── example.cpp
│ ├── rlTPCamera.h
│ └── rlTPCamera.cpp
└── rlFPCamera
│ ├── README.md
│ ├── samples
│ └── example.cpp
│ ├── rlFPCamera.h
│ └── rlFPCamera.cpp
├── icon_tools.h
├── README.md
├── rlGeoToos
├── rlFrustum.h
└── rlFrustum.cpp
├── rlgl_namespace.h
├── rlAssets
├── example
│ └── simple_asset_loader.cpp
├── rlAssets_platforms.cpp
├── rlAssets.h
└── rlAssets.cpp
├── raylib_namespace.h
├── raymath_namespace.h
├── raylib_premake5.lua
├── premake5.lua
├── math_3d
├── math_3d.h
└── math_3d.cpp
├── raymath_operators.h
├── rlSprite
├── example
│ └── simple_flip_example.cpp
├── rlSprites.h
└── rlSprites.cpp
├── .gitignore
└── object_transform.h
/premake-mingw.bat:
--------------------------------------------------------------------------------
1 | premake5.exe gmake2
2 | pause
3 |
--------------------------------------------------------------------------------
/premake-VisualStudio.bat:
--------------------------------------------------------------------------------
1 | premake5.exe vs2022
2 | pause
3 |
--------------------------------------------------------------------------------
/premake5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/extras-cpp/HEAD/premake5
--------------------------------------------------------------------------------
/premake5.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/extras-cpp/HEAD/premake5.exe
--------------------------------------------------------------------------------
/premake5.osx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raylib-extras/extras-cpp/HEAD/premake5.osx
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Contributing to raylib-extras
2 |
3 | Thank you for taking an intrerest in contributing to raylib-extras
4 |
5 | ## Guidelines
6 |
7 | - Please Make a PR with your change or addition. Add your name to this file under Contributors. Please do not change the copyright on the file you are changing or adding.
8 | - Please follow the existing style conventions with your change.
9 | - When possible use raymath for math functions, don't make your own.
10 | - When possible break your functions up into sub functions, especially if that sub function may be useful on it's own.
11 |
12 | # Contributors
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2020-2021 Jeffery Myers
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 |
--------------------------------------------------------------------------------
/cameras/README.md:
--------------------------------------------------------------------------------
1 | ## Cameras
2 | There are 3 different camera controllers provided in raylib-extras. Each one is intended to show an example of a different way to move the camera around a scene.
3 |
4 | ### rlFPCamera
5 | This is a first person camera. It uses the traditional mouse and WASD keys for movement. It provides position and view angle data back to the calling application.
6 | See cameras/rlFPCamera/samples/example.cpp for a simple use case.
7 |
8 | 
9 |
10 | ### rlTPCamera
11 | This is a third person camera. It uses the traditional mouse and WASD keys for movement. It follows a target position and lets the user rotate around that as it moves.
12 | See cameras/rlTPCamera/samples/example.cpp for a simple use case.
13 |
14 | 
15 |
16 | ### rlFreeCamera
17 | TODO
18 |
--------------------------------------------------------------------------------
/cameras/rlTPCamera/README.md:
--------------------------------------------------------------------------------
1 | # rlTPCamera
2 | A simple third person camera controller for raylib
3 |
4 | # API
5 | All data for the third person camera is managed by the rlTPCamera class.
6 |
7 | This structure is setup by calling rlTPCamera::Init with a camera, FOV, and Position.
8 |
9 |
10 | The fov argument is the vertical field of view, 45degrees is a good starting point. The horizontal view will be computed using the aspect ratio of the screen.
11 | The position will be the inital location of the camera in world space.
12 |
13 | Once the camera is initalized, options in the camera structure can be set, such as view bob, speed, control keys, and render distance.
14 |
15 | Whenever a window, or render texture is resized rlTPCameraResizeView needs to be called for any cameras used in that space, to properly recompute the FOV.
16 |
17 | Once per frame rlTPCamera::Update with the camera should be called, this will apply any input events and move the camera.
18 | Once a camera is updated it can be used on screen or in a render texture by calling.
19 |
20 | rlTPCamera::BeginMode3D and rlTPCamera::EndMode3D. These work just like BeginMode3d and EndMode3d for raylib cameras, but use the extended features of rlTPCamera
21 |
22 |
23 |
--------------------------------------------------------------------------------
/cameras/rlFPCamera/README.md:
--------------------------------------------------------------------------------
1 | # rlFPCamera
2 | A simple first person camera controller for raylib
3 |
4 | # API
5 | All data for the first person camera is managed by the rlFPCamera class.
6 |
7 | This class is setup by calling the rlFPCamera::Setup method with a FOV, and Position.
8 | ```
9 | Setup(fov, pos);
10 | ```
11 |
12 | The fov argument is the vertical field of view, 45 degrees is a good starting point. The horizontal view will be computed using the aspect ratio of the screen.
13 | The position will be the inital location of the camera in world space.
14 |
15 | Once the camera is initalized, options in the camera class can be set, such as view bob, speed, control keys, and render distance.
16 |
17 | Whenever a window, or render texture is resized rlFPCameraResizeView needs to be called for any cameras used in that space, to properly recompute the FOV.
18 |
19 | Once per frame Update should be called, this will apply any input events and move the camera.
20 | Once a camera is updated it can be used on screen or in a render texture by calling.
21 |
22 | rlFPCamera::BeginMode3D and rlFPCamera::EndMode3D. These work just like BeginMode3d and EndMode3d for raylib cameras, but use the extended features of rlFPCamera
23 |
24 |
25 |
--------------------------------------------------------------------------------
/icon_tools.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************************
2 | *
3 | * raylib-extras * Utilities and Shared Components for Raylib
4 | *
5 | * icon_tools.h * Helper for setting up a window icon
6 | *
7 | * LICENSE: ZLiB
8 | *
9 | * Copyright (c) 2020 Jeffery Myers
10 | *
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy
12 | * of this software and associated documentation files (the "Software"), to deal
13 | * in the Software without restriction, including without limitation the rights
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | * copies of the Software, and to permit persons to whom the Software is
16 | * furnished to do so, subject to the following conditions:
17 | *
18 | * The above copyright notice and this permission notice shall be included in all
19 | * copies or substantial portions of the Software.
20 | *
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | * SOFTWARE.
28 | *
29 | **********************************************************************************************/
30 |
31 | #pragma once
32 |
33 | #include "raylib.h"
34 |
35 | inline void SetupWindowIcon(const char* file)
36 | {
37 | if (!file)
38 | return;
39 |
40 | Image icon = LoadImage(file);
41 | if (!icon.data)
42 | return;
43 |
44 | ImageFormat(&icon, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
45 | SetWindowIcon(icon);
46 | UnloadImage(icon);
47 | }
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # extras-cpp
2 |
3 | Useful comonents for use the [Raylib](https://www.raylib.com/) library (C++ language version).
4 |
5 | # Building
6 | raylib-extras is setup to use premake to generate static libraries and examples for Visual Studio 2022 and makefiles for gcc on linux/mac OS and mingw on windows.
7 | The system is based on game-premake and will download raylib for you. Please see https://github.com/raylib-extras/game-premake for more info.
8 |
9 | # Components
10 | raylib-extras is broken up into modular components. Most components are designed to be used standalone.
11 |
12 | ## rlColors.h
13 | C++ versions of the built in raylib colors.
14 |
15 | ## Cameras
16 | There are 3 different camera controllers provided in raylib-extras. Each one is intended to show an example of a different way to move the camera around a scene.
17 |
18 | ### rlFPCamera
19 | This is a first person camera. It uses the traditional mouse and WASD keys for movement. It provides position and view angle data back to the calling application.
20 | See cameras/rlFPCamera/samples/example.cpp for a simple use case.
21 |
22 | 
23 |
24 | ### rlTPCamera
25 | This is a third person camera. It uses the traditional mouse and WASD keys for movement. It follows a target position and lets the user rotate around that as it moves.
26 | See cameras/rlTPCamera/samples/example.cpp for a simple use case.
27 | 
28 |
29 | # Other langauges
30 | raylib-extras is broken up into seperate repositories per language.
31 |
32 | * C and C++ https://github.com/raylib-extras/extras-c
33 | * C++ https://github.com/raylib-extras/extras-cpp
34 | * C# https://github.com/raylib-extras/extras-cs
35 |
36 |
--------------------------------------------------------------------------------
/rlGeoToos/rlFrustum.h:
--------------------------------------------------------------------------------
1 | /**********************************************************************************************
2 | *
3 | * raylibExtras * Utilities and Shared Components for Raylib
4 | *
5 | * RLAssets * Simple Asset Managment System for Raylib
6 | *
7 | * LICENSE: MIT
8 | *
9 | * Copyright (c) 2020 Jeffery Myers
10 | *
11 | * Permission is hereby granted, free of charge, to any person obtaining a copy
12 | * of this software and associated documentation files (the "Software"), to deal
13 | * in the Software without restriction, including without limitation the rights
14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | * copies of the Software, and to permit persons to whom the Software is
16 | * furnished to do so, subject to the following conditions:
17 | *
18 | * The above copyright notice and this permission notice shall be included in all
19 | * copies or substantial portions of the Software.
20 | *
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 | * SOFTWARE.
28 | *
29 | **********************************************************************************************/
30 |
31 | #pragma once
32 |
33 | #include "raylib.h"
34 | #include "raymath.h"
35 | #include