Skip to content

Commit 6f7cd3a

Browse files
[core] Camera2d comment updates (#5401)
* Make the comments on the camera 2d fields more clear about what space each one is in. * rlparser: update raylib_api.* by CI --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent ae438e8 commit 6f7cd3a

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

src/raylib.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,10 @@ typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D
334334

335335
// Camera2D, defines position/orientation in 2d space
336336
typedef struct Camera2D {
337-
Vector2 offset; // Camera offset (displacement from target)
338-
Vector2 target; // Camera target (rotation and zoom origin)
339-
float rotation; // Camera rotation in degrees
340-
float zoom; // Camera zoom (scaling), should be 1.0f by default
337+
Vector2 offset; // Camera offset (screen space offset from window origin)
338+
Vector2 target; // Camera target (world space target point that is mapped to screen space offset)
339+
float rotation; // Camera rotation in degrees (pivots around target)
340+
float zoom; // Camera zoom (scaling around target), must not be set to 0, set to 1.0f for no scale
341341
} Camera2D;
342342

343343
// Mesh, vertex data and vao/vbo

tools/rlparser/output/raylib_api.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,22 +769,22 @@
769769
{
770770
"type": "Vector2",
771771
"name": "offset",
772-
"description": "Camera offset (displacement from target)"
772+
"description": "Camera offset (screen space offset from window origin)"
773773
},
774774
{
775775
"type": "Vector2",
776776
"name": "target",
777-
"description": "Camera target (rotation and zoom origin)"
777+
"description": "Camera target (world space target point that is mapped to screen space offset)"
778778
},
779779
{
780780
"type": "float",
781781
"name": "rotation",
782-
"description": "Camera rotation in degrees"
782+
"description": "Camera rotation in degrees (pivots around target)"
783783
},
784784
{
785785
"type": "float",
786786
"name": "zoom",
787-
"description": "Camera zoom (scaling), should be 1.0f by default"
787+
"description": "Camera zoom (scaling around target), must not be set to 0, set to 1.0f for no scale"
788788
}
789789
]
790790
},

tools/rlparser/output/raylib_api.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,22 +769,22 @@ return {
769769
{
770770
type = "Vector2",
771771
name = "offset",
772-
description = "Camera offset (displacement from target)"
772+
description = "Camera offset (screen space offset from window origin)"
773773
},
774774
{
775775
type = "Vector2",
776776
name = "target",
777-
description = "Camera target (rotation and zoom origin)"
777+
description = "Camera target (world space target point that is mapped to screen space offset)"
778778
},
779779
{
780780
type = "float",
781781
name = "rotation",
782-
description = "Camera rotation in degrees"
782+
description = "Camera rotation in degrees (pivots around target)"
783783
},
784784
{
785785
type = "float",
786786
name = "zoom",
787-
description = "Camera zoom (scaling), should be 1.0f by default"
787+
description = "Camera zoom (scaling around target), must not be set to 0, set to 1.0f for no scale"
788788
}
789789
}
790790
},

tools/rlparser/output/raylib_api.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ Struct 13: Camera3D (5 fields)
399399
Struct 14: Camera2D (4 fields)
400400
Name: Camera2D
401401
Description: Camera2D, defines position/orientation in 2d space
402-
Field[1]: Vector2 offset // Camera offset (displacement from target)
403-
Field[2]: Vector2 target // Camera target (rotation and zoom origin)
404-
Field[3]: float rotation // Camera rotation in degrees
405-
Field[4]: float zoom // Camera zoom (scaling), should be 1.0f by default
402+
Field[1]: Vector2 offset // Camera offset (screen space offset from window origin)
403+
Field[2]: Vector2 target // Camera target (world space target point that is mapped to screen space offset)
404+
Field[3]: float rotation // Camera rotation in degrees (pivots around target)
405+
Field[4]: float zoom // Camera zoom (scaling around target), must not be set to 0, set to 1.0f for no scale
406406
Struct 15: Mesh (17 fields)
407407
Name: Mesh
408408
Description: Mesh, vertex data and vao/vbo

tools/rlparser/output/raylib_api.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@
155155
<Field type="int" name="projection" desc="Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC" />
156156
</Struct>
157157
<Struct name="Camera2D" fieldCount="4" desc="Camera2D, defines position/orientation in 2d space">
158-
<Field type="Vector2" name="offset" desc="Camera offset (displacement from target)" />
159-
<Field type="Vector2" name="target" desc="Camera target (rotation and zoom origin)" />
160-
<Field type="float" name="rotation" desc="Camera rotation in degrees" />
161-
<Field type="float" name="zoom" desc="Camera zoom (scaling), should be 1.0f by default" />
158+
<Field type="Vector2" name="offset" desc="Camera offset (screen space offset from window origin)" />
159+
<Field type="Vector2" name="target" desc="Camera target (world space target point that is mapped to screen space offset)" />
160+
<Field type="float" name="rotation" desc="Camera rotation in degrees (pivots around target)" />
161+
<Field type="float" name="zoom" desc="Camera zoom (scaling around target), must not be set to 0, set to 1.0f for no scale" />
162162
</Struct>
163163
<Struct name="Mesh" fieldCount="17" desc="Mesh, vertex data and vao/vbo">
164164
<Field type="int" name="vertexCount" desc="Number of vertices stored in arrays" />

0 commit comments

Comments
 (0)