ソースを参照

Added array bounds check to textures_bunnymark

pull/854/head
Chris Dill 5年前
コミット
42d57bbe00
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++;
}
}
}

読み込み中…
キャンセル
保存