From f0fe6164106bf7a51629d8879f2925ac75d460cc Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Wed, 27 Dec 2017 00:57:22 +0100 Subject: [PATCH] Modular makefile --- Makefile | 13 +++++++++++-- asteroids.h | 2 +- main.c | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4c71cbd..f674a67 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,14 @@ +libs = -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lSDL2_image -lSDL2_ttf +includes = -I"C:\SDL2\x32\include" +compiler = gcc +warningLevel = -Wall +sources = *.c +linker = -L"C:\SDL2\x32\lib" +target = Asteroids.exe +args = -o + all: - gcc -Wall -IC:\SDL2\x32\include *.c -LC:\SDL2\x32\lib -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lSDL2_image -lSDL2_ttf -o Asteroids.exe + $(compiler) $(warningLevel) $(includes) $(sources) $(linker) $(libs) $(args) $(target) run: - Asteroids.exe + $(target) diff --git a/asteroids.h b/asteroids.h index 378fb9d..9e8e709 100644 --- a/asteroids.h +++ b/asteroids.h @@ -25,7 +25,7 @@ typedef struct enemyStruct { Bullet * Bullets; } Enemy; -typedef struct shipStruct{ +typedef struct shipStruct { bool TurnRightButtonPressed, TurnLeftButtonPressed, ForwardButtonPressed, ShootButtonPressed, IsDead; double Rotation; Vector FacingDirection, Location, Momentum; diff --git a/main.c b/main.c index 5415373..01f239b 100644 --- a/main.c +++ b/main.c @@ -55,7 +55,7 @@ int main(int argc, char * args[]){ case SDL_KEYDOWN: if (event.key.keysym.scancode == SDL_SCANCODE_ESCAPE) running = false; break; - case SDL_MouseButtonEvent: + case SDL_MOUSEBUTTONDOWN: mousePress(event.button); break; }