Skip to content

Commit 39d31a4

Browse files
authored
Merge pull request #96 from RobLoach/breakingchanges
Update documentation
2 parents ed473ae + aed5b28 commit 39d31a4

16 files changed

+284
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased]
7+
## [v3.5.0] - xxxx-xx-xx
8+
### Changed
9+
- Update to raylib 3.5
10+
11+
### Added
12+
- Documentation
13+
814
### Removed
9-
- Static inline Color variables (for example, `raylib::Color::RayWhite`)
15+
- Static inline Color variables (for example, `raylib::Color::RayWhite`). Use `::RAYWHITE` instead.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.11)
22
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
33
project (raylib-cpp
4-
VERSION 3.1.0
4+
VERSION 3.5.0
55
DESCRIPTION "raylib-cpp C++ Object Oriented Wrapper for raylib"
66
HOMEPAGE_URL "https://github.com/robloach/raylib-cpp"
77
LANGUAGES C CXX)

include/AudioDevice.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ class AudioDevice {
4545
}
4646
}
4747

48+
/**
49+
* Close the audio device and context.
50+
*/
4851
~AudioDevice() {
4952
Close();
5053
}

include/BoundingBox.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ class BoundingBox : public ::BoundingBox {
3535
set(box);
3636
}
3737

38+
/**
39+
* Compute mesh bounding box limits
40+
*/
3841
BoundingBox(::Mesh mesh) {
3942
set(MeshBoundingBox(mesh));
4043
}

include/Camera2D.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,23 @@ class Camera2D : public ::Camera2D {
6565
return *this;
6666
}
6767

68+
/**
69+
* Returns camera 2d transform matrix
70+
*/
6871
inline Matrix GetMatrix() const {
6972
return ::GetCameraMatrix2D(*this);
7073
}
7174

75+
/**
76+
* Returns the screen space position for a 3d world space position
77+
*/
7278
inline Vector2 GetWorldToScreen2D(Vector2 position) const {
7379
return ::GetWorldToScreen2D(position, *this);
7480
}
7581

82+
/**
83+
* Returns the world space position for a 2d camera screen space position
84+
*/
7685
inline Vector2 GetScreenToWorld2D(Vector2 position) const {
7786
return ::GetScreenToWorld2D(position, *this);
7887
}

include/Camera3D.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,45 +68,72 @@ class Camera3D : public ::Camera3D {
6868
return *this;
6969
}
7070

71+
/**
72+
* Get transform matrix for camera
73+
*/
7174
inline Matrix GetMatrix() const {
7275
return ::GetCameraMatrix(*this);
7376
}
7477

78+
/**
79+
* Set camera mode (multiple camera modes available)
80+
*/
7581
inline Camera3D& SetMode(int mode) {
7682
::SetCameraMode(*this, mode);
7783
return *this;
7884
}
7985

86+
/**
87+
* Set camera alt key to combine with mouse movement (free camera)
88+
*/
8089
inline Camera3D& SetAltControl(int altKey) {
8190
::SetCameraAltControl(altKey);
8291
return *this;
8392
}
8493

94+
/**
95+
* Set camera smooth zoom key to combine with mouse (free camera)
96+
*/
8597
inline Camera3D& SetSmoothZoomControl(int szKey) {
8698
::SetCameraSmoothZoomControl(szKey);
8799
return *this;
88100
}
89101

102+
/**
103+
* Set camera move controls (1st person and 3rd person cameras)
104+
*/
90105
inline Camera3D& SetMoveControls(int frontKey, int backKey, int rightKey, int leftKey,
91106
int upKey, int downKey) {
92107
::SetCameraMoveControls(frontKey, backKey, rightKey, leftKey, upKey, downKey);
93108
return *this;
94109
}
95110

111+
/**
112+
* Update camera position for selected mode
113+
*/
96114
inline Camera3D& Update() {
97115
::UpdateCamera(this);
98116
return *this;
99117
}
100118

119+
/**
120+
* Update VR tracking (position and orientation) and camera
121+
*/
101122
inline Camera3D& UpdateVrTracking() {
102123
::UpdateVrTracking(this);
103124
return *this;
104125
}
105126

