diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2009-06-19 10:57:53 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2009-06-19 10:57:53 -0400 |
commit | 684a27ce13a9a08f4f1d94621cdab1232d2d33cf (patch) | |
tree | 4b85d42802b588767b6ac7b6972f2093154c7196 /src | |
parent | 1e3808b3338ff3b1499e000ce1f23e87d6050b8c (diff) | |
download | mazeoflife-684a27ce13a9a08f4f1d94621cdab1232d2d33cf.tar.gz mazeoflife-684a27ce13a9a08f4f1d94621cdab1232d2d33cf.tar.bz2 mazeoflife-684a27ce13a9a08f4f1d94621cdab1232d2d33cf.zip |
Added GNU configure stuff
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/Makefile.in | 417 | ||||
-rw-r--r-- | src/gamestate.cpp | 273 | ||||
-rw-r--r-- | src/gamestate.h | 59 | ||||
-rw-r--r-- | src/includes.h | 7 | ||||
-rw-r--r-- | src/mazeoflife.cpp | 90 | ||||
-rw-r--r-- | src/mazeoflife.h | 10 | ||||
-rw-r--r-- | src/state.h | 12 |
8 files changed, 871 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..4533bc4 --- /dev/null +++ b/src/Makefile.am | |||
@@ -0,0 +1,3 @@ | |||
1 | gamesdir = /usr/games | ||
2 | games_PROGRAMS = mazeoflife | ||
3 | mazeoflife_SOURCES = mazeoflife.cpp gamestate.cpp | ||
diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..6460691 --- /dev/null +++ b/src/Makefile.in | |||
@@ -0,0 +1,417 @@ | |||
1 | # Makefile.in generated by automake 1.10.2 from Makefile.am. | ||
2 | # @configure_input@ | ||
3 | |||
4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
5 | # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | ||
6 | # This Makefile.in is free software; the Free Software Foundation | ||
7 | # gives unlimited permission to copy and/or distribute it, | ||
8 | # with or without modifications, as long as this notice is preserved. | ||
9 | |||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
12 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
13 | # PARTICULAR PURPOSE. | ||
14 | |||
15 | @SET_MAKE@ | ||
16 | |||
17 | VPATH = @srcdir@ | ||
18 | pkgdatadir = $(datadir)/@PACKAGE@ | ||
19 | pkglibdir = $(libdir)/@PACKAGE@ | ||
20 | pkgincludedir = $(includedir)/@PACKAGE@ | ||
21 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
22 | install_sh_DATA = $(install_sh) -c -m 644 | ||
23 | install_sh_PROGRAM = $(install_sh) -c | ||
24 | install_sh_SCRIPT = $(install_sh) -c | ||
25 | INSTALL_HEADER = $(INSTALL_DATA) | ||
26 | transform = $(program_transform_name) | ||
27 | NORMAL_INSTALL = : | ||
28 | PRE_INSTALL = : | ||
29 | POST_INSTALL = : | ||
30 | NORMAL_UNINSTALL = : | ||
31 | PRE_UNINSTALL = : | ||
32 | POST_UNINSTALL = : | ||
33 | games_PROGRAMS = mazeoflife$(EXEEXT) | ||
34 | subdir = src | ||
35 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in | ||
36 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
37 | am__aclocal_m4_deps = $(top_srcdir)/configure.ac | ||
38 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
39 | $(ACLOCAL_M4) | ||
40 | mkinstalldirs = $(install_sh) -d | ||
41 | CONFIG_HEADER = $(top_builddir)/config.h | ||
42 | CONFIG_CLEAN_FILES = | ||
43 | am__installdirs = "$(DESTDIR)$(gamesdir)" | ||
44 | gamesPROGRAMS_INSTALL = $(INSTALL_PROGRAM) | ||
45 | PROGRAMS = $(games_PROGRAMS) | ||
46 | am_mazeoflife_OBJECTS = mazeoflife.$(OBJEXT) gamestate.$(OBJEXT) | ||
47 | mazeoflife_OBJECTS = $(am_mazeoflife_OBJECTS) | ||
48 | mazeoflife_LDADD = $(LDADD) | ||
49 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) | ||
50 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
51 | am__depfiles_maybe = depfiles | ||
52 | CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ | ||
53 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) | ||
54 | CXXLD = $(CXX) | ||
55 | CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ | ||
56 | -o $@ | ||
57 | SOURCES = $(mazeoflife_SOURCES) | ||
58 | DIST_SOURCES = $(mazeoflife_SOURCES) | ||
59 | ETAGS = etags | ||
60 | CTAGS = ctags | ||
61 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
62 | ACLOCAL = @ACLOCAL@ | ||
63 | AMTAR = @AMTAR@ | ||
64 | AUTOCONF = @AUTOCONF@ | ||
65 | AUTOHEADER = @AUTOHEADER@ | ||
66 | AUTOMAKE = @AUTOMAKE@ | ||
67 | AWK = @AWK@ | ||
68 | CC = @CC@ | ||
69 | CCDEPMODE = @CCDEPMODE@ | ||
70 | CFLAGS = @CFLAGS@ | ||
71 | CPP = @CPP@ | ||
72 | CPPFLAGS = @CPPFLAGS@ | ||
73 | CXX = @CXX@ | ||
74 | CXXDEPMODE = @CXXDEPMODE@ | ||
75 | CXXFLAGS = @CXXFLAGS@ | ||
76 | CYGPATH_W = @CYGPATH_W@ | ||
77 | DEFS = @DEFS@ | ||
78 | DEPDIR = @DEPDIR@ | ||
79 | ECHO_C = @ECHO_C@ | ||
80 | ECHO_N = @ECHO_N@ | ||
81 | ECHO_T = @ECHO_T@ | ||
82 | EGREP = @EGREP@ | ||
83 | EXEEXT = @EXEEXT@ | ||
84 | GREP = @GREP@ | ||
85 | INSTALL = @INSTALL@ | ||
86 | INSTALL_DATA = @INSTALL_DATA@ | ||
87 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
88 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
89 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
90 | LDFLAGS = @LDFLAGS@ | ||
91 | LIBOBJS = @LIBOBJS@ | ||
92 | LIBS = @LIBS@ | ||
93 | LTLIBOBJS = @LTLIBOBJS@ | ||
94 | MAKEINFO = @MAKEINFO@ | ||
95 | MKDIR_P = @MKDIR_P@ | ||
96 | OBJEXT = @OBJEXT@ | ||
97 | PACKAGE = @PACKAGE@ | ||
98 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
99 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
100 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
101 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
102 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
103 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
104 | PKG_CONFIG = @PKG_CONFIG@ | ||
105 | SDL_CFLAGS = @SDL_CFLAGS@ | ||
106 | SDL_LIBS = @SDL_LIBS@ | ||
107 | SET_MAKE = @SET_MAKE@ | ||
108 | SHELL = @SHELL@ | ||
109 | STRIP = @STRIP@ | ||
110 | VERSION = @VERSION@ | ||
111 | abs_builddir = @abs_builddir@ | ||
112 | abs_srcdir = @abs_srcdir@ | ||
113 | abs_top_builddir = @abs_top_builddir@ | ||
114 | abs_top_srcdir = @abs_top_srcdir@ | ||
115 | ac_ct_CC = @ac_ct_CC@ | ||
116 | ac_ct_CXX = @ac_ct_CXX@ | ||
117 | am__include = @am__include@ | ||
118 | am__leading_dot = @am__leading_dot@ | ||
119 | am__quote = @am__quote@ | ||
120 | am__tar = @am__tar@ | ||
121 | am__untar = @am__untar@ | ||
122 | bindir = @bindir@ | ||
123 | build_alias = @build_alias@ | ||
124 | builddir = @builddir@ | ||
125 | datadir = @datadir@ | ||
126 | datarootdir = @datarootdir@ | ||
127 | docdir = @docdir@ | ||
128 | dvidir = @dvidir@ | ||
129 | exec_prefix = @exec_prefix@ | ||
130 | host_alias = @host_alias@ | ||
131 | htmldir = @htmldir@ | ||
132 | includedir = @includedir@ | ||
133 | infodir = @infodir@ | ||
134 | install_sh = @install_sh@ | ||
135 | libdir = @libdir@ | ||
136 | libexecdir = @libexecdir@ | ||
137 | localedir = @localedir@ | ||
138 | localstatedir = @localstatedir@ | ||
139 | mandir = @mandir@ | ||
140 | mkdir_p = @mkdir_p@ | ||
141 | oldincludedir = @oldincludedir@ | ||
142 | pdfdir = @pdfdir@ | ||
143 | prefix = @prefix@ | ||
144 | program_transform_name = @program_transform_name@ | ||
145 | psdir = @psdir@ | ||
146 | sbindir = @sbindir@ | ||
147 | sharedstatedir = @sharedstatedir@ | ||
148 | srcdir = @srcdir@ | ||
149 | sysconfdir = @sysconfdir@ | ||
150 | target_alias = @target_alias@ | ||
151 | top_build_prefix = @top_build_prefix@ | ||
152 | top_builddir = @top_builddir@ | ||
153 | top_srcdir = @top_srcdir@ | ||
154 | gamesdir = /usr/games | ||
155 | mazeoflife_SOURCES = mazeoflife.cpp gamestate.cpp | ||
156 | all: all-am | ||
157 | |||
158 | .SUFFIXES: | ||
159 | .SUFFIXES: .cpp .o .obj | ||
160 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
161 | @for dep in $?; do \ | ||
162 | case '$(am__configure_deps)' in \ | ||
163 | *$$dep*) \ | ||
164 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
165 | && { if test -f $@; then exit 0; else break; fi; }; \ | ||
166 | exit 1;; \ | ||
167 | esac; \ | ||
168 | done; \ | ||
169 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ | ||
170 | cd $(top_srcdir) && \ | ||
171 | $(AUTOMAKE) --gnu src/Makefile | ||
172 | .PRECIOUS: Makefile | ||
173 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
174 | @case '$?' in \ | ||
175 | *config.status*) \ | ||
176 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
177 | *) \ | ||
178 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
179 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
180 | esac; | ||
181 | |||
182 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
183 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
184 | |||
185 | $(top_srcdir)/configure: $(am__configure_deps) | ||
186 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
187 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
188 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
189 | install-gamesPROGRAMS: $(games_PROGRAMS) | ||
190 | @$(NORMAL_INSTALL) | ||
191 | test -z "$(gamesdir)" || $(MKDIR_P) "$(DESTDIR)$(gamesdir)" | ||
192 | @list='$(games_PROGRAMS)'; for p in $$list; do \ | ||
193 | p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ | ||
194 | if test -f $$p \ | ||
195 | ; then \ | ||
196 | f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ | ||
197 | echo " $(INSTALL_PROGRAM_ENV) $(gamesPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(gamesdir)/$$f'"; \ | ||
198 | $(INSTALL_PROGRAM_ENV) $(gamesPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(gamesdir)/$$f" || exit 1; \ | ||
199 | else :; fi; \ | ||
200 | done | ||
201 | |||
202 | uninstall-gamesPROGRAMS: | ||
203 | @$(NORMAL_UNINSTALL) | ||
204 | @list='$(games_PROGRAMS)'; for p in $$list; do \ | ||
205 | f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ | ||
206 | echo " rm -f '$(DESTDIR)$(gamesdir)/$$f'"; \ | ||
207 | rm -f "$(DESTDIR)$(gamesdir)/$$f"; \ | ||
208 | done | ||
209 | |||
210 | clean-gamesPROGRAMS: | ||
211 | -test -z "$(games_PROGRAMS)" || rm -f $(games_PROGRAMS) | ||
212 | mazeoflife$(EXEEXT): $(mazeoflife_OBJECTS) $(mazeoflife_DEPENDENCIES) | ||
213 | @rm -f mazeoflife$(EXEEXT) | ||
214 | $(CXXLINK) $(mazeoflife_OBJECTS) $(mazeoflife_LDADD) $(LIBS) | ||
215 | |||
216 | mostlyclean-compile: | ||
217 | -rm -f *.$(OBJEXT) | ||
218 | |||
219 | distclean-compile: | ||
220 | -rm -f *.tab.c | ||
221 | |||
222 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamestate.Po@am__quote@ | ||
223 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mazeoflife.Po@am__quote@ | ||
224 | |||
225 | .cpp.o: | ||
226 | @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
227 | @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
228 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
229 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
230 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< | ||
231 | |||
232 | .cpp.obj: | ||
233 | @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
234 | @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
235 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
236 | @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
237 | @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` | ||
238 | |||
239 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
240 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
241 | unique=`for i in $$list; do \ | ||
242 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
243 | done | \ | ||
244 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
245 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
246 | mkid -fID $$unique | ||
247 | tags: TAGS | ||
248 | |||
249 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
250 | $(TAGS_FILES) $(LISP) | ||
251 | tags=; \ | ||
252 | here=`pwd`; \ | ||
253 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
254 | unique=`for i in $$list; do \ | ||
255 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
256 | done | \ | ||
257 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
258 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
259 | if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ | ||
260 | test -n "$$unique" || unique=$$empty_fix; \ | ||
261 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
262 | $$tags $$unique; \ | ||
263 | fi | ||
264 | ctags: CTAGS | ||
265 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
266 | $(TAGS_FILES) $(LISP) | ||
267 | tags=; \ | ||
268 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
269 | unique=`for i in $$list; do \ | ||
270 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
271 | done | \ | ||
272 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
273 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
274 | test -z "$(CTAGS_ARGS)$$tags$$unique" \ | ||
275 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
276 | $$tags $$unique | ||
277 | |||
278 | GTAGS: | ||
279 | here=`$(am__cd) $(top_builddir) && pwd` \ | ||
280 | && cd $(top_srcdir) \ | ||
281 | && gtags -i $(GTAGS_ARGS) $$here | ||
282 | |||
283 | distclean-tags: | ||
284 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
285 | |||
286 | distdir: $(DISTFILES) | ||
287 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
288 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
289 | list='$(DISTFILES)'; \ | ||
290 | dist_files=`for file in $$list; do echo $$file; done | \ | ||
291 | sed -e "s|^$$srcdirstrip/||;t" \ | ||
292 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
293 | case $$dist_files in \ | ||
294 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
295 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
296 | sort -u` ;; \ | ||
297 | esac; \ | ||
298 | for file in $$dist_files; do \ | ||
299 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
300 | if test -d $$d/$$file; then \ | ||
301 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
302 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
303 | cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ | ||
304 | fi; \ | ||
305 | cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ | ||
306 | else \ | ||
307 | test -f $(distdir)/$$file \ | ||
308 | || cp -p $$d/$$file $(distdir)/$$file \ | ||
309 | || exit 1; \ | ||
310 | fi; \ | ||
311 | done | ||
312 | check-am: all-am | ||
313 | check: check-am | ||
314 | all-am: Makefile $(PROGRAMS) | ||
315 | installdirs: | ||
316 | for dir in "$(DESTDIR)$(gamesdir)"; do \ | ||
317 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | ||
318 | done | ||
319 | install: install-am | ||
320 | install-exec: install-exec-am | ||
321 | install-data: install-data-am | ||
322 | uninstall: uninstall-am | ||
323 | |||
324 | install-am: all-am | ||
325 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
326 | |||
327 | installcheck: installcheck-am | ||
328 | install-strip: | ||
329 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
330 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
331 | `test -z '$(STRIP)' || \ | ||
332 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
333 | mostlyclean-generic: | ||
334 | |||
335 | clean-generic: | ||
336 | |||
337 | distclean-generic: | ||
338 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
339 | |||
340 | maintainer-clean-generic: | ||
341 | @echo "This command is intended for maintainers to use" | ||
342 | @echo "it deletes files that may require special tools to rebuild." | ||
343 | clean: clean-am | ||
344 | |||
345 | clean-am: clean-gamesPROGRAMS clean-generic mostlyclean-am | ||
346 | |||
347 | distclean: distclean-am | ||
348 | -rm -rf ./$(DEPDIR) | ||
349 | -rm -f Makefile | ||
350 | distclean-am: clean-am distclean-compile distclean-generic \ | ||
351 | distclean-tags | ||
352 | |||
353 | dvi: dvi-am | ||
354 | |||
355 | dvi-am: | ||
356 | |||
357 | html: html-am | ||
358 | |||
359 | info: info-am | ||
360 | |||
361 | info-am: | ||
362 | |||
363 | install-data-am: install-gamesPROGRAMS | ||
364 | |||
365 | install-dvi: install-dvi-am | ||
366 | |||
367 | install-exec-am: | ||
368 | |||
369 | install-html: install-html-am | ||
370 | |||
371 | install-info: install-info-am | ||
372 | |||
373 | install-man: | ||
374 | |||
375 | install-pdf: install-pdf-am | ||
376 | |||
377 | install-ps: install-ps-am | ||
378 | |||
379 | installcheck-am: | ||
380 | |||
381 | maintainer-clean: maintainer-clean-am | ||
382 | -rm -rf ./$(DEPDIR) | ||
383 | -rm -f Makefile | ||
384 | maintainer-clean-am: distclean-am maintainer-clean-generic | ||
385 | |||
386 | mostlyclean: mostlyclean-am | ||
387 | |||
388 | mostlyclean-am: mostlyclean-compile mostlyclean-generic | ||
389 | |||
390 | pdf: pdf-am | ||
391 | |||
392 | pdf-am: | ||
393 | |||
394 | ps: ps-am | ||
395 | |||
396 | ps-am: | ||
397 | |||
398 | uninstall-am: uninstall-gamesPROGRAMS | ||
399 | |||
400 | .MAKE: install-am install-strip | ||
401 | |||
402 | .PHONY: CTAGS GTAGS all all-am check check-am clean \ | ||
403 | clean-gamesPROGRAMS clean-generic ctags distclean \ | ||
404 | distclean-compile distclean-generic distclean-tags distdir dvi \ | ||
405 | dvi-am html html-am info info-am install install-am \ | ||
406 | install-data install-data-am install-dvi install-dvi-am \ | ||
407 | install-exec install-exec-am install-gamesPROGRAMS \ | ||
408 | install-html install-html-am install-info install-info-am \ | ||
409 | install-man install-pdf install-pdf-am install-ps \ | ||
410 | install-ps-am install-strip installcheck installcheck-am \ | ||
411 | installdirs maintainer-clean maintainer-clean-generic \ | ||
412 | mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ | ||
413 | ps ps-am tags uninstall uninstall-am uninstall-gamesPROGRAMS | ||
414 | |||
415 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
416 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
417 | .NOEXPORT: | ||
diff --git a/src/gamestate.cpp b/src/gamestate.cpp new file mode 100644 index 0000000..39d589d --- /dev/null +++ b/src/gamestate.cpp | |||
@@ -0,0 +1,273 @@ | |||
1 | #include "includes.h" | ||
2 | |||
3 | GameState::GameState() | ||
4 | { | ||
5 | player_color = getColor(255, 255, 0); | ||
6 | event_color = getColor(0, 0, 255); | ||
7 | |||
8 | newGame = false; | ||
9 | |||
10 | info.playerx = 1; | ||
11 | info.playery = 1; | ||
12 | info.level = Level(); | ||
13 | info.doneMaking = false; | ||
14 | board = Board(&info); | ||
15 | |||
16 | SDL_WM_SetCaption("Maze Of Life - Level 1", NULL); | ||
17 | } | ||
18 | |||
19 | void GameState::input(SDLKey key) | ||
20 | { | ||
21 | if (info.doneMaking) | ||
22 | { | ||
23 | switch (key) | ||
24 | { | ||
25 | case SDLK_LEFT: | ||
26 | move(info.playerx-1, info.playery); | ||
27 | |||
28 | break; | ||
29 | case SDLK_RIGHT: | ||
30 | move(info.playerx+1, info.playery); | ||
31 | |||
32 | break; | ||
33 | case SDLK_UP: | ||
34 | move(info.playerx, info.playery-1); | ||
35 | |||
36 | break; | ||
37 | case SDLK_DOWN: | ||
38 | move(info.playerx, info.playery+1); | ||
39 | |||
40 | break; | ||
41 | case SDLK_ESCAPE: | ||
42 | newGame = false; | ||
43 | |||
44 | info.playerx = 1; | ||
45 | info.playery = 1; | ||
46 | info.level = Level(); | ||
47 | info.doneMaking = false; | ||
48 | board = Board(&info); | ||
49 | |||
50 | SDL_WM_SetCaption("Maze Of Life - Level 1", NULL); | ||
51 | |||
52 | break; | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | void GameState::tick() | ||
58 | { | ||
59 | if (newGame) | ||
60 | { | ||
61 | switch (rand()%4) | ||
62 | { | ||
63 | case 0: info.playerx = 1; info.playery = 1; break; | ||
64 | case 1: info.playerx = 1; info.playery = HEIGHT-2; break; | ||
65 | case 2: info.playerx = WIDTH-2; info.playery = HEIGHT-2; break; | ||
66 | case 3: info.playerx = WIDTH-2; info.playery = 1; break; | ||
67 | } | ||
68 | |||
69 | info.level.incrementLevel(); | ||
70 | info.doneMaking = false; | ||
71 | board = Board(&info); | ||
72 | newGame = false; | ||
73 | |||
74 | char title[32]; | ||
75 | sprintf(title, "Maze Of Life - Level %d", info.level.getLevel()); | ||
76 | SDL_WM_SetCaption(title, NULL); | ||
77 | } | ||
78 | |||
79 | board.tick(); | ||
80 | } | ||
81 | |||
82 | void GameState::move(int x, int y) | ||
83 | { | ||
84 | wrap(&x, &y); | ||
85 | |||
86 | if (board.isObstructed(x,y)) return; | ||
87 | if ((x==15)&&(y==15)) newGame = true; | ||
88 | |||
89 | info.playerx = x; | ||
90 | info.playery = y; | ||
91 | } | ||
92 | |||
93 | void GameState::render(SDL_Surface* screen) | ||
94 | { | ||
95 | // Paint maze | ||
96 | board.render(screen); | ||
97 | |||
98 | // Paint player | ||
99 | SDL_Rect block; | ||
100 | block.x = info.playerx*16; | ||
101 | block.y = info.playery*16; | ||
102 | block.w = 16; | ||
103 | block.h = 16; | ||
104 | |||
105 | SDL_FillRect(screen, &block, player_color); | ||
106 | |||
107 | // Paint event | ||
108 | block.x = 15*16; | ||
109 | block.y = 15*16; | ||
110 | |||
111 | SDL_FillRect(screen, &block, event_color); | ||
112 | } | ||
113 | |||
114 | GameState::Level::Level() | ||
115 | { | ||
116 | level = 1; | ||
117 | |||
118 | alive[0] = getColor(0, 0, 0); // Black | ||
119 | alive[1] = getColor(255, 0, 0); // Red | ||
120 | alive[2] = getColor(0, 255, 0); // Green | ||
121 | alive[3] = getColor(85, 85, 85); // Dark Gray | ||
122 | alive[4] = getColor(255, 0, 255); // Magenta | ||
123 | |||
124 | dead[0] = getColor(255, 255, 255); // White | ||
125 | dead[1] = getColor(255, 192, 203); // Pink | ||
126 | dead[2] = getColor(0, 255, 255); // Cyan | ||
127 | dead[3] = getColor(170, 170, 170); // Light Gray | ||
128 | dead[4] = getColor(255, 128, 0); // Orange | ||
129 | } | ||
130 | |||
131 | int GameState::Level::getLevel() | ||
132 | { | ||
133 | return level; | ||
134 | } | ||
135 | |||
136 | bool GameState::Level::checkSquare(int x, int y) | ||
137 | { | ||
138 | switch (level/10+1) | ||
139 | { | ||
140 | case 1: | ||
141 | return ((x>13)&&(x<16)&&(y>13)&&(y<16)); | ||
142 | case 2: | ||
143 | return ((x>13)&&(x<17)&&(y>13)&&(y<17)); | ||
144 | case 3: | ||
145 | case 4: | ||
146 | return ((x>12)&&(x<18)&&(y>12)&&(y<18)); | ||
147 | case 5: | ||
148 | case 6: | ||
149 | return ((x>11)&&(x<19)&&(y>11)&&(y<19)); | ||
150 | default: | ||
151 | return true; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | Uint32 GameState::Level::getAliveColor() | ||
156 | { | ||
157 | return alive[(level/10)%5]; | ||
158 | } | ||
159 | |||
160 | Uint32 GameState::Level::getDeadColor() | ||
161 | { | ||
162 | return dead[(level/10)%5]; | ||
163 | } | ||
164 | |||
165 | void GameState::Level::incrementLevel() | ||
166 | { | ||
167 | level++; | ||
168 | } | ||
169 | |||
170 | GameState::Board::Board() | ||
171 | { | ||
172 | GameState::Board::Board(new GameState::Info()); | ||
173 | } | ||
174 | |||
175 | GameState::Board::Board(GameState::Info* info) | ||
176 | { | ||
177 | this->info = info; | ||
178 | |||
179 | int x,y; | ||
180 | for (y=0;y<HEIGHT;y++) | ||
181 | { | ||
182 | for (x=0;x<WIDTH;x++) | ||
183 | { | ||
184 | if (info->level.checkSquare(x, y)) | ||
185 | { | ||
186 | blocks[x][y] = rand() % 2; | ||
187 | } else { | ||
188 | blocks[x][y] = false; | ||
189 | } | ||
190 | } | ||
191 | } | ||
192 | |||
193 | blocks[15][15] = false; | ||
194 | } | ||
195 | |||
196 | bool GameState::Board::isObstructed(int x, int y) | ||
197 | { | ||
198 | return blocks[x][y]; | ||
199 | } | ||
200 | |||
201 | void GameState::Board::render(SDL_Surface* screen) | ||
202 | { | ||
203 | SDL_Rect block; | ||
204 | block.w = 16; | ||
205 | block.h = 16; | ||
206 | |||
207 | int x,y; | ||
208 | |||
209 | for (y=0;y<HEIGHT;y++) | ||
210 | { | ||
211 | for (x=0;x<WIDTH;x++) | ||
212 | { | ||
213 | block.x = x*16; | ||
214 | block.y = y*16; | ||
215 | |||
216 | SDL_FillRect(screen, &block, (blocks[x][y] ? info->level.getAliveColor() : info->level.getDeadColor())); | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | |||
221 | void GameState::Board::tick() | ||
222 | { | ||
223 | bool temp[WIDTH][HEIGHT]; | ||
224 | int x,y; | ||
225 | for (x=0;x<WIDTH;x++) | ||
226 | { | ||
227 | for (y=0;y<HEIGHT;y++) | ||
228 | { | ||
229 | temp[x][y] = blocks[x][y]; | ||
230 | } | ||
231 | } | ||
232 | |||
233 | for (x=0;x<WIDTH;x++) | ||
234 | { | ||
235 | for (y=0;y<HEIGHT;y++) | ||
236 | { | ||
237 | if ((x==15)&&(y==15)) | ||
238 | { | ||
239 | continue; | ||
240 | } | ||
241 | |||
242 | int neighbors = 0; | ||
243 | |||
244 | if ((x>0)&&(y>0)) incrementIfNeighbor(x-1,y-1,temp,&neighbors); | ||
245 | if ((x>0)) incrementIfNeighbor(x-1,y,temp,&neighbors); | ||
246 | if ((x>0)&&(y<HEIGHT-1)) incrementIfNeighbor(x-1,y+1,temp,&neighbors); | ||
247 | if ((y>0)) incrementIfNeighbor(x,y-1,temp,&neighbors); | ||
248 | if ((y<HEIGHT-1)) incrementIfNeighbor(x,y+1,temp,&neighbors); | ||
249 | if ((x<WIDTH-1)&&(y>0)) incrementIfNeighbor(x+1,y-1,temp,&neighbors); | ||
250 | if ((x<WIDTH-1)) incrementIfNeighbor(x+1,y,temp,&neighbors); | ||
251 | if ((x<WIDTH-1)&&(y<HEIGHT-1)) incrementIfNeighbor(x+1,y+1,temp,&neighbors); | ||
252 | |||
253 | if (temp[x][y]) | ||
254 | { | ||
255 | blocks[x][y] = ((neighbors >= 1) && (neighbors <= 4)); | ||
256 | } else { | ||
257 | blocks[x][y] = (neighbors == 3); | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | |||
262 | if (!info->doneMaking && ++gens > 100) info->doneMaking = true; | ||
263 | } | ||
264 | |||
265 | void GameState::Board::incrementIfNeighbor(int x, int y, bool temp[WIDTH][HEIGHT], int* tick) | ||
266 | { | ||
267 | wrap(&x, &y); | ||
268 | |||
269 | if ((temp[x][y])||((info->playerx==x)&&(info->playery==y))||((x==15)&&(y==15))) | ||
270 | { | ||
271 | ++*tick; | ||
272 | } | ||
273 | } | ||
diff --git a/src/gamestate.h b/src/gamestate.h new file mode 100644 index 0000000..7d9d798 --- /dev/null +++ b/src/gamestate.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef GAMESTATE_H | ||
2 | #define GAMESTATE_H | ||
3 | |||
4 | class GameState : public State { | ||
5 | public: | ||
6 | GameState(); | ||
7 | void input(SDLKey key); | ||
8 | void tick(); | ||
9 | void render(SDL_Surface* screen); | ||
10 | |||
11 | class Level | ||
12 | { | ||
13 | private: | ||
14 | int level; | ||
15 | Uint32 alive[5]; | ||
16 | Uint32 dead[5]; | ||
17 | |||
18 | public: | ||
19 | Level(); | ||
20 | int getLevel(); | ||
21 | int getLevelGroup(); | ||
22 | bool checkSquare(int x, int y); | ||
23 | Uint32 getAliveColor(); | ||
24 | Uint32 getDeadColor(); | ||
25 | void incrementLevel(); | ||
26 | }; | ||
27 | |||
28 | struct Info { | ||
29 | int playerx, playery; | ||
30 | Level level; | ||
31 | bool doneMaking; | ||
32 | }; | ||
33 | |||
34 | class Board | ||
35 | { | ||
36 | private: | ||
37 | bool blocks[WIDTH][HEIGHT]; | ||
38 | void incrementIfNeighbor(int x, int y, bool temp[WIDTH][HEIGHT], int* tick); | ||
39 | GameState::Info* info; | ||
40 | int gens; | ||
41 | |||
42 | public: | ||
43 | Board(); | ||
44 | Board(GameState::Info* info); | ||
45 | bool isObstructed(int x, int y); | ||
46 | void render(SDL_Surface* screen); | ||
47 | void tick(); | ||
48 | }; | ||
49 | |||
50 | private: | ||
51 | Uint32 player_color; | ||
52 | Uint32 event_color; | ||
53 | bool newGame; | ||
54 | Info info; | ||
55 | Board board; | ||
56 | void move(int x, int y); | ||
57 | }; | ||
58 | |||
59 | #endif | ||
diff --git a/src/includes.h b/src/includes.h new file mode 100644 index 0000000..a47a307 --- /dev/null +++ b/src/includes.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #include <SDL.h> | ||
2 | #include <stdio.h> | ||
3 | #include <time.h> | ||
4 | #include <string> | ||
5 | #include "mazeoflife.h" | ||
6 | #include "state.h" | ||
7 | #include "gamestate.h" | ||
diff --git a/src/mazeoflife.cpp b/src/mazeoflife.cpp new file mode 100644 index 0000000..7819ffd --- /dev/null +++ b/src/mazeoflife.cpp | |||
@@ -0,0 +1,90 @@ | |||
1 | #include "includes.h" | ||
2 | |||
3 | SDL_Surface *screen; | ||
4 | bool gameSleep = false; | ||
5 | |||
6 | int main(int argc, char *argv[]) | ||
7 | { | ||
8 | srand(time(NULL)); | ||
9 | |||
10 | /* Initialize defaults, Video and Audio */ | ||
11 | if((SDL_Init(SDL_INIT_VIDEO)==-1)) { | ||
12 | printf("Could not initialize SDL: %s.\n", SDL_GetError()); | ||
13 | exit(-1); | ||
14 | } | ||
15 | |||
16 | /* Clean up on exit */ | ||
17 | atexit(SDL_Quit); | ||
18 | |||
19 | SDL_WM_SetCaption("Maze Of Life", NULL); | ||
20 | |||
21 | /* | ||
22 | * Initialize the display in a 640x480 8-bit palettized mode, | ||
23 | * requesting a software surface | ||
24 | */ | ||
25 | screen = SDL_SetVideoMode(WIDTH*16, HEIGHT*16, 8, SDL_DOUBLEBUF); | ||
26 | if ( screen == NULL ) { | ||
27 | fprintf(stderr, "Couldn't set %dx%dx8 video mode: %s\n", WIDTH*16, WIDTH*16, SDL_GetError()); | ||
28 | exit(1); | ||
29 | } | ||
30 | |||
31 | SDL_EnableKeyRepeat(100, 50); | ||
32 | |||
33 | State* state = new GameState(); | ||
34 | |||
35 | SDL_Event anEvent; | ||
36 | for (;;) | ||
37 | { | ||
38 | state->tick(); | ||
39 | |||
40 | while (SDL_PollEvent(&anEvent)) | ||
41 | { | ||
42 | switch (anEvent.type) | ||
43 | { | ||
44 | case SDL_ACTIVEEVENT: | ||
45 | if (anEvent.active.state == SDL_APPINPUTFOCUS) | ||
46 | { | ||
47 | gameSleep = !anEvent.active.gain; | ||
48 | } | ||
49 | |||
50 | break; | ||
51 | case SDL_QUIT: | ||
52 | exit(0); | ||
53 | |||
54 | break; | ||
55 | case SDL_KEYDOWN: | ||
56 | state->input(anEvent.key.keysym.sym); | ||
57 | |||
58 | break; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | state->render(screen); | ||
63 | |||
64 | SDL_Flip(screen); | ||
65 | } | ||
66 | |||
67 | exit(0); | ||
68 | } | ||
69 | |||
70 | void wrap(int* x, int* y) | ||
71 | { | ||
72 | if (*x < 0) | ||
73 | { | ||
74 | *x = WIDTH-(0-*x); | ||
75 | } else if (*y < 0) | ||
76 | { | ||
77 | *y = HEIGHT-(0-*y); | ||
78 | } else if (*x >= WIDTH) | ||
79 | { | ||
80 | *x = *x-WIDTH; | ||
81 | } else if (*y >= HEIGHT) | ||
82 | { | ||
83 | *y = *y-HEIGHT; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | Uint32 getColor(int r, int g, int b) | ||
88 | { | ||
89 | return SDL_MapRGB(screen->format, r, g, b); | ||
90 | } | ||
diff --git a/src/mazeoflife.h b/src/mazeoflife.h new file mode 100644 index 0000000..6af0cf4 --- /dev/null +++ b/src/mazeoflife.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #ifndef MAZEOFLIFE_H | ||
2 | #define MAZEOFLIFE_H | ||
3 | |||
4 | const int WIDTH = 30; | ||
5 | const int HEIGHT = 30; | ||
6 | |||
7 | void wrap(int* x, int* y); | ||
8 | Uint32 getColor(int r, int g, int b); | ||
9 | |||
10 | #endif | ||
diff --git a/src/state.h b/src/state.h new file mode 100644 index 0000000..1a97a1b --- /dev/null +++ b/src/state.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef STATE_H | ||
2 | #define STATE_H | ||
3 | |||
4 | class State | ||
5 | { | ||
6 | public: | ||
7 | virtual void input(SDLKey key) = 0; | ||
8 | virtual void tick() = 0; | ||
9 | virtual void render(SDL_Surface* screen) = 0; | ||
10 | }; | ||
11 | |||
12 | #endif | ||