Skip to content

Commit 0f5560a

Browse files
author
Patrick Rye
committed
Update to v1.1.3-beta
01 September 2015 Released version 1.1.3-Beta Change log: -Added: Cleanup.bat for deleting useless files -Updated: Log file to print out floating values -Added: Cannon Image
1 parent 2501ffe commit 0f5560a

File tree

11 files changed

+303
-15
lines changed

11 files changed

+303
-15
lines changed

ChangesLog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
01 September 2015
2+
Released version 1.1.3-Beta
3+
4+
Change log:
5+
-Added: Cleanup.bat for deleting useless files
6+
-Updated: Log file to print out floating values
7+
-Added: Cannon Image
8+
19
28 August 2015
210
Released version 1.1.2-Beta
311

Cleanup.bat

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@echo off
2+
:: This batch file will go through the folders and delete files that are not needed.
3+
:: Really just for personal use
4+
:: There are a lot of random files that get throw about, this batch file will delete them if they are there.
5+
:: because I'm too lazy to go searching for them myself, but I want to keep my folders clean.
6+
7+
echo Cleaning Project Folder...
8+
IF EXIST %~dp0Project\bin RMDIR /S /Q %~dp0Project\bin
9+
IF EXIST %~dp0Project\obj RMDIR /S /Q %~dp0Project\obj
10+
IF EXIST %~dp0Project\SDL-Cannon-Simulation.depend del /F %~dp0Project\SDL-Cannon-Simulation.depend
11+
IF EXIST %~dp0Project\SDL-Cannon-Simulation.layout del /F %~dp0Project\SDL-Cannon-Simulation.layout
12+
echo.
13+
14+
echo Cleaning res Folder...
15+
IF EXIST %~dp0res\boilerplate.res del /F %~dp0res\boilerplate.res
16+
echo.
17+
18+
echo Cleaning src Folder...
19+
IF EXIST %~dp0src\main.o del /F %~dp0src\main.o
20+
IF EXIST %~dp0src\cannonball.o del /F %~dp0src\cannonball.o
21+
IF EXIST %~dp0src\config.o del /F %~dp0src\config.o
22+
IF EXIST %~dp0src\tick.o del /F %~dp0src\tick.o
23+
IF EXIST %~dp0src\screen.o del /F %~dp0src\screen.o
24+
echo.
25+
26+
echo Cleaning Main Folder...
27+
IF EXIST %~dp0Config.ini del /F %~dp0Config.ini
28+
IF EXIST %~dp0gmon.out del /F %~dp0gmon.out
29+
IF EXIST %~dp0Cannon.exe del /F %~dp0Cannon.exe
30+
IF EXIST %~dp0Cannon-PRIVATE.exe del /F %~dp0Cannon-PRIVATE.exe
31+
IF EXIST %~dp0Cannon del /F %~dp0Cannon
32+
IF EXIST %~dp0Cannon-PRIVATE del /F %~dp0Cannon-PRIVATE
33+
IF EXIST %~dp0logfile.log del /F %~dp0logfile.log
34+
IF EXIST %~dp0time-log.log del /F %~dp0time-log.log
35+
echo.
36+
37+
echo All cleaning done.
38+

project/SDL-Cannon-Simulation.cbp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<Unit filename="../src/config.cpp" />
123123
<Unit filename="../src/config.h" />
124124
<Unit filename="../src/image_ball.xpm" />
125+
<Unit filename="../src/image_cannon.xpm" />
125126
<Unit filename="../src/image_sky.xpm" />
126127
<Unit filename="../src/main.cpp" />
127128
<Unit filename="../src/screen.cpp" />

