Skip to content

Commit a67348c

Browse files
author
Patrick Rye
committed
Added Makefile
Added a simple Makefile (have not tested it yet)
1 parent 586b5e7 commit a67348c

File tree

5 files changed

+43
-6
lines changed

5 files changed

+43
-6
lines changed

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Basic Make file (haven't tested it yet)
2+
CC=g++
3+
# Flags to be used
4+
CFLAGS=-w -s -Os -std=c++11
5+
# Linked libraries
6+
LDFLAGS=-lSDL2main -lSDL2 -lSDL2_image
7+
# Path to .cpp files
8+
SRCPATH = ./src/
9+
# Name of the executable made
10+
EXECUTABLE=cannon
11+
# Include Flags to look in Src folder
12+
INCLUDEFLAGS=-I. -I$(SRCPATH)
13+
14+
all: project
15+
16+
project: main.o cannonball.o config.o screen.o tick.o
17+
$(CC) $(CFLAGS) main.o cannonball.o config.o screen.o tick.o -o $(EXECUTABLE) $(LDFLAGS)
18+
19+
main.o: $(SRCPATH)main.cpp $(SRCPATH)version.h $(SRCPATH)global.h $(SRCPATH)screen.h $(SRCPATH)cannonball.h $(SRCPATH)tick.h $(SRCPATH)config.h
20+
$(CC) $(CFLAGS) $(INCLUDEFLAGS) $(SRCPATH)main.cpp -c main.o
21+
22+
cannonball.o: $(SRCPATH)cannonball.cpp $(SRCPATH)cannonball.h $(SRCPATH)screen.h
23+
$(CC) $(CFLAGS) $(INCLUDEFLAGS) $(SRCPATH)cannonball.cpp -c cannonball.o
24+
25+
config.o: $(SRCPATH)config.cpp $(SRCPATH)config.h $(SRCPATH)version.h
26+
$(CC) $(CFLAGS) $(INCLUDEFLAGS) $(SRCPATH)config.cpp -c config.o
27+
28+
screen.o: $(SRCPATH)screen.cpp $(SRCPATH)screen.h $(SRCPATH)image_ball.xpm $(SRCPATH)image_pixel.xpm
29+
$(CC) $(CFLAGS) $(INCLUDEFLAGS) $(SRCPATH)screen.cpp -c screen.o
30+
31+
tick.o: $(SRCPATH)tick.cpp $(SRCPATH)tick.h
32+
$(CC) $(CFLAGS) $(INCLUDEFLAGS) $(SRCPATH)tick.cpp -c tick.o
33+
34+
clean:
35+
rm *o $(EXECUTABLE)
36+

project/SDL-Cannon-Simulation.cbp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
</Build>
111111
<Compiler>
112112
<Add option="-std=c++11" />
113+
<Add option="-Wno-write-strings" />
113114
<Add directory="C:/MinGW/SDL2-2.0.4/i686-w64-mingw32/include" />
114115
<Add directory="../SDL2Stuff/include" />
115116
</Compiler>

src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace Global {
5757
//This is the maximum number of cannonballs which can be "alive" at a time
5858
#define DEFINED_CANNONBALL_LIMIT 20
5959
//IF this is not commented out then program will use unrealistic method that will increase velocity the closer they are together
60-
//#define DEFINED_USE_R2_VEL_MODDER
60+
#define DEFINED_USE_R2_VEL_MODDER
6161
/**********************************************************************************************************************************************************************/
6262
clsCannonball Cannonballs[DEFINED_CANNONBALL_LIMIT];
6363
/**********************************************************************************************************************************************************************/
@@ -194,7 +194,7 @@ bool checkCollide(BOX A, BOX B) { //checks if two objects (made with the BOXES c
194194
}
195195
/**********************************************************************************************************************************************************************/
196196
void doCollision(uint numA, uint numB) {
197-
dblXY Avel, Bvel, NewVel;
197+
dblXY Avel, Bvel;
198198
PP Aprops, Bprops;
199199

200200
Avel = Cannonballs[numA].getVelocity();

src/screen.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
/**********************************************************************************************************************************************************************/
22
#include "screen.h"
33
/**********************************************************************************************************************************************************************/
4+
//Include the xpm files which present the images.
5+
#include "image_ball.xpm"
6+
#include "image_pixel.xpm"
7+
/**********************************************************************************************************************************************************************/
48
clsScreen::clsScreen() {
59
window.width = Global::Config.values.uintScreenWidth;
610
window.height = Global::Config.values.uintScreenHeight;

src/screen.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
#include "config.h"
99
#include "global.h"
1010
/**********************************************************************************************************************************************************************/
11-
//Include the xpm files which present the images.
12-
#include "image_ball.xpm"
13-
#include "image_pixel.xpm"
14-
/**********************************************************************************************************************************************************************/
1511
struct stcWinAtt { //Attribute of the window
1612
uint width;
1713
uint height;

0 commit comments

Comments
 (0)