浏览代码

examples/renderer/10-geometry: Fixes and cleanups.

Ryan C. Gordon 1 年之前
父节点
当前提交
37d62deca1
共有 1 个文件被更改,包括 2 次插入10 次删除
  1. 2 10
      examples/renderer/10-geometry/geometry.c

+ 2 - 10
examples/renderer/10-geometry/geometry.c

@@ -84,6 +84,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
     const float size = 200.0f + (200.0f * scale);
     const float size = 200.0f + (200.0f * scale);
 
 
     SDL_Vertex vertices[4];
     SDL_Vertex vertices[4];
+    int i;
 
 
     /* as you can see from this, rendering draws over whatever was drawn before it. */
     /* as you can see from this, rendering draws over whatever was drawn before it. */
     SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);  /* black, full alpha */
     SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);  /* black, full alpha */
@@ -105,15 +106,6 @@ SDL_AppResult SDL_AppIterate(void *appstate)
     vertices[2].color.b = 1.0f;
     vertices[2].color.b = 1.0f;
     vertices[2].color.a = 1.0f;
     vertices[2].color.a = 1.0f;
 
 
-#if 0
-typedef struct SDL_Vertex
-{
-    SDL_FPoint position;        /**< Vertex position, in SDL_Renderer coordinates  */
-    SDL_FColor color;           /**< Vertex color */
-    SDL_FPoint tex_coord;       /**< Normalized texture coordinates, if needed */
-} SDL_Vertex;
-#endif
-
     SDL_RenderGeometry(renderer, NULL, vertices, 3, NULL, 0);
     SDL_RenderGeometry(renderer, NULL, vertices, 3, NULL, 0);
 
 
     /* you can also map a texture to the geometry! Texture coordinates go from 0.0f to 1.0f. That will be the location
     /* you can also map a texture to the geometry! Texture coordinates go from 0.0f to 1.0f. That will be the location
@@ -140,7 +132,7 @@ typedef struct SDL_Vertex
        using indices, to get the whole thing on the screen: */
        using indices, to get the whole thing on the screen: */
 
 
     /* Let's just move this over so it doesn't overlap... */
     /* Let's just move this over so it doesn't overlap... */
-    for (int i = 0; i < 3; i++) {
+    for (i = 0; i < 3; i++) {
         vertices[i].position.x += 450;
         vertices[i].position.x += 450;
     }
     }