res/my_icon.rc

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/cannonball.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void clsCannonball::update(void) {
7777
if (Global::blnDebugMode) {printf("Ball updated, new position (%f, %f)\n",dblLOC.x,dblLOC.y);}
7878
if (Global::Config.values.blnLogging) {
7979
FILE* logfile = fopen("logfile.log","a");
80-
fprintf(logfile,"new position (%d, %d)\n",place.x,place.y);
80+
fprintf(logfile,"(%.5f, %.5f)\n",dblLOC.x,dblLOC.y);
8181
fclose(logfile);
8282
}
8383
}

src/cannonball.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ class clsCannonball {
6363

6464
void Drag_calcvalues(void);
6565
void Drag_updateacc(void);
66-
67-
6866
};
6967
/**********************************************************************************************************************************************/
7068
#endif // __CANNONBALL_HEADER__

src/image_cannon.xpm

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
/* XPM */
2+
static char * image_cannon_xpm[] = {
3+
"48 48 174 2",
4+
" c None",
5+
". c #FFFFFF",
6+
"+ c #F7F7F7",
7+
"@ c #FEFEFE",
8+
"# c #7B7B7B",
9+
"$ c #0E0E0E",
10+
"% c #BEBEBE",
11+
"& c #E9E9E9",
12+
"* c #1D1D1D",
13+
"= c #000000",
14+
"- c #222222",
15+
"; c #555555",
16+
"> c #050505",
17+
", c #B2B2B2",
18+
"' c #B4B4B4",
19+
") c #E8E8E8",
20+
"! c #CACACA",
21+
"~ c #232323",
22+
"{ c #585858",
23+
"] c #F9F9F9",
24+
"^ c #FBFBFB",
25+
"/ c #D7D7D7",
26+
"( c #F3F3F3",
27+
"_ c #EBEBEB",
28+
": c #C6C6C6",
29+
"< c #404040",
30+
"[ c #E1E1E1",
31+
"} c #B8B8B8",
32+
"| c #070707",
33+
"1 c #767676",
34+
"2 c #DFDFDF",
35+
"3 c #A1A1A1",
36+
"4 c #868686",
37+
"5 c #727272",
38+
"6 c #575757",
39+
"7 c #363636",
40+
"8 c #0A0A0A",
41+
"9 c #6B6B6B",
42+
"0 c #AFAFAF",
43+
"a c #757575",
44+
"b c #F2F2F2",
45+
"c c #B0B0B0",
46+
"d c #777777",
47+
"e c #393939",
48+
"f c #1E1E1E",
49+
"g c #181818",
50+
"h c #111111",
51+
"i c #0D0D0D",
52+
"j c #040404",
53+
"k c #F8F8F8",
54+
"l c #BFBFBF",
55+
"m c #424242",
56+
"n c #FAFAFA",
57+
"o c #FCFCFC",
58+
"p c #EEEEEE",
59+
"q c #C8C8C8",
60+
"r c #676767",
61+
"s c #0C0C0C",
62+
"t c #6E6E6E",
63+
"u c #0F0F0F",
64+
"v c #343434",
65+
"w c #474747",
66+
"x c #E3E3E3",
67+
"y c #AEAEAE",
68+
"z c #5F5F5F",
69+
"A c #171717",
70+
"B c #EDEDED",
71+
"C c #505050",
72+
"D c #1B1B1B",
73+
"E c #D1D1D1",
74+
"F c #ACACAC",
75+
"G c #010101",
76+
"H c #919191",
77+
"I c #191919",
78+
"J c #323232",
79+
"K c #313131",
80+
"L c #F4F4F4",
81+
"M c #EFEFEF",
82+
"N c #737373",
83+
"O c #3D3D3D",
84+
"P c #1A1A1A",
85+
"Q c #6C6C6C",
86+
"R c #3E3E3E",
87+
"S c #CFCFCF",
88+
"T c #030303",
89+
"U c #020202",
90+
"V c #535353",
91+
"W c #9F9F9F",
92+
"X c #D9D9D9",
93+
"Y c #ECECEC",
94+
"Z c #8B8B8B",
95+
"` c #141414",
96+
" . c #CECECE",
97+
".. c #3C3C3C",
98+
"+. c #A2A2A2",
99+
"@. c #DDDDDD",
100+
"#. c #F0F0F0",
101+
"$. c #B7B7B7",
102+
"%. c #606060",
103+
"&. c #060606",
104+
"*. c #7E7E7E",
105+
"=. c #E0E0E0",
106+
"-. c #9D9D9D",
107+
";. c #282828",
108+
">. c #848484",
109+
",. c #A3A3A3",
110+
"'. c #121212",
111+
"). c #E6E6E6",
112+
"!. c #E7E7E7",
113+
"~. c #989898",
114+
"{. c #646464",
115+
"]. c #F5F5F5",
116+
"^. c #4D4D4D",
117+
"/. c #4B4B4B",
118+
"(. c #383838",
119+
"_. c #C7C7C7",
120+
":. c #090909",
121+
"<. c #686868",
122+
"[. c #303030",
123+
"}. c #D8D8D8",
124+
"|. c #C9C9C9",
125+
"1. c #161616",
126+
"2. c #C0C0C0",
127+
"3. c #1C1C1C",
128+
"4. c #DCDCDC",
129+
"5. c #454545",
130+
"6. c #464646",
131+
"7. c #6F6F6F",
132+
"8. c #242424",
133+
"9. c #888888",
134+
"0. c #202020",
135+
"a. c #D6D6D6",
136+
"b. c #080808",
137+
"c. c #7D7D7D",
138+
"d. c #ADADAD",
139+
"e. c #707070",
140+
"f. c #BABABA",
141+
"g. c #FDFDFD",
142+
"h. c #E4E4E4",
143+
"i. c #0B0B0B",
144+
"j. c #151515",
145+
"k. c #828282",
146+
"l. c #EAEAEA",
147+
"m. c #5D5D5D",
148+
"n. c #5E5E5E",
149+
"o. c #BDBDBD",
150+
"p. c #9B9B9B",
151+
"q. c #898989",
152+
"r. c #F1F1F1",
153+
"s. c #8A8A8A",
154+
"t. c #E2E2E2",
155+
"u. c #2F2F2F",
156+
"v. c #D3D3D3",
157+
"w. c #717171",
158+
"x. c #212121",
159+
"y. c #414141",
160+
"z. c #525252",
161+
"A. c #8E8E8E",
162+
"B. c #A9A9A9",
163+
"C. c #E5E5E5",
164+
"D. c #8D8D8D",
165+
"E. c #D2D2D2",
166+
"F. c #4F4F4F",
167+
"G. c #101010",
168+
"H. c #DADADA",
169+
"I. c #9A9A9A",
170+
"J. c #3F3F3F",
171+
"K. c #F6F6F6",
172+
"L. c #AAAAAA",
173+
"M. c #D5D5D5",
174+
"N. c #3A3A3A",
175+
"O. c #4C4C4C",
176+
"P. c #979797",
177+
"Q. c #ABABAB",
178+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
179+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
180+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
181+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
182+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
183+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
184+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
185+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
186+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
187+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
188+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + . . . . . . ",
189+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ # $ % . . . . . ",
190+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . & * = - . . . . . ",
191+
". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . @ ; = = > , . . . . ",
192+
". . . ' ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ! ~ = = = = { ] . . . ",
193+
". ^ * = = / . . . . . . . . . . . . . . . . . . . . . . . . . . ] ( _ : < = = = = = = = [ . . . ",
194+
". } | = = 1 . . . . . . . . . . . . . . . . . . . ] 2 ! ' 3 4 5 6 7 8 = = = = = = = = = 9 . . . ",
195+
". 0 > = = a . . . . . . . . . . . . . . b c d e f g h i | j = = = = = = = = = = = = = = = k . . ",
196+
". l 8 = = m n + . . . . . . . o p q r s = = = = = = = = = = = = = = = = = = = = = = = = = t . . ",
197+
". _ u = = = v w # x . . . o y z A = = = = = = = = = = = = = = = = = = = = = = = = = = = = u B . ",
198+
". . C = = = = = = D E . F - > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = G H . ",
199+
". . . I = = = = = = J * = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = K L ",
200+
". . . M N O P = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = q ",
201+
". . . . @ ( M Q = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = R ",
202+
". . . . . . S > = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = T h A $ = U ",
203+
". . . . . q U = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = V W X Y E Z F ",
204+
". . . . & D = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ` .n . . . . . . ",
205+
". . . @ t = = = = = = = = = = = G u ..+.@.. . #.$.%.P j = = = = = = = = = = m . . . . . . . . . ",
206+
". . . _ &.= = = = = = = = = = U *.=.. . . . . . . . ] -.;.= = = = = = G = >.. . . . . . . . . . ",
207+
". . . ,.= = = = = = = = = = '.).. . . !.~.{.{.4 ! . . . ].^.= = = = = = 0 . . . . . . . . . . . ",
208+
". . . /.= = = = = = = = = (.k . o _.K = = = = = = :.3 ].. . <.= = = :.: . . . . . . . . . . . . ",
209+
". . . A = = = = = = = = u [ . n {.= = = = = = = = = = [.}.. . ; = :.l . . . . . . . . . . . . . ",
210+
"|.1.[.= = = = = = = = = 2.. . ..= = = = = = = = = = = = 3.& . B 8 4.. . . . . . . . . . . . . . ",
211+
"5.= = = = = = = = = = 6.. . 7.= = = = 8.9.2 ) y 7 > = = = 0.. . . . . . . . . . . . . . . . . . ",
212+
"7 = = = = = = = = = = a.. E b.= G = c.o . . . . . d.8 = = = 4 . . . . . . . . . . . . . . . . . ",
213+
"z = = = = = = = = = K b . N = = = e.. . . . . . . . f.= = = D o . . . . . . . . . . . . . . . . ",
214+
"0 = = = = = = = = = {.g.( v = = s M . . @ ) h.n . . . m = = i.l . . . . . . . . . . . . . . . . ",
215+
"M j.= = = = = = = = k.. l.` = = m.^ . . ~.G = n.. . . o.= = U p.. . . . . . . . . . . . . . . . ",
216+
". d = = = = = = = = q.. ).= = = *.. . . D = = = r.. . x = = = s.. . . . . . . . . . . . . . . . ",
217+
". t.j.= = = $ = = = 9.. ) i = = 7.. . . u.= = = . . . @.= = = Z . . . . . . . . . . . . . . . . ",
218+
". . f.8 = = v.r G = w.. B x.= = y.+ . . t.z z.l . . . A.= = > B.. . . . . . . . . . . . . . . . ",
219+
". . . C.D.E.. o x Q V + ] F.= = = E.. . . g.n . . . . s = = G.H.. . . . . . . . . . . . . . . . ",
220+
". . . . . . . . . . . . . I.= = = ` L . . . . . . . J.= = = e . . . . . . . . . . . . . . . . . ",
221+
". . . . . . . . . . . . . K.3.= = = P L.@ . . . |.w = = = = M.. . . . . . . . . . . . . . . . . ",
222+
". . . . . . . . . . . . . . X = = = = &.g N.O.f s = = = = P.. . . . . . . . . . . . . . . . . . ",
223+
". . . . . . . . . . . . . . . ' U = = = = = = = = = = = Q . . . . . . . . . . . . . . . . . . . ",
224+
". . . . . . . . . . . . . . . . q 7 = = = = = = = = 3.P.. . . . . . . . . . . . . . . . . . . . ",
225+
". . . . . . . . . . . . . . . . . L ! z | = = = w Q.Y . . . . . . . . . . . . . . . . . . . . . "};

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ namespace Global {
1717
clsConfig Config;
1818
}
1919
/**********************************************************************************************************************************************************************/
20-
/* TODO (GamerMan7799#1#): Find and implement Cannon image */
2120
/* TODO (GamerMan7799#1#): Allow changing starting points */
2221
/* TODO (GamerMan7799#1#): Figure out how to detect the edges of the images */
2322
/* TODO (GamerMan7799#9#): Multiple cannonballs ??!?? */
23+
/* TODO (GamerMan7799#1#): Get Highest height and Distance from fire at end of run. */
2424
/**********************************************************************************************************************************************************************/
2525
//Structs and type defs
2626
typedef unsigned char uchar;

