Skip to content

Commit db4ed5a

Browse files
committed
Use initializer list constructor
instead of type conversion from initializer list. MSVC does not allow this type of conversion.
1 parent 8ddc4e0 commit db4ed5a

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

examples/core/core_world_screen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ int main() {
4242
camera.Update(); // Update camera
4343

4444
// Calculate cube screen space position (with a little offset to be in top)
45-
cubeScreenPosition = GetWorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
45+
cubeScreenPosition = GetWorldToScreen(Vector3{cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
4646
//----------------------------------------------------------------------------------
4747

4848
// Draw

examples/models/models_first_person_maze.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int main(void)
2525

2626
raylib::Image imMap("resources/cubicmap.png"); // Load cubicmap image (RAM)
2727
raylib::Texture cubicmap(imMap); // Convert image to texture to display (VRAM)
28-
Mesh mesh = raylib::Mesh::Cubicmap(imMap, (Vector3){ 1.0f, 1.0f, 1.0f });
28+
Mesh mesh = raylib::Mesh::Cubicmap(imMap, Vector3{ 1.0f, 1.0f, 1.0f });
2929
raylib::Model model(mesh);
3030

3131
// NOTE: By default each cube is mapped to one part of texture atlas
@@ -75,7 +75,7 @@ int main(void)
7575
{
7676
if ((mapPixels[y*cubicmap.width + x].r == 255) && // Collision: white pixel, only check R channel
7777
(playerPos.CheckCollisionCircle(playerRadius,
78-
(Rectangle){ mapPosition.x - 0.5f + x*1.0f, mapPosition.z - 0.5f + y*1.0f, 1.0f, 1.0f })))
78+
Rectangle{ mapPosition.x - 0.5f + x*1.0f, mapPosition.z - 0.5f + y*1.0f, 1.0f, 1.0f })))
7979
{
8080
// Collision detected, reset camera position
8181
camera.position = oldCamPos;
@@ -97,7 +97,7 @@ int main(void)
9797
}
9898
camera.EndMode();
9999

100-
cubicmap.Draw((Vector2){ static_cast<float>(GetScreenWidth() - cubicmap.width*4 - 20), 20 }, 0.0f, 4.0f, WHITE);
100+
cubicmap.Draw(Vector2{ static_cast<float>(GetScreenWidth() - cubicmap.width*4 - 20), 20 }, 0.0f, 4.0f, WHITE);
101101
DrawRectangleLines(GetScreenWidth() - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN);
102102

103103
// Draw player position radar

examples/physics/physics_demo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ int main(void)
5959

6060
if (needsReset)
6161
{
62-
floor = physics.CreateBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
62+
floor = physics.CreateBodyRectangle(Vector2{ screenWidth/2, screenHeight }, 500, 100, 10);
6363
floor->enabled = false;
6464

65-
circle = physics.CreateBodyCircle((Vector2){ screenWidth/2, screenHeight/2 }, 45, 10);
65+
circle = physics.CreateBodyCircle(Vector2{ screenWidth/2, screenHeight/2 }, 45, 10);
6666
circle->enabled = false;
6767

6868
needsReset = false;

examples/text/text_font_loading.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ int main() {
6666

6767
if (!useTtf)
6868
{
69-
fontBm.DrawText(msg, (Vector2){ 20.0f, 100.0f }, fontBm.baseSize, 2, MAROON);
69+
fontBm.DrawText(msg, Vector2{ 20.0f, 100.0f }, fontBm.baseSize, 2, MAROON);
7070
DrawText("Using BMFont (Angelcode) imported", 20, GetScreenHeight() - 30, 20, GRAY);
7171
}
7272
else
7373
{
74-
fontTtf.DrawText(msg, (Vector2){ 20.0f, 100.0f }, fontTtf.baseSize, 2, LIME);
74+
fontTtf.DrawText(msg, Vector2{ 20.0f, 100.0f }, fontTtf.baseSize, 2, LIME);
7575
DrawText("Using TTF font generated", 20, GetScreenHeight() - 30, 20, GRAY);
7676
}
7777
}

include/Camera3D.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class Camera3D : public ::Camera3D {
2525
* @param projection Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
2626
*/
2727
Camera3D(::Vector3 position,
28-
::Vector3 target = (::Vector3){0.0f, 0.0f, 0.0f},
29-
::Vector3 up = (::Vector3){0.0f, 1.0f, 0.0f},
28+
::Vector3 target = ::Vector3{0.0f, 0.0f, 0.0f},
29+
::Vector3 up = ::Vector3{0.0f, 1.0f, 0.0f},
3030
float fovy = 0,
3131
int projection = CAMERA_PERSPECTIVE
3232
) : ::Camera3D{position, target, up, fovy, projection} {}

0 commit comments

Comments
 (0)