瀏覽代碼

Merge pull request #854 from ChrisDill/master

Added array bounds check to textures_bunnymark
pull/856/head
Ray 5 年之前
committed by GitHub
父節點
當前提交
20bdc3bc2a
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 8 行新增5 行删除
  1. +8
    -5
      examples/textures/textures_bunnymark.c

+ 8
- 5
examples/textures/textures_bunnymark.c 查看文件

@ -54,13 +54,16 @@ int main(void)
// Create more bunnies
for (int i = 0; i < 100; i++)
{
bunnies[bunniesCount].position = GetMousePosition();
bunnies[bunniesCount].speed.x = (float)GetRandomValue(-250, 250)/60.0f;
bunnies[bunniesCount].speed.y = (float)GetRandomValue(-250, 250)/60.0f;
bunnies[bunniesCount].color = (Color){ GetRandomValue(50, 240),
if (bunniesCount < MAX_BUNNIES)
{
bunnies[bunniesCount].position = GetMousePosition();
bunnies[bunniesCount].speed.x = (float)GetRandomValue(-250, 250)/60.0f;
bunnies[bunniesCount].speed.y = (float)GetRandomValue(-250, 250)/60.0f;
bunnies[bunniesCount].color = (Color){ GetRandomValue(50, 240),
GetRandomValue(80, 240),
GetRandomValue(100, 240), 255 };
bunniesCount++;
bunniesCount++;
}
}
}

Loading…
取消
儲存