src/screen.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ clsScreen::clsScreen(uint ball_radius) {
6060
blnBall = true;
6161
if (Global::blnDebugMode) {printf("Ball loading successful\n");}
6262
}
63+
64+
cannon = loadIMG("cannon");
65+
if (bln_SDL_started == false) {return;}
66+
else {
67+
blnCannon = true;
68+
if (Global::blnDebugMode) {printf("Cannon loading successful\n");}
69+
}
6370
}
6471
/**********************************************************************************************************************************************************************/
6572
clsScreen::~clsScreen() {
@@ -84,11 +91,14 @@ void clsScreen::updateBall(LOC newplace) {
8491
SDL_RenderClear(ren);
8592
//Copy sky
8693
SDL_RenderCopy(ren,sky,NULL,NULL);
94+
SDL_Rect dst;
95+
dst.x = 0;
96+
dst.y = height - 48 - 5;
97+
SDL_QueryTexture(cannon,NULL,NULL, &dst.w, &dst.h);
98+
SDL_RenderCopy(ren,cannon,NULL,&dst);
8799

88100
//Because the top left is 0,0 I have to change the y value to match this
89101
newplace.y = height - newplace.y;
90-
91-
SDL_Rect dst;
92102
dst.x = newplace.x;
93103
dst.y = newplace.y;
94104
//Query ball texture to get its width and height
@@ -109,6 +119,11 @@ void clsScreen::cleanup(void) {
109119
SDL_DestroyTexture(sky);
110120
blnSky = false;
111121
if (Global::blnDebugMode) {printf("Sky texture destroyed\n");}
122+
}
123+
if (blnCannon) {
124+
SDL_DestroyTexture(cannon);
125+
blnCannon = false;
126+
if (Global::blnDebugMode) {printf("Cannon texture destroyed\n");}
112127
}
113128
if (blnRenderer) {
114129
SDL_DestroyRenderer(ren);
@@ -133,6 +148,7 @@ SDL_Texture* clsScreen::loadIMG(std::string filename) {
133148

134149
if (filename == "ball") {temp = IMG_ReadXPMFromArray(image_ball_xpm);}
135150
else if (filename == "sky") {temp = IMG_ReadXPMFromArray(image_sky_xpm);}
151+
else if (filename == "cannon") {temp = IMG_ReadXPMFromArray(image_cannon_xpm);}
136152
else {
137153
printf("Failed to find specified xpm array.\n");
138154
cleanup();

src/screen.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//Include the xpm files which present the images.
1212
#include "image_ball.xpm"
1313
#include "image_sky.xpm"
14+
#include "image_cannon.xpm"
1415
/**********************************************************************************************************************************************************************/
1516
//typedefs because reasons
1617
typedef unsigned int uint;
@@ -37,6 +38,7 @@ class clsScreen {
3738
private:
3839
SDL_Texture *ball;
3940
SDL_Texture *sky;
41+
SDL_Texture *cannon;
4042
SDL_Window *win;
4143
SDL_Renderer *ren;
4244

@@ -50,6 +52,7 @@ class clsScreen {
5052
bool blnRenderer;
5153
bool blnSky;
5254
bool blnBall;
55+
bool blnCannon;
5356

5457
SDL_Texture* loadIMG(std::string);
5558
void error(void);

0 commit comments

Comments
 (0)