From 2d953e1e1b46115414bd8546b0c2ba2af27b2a8d Mon Sep 17 00:00:00 2001 From: Julia09055x Date: Sun, 10 Dec 2023 21:05:11 +0100 Subject: [PATCH] Snake hat Tail und Farben angepasst --- src/render.c | 84 ++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/src/render.c b/src/render.c index 9a34d45..700abdb 100644 --- a/src/render.c +++ b/src/render.c @@ -13,67 +13,61 @@ void renderGame(){ SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); SDL_RenderClear(renderer); -//Head__________________________________________________ - SDL_SetRenderDrawColor(renderer, 0, 200, 100, 255); //RGB-Farbe Kopf - SDL_Rect rect; - rect.x = (game.snake.headX * config.blockSizePx); //Abstand links - rect.y = (game.snake.headY * config.blockSizePx); //Abstand rechts - rect.w = config.blockSizePx; - rect.h = config.blockSizePx; + SDL_Rect rect; //Rechteck anlegen + rect.w = config.blockSizePx; //Breite festlegen + rect.h = config.blockSizePx; //Höhe festlegen - SDL_RenderFillRect(renderer, &rect); //Rechteck rendern +//_______Head kreieren__________________________________________________ + SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); //RGB-Farbe Kopf + rect.x = (game.snake.headX * config.blockSizePx); //Abstand links + rect.y = (game.snake.headY * config.blockSizePx); //Abstand rechts + SDL_RenderFillRect(renderer, &rect); //Rechteck rendern - //Snake-Baustein kreieren_________________________________________________________________ - for(int i = 1; i>game.snake.length; i++){ - SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); //RGB-Farbe Tail - - SDL_Rect rect; +//______Tail kreieren_________________________________________________________________ + for(int i = 1; i