summaryrefslogtreecommitdiffhomepage
path: root/examples/shaders
diff options
context:
space:
mode:
authorJeffery Myers <[email protected]>2021-10-25 01:21:16 -0700
committerGitHub <[email protected]>2021-10-25 10:21:16 +0200
commitdaeccd03ace3eacf7907ecca1a697c7d00961cf4 (patch)
tree0be2045a1003eed50c1456fd1a380ff970837233 /examples/shaders
parent086f76ba7abefb1b34e1baa353c5f69dfc5dafdc (diff)
downloadraylib-daeccd03ace3eacf7907ecca1a697c7d00961cf4.tar.gz
raylib-daeccd03ace3eacf7907ecca1a697c7d00961cf4.zip
Fix VC warnings for examples (#2085)
Diffstat (limited to 'examples/shaders')
-rw-r--r--examples/shaders/shaders_mesh_instancing.c20
-rw-r--r--examples/shaders/shaders_spotlight.c16
2 files changed, 18 insertions, 18 deletions
diff --git a/examples/shaders/shaders_mesh_instancing.c b/examples/shaders/shaders_mesh_instancing.c
index 11662f73..339b9379 100644
--- a/examples/shaders/shaders_mesh_instancing.c
+++ b/examples/shaders/shaders_mesh_instancing.c
@@ -67,14 +67,14 @@ int main(void)
// Scatter random cubes around
for (int i = 0; i < MAX_INSTANCES; i++)
{
- x = GetRandomValue(-50, 50);
- y = GetRandomValue(-50, 50);
- z = GetRandomValue(-50, 50);
+ x = (float)GetRandomValue(-50, 50);
+ y = (float)GetRandomValue(-50, 50);
+ z = (float)GetRandomValue(-50, 50);
translations[i] = MatrixTranslate(x, y, z);
- x = GetRandomValue(0, 360);
- y = GetRandomValue(0, 360);
- z = GetRandomValue(0, 360);
+ x = (float)GetRandomValue(0, 360);
+ y = (float)GetRandomValue(0, 360);
+ z = (float)GetRandomValue(0, 360);
Vector3 axis = Vector3Normalize((Vector3){ x, y, z });
float angle = (float)GetRandomValue(0, 10)*DEG2RAD;
@@ -136,11 +136,11 @@ int main(void)
if (IsKeyDown(KEY_NINE)) groups = 9;
if (IsKeyDown(KEY_W)) { groups = 7; amp = 25; speed = 18; variance = 0.70f; }
- if (IsKeyDown(KEY_EQUAL)) speed = (speed <= (fps*0.25f))? (fps*0.25f) : (speed*0.95f);
- if (IsKeyDown(KEY_KP_ADD)) speed = (speed <= (fps*0.25f))? (fps*0.25f) : (speed*0.95f);
+ if (IsKeyDown(KEY_EQUAL)) speed = (speed <= (fps*0.25f))? (int)(fps*0.25f) : (int)(speed*0.95f);
+ if (IsKeyDown(KEY_KP_ADD)) speed = (speed <= (fps*0.25f))? (int)(fps*0.25f) : (int)(speed*0.95f);
- if (IsKeyDown(KEY_MINUS)) speed = fmaxf(speed*1.02f, speed + 1);
- if (IsKeyDown(KEY_KP_SUBTRACT)) speed = fmaxf(speed*1.02f, speed + 1);
+ if (IsKeyDown(KEY_MINUS)) speed = (int)fmaxf(speed*1.02f, speed + 1);
+ if (IsKeyDown(KEY_KP_SUBTRACT)) speed = (int)fmaxf(speed*1.02f, speed + 1);
// Update the light shader with the camera view position
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
diff --git a/examples/shaders/shaders_spotlight.c b/examples/shaders/shaders_spotlight.c
index 892093d7..bdc2a0aa 100644
--- a/examples/shaders/shaders_spotlight.c
+++ b/examples/shaders/shaders_spotlight.c
@@ -120,14 +120,14 @@ int main(void)
// and initialize the shader locations
for (int i = 0; i < MAX_SPOTS; i++)
{
- spots[i].pos.x = GetRandomValue(64.0f, screenWidth - 64.0f);
- spots[i].pos.y = GetRandomValue(64.0f, screenHeight - 64.0f);
+ spots[i].pos.x = (float)GetRandomValue(64, screenWidth - 64);
+ spots[i].pos.y = (float)GetRandomValue(64, screenHeight - 64);
spots[i].vel = (Vector2){ 0, 0 };
while ((fabs(spots[i].vel.x) + fabs(spots[i].vel.y)) < 2)
{
- spots[i].vel.x = GetRandomValue(-400.f, 40.0f) / 10.0f;
- spots[i].vel.y = GetRandomValue(-400.f, 40.0f) / 10.0f;
+ spots[i].vel.x = GetRandomValue(-400, 40) / 10.0f;
+ spots[i].vel.y = GetRandomValue(-400, 40) / 10.0f;
}
spots[i].inner = 28.0f * (i + 1);
@@ -190,8 +190,8 @@ int main(void)
for (int i = 0; i < 16; i++)
{
DrawTexture(texRay,
- (screenWidth/2.0f) + cos((frameCounter + i*8)/51.45f)*(screenWidth/2.2f) - 32,
- (screenHeight/2.0f) + sin((frameCounter + i*8)/17.87f)*(screenHeight/4.2f), WHITE);
+ (int)((screenWidth/2.0f) + cos((frameCounter + i*8)/51.45f)*(screenWidth/2.2f) - 32),
+ (int)((screenHeight/2.0f) + sin((frameCounter + i*8)/17.87f)*(screenHeight/4.2f)), WHITE);
}
// Draw spot lights
@@ -206,8 +206,8 @@ int main(void)
DrawFPS(10, 10);
DrawText("Move the mouse!", 10, 30, 20, GREEN);
- DrawText("Pitch Black", screenWidth*0.2f, screenHeight/2, 20, GREEN);
- DrawText("Dark", screenWidth*.66f, screenHeight/2, 20, GREEN);
+ DrawText("Pitch Black", (int)(screenWidth*0.2f), screenHeight/2, 20, GREEN);
+ DrawText("Dark", (int)(screenWidth*.66f), screenHeight/2, 20, GREEN);
EndDrawing();