Skip to content

Commit a2f6ae6

Browse files
authored
Fix warnings in examples (#4492)
Move shapes/shapes_rectangle_advanced to the correct folder in MSVC project Add core_input_virtual_controls.vcxproj back into sln file
1 parent 5e6cdf3 commit a2f6ae6

6 files changed

Lines changed: 455 additions & 48 deletions

File tree

examples/core/core_input_gamepad.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ int main(void)
196196
{
197197

198198
// Draw background: generic
199-
DrawRectangleRounded((Rectangle){ 175, 110, 460, 220}, 0.3f, 0.0f, DARKGRAY);
199+
DrawRectangleRounded((Rectangle){ 175, 110, 460, 220}, 0.3f, 16, DARKGRAY);
200200

201201
// Draw buttons: basic
202202
DrawCircle(365, 170, 12, RAYWHITE);
@@ -225,10 +225,10 @@ int main(void)
225225
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(217 + 54, 176, 30, 25, RED);
226226

227227
// Draw buttons: left-right back
228-
DrawRectangleRounded((Rectangle){ 215, 98, 100, 10}, 0.5f, 0.0f, DARKGRAY);
229-
DrawRectangleRounded((Rectangle){ 495, 98, 100, 10}, 0.5f, 0.0f, DARKGRAY);
230-
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawRectangleRounded((Rectangle){ 215, 98, 100, 10}, 0.5f, 0.0f, RED);
231-
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawRectangleRounded((Rectangle){ 495, 98, 100, 10}, 0.5f, 0.0f, RED);
228+
DrawRectangleRounded((Rectangle){ 215, 98, 100, 10}, 0.5f, 16, DARKGRAY);
229+
DrawRectangleRounded((Rectangle){ 495, 98, 100, 10}, 0.5f, 16, DARKGRAY);
230+
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawRectangleRounded((Rectangle){ 215, 98, 100, 10}, 0.5f, 16, RED);
231+
if (IsGamepadButtonDown(gamepad, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawRectangleRounded((Rectangle){ 495, 98, 100, 10}, 0.5f, 16, RED);
232232

233233
// Draw axis: left joystick
234234
Color leftGamepadColor = BLACK;

examples/core/core_input_virtual_controls.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ int main(void)
2929

3030
InitWindow(screenWidth, screenHeight, "raylib [core] example - input virtual controls");
3131

32-
const int dpadX = 90;
33-
const int dpadY = 300;
34-
const int dpadRad = 25;//radius of each pad
32+
const float dpadX = 90;
33+
const float dpadY = 300;
34+
const float dpadRad = 25.0f;//radius of each pad
3535
Color dpadColor = BLUE;
3636
int dpadKeydown = -1;//-1 if not down, else 0,1,2,3
3737

3838

3939
const float dpadCollider[4][2]= // collider array with x,y position
4040
{
41-
{dpadX,dpadY-dpadRad*1.5},//up
42-
{dpadX-dpadRad*1.5,dpadY},//left
43-
{dpadX+dpadRad*1.5,dpadY},//right
44-
{dpadX,dpadY+dpadRad*1.5}//down
41+
{dpadX,dpadY-dpadRad*1.5f},//up
42+
{dpadX-dpadRad*1.5f,dpadY},//left
43+
{dpadX+dpadRad*1.5f,dpadY},//right
44+
{dpadX,dpadY+dpadRad*1.5f}//down
4545
};
4646
const char dpadLabel[4]="XYBA";//label of Dpad
4747

@@ -57,8 +57,8 @@ int main(void)
5757
// Update
5858
//--------------------------------------------------------------------------
5959
dpadKeydown = -1; //reset
60-
float inputX=0;
61-
float inputY=0;
60+
int inputX = 0;
61+
int inputY = 0;
6262
if(GetTouchPointCount()>0)
6363
{//use touch pos
6464
inputX = GetTouchX();
@@ -97,18 +97,18 @@ int main(void)
9797
for(int i=0;i<4;i++)
9898
{
9999
//draw all pad
100-
DrawCircle(dpadCollider[i][0],dpadCollider[i][1],dpadRad,dpadColor);
100+
DrawCircleV((Vector2) { dpadCollider[i][0], dpadCollider[i][1] }, dpadRad, dpadColor);
101101
if(i!=dpadKeydown)
102102
{
103103
//draw label
104104
DrawText(TextSubtext(dpadLabel,i,1),
105-
dpadCollider[i][0]-7,
106-
dpadCollider[i][1]-8,20,BLACK);
105+
(int)dpadCollider[i][0]-7,
106+
(int)dpadCollider[i][1]-8,20,BLACK);
107107
}
108108
}
109109

110-
DrawRectangle(playerX-4,playerY-4,75,28,RED);
111-
DrawText("Player",playerX,playerY,20,WHITE);
110+
DrawRectangleRec((Rectangle) { playerX - 4, playerY - 4, 75, 28 }, RED);
111+
DrawText("Player", (int)playerX, (int)playerY, 20, WHITE);
112112
EndDrawing();
113113
//--------------------------------------------------------------------------
114114
}

examples/shapes/shapes_rectangle_advanced.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ int main(int argc, char *argv[])
290290
{
291291
// Update rectangle bounds
292292
//----------------------------------------------------------------------------------
293-
double width = GetScreenWidth()/2.0, height = GetScreenHeight()/6.0;
293+
float width = GetScreenWidth()/2.0f, height = GetScreenHeight()/6.0f;
294294
Rectangle rec = {
295-
GetScreenWidth() / 2.0 - width/2,
296-
GetScreenHeight() / 2.0 - (5)*(height/2),
295+
GetScreenWidth() / 2.0f - width/2,
296+
GetScreenHeight() / 2.0f - (5)*(height/2),
297297
width, height
298298
};
299299
//--------------------------------------------------------------------------------------
@@ -304,19 +304,19 @@ int main(int argc, char *argv[])
304304
ClearBackground(RAYWHITE);
305305

306306
// Draw All Rectangles with different roundess for each side and different gradients
307-
DrawRectangleRoundedGradientH(rec, 0.8, 0.8, 36, BLUE, RED);
307+
DrawRectangleRoundedGradientH(rec, 0.8f, 0.8f, 36, BLUE, RED);
308308

309309
rec.y += rec.height + 1;
310-
DrawRectangleRoundedGradientH(rec, 0.5, 1.0, 36, RED, PINK);
310+
DrawRectangleRoundedGradientH(rec, 0.5f, 1.0f, 36, RED, PINK);
311311

312312
rec.y += rec.height + 1;
313-
DrawRectangleRoundedGradientH(rec, 1.0, 0.5, 36, RED, BLUE);
313+
DrawRectangleRoundedGradientH(rec, 1.0f, 0.5f, 36, RED, BLUE);
314314

315315
rec.y += rec.height + 1;
316-
DrawRectangleRoundedGradientH(rec, 0.0, 1.0, 36, BLUE, BLACK);
316+
DrawRectangleRoundedGradientH(rec, 0.0f, 1.0f, 36, BLUE, BLACK);
317317

318318
rec.y += rec.height + 1;
319-
DrawRectangleRoundedGradientH(rec, 1.0, 0.0, 36, BLUE, PINK);
319+
DrawRectangleRoundedGradientH(rec, 1.0f, 0.0f, 36, BLUE, PINK);
320320
EndDrawing();
321321
//--------------------------------------------------------------------------------------
322322
}

0 commit comments

Comments
 (0)