@@ -45,7 +45,10 @@ static void FreeMeshBuilder(MeshBuilder *mb);
4545static Mesh BuildMesh (MeshBuilder * mb );
4646static Mesh GenMeshDecal (Model inputModel , Matrix projection , float decalSize , float decalOffset );
4747static Vector3 ClipSegment (Vector3 v0 , Vector3 v1 , Vector3 p , float s );
48- #define FreeDecalMeshData () GenMeshDecal((Model){ .meshCount = -1.0f }, (Matrix){ 0 }, 0.0f, 0.0f)
48+ inline void FreeDecalMeshData ()
49+ {
50+ GenMeshDecal ((Model ) { .meshCount = -1 }, (Matrix ) { 0 }, 0.0f , 0.0f );
51+ }
4952static bool GuiButton (Rectangle rec , const char * label );
5053
5154//------------------------------------------------------------------------------------
@@ -198,12 +201,12 @@ int main(void)
198201 EndMode3D ();
199202
200203 float yPos = 10 ;
201- float x0 = GetScreenWidth () - 300 ;
204+ float x0 = GetScreenWidth () - 300.0f ;
202205 float x1 = x0 + 100 ;
203206 float x2 = x1 + 100 ;
204207
205- DrawText ("Vertices" , x1 , yPos , 10 , LIME );
206- DrawText ("Triangles" , x2 , yPos , 10 , LIME );
208+ DrawText ("Vertices" , ( int ) x1 , ( int ) yPos , 10 , LIME );
209+ DrawText ("Triangles" , ( int ) x2 , ( int ) yPos , 10 , LIME );
207210 yPos += 15 ;
208211
209212 int vertexCount = 0 ;
@@ -215,43 +218,43 @@ int main(void)
215218 triangleCount += model .meshes [i ].triangleCount ;
216219 }
217220
218- DrawText ("Main model" , x0 , yPos , 10 , LIME );
219- DrawText (TextFormat ("%d" , vertexCount ), x1 , yPos , 10 , LIME );
220- DrawText (TextFormat ("%d" , triangleCount ), x2 , yPos , 10 , LIME );
221+ DrawText ("Main model" , ( int ) x0 , ( int ) yPos , 10 , LIME );
222+ DrawText (TextFormat ("%d" , vertexCount ), ( int ) x1 , ( int ) yPos , 10 , LIME );
223+ DrawText (TextFormat ("%d" , triangleCount ), ( int ) x2 , ( int ) yPos , 10 , LIME );
221224 yPos += 15 ;
222225
223226 for (int i = 0 ; i < decalCount ; i ++ )
224227 {
225228 if (i == 20 )
226229 {
227- DrawText ("..." , x0 , yPos , 10 , LIME );
230+ DrawText ("..." , ( int ) x0 , ( int ) yPos , 10 , LIME );
228231 yPos += 15 ;
229232 }
230233
231234 if (i < 20 )
232235 {
233- DrawText (TextFormat ("Decal #%d" , i + 1 ), x0 , yPos , 10 , LIME );
234- DrawText (TextFormat ("%d" , decalModels [i ].meshes [0 ].vertexCount ), x1 , yPos , 10 , LIME );
235- DrawText (TextFormat ("%d" , decalModels [i ].meshes [0 ].triangleCount ), x2 , yPos , 10 , LIME );
236+ DrawText (TextFormat ("Decal #%d" , i + 1 ), ( int ) x0 , ( int ) yPos , 10 , LIME );
237+ DrawText (TextFormat ("%d" , decalModels [i ].meshes [0 ].vertexCount ), ( int ) x1 , ( int ) yPos , 10 , LIME );
238+ DrawText (TextFormat ("%d" , decalModels [i ].meshes [0 ].triangleCount ), ( int ) x2 , ( int ) yPos , 10 , LIME );
236239 yPos += 15 ;
237240 }
238241
239242 vertexCount += decalModels [i ].meshes [0 ].vertexCount ;
240243 triangleCount += decalModels [i ].meshes [0 ].triangleCount ;
241244 }
242245
243- DrawText ("TOTAL" , x0 , yPos , 10 , LIME );
244- DrawText (TextFormat ("%d" , vertexCount ), x1 , yPos , 10 , LIME );
245- DrawText (TextFormat ("%d" , triangleCount ), x2 , yPos , 10 , LIME );
246+ DrawText ("TOTAL" , ( int ) x0 , ( int ) yPos , 10 , LIME );
247+ DrawText (TextFormat ("%d" , vertexCount ), ( int ) x1 , ( int ) yPos , 10 , LIME );
248+ DrawText (TextFormat ("%d" , triangleCount ), ( int ) x2 , ( int ) yPos , 10 , LIME );
246249 yPos += 15 ;
247250
248251 DrawText ("Hold RMB to move camera" , 10 , 430 , 10 , GRAY );
249252 DrawText ("(c) Character model and texture from kenney.nl" , screenWidth - 260 , screenHeight - 20 , 10 , GRAY );
250253
251254 // UI elements
252- if (GuiButton ((Rectangle ){ 10 , screenHeight - 100 , 100 , 60 }, showModel ? "Hide Model" : "Show Model" )) showModel = !showModel ;
255+ if (GuiButton ((Rectangle ){ 10 , screenHeight - 1000.f , 100 , 60 }, showModel ? "Hide Model" : "Show Model" )) showModel = !showModel ;
253256
254- if (GuiButton ((Rectangle ){ 10 + 110 , screenHeight - 100 , 100 , 60 }, "Clear Decals" ))
257+ if (GuiButton ((Rectangle ){ 10 + 110 , screenHeight - 100.0f , 100 , 60 }, "Clear Decals" ))
255258 {
256259 // Clear decals, unload all decal models
257260 for (int i = 0 ; i < decalCount ; i ++ ) UnloadModel (decalModels [i ]);
@@ -596,8 +599,8 @@ static bool GuiButton(Rectangle rec, const char *label)
596599 DrawRectangleRec (rec , bgColor );
597600 DrawRectangleLinesEx (rec , 2.0f , DARKGRAY );
598601
599- float fontSize = 10.0f ;
600- float textWidth = MeasureText (label , fontSize );
602+ int fontSize = 10 ;
603+ int textWidth = MeasureText (label , fontSize );
601604
602605 DrawText (label , (int )(rec .x + rec .width * 0.5f - textWidth * 0.5f ), (int )(rec .y + rec .height * 0.5f - fontSize * 0.5f ), fontSize , DARKGRAY );
603606
0 commit comments