flappychik

Silly SDL2 game
git clone git://bsandro.tech/flappychik
Log | Files | Refs

commit 4573fc30325928ff2d87f78b9618e4056609c452
parent ce79c14674a867237d45c54431e05f3efb3acfda
Author: bsandro <brian.drosan@gmail.com>
Date:   Mon, 14 Feb 2022 04:08:06 +0200

rotating chikaiKnife

Diffstat:
Mmain.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/main.c b/main.c @@ -12,7 +12,7 @@ #endif #define FPS 60 -#define SPEED 240 // pixels per second +#define SPEED 80 // pixels per second int main(int argc, char *argv[]) { (void)argc; @@ -42,6 +42,7 @@ int main(int argc, char *argv[]) { SDL_RenderCopy(renderer, tex_bg, NULL, NULL); SDL_Rect knife_rect = {0, 0, 56, 56}; + int knife_angle = 0; SDL_RenderCopy(renderer, tex_knife, NULL, &knife_rect); SDL_RenderPresent(renderer); @@ -66,8 +67,10 @@ int main(int argc, char *argv[]) { knife_rect.x += offset; knife_rect.y += offset; + knife_angle += 1; + knife_angle %= 360; SDL_RenderCopy(renderer, tex_bg, NULL, NULL); - SDL_RenderCopy(renderer, tex_knife, NULL, &knife_rect); + SDL_RenderCopyEx(renderer, tex_knife, NULL, &knife_rect, knife_angle, NULL, SDL_FLIP_NONE); SDL_RenderPresent(renderer); printf("frame time: %llu\n", ftime);