Skip to content

MSVC build fix #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/core/core_world_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main() {
camera.Update(); // Update camera

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

// Draw
Expand Down
6 changes: 3 additions & 3 deletions examples/models/models_first_person_maze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(void)

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

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

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

// Draw player position radar
Expand Down
4 changes: 2 additions & 2 deletions examples/physics/physics_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ int main(void)

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

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

needsReset = false;
Expand Down
4 changes: 2 additions & 2 deletions examples/text/text_font_loading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ int main() {

if (!useTtf)
{
fontBm.DrawText(msg, (Vector2){ 20.0f, 100.0f }, fontBm.baseSize, 2, MAROON);
fontBm.DrawText(msg, Vector2{ 20.0f, 100.0f }, fontBm.baseSize, 2, MAROON);
DrawText("Using BMFont (Angelcode) imported", 20, GetScreenHeight() - 30, 20, GRAY);
}
else
{
fontTtf.DrawText(msg, (Vector2){ 20.0f, 100.0f }, fontTtf.baseSize, 2, LIME);
fontTtf.DrawText(msg, Vector2{ 20.0f, 100.0f }, fontTtf.baseSize, 2, LIME);
DrawText("Using TTF font generated", 20, GetScreenHeight() - 30, 20, GRAY);
}
}
Expand Down
4 changes: 2 additions & 2 deletions include/Camera3D.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Camera3D : public ::Camera3D {
* @param projection Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
*/
Camera3D(::Vector3 position,
::Vector3 target = (::Vector3){0.0f, 0.0f, 0.0f},
::Vector3 up = (::Vector3){0.0f, 1.0f, 0.0f},
::Vector3 target = ::Vector3{0.0f, 0.0f, 0.0f},
::Vector3 up = ::Vector3{0.0f, 1.0f, 0.0f},
float fovy = 0,
int projection = CAMERA_PERSPECTIVE
) : ::Camera3D{position, target, up, fovy, projection} {}
Expand Down
6 changes: 5 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ set(CTEST_CUSTOM_TESTS_IGNORE pkg-config--static)

# Executable
add_executable(raylib_test raylib_test.cpp)
target_compile_options(raylib_test PRIVATE -Wall -Wextra -Wconversion -Wsign-conversion)
if (MSVC)
target_compile_options(raylib_test PRIVATE /Wall /W4)
else()
target_compile_options(raylib_test PRIVATE -Wall -Wextra -Wconversion -Wsign-conversion)
endif()
target_link_libraries(raylib_test raylib-cpp raylib)

# Test
Expand Down