From 4b380c19adf70bc214fc911ef48ebe652223b13c Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Mon, 16 Aug 2021 20:13:39 +0200 Subject: [PATCH] warnings silenciats --- .gitignore | 3 +++ asteroids.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3d2157b..ee2c96a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ *.exe .vscode *.out +asteroids +pacman +tetris diff --git a/asteroids.cpp b/asteroids.cpp index 93cd416..a57cea1 100644 --- a/asteroids.cpp +++ b/asteroids.cpp @@ -13,7 +13,7 @@ void create_rock(int size, int x = 0, int y = 0) { int i = 0; while (i<20 && model[i].num_lines > 0) { i++; } model[i].num_lines = 8; model[i].size = size; //900 - if (x == 0) { model[i].pos = { 100+rand()%600, 100+rand()%400 }; } else { model[i].pos = { x, y }; } + if (x == 0) { model[i].pos = { float(100+rand()%600), float(100+rand()%400) }; } else { model[i].pos = { float(x), float(y) }; } model[i].angle = rand()%360; model[i].speed = { (rand()%10) * (4-size) * 0.1f * SDL_cosf(model[i].angle*M_PI/180.0f), (rand()%10) * (3-size) * 0.1f * SDL_sinf(model[i].angle*M_PI/180.0f) }; float da = 0.0f; @@ -90,8 +90,8 @@ int main(int argc, char* argv[]) { } wl[model[i].num_lines] = wl[0]; SDL_RenderDrawLinesF(sdlRenderer, wl, model[i].num_lines+1); - if (bullet[i].ttl > 0) { SDL_Rect rect { bullet[i].pos.x, bullet[i].pos.y, 2, 2}; SDL_RenderDrawRect(sdlRenderer, &rect); } - if (debris[i].ttl > 0) { SDL_Rect rect { debris[i].pos.x, debris[i].pos.y, 2, 2}; SDL_RenderDrawRect(sdlRenderer, &rect); } + if (bullet[i].ttl > 0) { SDL_Rect rect { int(bullet[i].pos.x), int(bullet[i].pos.y), 2, 2}; SDL_RenderDrawRect(sdlRenderer, &rect); } + if (debris[i].ttl > 0) { SDL_Rect rect { int(debris[i].pos.x), int(debris[i].pos.y), 2, 2}; SDL_RenderDrawRect(sdlRenderer, &rect); } } SDL_RenderPresent(sdlRenderer); }