From 6c115f087da1622281ea79117fad1215bfdf27b3 Mon Sep 17 00:00:00 2001 From: Yaroslav Orlianskyi Date: Sun, 5 Jun 2022 18:50:53 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B8=D1=82=D1=8C=20'f?= =?UTF-8?q?inal/game.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- final/game.c | 60 ---------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 final/game.c diff --git a/final/game.c b/final/game.c deleted file mode 100644 index f66c671..0000000 --- a/final/game.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -//#include - -#define mapWidth 80 -#define mapHeight 25 - -typedef struct SObject{ - float x,y; - float Witdth, Height; -}TObject; - -char map[mapHeight][mapWidth+1]; -TObject mario; - -void ClearMap(){ - for(int i = 0; i < mapWidth; i++) - map[0][i] = '.'; - map[0][mapWidth] = '\0'; - for(int j = 0; j < mapHeight; j++) - sprintf(map[j], map[0]); -} - -void ShowMap(){ - map[mapHeight-1][mapWidth-1] = '\0'; - for(int i = 0; i < mapHeight; i++) - printf("%s", map[i]); -} - -void SetObjectPos(TObject *obj, float xPos, float yPos){ - (*obj).x = xPos; - (*obj).y = yPos; -} - -void InitObject(TObject *obj, float xPos, float yPos, float oWidth, float oHeight){ - SetObjectPos(obj, xPos, yPos); - (*obj).Witdth = oWidth; - (*obj).Height = oHeight; -} - -void PutObjectOnMap(TObject obj){ - int ix = (int)round(obj.x); - int iy = (int)round(obj.y); - int iWidth = (int)round(obj.Witdth); - int iHeight = (int)round(obj.Height); - - for(int i = ix; i < (ix + iWidth); i++) - for(int j = iy; j < (iy + iHeight); j++) - map[j][i] = '@'; -} - -int main() -{ - InitObject(&mario, 39, 10, 3, 3); - ClearMap(); - PutObjectOnMap(mario); - ShowMap(); - return 0; -}