127+
/**
128+
* Returns a ray trace from mouse position
129+
*/
106130
inline Ray GetMouseRay(::Vector2 mousePosition) const {
107131
return ::GetMouseRay(mousePosition, *this);
108132
}
109133

134+
/**
135+
* Returns the screen space position for a 3d world space position
136+
*/
110137
inline Vector2 GetWorldToScreen(::Vector3 position) const {
111138
return ::GetWorldToScreen(position, *this);
112139
}

include/Color.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,23 @@ class Color : public ::Color {
7373

7474
operator int() const { return ::ColorToInt(*this); }
7575

76+
/**
77+
* Returns color with alpha applied, alpha goes from 0.0f to 1.0f
78+
*/
7679
Color Fade(float alpha) const {
7780
return ::Fade(*this, alpha);
7881
}
7982

83+
/**
84+
* Returns Color normalized as float [0..1]
85+
*/
8086
Vector4 Normalize() const {
8187
return ::ColorNormalize(*this);
8288
}
8389

90+
/**
91+
* Returns HSV values for a Color
92+
*/
8493
Vector3 ToHSV() const {
8594
return ::ColorToHSV(*this);
8695
}
@@ -121,6 +130,9 @@ class Color : public ::Color {
121130
return *this;
122131
}
123132

133+
/**
134+
* Draw a line
135+
*/
124136
inline Color& DrawLine(int startPosX, int startPosY, int endPosX, int endPosY) {
125137
::DrawLine(startPosX, startPosY, endPosX, endPosY, *this);
126138
return *this;

include/Gamepad.hpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,42 +52,72 @@ class Gamepad {
5252

5353
operator int() const { return number; }
5454

55+
/**
56+
* Detect if a gamepad is available
57+
*/
5558
inline bool IsAvailable() const {
5659
return ::IsGamepadAvailable(number);
5760
}
5861

62+
/**
63+
* Check gamepad name (if available)
64+
*/
5965
inline bool IsName(const std::string& name) const {
6066
return ::IsGamepadName(number, name.c_str());
6167
}
6268

69+
/**
70+
* Return gamepad internal name id
71+
*/
6372
std::string GetName() const {
6473
return std::string(::GetGamepadName(number));
6574
}
6675

76+
/**
77+
* Detect if a gamepad button has been pressed once
78+
*/
6779
inline bool IsButtonPressed(int button) const {
6880
return ::IsGamepadButtonPressed(number, button);
6981
}
7082

83+
/**
84+
* Detect if a gamepad button is being pressed
85+
*/
7186
inline bool IsButtonDown(int button) const {
7287
return ::IsGamepadButtonDown(number, button);
7388
}
7489

90+
/**
91+
* Detect if a gamepad button has been released once
92+
*/
7593
inline bool IsButtonReleased(int button) const {
7694
return ::IsGamepadButtonReleased(number, button);
7795
}
7896

97+
/**
98+
* Detect if a gamepad button is NOT being pressed
99+
*/
79100
inline bool IsButtonUp(int button) const {
80101
return ::IsGamepadButtonUp(number, button);
81102
}
82103

104+
/**
105+
* Get the last gamepad button pressed
106+
*/
83107
inline int GetButtonPressed() const {
84108
return ::GetGamepadButtonPressed();
85109
}
86110

111+
/**
112+
* Return gamepad axis count for a gamepad
113+
*/
87114
inline int GetAxisCount() const {
88115
return ::GetGamepadAxisCount(number);
89116
}
90117

118+
/**
119+
* Return axis movement value for a gamepad axis
120+
*/
91121
inline float GetAxisMovement(int axis) const {
92122
return ::GetGamepadAxisMovement(number, axis);
93123
}

include/Image.hpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,39 @@ class Image : public ::Image {
9595
return ::GenImageGradientH(width, height, left, right);
9696
}
9797

98+
/**
99+
* Generate image: radial gradient
100+
*/
98101
static Image GenGradientRadial(int width, int height, float density,
99102
Color inner, Color outer) {
100103
return ::GenImageGradientRadial(width, height, density, inner, outer);
101104
}
102105

106+
/**
107+
* Generate image: checked
108+
*/
103109
static Image GenChecked(int width, int height, int checksX, int checksY,
104110
Color col1, Color col2) {
105111
return ::GenImageChecked(width, height, checksX, checksY, col1, col2);
106112
}
107113

114+
/**
115+
* Generate image: white noise
116+
*/
108117
static Image GenWhiteNoise(int width, int height, float factor) {
109118
return ::GenImageWhiteNoise(width, height, factor);
110119
}
111120

121+
/**
122+
* Generate image: perlin noise
123+
*/
112124
static Image GenPerlinNoise(int width, int height, int offsetX, int offsetY, float scale) {
113125
return ::GenImagePerlinNoise(width, height, offsetX, offsetY, scale);
114126
}
115127

128+
/**
129+
* Generate image: cellular algorithm. Bigger tileSize means bigger cells
130+
*/
116131
static Image GenCellular(int width, int height, int tileSize) {
117132
return ::GenImageCellular(width, height, tileSize);
118133
}
@@ -288,65 +303,110 @@ class Image : public ::Image {
288303
return *this;
289304
}
290305

306+
/**
307+
* Flip image vertically
308+
*/
291309
inline Image& FlipVertical() {
292310
::ImageFlipVertical(this);
293311
return *this;
294312
}
295313

314+
/**
315+
* Flip image horizontally
316+
*/
296317
inline Image& FlipHorizontal() {
297318
::ImageFlipHorizontal(this);
298319
return *this;
299320
}
300321

322+
/**
323+
* Rotate image clockwise 90deg
324+
*/
301325
inline Image& RotateCW() {
302326
::ImageRotateCW(this);
303327
return *this;
304328
}
305329

330+
/**
331+
* Rotate image counter-clockwise 90deg
332+
*/
306333
inline Image& RotateCCW() {
307334
::ImageRotateCCW(this);
308335
return *this;
309336
}
310337

338+
/**
339+
* Modify image color: tint
340+
*/
311341
inline Image& ColorTint(::Color color = WHITE) {
312342
::ImageColorTint(this, color);
313343
return *this;
314344
}
315345

346+
/**
347+
* Modify image color: invert
348+
*/
316349
inline Image& ColorInvert() {
317350
::ImageColorInvert(this);
318351
return *this;
319352
}
320353

354+
/**
355+
* Modify image color: grayscale
356+
*/
321357
inline Image& ColorGrayscale() {
322358
::ImageColorGrayscale(this);
323359
return *this;
324360
}
325361

362+
/**
363+
* Modify image color: contrast
364+
*
365+
* @param contrast Contrast values between -100 and 100
366+
*/
326367
inline Image& ColorContrast(float contrast) {
327368
::ImageColorContrast(this, contrast);
328369
return *this;
329370
}
330371

372+
/**
373+
* Modify image color: brightness
374+
*
375+
* @param brightness Brightness values between -255 and 255
376+
*/
331377
inline Image& ColorBrightness(int brightness) {
332378
::ImageColorBrightness(this, brightness);
333379
return *this;
334380
}
335381

382+
/**
383+
* Modify image color: replace color
384+
*/
336385
inline Image& ColorReplace(::Color color, ::Color replace) {
337386
::ImageColorReplace(this, color, replace);
338387
return *this;
339388
}
340389

390+
/**
391+
* Get image alpha border rectangle
392+
*
393+
* @param threshold Threshold is defined as a percentatge: 0.0f -> 1.0f
394+
*/
341395
inline Rectangle GetAlphaBorder(float threshold) const {
342396
return ::GetImageAlphaBorder(*this, threshold);
343397
}
344398

399+
/**
400+
* Clear image background with given color
401+
*/
345402
inline Image& ClearBackground(::Color color = WHITE) {
346403
::ImageClearBackground(this, color);
347404
return *this;
348405
}
349406

407+
/**
408+
* Draw pixel within an image
409+
*/
350410
inline Image& DrawPixel(int posX, int posY, ::Color color) {
351411
::ImageDrawPixel(this, posX, posY, color);
352412
return *this;

0 commit comments

Comments
 (0)