initial commit

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
2025-10-31 23:37:30 +01:00
commit 7228269764
9653 changed files with 4034514 additions and 0 deletions

View File

@@ -0,0 +1,224 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.13 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
@MAKE_SET@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
INSTALL = @INSTALL@
EXEEXT = @EXEEXT@
WINDRES = @WINDRES@
NM = @NM@
BK_DEPS = @BK_DEPS@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
LIBS = @LIBS@
LDFLAGS_GUI = @LDFLAGS_GUI@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
USE_DPI_AWARE_MANIFEST = @USE_DPI_AWARE_MANIFEST@
WX_LIB_FLAVOUR = @WX_LIB_FLAVOUR@
TOOLKIT = @TOOLKIT@
TOOLKIT_LOWERCASE = @TOOLKIT_LOWERCASE@
TOOLKIT_VERSION = @TOOLKIT_VERSION@
TOOLCHAIN_FULLNAME = @TOOLCHAIN_FULLNAME@
EXTRALIBS = @EXTRALIBS@
EXTRALIBS_XML = @EXTRALIBS_XML@
EXTRALIBS_GUI = @EXTRALIBS_GUI@
WX_CPPFLAGS = @WX_CPPFLAGS@
WX_CXXFLAGS = @WX_CXXFLAGS@
WX_LDFLAGS = @WX_LDFLAGS@
HOST_SUFFIX = @HOST_SUFFIX@
DYLIB_RPATH_FLAG = @DYLIB_RPATH_FLAG@
SAMPLES_CXXFLAGS = @SAMPLES_CXXFLAGS@
wx_top_builddir = @wx_top_builddir@
### Variables: ###
DESTDIR =
WX_RELEASE = 3.3
WX_VERSION = $(WX_RELEASE).1
LIBDIRNAME = $(wx_top_builddir)/lib
LIFE_CXXFLAGS = $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) -I$(srcdir) $(__DLLFLAG_p) -I$(srcdir)/../../samples \
$(WX_CXXFLAGS) $(SAMPLES_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS)
LIFE_OBJECTS = \
life_life.o \
life_dialogs.o \
life_game.o \
life_reader.o \
$(__life___win32rc)
### Conditionally set variables: ###
@COND_DEPS_TRACKING_0@CXXC = $(CXX)
@COND_DEPS_TRACKING_1@CXXC = $(BK_DEPS) $(CXX)
@COND_USE_GUI_0@PORTNAME = base
@COND_USE_GUI_1@PORTNAME = $(TOOLKIT_LOWERCASE)$(TOOLKIT_VERSION)
@COND_TOOLKIT_MAC@WXBASEPORT = _carbon
@COND_BUILD_debug@WXDEBUGFLAG = d
@COND_WXUNIV_1@WXUNIVNAME = univ
@COND_MONOLITHIC_0@EXTRALIBS_FOR_BASE = $(EXTRALIBS)
@COND_MONOLITHIC_1@EXTRALIBS_FOR_BASE = $(EXTRALIBS) \
@COND_MONOLITHIC_1@ $(EXTRALIBS_XML) $(EXTRALIBS_GUI)
@COND_MONOLITHIC_0@EXTRALIBS_FOR_GUI = $(EXTRALIBS_GUI)
@COND_MONOLITHIC_1@EXTRALIBS_FOR_GUI =
@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
@COND_WXUNIV_1@__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
@COND_DEBUG_FLAG_0@__DEBUG_DEFINE_p_1 = --define wxDEBUG_LEVEL=0
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI
@COND_USE_RTTI_0@__RTTI_DEFINE_p_1 = --define wxNO_RTTI
@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS
@COND_USE_THREADS_0@__THREAD_DEFINE_p_1 = --define wxNO_THREADS
@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL
@COND_SHARED_1@__DLLFLAG_p_1 = --define WXUSINGDLL
@COND_PLATFORM_WIN32_1@__WIN32_DPI_MANIFEST_p = \
@COND_PLATFORM_WIN32_1@ --define \
@COND_PLATFORM_WIN32_1@ wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST)
COND_PLATFORM_OS2_1___life___os2_emxbindcmd = $(NM) life$(EXEEXT) | if grep -q \
pmwin.763 ; then emxbind -ep life$(EXEEXT) ; fi
@COND_PLATFORM_OS2_1@__life___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___life___os2_emxbindcmd)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
@COND_PLATFORM_MACOSX_1@__life_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1@ = life.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@__life_bundle___depname = life_bundle
@COND_TOOLKIT_MAC@____life_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ $(__life_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____life_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_CARBON@ = $(__life_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_COCOA@____life_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_COCOA@ = $(__life_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____life_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = $(__life_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_COCOA@____life_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__life_app_Contents_PkgInfo___depname)
COND_MONOLITHIC_0___WXLIB_CORE_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)
COND_MONOLITHIC_0___WXLIB_BASE_p = \
-lwx_base$(WXBASEPORT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
@COND_PLATFORM_WIN32_1@__life___win32rc = life_life_rc.o
COND_MONOLITHIC_1___WXLIB_MONO_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p)
@COND_MONOLITHIC_1_USE_STC_1@__LIB_SCINTILLA_IF_MONO_p \
@COND_MONOLITHIC_1_USE_STC_1@ = $(__LIB_SCINTILLA_p)
@COND_USE_STC_1@__LIB_SCINTILLA_p = \
@COND_USE_STC_1@ -lwxscintilla$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_1_USE_STC_1@__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
@COND_USE_STC_1@__LIB_LEXILLA_p = \
@COND_USE_STC_1@ -lwxlexilla$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@__LIB_TIFF_p \
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@ = \
@COND_USE_GUI_1_wxUSE_LIBTIFF_builtin@ -lwxtiff$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@__LIB_JPEG_p \
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@ = \
@COND_USE_GUI_1_wxUSE_LIBJPEG_builtin@ -lwxjpeg$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@__LIB_PNG_p \
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@ = \
@COND_USE_GUI_1_wxUSE_LIBPNG_builtin@ -lwxpng$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_USE_GUI_1_wxUSE_LIBWEBP_builtin@__LIB_WEBP_p \
@COND_USE_GUI_1_wxUSE_LIBWEBP_builtin@ = \
@COND_USE_GUI_1_wxUSE_LIBWEBP_builtin@ -lwxwebp$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_wxUSE_ZLIB_builtin@__LIB_ZLIB_p = \
@COND_wxUSE_ZLIB_builtin@ -lwxzlib$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_wxUSE_REGEX_builtin@__LIB_REGEX_p = \
@COND_wxUSE_REGEX_builtin@ -lwxregexu$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_wxUSE_EXPAT_builtin@__LIB_EXPAT_p = \
@COND_wxUSE_EXPAT_builtin@ -lwxexpat$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
### Targets: ###
all: life$(EXEEXT) $(__life_bundle___depname) data
install:
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f life$(EXEEXT)
rm -rf life.app
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
life$(EXEEXT): $(LIFE_OBJECTS) $(__life___win32rc)
$(CXX) -o $@ $(LIFE_OBJECTS) -L$(LIBDIRNAME) $(DYLIB_RPATH_FLAG) $(LDFLAGS_GUI) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(__life___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@life.app/Contents/PkgInfo: life$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1@ mkdir -p life.app/Contents
@COND_PLATFORM_MACOSX_1@ mkdir -p life.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1@ mkdir -p life.app/Contents/Resources
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ sed -e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.life/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/life/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/life/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_COPYRIGHT}/Copyright 2002-2025 wxWidgets/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_VERSION}/$(WX_VERSION)/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_INFO_STRING}/life version $(WX_VERSION), (c) 2002-2025 wxWidgets/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_LONG_VERSION_STRING}/$(WX_VERSION), (c) 2002-2025 wxWidgets/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_SHORT_VERSION_STRING}/$(WX_RELEASE)/" \
@COND_PLATFORM_MACOSX_1@ $(top_srcdir)/src/osx/carbon/Info.plist.in >life.app/Contents/Info.plist
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >life.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ ln -f life$(EXEEXT) life.app/Contents/MacOS/life
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns life.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1@life_bundle: $(____life_BUNDLE_TGT_REF_DEP)
data:
@mkdir -p .
@for f in breeder.lif; do \
if test ! -f ./$$f -a ! -d ./$$f ; \
then x=yep ; \
else x=`find $(srcdir)/$$f -newer ./$$f -print` ; \
fi; \
case "$$x" in ?*) \
cp -pRf $(srcdir)/$$f . ;; \
esac; \
done
life_life.o: $(srcdir)/life.cpp
$(CXXC) -c -o $@ $(LIFE_CXXFLAGS) $(srcdir)/life.cpp
life_dialogs.o: $(srcdir)/dialogs.cpp
$(CXXC) -c -o $@ $(LIFE_CXXFLAGS) $(srcdir)/dialogs.cpp
life_game.o: $(srcdir)/game.cpp
$(CXXC) -c -o $@ $(LIFE_CXXFLAGS) $(srcdir)/game.cpp
life_reader.o: $(srcdir)/reader.cpp
$(CXXC) -c -o $@ $(LIFE_CXXFLAGS) $(srcdir)/reader.cpp
life_life_rc.o: $(srcdir)/life.rc
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) --include-dir $(srcdir) $(__DLLFLAG_p_1) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean life_bundle data

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,22 @@
/* XPM */
static const char *const center_xpm[] = {
"16 16 3 1",
" c None",
". c Black",
"X c Yellow",
" ",
" ",
" ",
" .... ",
" .XXXX. ",
" .XXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXX. ",
" .XXXX. ",
" .... ",
" ",
" ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,22 @@
/* XPM */
static const char *const east_xpm[] = {
"16 16 3 1",
" c None",
". c Black",
"X c Yellow",
" ",
" .. ",
" .X.. ",
" .XX.. ",
" .XXXX.. ",
" .XXXXX.. ",
" .XXXXXXX.. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXX.. ",
" .XXXXX.. ",
" .XXXX.. ",
" .XX.. ",
" .X.. ",
" .. ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *const info_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c None",
". c Blue",
/* pixels */
" ",
" .... ",
" ...... ",
" ...... ",
" .... ",
" ",
" ",
" ....... ",
" ..... ",
" ..... ",
" ..... ",
" ..... ",
" ..... ",
" ..... ",
" ..... ",
" ......... "
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -0,0 +1,81 @@
/* XPM */
static const char *const life_xpm[] = {
"151 73 5 1",
" c None",
". c #808080",
"X c Black",
"o c Gray100",
"O c #c0c0c0",
" .X ",
" .XXo.. ",
" .XXOooooX ",
" .XXooOoooooX ",
" XXXoooooOoooooX ",
" .XXXoooOoooooOooooX. ",
" .XXoOoooooOoooooOoooOOX ",
" .XXXooooOoooooOoooooOOOoooX ",
" .XXooOoooooOoooooOoooOOOoooooX ",
" .XXXooooooooooooooooo.OOoooOoooooX ",
" .XXoooOooooooOoooooOo.XXXOoooooOoooo.. ",
" ..XXooooooOooooooOoooOXXXXXXX.oooooOoooooX ",
" .XXooooooooooOooooooO.XXXXXXXXXXXoooooOoooOOX ",
" .XXooOooooooooooOooo.XXXXXXXXXXXXXXXoooooOOOOooX ",
" .XXOoooooOoooooOoooo.XXXXXXXXXXXXXXXXXXXooOOOOoooooX. ",
" .XXoooOoooooOoooooOo.XXXXXXXXXXXXXXXXXXXXXXOOoooOOoooooX ",
" .XXoOoooooOoooooOooooOXXXXXXXXXXXXXXXXXXXXXX.oOooooooOoooooX ",
" .XXOooooOoooooOoooooOOOOooXXXXXXXXXXXXXXXXXX.OoooooOoooooOoooooX ",
" .XXOooooooooOoooooOoo.XX.oooooXXXXXXXXXXXXXXX.oooOoooooOoooooOoooOOX. ",
" .XX.ooooooooooOoooooOXXXXXXOoooooXXXXXXXXXXX.OOoooooOoooooOoooooOOOooo.X ",
" .XXOooOoooooOoooooOoO.XXXXXXXXXOoooooXXXXXXXXoooooOoooooOoooooOooOOoOOoooooX ",
" XXXOoooooOoooooOoooo.XXXXXXXXXXXXXOoooooXXXXXXXooooooOoooooOooooOOOoooooOoooooX ",
" .XXXooooOoooooOooooo..XXXXXXXXXXXXXXXXXOoooOOXXXXXXXooooooOoooooOOOOooOooooooOoooooX ",
" ..XXooOoooooOoooooOooOXXXXXXXXXXXXXXXXXXXXX.OOoooXXXXXXXooooooOoo.XXXooooooOoooooOoooooX. ",
" ..XXOoooooOoooooOoooooXXXXXXXXXXXXXXXXXXXXXXXOoOoooooXXXXXXXoooooOXXXXXXXooooooOoooooOoooOOOX ",
" ..XXoooOooooooooooooooOOooXXXXXXXXXXXXXXXXXXX.oooooOoooooXXXXXXXo.XXXXXXXXXXXOoooooOoooooOOOooooX ",
" ..XXoOoooooOoooooOoooO.XOoooooXXXXXXXXXXXXXXX.OoOooooooOoooooXXXXXXXXXXXXXXXXXXXXXoooooOoOOOOoOoooooX ",
" ..XX.ooooOoooooOooooo..XXXXXoooooOXXXXXXXXXXXXOoooooOooooooOoooooXXXXXXXXXXXXXXXXXXXXXooooOOooooooOoooooX. ",
" ..XXoooOoooooOoooooOooOOoXXXXXXXooooo.XXXXXXX.OoooOoooooOooooooOooOOOXXXXXXXXXXXXXXXXXXXXXOOOooOooooooOooooo.X ",
" .XXOOoooooOoooooOoooooOOOooooXXXXXXXooooo.XXXXXXooooooOoooooOoooooOOoooooXXXXXXXXXXXXXXXXXXXOOooooooOoooooOooooooX ",
" .XXOoooOOoooooOoooooOoOOooOooooooXXXXXX.ooooOXXXXXXXooooooOoooooOoOOOooOoooooXXXXXXXXXXXXXXX.ooooOooooooOoooooOoooOOoX ",
" ..XX.oOoooooOooooooOoooOOOoooooOooooo.XXXXXXOOOOooXXXXXXXooooooOooo.XXooooooOoooooXXXXXXXXXX.OooOoooooOooooooOoooooOOoooooX. ",
" ..XXooooooOoooooOoooooOOOooooooooooOoooooXXXXXXXOoooooXXXXXXXoooooOXXXXXXXooooooOoooooXXXXXXX.ooooooOoooooOooooooOoOOOooOooooo.X ",
" .XXXoOoooooOoooooOoooooOOoooooOooooooOoooooXXXXXXXooooooXXXXXXXoooO.XXXXXXXXooooooOoooooXXXXXXX.ooooooOooooooOoooo.XOoooooOooooo.X ",
" XoooooOoooooOoooooXOOooooOoooooOoooooOoooOOOXXXXXXXooooooXXXXXXX.XXXXXXXXXXXXooooooOoooOOXXXXXXXXooooooOooooooO.XXXXXooooooOooooooX ",
" XoooooOooooooOo.XXX.ooooooOoooooOoooooOOOooooXXXXXXXoooooOXXXXXXXXXXXXXXXXXXXXoooooOOOOoooXXXXXXXXooooooOooo.XXXXXXXXXOoooooOooooooX ",
" XoooooOooooO.XXXXXXooooooOooooooOoOOooOooooo.XXXXXXXooooo.XXXXXXXXXXXXXXXXXXXXooOOOoOooooo.XXXXXXXooooooXXXXXXXXXXXXXX.oooooOOoooOOX. ",
" ..oooooOOOoooXXXXXXXooooooOooooOOOoooooOoooooXXXXXXX.OOOoo.XXXXXXXXXXXXXXXXXXXOOoooooOooooo.XXXXXXXoO.XXXXXXXXXXXXXXXXXXooooooOOOooo.X ",
" XooOOOOoooooOXXXXXX.ooooooOOOoooOoooooOooooooXXXXXXXOoooooXXXXXXXXXXXXXXXXXoooOooooooOooooo.XXXXXXXXXXXXXXXXXXXXXXXXXXXXooOOOoOooooooX ",
" .XoooooOoooooXXXXXXXooOOOOOooooooOoooooOooooooXXXXXXXooooooXXXXXXXXXXXX.OooooooOooooooOooooo.XXXXXXXXXXXXXXXXXXXXXXXXXXXXOoooooOooooooX ",
" XoooooOooooooXXXXXXXOoooooOoooooOooooooOoOOOooXXXXXXXooooooXXXXXXXX.ooooOooooooOooooooOooOOO.XXXXXXXXXXXXXXXXXXXXXXXX.ooOooooooOooooooX ",
" .XoooooOooooo.XXXXXX.ooooooOoooooOooooOOOooooo.XXXXXXXooooooXXXXXXXooooooOooooooOoooooOOOoooo.XXXXXXXXXXXXXXXXXXX.OOoooooOOoooooOOoooooX.",
" XoooooOoooOOOXXXXXXXooooooOooooooOOOoooOOoooooXXXXXXXXoooOOOXXXXXXXooooooOooooooOoOOoooOooooo.XXXXXXXXXXXXXXXXoooooOooooooOooooooOoo.XXXX",
" XooooOOOoooooXXXXXXXooooooOooOOooOoooooOooooooXXXXXXX.OOooo.XXXXXXXooooooOoooOOOOooooooOooooooXXXXXXXXXXX.ooOooooooOooooooOooooO.XXXX ",
" XOOOoooOoooooXXXXXXX.ooooOOOoooooOooooooOooooooXXXXXXXOooooo.XXXXXXXooooooOOoooooOooooooOooooooXXXXXX.OooooooOooooooOooooooXO.XXX. ",
" XoooooOooooooXXXXXXXOOOoooOOoooooOooooooOooooOOXXXXXXXooooooXXXXXXXXoOOOooOooooooOooooooOoooooOXXOoooOOooooooOooooooOooo.XXXX. ",
" XooooooOooooo.XXXXXXXooooooOooooooOoooooOOOOooo.XXXXXXXooooooXXXXXXX.ooooooOooooooOooooooOoOOOooOooooooOooooooOoooooOXXXX. ",
" XoooooOoooooOXXXXXXX.ooooooOooooooOooOOOOooooooXXXXXXXXooooooXXXXXXX.ooooooOooooooOooooOOOooooooOooooooOooooooOO.XXXX. ",
" ..oooooOOOOoooXXXXXXXoooooooOooooOOOoooooOooooooXXXXXXXXooOOooXXXXXXXOoooooOOoooooOOOOOoooOooooooOooooooOoooO.XXX.. ",
" XoooOOOOooooo.XXXXXXXooooooOOOOoooOooooooOooooooXXXXXXX.oooooOXXXXXXXOoooooOOooOOOoOooooooOooooooOoooooOXXXXX. ",
" .XoooooOooooooXXXXXXX.ooOOOOOooooooOooooooOoooooOXXXXXXXooooooOXXXXXXXoooooOOOooooooOooooooOooooooOo.XXXX. ",
" XooooooOoooooOXXXXXXXOoooooOOoooooOooooooOoooOOo.XXXXXXXoooooo.XXXXXXXOOOOooOoooooooOooooooOoooO.XXXX. ",
" .XoooooOooooooXXXXXXXXooooooOooooooOooooO.XooooooXXXXXXXXoooooo.XXXXXOOooooooOooooooooooooo.XXXXX. ",
" XooooooOoooOOOXXXXXXX.ooooooOoooooo..XXXXXXooooooXXXXXXXXoooooOXOoooooOooooooOoooooooooO.XXX. ",
" XoooooOOOoooo.XXXXXXXooooooOooo.XXXXXXXXXX.ooooooXXXXXXXXOOOoooOooooooOooooooOooooO.XXX. ",
" XOOOOooOooooooXXXXXXXXooooO.XXXXXXXXXXXXXXXooooooOXXXXXXOOooooooOooooooOooooooX.XXXX. ",
" XooooooOooooooXXXXXXXX.XXXXXXXXXXXXXXXXXXXXooooooOXOooooOoooooooOooooooOoo.XXXX. ",
" X.oooooOoooooo.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXoOOOooOooooooOooooooOOoooo.XXXX. ",
" XooooooOoooooOXXXXXXXXXXXXXXXXXXXXXXXXXXX.OOooooooOooooooOoooooo...XXX. ",
" X.oooooOOOOoooOXXXXXXXXXXXXXXXXXXXXXX.OooooOOooooooOooooooOoo..XXX. ",
" XoooOOoOooooooXXXXXXXXXXXXXXXXXX.OooOooooooOooooooOOoooo.XXXX. ",
" .XoooooOOooooooXXXXXXXXXXXXXOOoooooooOooooooOooooooX.XXXX. ",
" XooooooOoooooo.XXXXXXXXOoooooOooooooOoooooooOoo.XXXX. ",
" .XooooooOooooooXXXXoooOooooooOOooooooOooooO.XXXX. ",
" XooooooOoooOOOoOooooooOooooooOoooooooX.XXXX. ",
" XoooooOOOoooooOooooooOOooooooOoO.XXXX.. ",
" XXOOoooOOooooooOooooooOooooO.XXXX. ",
" XooooooOooooooOooooooOX.XXX. ",
" X.ooooooOooooooOoO.XXXX. ",
" XooooooOooooO.XXX.. ",
" X.oooooOXXXXX. ",
" XOO.XXX.. ",
".XX. "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,22 @@
/* XPM */
static const char *const north_xpm[] = {
"16 16 3 1",
" c None",
". c Black",
"X c Yellow",
" ",
" .. ",
" .XX. ",
" .XX. ",
" .XXXX. ",
" .XXXX. ",
" .XXXXXX. ",
" .XXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXXXXXX. ",
" .XX......XX. ",
" .X.. ..X. ",
" .. .. ",
" ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,57 @@
/* XPM */
static const char *const open_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 36 1",
", c #AAC1E8",
"1 c #9AEA53",
"q c #DCE6F6",
". c #295193",
"; c #A9D066",
"r c #C6D6F0",
"$ c #4A7CCE",
"9 c #779DDB",
"8 c #EAF0FA",
"O c #6E96D8",
"X c #214279",
"e c #BED0EE",
"6 c #85A7DF",
"5 c #F0F5FC",
"t c #ADC4E9",
": c #3161B1",
" c None",
"u c #274D8B",
"& c #BFDC9B",
"> c #9FB9E5",
"y c #5584D1",
"w c #3569BF",
"% c #3A70CA",
"+ c #305FAC",
"3 c #5D89D3",
"0 c #D2DFF4",
"@ c #CAE2AA",
"= c #B2D58C",
"2 c #FAFCFE",
"# c #638ED5",
"* c #CEDCF2",
"4 c #90AFE2",
"< c #B3C8EB",
"7 c #E5EDF9",
"- c #A2BCE6",
"o c #DFF0D0",
/* pixels */
" ",
" .... ",
"XXXXX .oo. ",
"XOOOO+ .@o. ",
"XOOOO#$%.&*XXX ",
"XOOOOOOO.=*X-X ",
"XOXXXX...;*XXXX:",
"XOX>,<.11111*X2:",
"X3X4>,<.111*X5-:",
"XX#64>,,.1*X78: ",
"XXO964>,,.X0q7: ",
"Xw3O964>,,er0t: ",
"X%y3O964>,<er: ",
"uXXXXXXXXXXXX: ",
" "
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *const play_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c None",
". c Black",
/* pixels */
" ",
" ",
" ",
" . ",
" ... ",
" ..... ",
" ....... ",
" ......... ",
" ....... ",
" ..... ",
" ... ",
" . ",
" ",
" ",
" ",
" "
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

View File

@@ -0,0 +1,52 @@
/* XPM */
static const char *const reset_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 31 1",
". c #7198D9",
"2 c #DCE6F6",
", c #FFFFFF",
"= c #9AB6E4",
"6 c #EAF0FA",
"w c #6992D7",
"0 c #5886D2",
"7 c #F7F9FD",
"5 c #F0F5FC",
"* c #A8C0E8",
" c None",
"8 c #FDFEFF",
"% c #C4D5F0",
"3 c #E2EAF8",
"+ c #4377CD",
"O c #487BCE",
"; c #6B94D7",
"- c #89A9DF",
": c #5584D1",
"# c #3569BF",
"@ c #3A70CA",
"1 c #D2DFF4",
"> c #3366BB",
"$ c #2E5CA8",
"9 c #FAFCFE",
"4 c #F5F8FD",
"q c #638ED5",
"o c #5282D0",
"& c #B8CCEC",
"X c #376EC9",
"< c #ACE95B",
/* pixels */
" .XoO+@#$. ",
" .%%&*=-O;: ",
" >>>>%&*=O,=o ",
" ><<>%%&*O,,=o ",
">>><<>>>%&OOo+@ ",
"><<<<<<>1%&*=-@ ",
"><<<<<<>21%&*=@ ",
">>><<>>>321%&*+ ",
" ><<>456321%&O ",
" >>>>7456321%o ",
" .,8974563210 ",
" .,,897456320 ",
" .,,,8974563q ",
" .,,,,897456w ",
" ............ "
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,22 @@
/* XPM */
static const char *const south_xpm[] = {
"16 16 3 1",
" c None",
". c Black",
"X c Yellow",
" ",
" ",
" .. .. ",
" .X.. ..X. ",
" .XX......XX. ",
" .XXXXXXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXX. ",
" .XXXXXX. ",
" .XXXX. ",
" .XXXX. ",
" .XX. ",
" .XX. ",
" .. ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,24 @@
/* XPM */
static const char *const stop_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 2 1",
" c None",
". c Black",
/* pixels */
" ",
" ",
" ",
" ........ ",
" ........ ",
" ........ ",
" ........ ",
" ........ ",
" ........ ",
" ........ ",
" ........ ",
" ........ ",
" ",
" ",
" ",
" "
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,22 @@
/* XPM */
static const char *const west_xpm[] = {
"16 16 3 1",
" c None",
". c Black",
"X c Yellow",
" ",
" .. ",
" ..X. ",
" ..XX. ",
" ..XXXX. ",
" ..XXXXX. ",
" ..XXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" ..XXXXXXX. ",
" ..XXXXX. ",
" ..XXXX. ",
" ..XX. ",
" ..X. ",
" .. ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,23 @@
/* XPM */
static const char *const zoomin_xpm[] = {
"16 16 3 1",
" c None",
". c Black",
"X c Gray100",
" .... ",
" ..XXXX.. ",
" .XXXXXXXX. ",
" .XXX..XXX. ",
".XXXX..XXXX. ",
".XX......XX. ",
".XX......XX. ",
".XXXX..XXXX. ",
" .XXX..XXX. ",
" .XXXXXXXX. ",
" ..XXXX... ",
" .... ... ",
" ... ",
" ... ",
" ... ",
" .. "
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

View File

@@ -0,0 +1,23 @@
/* XPM */
static const char *const zoomout_xpm[] = {
"16 16 3 1",
" c None",
". c Black",
"X c Gray100",
" .... ",
" ..XXXX.. ",
" .XXXXXXXX. ",
" .XXXXXXXX. ",
".XXXXXXXXXX. ",
".XX......XX. ",
".XX......XX. ",
".XXXXXXXXXX. ",
" .XXXXXXXX. ",
" .XXXXXXXX. ",
" ..XXXX... ",
" .... ... ",
" ... ",
" ... ",
" ... ",
" .. "
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 5 October 2009 *
# *
#*****************************************************************************
.first
define wx [--.include.wx]
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WXMOTIF__=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)
.else
CXX_DEFINE =
.endif
.endif
.suffixes : .cpp
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
all :
.ifdef __WXMOTIF__
$(MMS)$(MMSQUALIFIERS) life.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) life_gtk.exe
.endif
.endif
OBJS=life.obj,dialogs.obj,game.obj,reader.obj
.ifdef __WXMOTIF__
life.exe : $(OBJS)
cxxlink/exec=life.exe $(OBJS),[--.lib]vms/opt
.else
.ifdef __WXGTK__
life_gtk.exe : $(OBJS)
cxxlink/exec=life_gtk.exe $(OBJS),[--.lib]vms_gtk/opt
.endif
.endif
life.obj : life.cpp
dialogs.obj : dialogs.cpp
game.obj : game.cpp
reader.obj : reader.cpp

View File

@@ -0,0 +1,203 @@
/////////////////////////////////////////////////////////////////////////////
// Name: life/dialogs.cpp
// Purpose: Life! dialogs
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Created: Jan/2000
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ==========================================================================
// headers, declarations, constants
// ==========================================================================
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/statline.h"
#include "wx/minifram.h"
#include "wx/settings.h"
#include "dialogs.h"
#include "life.h"
#include "game.h"
// --------------------------------------------------------------------------
// resources
// --------------------------------------------------------------------------
#include "bitmaps/life.xpm"
// sample configurations
#include "samples.inc"
// --------------------------------------------------------------------------
// constants
// --------------------------------------------------------------------------
// IDs for the controls and the menu commands
enum
{
// listbox in samples dialog
ID_LISTBOX
};
// --------------------------------------------------------------------------
// event tables and other macros for wxWidgets
// --------------------------------------------------------------------------
// Event tables
wxBEGIN_EVENT_TABLE(LifeSamplesDialog, wxDialog)
EVT_LISTBOX (ID_LISTBOX, LifeSamplesDialog::OnListBox)
wxEND_EVENT_TABLE()
// ==========================================================================
// implementation
// ==========================================================================
// --------------------------------------------------------------------------
// LifeSamplesDialog
// --------------------------------------------------------------------------
LifeSamplesDialog::LifeSamplesDialog(wxWindow *parent)
: wxDialog(parent, wxID_ANY, _("Sample games"),
wxDefaultPosition, wxDefaultSize)
{
m_value = 0;
wxSize listSize = wxDefaultSize;
bool isPDA = wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA;
// Screens are generally horizontal in orientation,
// but PDAs are generally vertical.
bool screenIsHorizontal = true;
if (isPDA &&
wxSystemSettings::GetMetric(wxSYS_SCREEN_X) < wxSystemSettings::GetMetric(wxSYS_SCREEN_Y))
{
listSize = wxSize(wxDefaultCoord, 50);
screenIsHorizontal = false;
}
// create and populate the list of available samples
m_list = new wxListBox( this, ID_LISTBOX,
wxDefaultPosition,
listSize,
0, nullptr,
wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL );
for (unsigned i = 0; i < (sizeof(g_patterns) / sizeof(LifePattern)); i++)
m_list->Append(g_patterns[i].m_name);
// descriptions
wxStaticBox *statbox = new wxStaticBox( this, wxID_ANY, _("Description"));
m_life = new Life();
m_life->SetPattern(g_patterns[0]);
m_canvas = new LifeCanvas( this, m_life, false );
m_text = new wxTextCtrl( this, wxID_ANY,
g_patterns[0].m_description,
wxDefaultPosition,
wxSize(300, 60),
wxTE_MULTILINE | wxTE_READONLY);
// layout components
wxStaticBoxSizer *sizer1 = new wxStaticBoxSizer( statbox, wxVERTICAL );
sizer1->Add( m_canvas, 2, wxGROW | wxALL, 5);
sizer1->Add( m_text, 1, wxGROW | wxALL, 5 );
wxBoxSizer *sizer2 = new wxBoxSizer( screenIsHorizontal ? wxHORIZONTAL : wxVERTICAL );
sizer2->Add( m_list, 0, wxGROW | wxALL, 5 );
sizer2->Add( sizer1, 1, wxGROW | wxALL, 5 );
wxBoxSizer *sizer3 = new wxBoxSizer( wxVERTICAL );
sizer3->Add( CreateTextSizer(_("Select a configuration")), 0, wxALL|wxCENTRE, isPDA ? 2 : 10 );
#if wxUSE_STATLINE
if (!isPDA)
sizer3->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 10 );
#endif // wxUSE_STATLINE
sizer3->Add( sizer2, 1, wxGROW | wxALL, 5 );
wxSizer *sizerBtns = CreateButtonSizer(wxOK|wxCANCEL);
if ( sizerBtns )
{
sizer3->Add(sizerBtns, wxSizerFlags().Expand().Border());
}
// activate
SetSizer(sizer3);
sizer3->SetSizeHints(this);
sizer3->Fit(this);
Centre(wxBOTH | wxCENTRE_ON_SCREEN);
}
LifeSamplesDialog::~LifeSamplesDialog()
{
m_canvas->Destroy();
}
const LifePattern& LifeSamplesDialog::GetPattern()
{
return g_patterns[m_value];
}
void LifeSamplesDialog::OnListBox(wxCommandEvent& event)
{
int sel = event.GetSelection();
if (sel != -1)
{
m_value = m_list->GetSelection();
m_text->SetValue(g_patterns[ sel ].m_description);
m_life->SetPattern(g_patterns[ sel ]);
// these values shouldn't be hardcoded...
if ((size_t)sel < (sizeof(g_patterns) / sizeof(LifePattern)) - 3)
m_canvas->SetCellSize(8);
else
m_canvas->SetCellSize(2);
}
}
// --------------------------------------------------------------------------
// LifeAboutDialog
// --------------------------------------------------------------------------
LifeAboutDialog::LifeAboutDialog(wxWindow *parent)
: wxDialog(parent, wxID_ANY, _("About Life!"),
wxDefaultPosition, wxDefaultSize)
{
// logo
wxStaticBitmap *sbmp = new wxStaticBitmap(this, wxID_ANY, wxBitmap(life_xpm));
// layout components
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
sizer->Add( sbmp, 0, wxCENTRE | wxALL, 10 );
#if wxUSE_STATLINE
sizer->Add( new wxStaticLine(this, wxID_ANY), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
#endif // wxUSE_STATLINE
sizer->Add( CreateTextSizer(_("Life! version 2.2 for wxWidgets\n\n\
(c) 2000 Guillermo Rodriguez Garcia\n\n\
<guille@iies.es>\n\n\
Portions of the code are based in XLife;\n\
XLife is (c) 1989 by Jon Bennett et al.")),
0, wxCENTRE | wxRIGHT|wxLEFT|wxTOP, 20 );
// buttons if any
wxSizer *sizerBtns = CreateButtonSizer(wxOK);
if ( sizerBtns )
{
sizer->Add(sizerBtns, wxSizerFlags().Expand().Border());
}
// activate
SetSizer(sizer);
sizer->SetSizeHints(this);
sizer->Fit(this);
Centre(wxBOTH | wxCENTRE_ON_SCREEN);
}

View File

@@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialogs.h
// Purpose: Life! dialogs
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Created: Jan/2000
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _LIFE_DIALOGS_H_
#define _LIFE_DIALOGS_H_
#include "life.h"
#include "game.h"
// --------------------------------------------------------------------------
// LifeSamplesDialog
// --------------------------------------------------------------------------
class LifeSamplesDialog : public wxDialog
{
public:
// ctor and dtor
LifeSamplesDialog(wxWindow *parent);
virtual ~LifeSamplesDialog();
// members
const LifePattern& GetPattern();
// event handlers
void OnListBox(wxCommandEvent &event);
private:
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
int m_value;
wxListBox *m_list;
wxTextCtrl *m_text;
LifeCanvas *m_canvas;
Life *m_life;
};
// --------------------------------------------------------------------------
// LifeAboutDialog
// --------------------------------------------------------------------------
class LifeAboutDialog : public wxDialog
{
public:
// ctor
LifeAboutDialog(wxWindow *parent);
};
#endif // _LIFE_DIALOGS_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,163 @@
/////////////////////////////////////////////////////////////////////////////
// Name: game.h
// Purpose: Life! game logic
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Created: Jan/2000
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _LIFE_GAME_H_
#define _LIFE_GAME_H_
// --------------------------------------------------------------------------
// LifePattern
// --------------------------------------------------------------------------
// A class which holds a pattern
class LifePattern
{
public:
// This ctor is used by the LifeReader class
LifePattern(const wxString& name,
const wxString& description,
const wxString& rules,
const wxArrayString& shape)
: m_name(name)
, m_description(description)
, m_rules(rules)
, m_shape(shape)
{
}
// A more convenient ctor for the built-in samples
LifePattern(const wxString& name,
const wxString& description,
int width,
int height,
const char *shape)
: m_name(name)
, m_description(description)
{
// TODO: add the positions later, since the formatting command
// causes a crash due to conversion objects not being available
// during initialisation.
#ifndef __WXMAC__
m_shape.Add( wxString::Format(wxT("%i %i"), -width/2, -height/2) );
#endif
for(int j = 0; j < height; j++)
{
wxString tmp;
for(int i = 0; i < width; i++)
{
tmp += wxChar(shape[j * width + i]);
}
m_shape.Add( tmp );
}
}
wxString m_name;
wxString m_description;
wxString m_rules;
wxArrayString m_shape;
};
// --------------------------------------------------------------------------
// Life
// --------------------------------------------------------------------------
// A struct used to pass cell coordinates around
struct LifeCell
{
wxInt32 i;
wxInt32 j;
};
// A private class that contains data about a block of cells
class LifeCellBox;
// A class that models a Life game instance
class Life
{
public:
// ctor and dtor
Life();
~Life();
// accessors
inline wxUint32 GetNumCells() const { return m_numcells; }
inline wxString GetRules() const { return m_rules; }
inline wxString GetDescription() const { return m_description; }
bool IsAlive(wxInt32 x, wxInt32 y);
void SetCell(wxInt32 x, wxInt32 y, bool alive = true);
void SetPattern(const LifePattern &pattern);
// game control
void Clear();
bool NextTic();
// navigation
LifeCell FindNorth();
LifeCell FindSouth();
LifeCell FindWest();
LifeCell FindEast();
LifeCell FindCenter();
// The following functions find cells within a given viewport; either
// all alive cells, or only those cells which have changed since last
// generation. You first call BeginFind() to specify the viewport,
// then keep calling FindMore() until it returns true.
//
// BeginFind:
// Specify the viewport and whether to look for alive cells or for
// cells which have changed since the last generation and thus need
// to be repainted. In this latter case, there is no distinction
// between newborn or just-dead cells.
//
// FindMore:
// Fills an array with cells that match the specification given with
// BeginFind(). The array itself belongs to the Life object and must
// not be modified or freed by the caller. If this function returns
// false, then the operation is not complete: just process all cells
// and call FillMore() again.
//
void BeginFind(wxInt32 x0, wxInt32 y0,
wxInt32 x1, wxInt32 y1,
bool changed);
bool FindMore(LifeCell *cells[], size_t *ncells);
private:
// cellbox-related
LifeCellBox *CreateBox(wxInt32 x, wxInt32 y, wxUint32 hv);
LifeCellBox *LinkBox(wxInt32 x, wxInt32 y, bool create = true);
void KillBox(LifeCellBox *c);
// helper for BeginFind & FindMore
void DoLine(wxInt32 x, wxInt32 y, wxUint32 alive, wxUint32 old = 0);
// pattern description
wxString m_name; // name (currently unused)
wxString m_rules; // rules (currently unused)
wxString m_description; // description
// pattern data
LifeCellBox *m_head; // list of alive boxes
LifeCellBox *m_available; // list of reusable dead boxes
LifeCellBox **m_boxes; // hash table of alive boxes
wxUint32 m_numcells; // population (number of alive cells)
// state vars for BeginFind & FindMore
LifeCell *m_cells; // array of cells
size_t m_ncells; // number of valid entries in m_cells
wxInt32 m_x, m_y, // counters and search mode
m_x0, m_y0,
m_x1, m_y1;
bool m_changed;
bool m_findmore;
};
#endif // _LIFE_GAME_H_

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<makefile>
<include file="../../build/bakefiles/common_samples.bkl"/>
<exe id="life" template="wx_sample" template_append="wx_append">
<sources>
life.cpp
dialogs.cpp
game.cpp
reader.cpp
</sources>
<wx-lib>core</wx-lib>
<wx-lib>base</wx-lib>
<win32-res>life.rc</win32-res>
</exe>
<wx-data id="data">
<files>
breeder.lif
</files>
</wx-data>
</makefile>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
/////////////////////////////////////////////////////////////////////////////
// Name: life.h
// Purpose: The game of Life, created by J. H. Conway
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Created: Jan/2000
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _LIFE_APP_H_
#define _LIFE_APP_H_
#include "wx/minifram.h"
#include "game.h"
// --------------------------------------------------------------------------
// LifeCanvas
// --------------------------------------------------------------------------
// Note that in LifeCanvas, all cell coordinates are
// named i, j, while screen coordinates are named x, y.
class LifeCanvas : public wxWindow
{
public:
// ctor and dtor
LifeCanvas(wxWindow* parent, Life* life, bool interactive = true);
virtual ~LifeCanvas();
// view management
int GetCellSize() const { return m_cellsize; }
void SetCellSize(int cellsize);
void Recenter(wxInt32 i, wxInt32 j);
// drawing
void DrawChanged();
void DrawCell(wxInt32 i, wxInt32 j, bool alive);
private:
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
// draw a cell (parametrized by DC)
void DrawCell(wxInt32 i, wxInt32 j, wxDC &dc);
// event handlers
void OnPaint(wxPaintEvent& event);
void OnMouse(wxMouseEvent& event);
void OnSize(wxSizeEvent& event);
void OnScroll(wxScrollWinEvent& event);
void OnEraseBackground(wxEraseEvent& event);
// conversion between cell and screen coordinates
inline wxInt32 XToCell(wxCoord x) const { return (x / m_cellsize) + m_viewportX; }
inline wxInt32 YToCell(wxCoord y) const { return (y / m_cellsize) + m_viewportY; }
inline wxCoord CellToX(wxInt32 i) const { return (i - m_viewportX) * m_cellsize; }
inline wxCoord CellToY(wxInt32 j) const { return (j - m_viewportY) * m_cellsize; }
// what is the user doing?
enum MouseStatus
{
MOUSE_NOACTION,
MOUSE_DRAWING,
MOUSE_ERASING
};
Life *m_life; // Life object
int m_cellsize; // current cell size, in pixels
bool m_interactive; // is this canvas interactive?
MouseStatus m_status; // what is the user doing?
wxInt32 m_viewportX; // first visible cell (x coord)
wxInt32 m_viewportY; // first visible cell (y coord)
wxInt32 m_viewportW; // number of visible cells (w)
wxInt32 m_viewportH; // number of visible cells (h)
int m_thumbX; // horiz. scrollbar thumb position
int m_thumbY; // vert. scrollbar thumb position
wxInt32 m_mi, m_mj; // last mouse position
};
// --------------------------------------------------------------------------
// LifeNavigator
// --------------------------------------------------------------------------
class LifeNavigator : public wxMiniFrame
{
public:
// ctor
LifeNavigator(wxWindow *parent);
private:
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
// event handlers
void OnClose(wxCloseEvent& event);
};
// --------------------------------------------------------------------------
// LifeFrame
// --------------------------------------------------------------------------
class LifeFrame : public wxFrame
{
public:
// ctor and dtor
LifeFrame();
virtual ~LifeFrame();
// member functions
void UpdateInfoText();
void UpdateUI();
private:
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
// event handlers
void OnMenu(wxCommandEvent& event);
void OnOpen(wxCommandEvent& event);
void OnSamples(wxCommandEvent& event);
void OnNavigate(wxCommandEvent& event);
void OnZoom(wxCommandEvent& event);
void OnSlider(wxScrollEvent& event);
void OnTimer(wxTimerEvent& event);
void OnClose(wxCloseEvent& event);
// event handler helpers
void OnStart();
void OnStop();
void OnStep();
Life *m_life;
LifeCanvas *m_canvas;
LifeNavigator *m_navigator;
wxStaticText *m_text;
wxTimer *m_timer;
bool m_running;
bool m_topspeed;
long m_interval;
long m_tics;
};
// --------------------------------------------------------------------------
// LifeApp
// --------------------------------------------------------------------------
class LifeApp : public wxApp
{
public:
virtual bool OnInit() override;
};
#endif // _LIFE_APP_H_

View File

@@ -0,0 +1,17 @@
mondrian ICON "mondrian.ico"
#include "wx/msw/wx.rc"
reset BITMAP "bitmaps/reset.bmp"
open BITMAP "bitmaps/open.bmp"
play BITMAP "bitmaps/play.bmp"
stop BITMAP "bitmaps/stop.bmp"
zoomin BITMAP "bitmaps/zoomin.bmp"
zoomout BITMAP "bitmaps/zoomout.bmp"
info BITMAP "bitmaps/info.bmp"
north BITMAP "bitmaps/north.bmp"
east BITMAP "bitmaps/east.bmp"
south BITMAP "bitmaps/south.bmp"
west BITMAP "bitmaps/west.bmp"
center BITMAP "bitmaps/center.bmp"
life BITMAP "bitmaps/life.bmp"

View File

@@ -0,0 +1,244 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.13 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
include ../../build/msw/config.gcc
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
CPPDEPS = -MT$@ -MF$@.d -MD -MP
WX_RELEASE_NODOT = 33
COMPILER_PREFIX = gcc
OBJS = \
$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
LIBDIRNAME = \
.\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)
SETUPHDIR = $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)
LIFE_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) -D__WXMSW__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
-I$(SETUPHDIR) -I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_p) -W \
-Wall -I. $(__DLLFLAG_p) -I.\..\..\samples -DNOPCH $(__RTTIFLAG_5) \
$(__EXCEPTIONSFLAG_6) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
LIFE_OBJECTS = \
$(OBJS)\life_life.o \
$(OBJS)\life_dialogs.o \
$(OBJS)\life_game.o \
$(OBJS)\life_reader.o \
$(OBJS)\life_life_rc.o
### Conditionally set variables: ###
ifeq ($(USE_GUI),0)
PORTNAME = base
endif
ifeq ($(USE_GUI),1)
PORTNAME = msw$(TOOLKIT_VERSION)
endif
ifeq ($(OFFICIAL_BUILD),1)
COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
endif
ifeq ($(BUILD),debug)
WXDEBUGFLAG = d
endif
ifeq ($(WXUNIV),1)
WXUNIVNAME = univ
endif
ifeq ($(SHARED),1)
WXDLLFLAG = dll
endif
ifeq ($(SHARED),0)
LIBTYPE_SUFFIX = lib
endif
ifeq ($(SHARED),1)
LIBTYPE_SUFFIX = dll
endif
ifeq ($(MONOLITHIC),0)
EXTRALIBS_FOR_BASE =
endif
ifeq ($(MONOLITHIC),1)
EXTRALIBS_FOR_BASE =
endif
ifeq ($(BUILD),debug)
__OPTIMIZEFLAG_2 = -O0
endif
ifeq ($(BUILD),release)
__OPTIMIZEFLAG_2 = -O2
endif
ifeq ($(USE_RTTI),0)
__RTTIFLAG_5 = -fno-rtti
endif
ifeq ($(USE_RTTI),1)
__RTTIFLAG_5 =
endif
ifeq ($(USE_EXCEPTIONS),0)
__EXCEPTIONSFLAG_6 = -fno-exceptions
endif
ifeq ($(USE_EXCEPTIONS),1)
__EXCEPTIONSFLAG_6 =
endif
ifeq ($(WXUNIV),1)
__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
endif
ifeq ($(WXUNIV),1)
__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
endif
ifeq ($(DEBUG_FLAG),0)
__DEBUG_DEFINE_p = -DwxDEBUG_LEVEL=0
endif
ifeq ($(DEBUG_FLAG),0)
__DEBUG_DEFINE_p_1 = --define wxDEBUG_LEVEL=0
endif
ifeq ($(BUILD),release)
__NDEBUG_DEFINE_p = -DNDEBUG
endif
ifeq ($(BUILD),release)
__NDEBUG_DEFINE_p_1 = --define NDEBUG
endif
ifeq ($(USE_EXCEPTIONS),0)
__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
endif
ifeq ($(USE_EXCEPTIONS),0)
__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
endif
ifeq ($(USE_RTTI),0)
__RTTI_DEFINE_p = -DwxNO_RTTI
endif
ifeq ($(USE_RTTI),0)
__RTTI_DEFINE_p_1 = --define wxNO_RTTI
endif
ifeq ($(USE_THREADS),0)
__THREAD_DEFINE_p = -DwxNO_THREADS
endif
ifeq ($(USE_THREADS),0)
__THREAD_DEFINE_p_1 = --define wxNO_THREADS
endif
ifeq ($(USE_CAIRO),1)
____CAIRO_INCLUDEDIR_FILENAMES_p = -I$(CAIRO_ROOT)\include\cairo
endif
ifeq ($(USE_CAIRO),1)
__CAIRO_INCLUDEDIR_p = --include-dir $(CAIRO_ROOT)/include/cairo
endif
ifeq ($(SHARED),1)
__DLLFLAG_p = -DWXUSINGDLL
endif
ifeq ($(SHARED),1)
__DLLFLAG_p_1 = --define WXUSINGDLL
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_CORE_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_BASE_p = -lwxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
endif
ifeq ($(MONOLITHIC),1)
__WXLIB_MONO_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
endif
ifeq ($(MONOLITHIC),1)
ifeq ($(USE_STC),1)
__LIB_SCINTILLA_IF_MONO_p = -lwxscintilla$(WXDEBUGFLAG)
endif
endif
ifeq ($(MONOLITHIC),1)
ifeq ($(USE_STC),1)
__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
endif
endif
ifeq ($(USE_STC),1)
__LIB_LEXILLA_p = -lwxlexilla$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_TIFF_p = -lwxtiff$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_JPEG_p = -lwxjpeg$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_PNG_p = -lwxpng$(WXDEBUGFLAG)
endif
ifeq ($(USE_GUI),1)
__LIB_WEBP_p = -lwxwebp$(WXDEBUGFLAG)
endif
ifeq ($(USE_CAIRO),1)
__CAIRO_LIB_p = -lcairo
endif
ifeq ($(USE_CAIRO),1)
____CAIRO_LIBDIR_FILENAMES_p = -L$(CAIRO_ROOT)\lib
endif
ifeq ($(BUILD),debug)
ifeq ($(DEBUG_INFO),default)
__DEBUGINFO = -g
endif
endif
ifeq ($(BUILD),release)
ifeq ($(DEBUG_INFO),default)
__DEBUGINFO =
endif
endif
ifeq ($(DEBUG_INFO),0)
__DEBUGINFO =
endif
ifeq ($(DEBUG_INFO),1)
__DEBUGINFO = -g
endif
ifeq ($(USE_THREADS),0)
__THREADSFLAG =
endif
ifeq ($(USE_THREADS),1)
__THREADSFLAG = -mthreads
endif
all: $(OBJS)
$(OBJS):
-if not exist $(OBJS) mkdir $(OBJS)
### Targets: ###
all: $(OBJS)\life.exe data
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
-if exist $(OBJS)\*.d del $(OBJS)\*.d
-if exist $(OBJS)\life.exe del $(OBJS)\life.exe
$(OBJS)\life.exe: $(LIFE_OBJECTS) $(OBJS)\life_life_rc.o
$(foreach f,$(subst \,/,$(LIFE_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lgdiplus -lmsimg32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
@-del $@.rsp
data:
if not exist $(OBJS) mkdir $(OBJS)
for %%f in (breeder.lif) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
$(OBJS)\life_life.o: ./life.cpp
$(CXX) -c -o $@ $(LIFE_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\life_dialogs.o: ./dialogs.cpp
$(CXX) -c -o $@ $(LIFE_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\life_game.o: ./game.cpp
$(CXX) -c -o $@ $(LIFE_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\life_reader.o: ./reader.cpp
$(CXX) -c -o $@ $(LIFE_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\life_life_rc.o: ./life.rc
$(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_1) --define wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST) --include-dir ./../../samples --define NOPCH
.PHONY: all clean data
SHELL := $(COMSPEC)
# Dependencies tracking:
-include $(OBJS)/*.d

View File

@@ -0,0 +1,35 @@
#
# File: Makefile for samples
# Author: Robert Roebling
# Created: 1999
# Updated:
# Copyright: (c) 1998 Robert Roebling
#
# This makefile requires a Unix version of wxWindows
# to be installed on your system. This is most often
# done typing "make install" when using the complete
# sources of wxWindows or by installing the two
# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm
# under Linux.
#
CXX = $(shell wx-config --cxx)
PROGRAM = life
OBJECTS = $(PROGRAM).o dialogs.o game.o reader.o
# implementation
.SUFFIXES: .o .cpp
.cpp.o :
$(CXX) -c `wx-config --cxxflags` -o $@ $<
all: $(PROGRAM)
$(PROGRAM): $(OBJECTS)
$(CXX) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
clean:
rm -f *.o $(PROGRAM)

View File

@@ -0,0 +1,457 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.13 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
!include <../../build/msw/config.vc>
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
WX_RELEASE_NODOT = 33
COMPILER_PREFIX = vc
OBJS = \
$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)
LIBDIRNAME = \
.\..\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG)
SETUPHDIR = $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)
LIFE_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
$(__DEBUGINFO_0) /Fd$(OBJS)\life.pdb $(____DEBUGRUNTIME_3_p) \
$(__OPTIMIZEFLAG_6) /D_CRT_SECURE_NO_DEPRECATE=1 \
/D_CRT_NON_CONFORMING_SWPRINTFS=1 /D_SCL_SECURE_NO_WARNINGS=1 \
$(__NO_VC_CRTDBG_p) $(__TARGET_CPU_COMPFLAG_p) /D__WXMSW__ \
$(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) \
$(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \
/I$(SETUPHDIR) /I.\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_p) /W4 /I. \
$(__DLLFLAG_p) /D_WINDOWS /I.\..\..\samples /DNOPCH $(__RTTIFLAG_11) \
$(__EXCEPTIONSFLAG_12) $(CPPFLAGS) $(CXXFLAGS)
LIFE_OBJECTS = \
$(OBJS)\life_life.obj \
$(OBJS)\life_dialogs.obj \
$(OBJS)\life_game.obj \
$(OBJS)\life_reader.obj
LIFE_RESOURCES = \
$(OBJS)\life_life.res
### Conditionally set variables: ###
!if "$(TARGET_CPU)" == "AMD64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "ARM"
ARCH_SUFFIX = _arm
!endif
!if "$(TARGET_CPU)" == "ARM64"
ARCH_SUFFIX = _arm64
!endif
!if "$(TARGET_CPU)" == "IA64"
ARCH_SUFFIX = _ia64
!endif
!if "$(TARGET_CPU)" == "X64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "amd64"
ARCH_SUFFIX = _x64
!endif
!if "$(TARGET_CPU)" == "arm"
ARCH_SUFFIX = _arm
!endif
!if "$(TARGET_CPU)" == "arm64"
ARCH_SUFFIX = _arm64
!endif
!if "$(TARGET_CPU)" == "ia64"
ARCH_SUFFIX = _ia64
!endif
!if "$(TARGET_CPU)" == "x64"
ARCH_SUFFIX = _x64
!endif
!if "$(USE_GUI)" == "0"
PORTNAME = base
!endif
!if "$(USE_GUI)" == "1"
PORTNAME = msw$(TOOLKIT_VERSION)
!endif
!if "$(OFFICIAL_BUILD)" == "1"
COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
WXDEBUGFLAG = d
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
WXDEBUGFLAG = d
!endif
!if "$(WXUNIV)" == "1"
WXUNIVNAME = univ
!endif
!if "$(SHARED)" == "1"
WXDLLFLAG = dll
!endif
!if "$(SHARED)" == "0"
LIBTYPE_SUFFIX = lib
!endif
!if "$(SHARED)" == "1"
LIBTYPE_SUFFIX = dll
!endif
!if "$(TARGET_CPU)" == "AMD64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "ARM"
LINK_TARGET_CPU = /MACHINE:ARM
!endif
!if "$(TARGET_CPU)" == "ARM64"
LINK_TARGET_CPU = /MACHINE:ARM64
!endif
!if "$(TARGET_CPU)" == "IA64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(TARGET_CPU)" == "X64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "amd64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "arm"
LINK_TARGET_CPU = /MACHINE:ARM
!endif
!if "$(TARGET_CPU)" == "arm64"
LINK_TARGET_CPU = /MACHINE:ARM64
!endif
!if "$(TARGET_CPU)" == "ia64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(TARGET_CPU)" == "x64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "1" && "$(VISUALSTUDIOVERSION)" == "17.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "14.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "15.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "16.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(USE_DPI_AWARE_MANIFEST)" == "2" && "$(VISUALSTUDIOVERSION)" == "17.0"
WIN32_DPI_LINKFLAG = /MANIFEST:EMBED \
/MANIFESTINPUT:./../../include/wx/msw/wx_dpi_aware_pmv2.manifest
!endif
!if "$(MONOLITHIC)" == "0"
EXTRALIBS_FOR_BASE =
!endif
!if "$(MONOLITHIC)" == "1"
EXTRALIBS_FOR_BASE =
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_0 = /Zi
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_0 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_0 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_0 = /Zi
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_1 = /DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_1 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_1 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_1 = /DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_2 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_2 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p = /D_DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
____DEBUGRUNTIME_3_p =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
____DEBUGRUNTIME_3_p = /D_DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p_1 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
____DEBUGRUNTIME_3_p_1 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_4 = d
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_4 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__DEBUGRUNTIME_4 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
__DEBUGRUNTIME_4 = d
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_5 =
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
__DEBUGRUNTIME_5 =
!endif
!if "$(BUILD)" == "debug"
__OPTIMIZEFLAG_6 = /Od
!endif
!if "$(BUILD)" == "release"
__OPTIMIZEFLAG_6 = /O2
!endif
!if "$(USE_THREADS)" == "0"
__THREADSFLAG_9 = L
!endif
!if "$(USE_THREADS)" == "1"
__THREADSFLAG_9 = T
!endif
!if "$(RUNTIME_LIBS)" == "dynamic"
__RUNTIME_LIBS_10 = D
!endif
!if "$(RUNTIME_LIBS)" == "static"
__RUNTIME_LIBS_10 = $(__THREADSFLAG_9)
!endif
!if "$(USE_RTTI)" == "0"
__RTTIFLAG_11 = /GR-
!endif
!if "$(USE_RTTI)" == "1"
__RTTIFLAG_11 = /GR
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONSFLAG_12 =
!endif
!if "$(USE_EXCEPTIONS)" == "1"
__EXCEPTIONSFLAG_12 = /EHsc
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
!endif
!if "$(TARGET_CPU)" == ""
__TARGET_CPU_COMPFLAG_p = /DTARGET_CPU_COMPFLAG=0
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
__TARGET_CPU_COMPFLAG_p =
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
__TARGET_CPU_COMPFLAG_p =
!endif
!if "$(TARGET_CPU)" == ""
__TARGET_CPU_COMPFLAG_p_1 = /d TARGET_CPU_COMPFLAG=0
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "X64"
__TARGET_CPU_COMPFLAG_p_1 =
!endif
!if "$(TARGET_CPU)" == "" && "$(VISUALSTUDIOPLATFORM)" == "x64"
__TARGET_CPU_COMPFLAG_p_1 =
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p = /D__WXUNIVERSAL__
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p_1 = /d __WXUNIVERSAL__
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p = /DwxDEBUG_LEVEL=0
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p_1 = /d wxDEBUG_LEVEL=0
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__NDEBUG_DEFINE_p = /DNDEBUG
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__NDEBUG_DEFINE_p = /DNDEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__NDEBUG_DEFINE_p_1 = /d NDEBUG
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__NDEBUG_DEFINE_p_1 = /d NDEBUG
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p = /DwxNO_EXCEPTIONS
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p_1 = /d wxNO_EXCEPTIONS
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p = /DwxNO_RTTI
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p_1 = /d wxNO_RTTI
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p = /DwxNO_THREADS
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p_1 = /d wxNO_THREADS
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES_p = /I$(CAIRO_ROOT)\include\cairo
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES_1_p = /i $(CAIRO_ROOT)\include\cairo
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p = /DWXUSINGDLL
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p_1 = /d WXUSINGDLL
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_CORE_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_BASE_p = \
wxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(MONOLITHIC)" == "1"
__WXLIB_MONO_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(MONOLITHIC)" == "1" && "$(USE_STC)" == "1"
__LIB_SCINTILLA_IF_MONO_p = wxscintilla$(WXDEBUGFLAG).lib
!endif
!if "$(MONOLITHIC)" == "1" && "$(USE_STC)" == "1"
__LIB_LEXILLA_IF_MONO_p = $(__LIB_LEXILLA_p)
!endif
!if "$(USE_STC)" == "1"
__LIB_LEXILLA_p = wxlexilla$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_WEBP_p = wxwebp$(WXDEBUGFLAG).lib
!endif
!if "$(USE_CAIRO)" == "1"
__CAIRO_LIB_p = cairo.lib
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_LIBDIR_FILENAMES_p = /LIBPATH:$(CAIRO_ROOT)\lib
!endif
all: $(OBJS)
$(OBJS):
-if not exist $(OBJS) mkdir $(OBJS)
### Targets: ###
all: $(OBJS)\life.exe data
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
-if exist $(OBJS)\*.res del $(OBJS)\*.res
-if exist $(OBJS)\*.pch del $(OBJS)\*.pch
-if exist $(OBJS)\life.exe del $(OBJS)\life.exe
-if exist $(OBJS)\life.ilk del $(OBJS)\life.ilk
-if exist $(OBJS)\life.pdb del $(OBJS)\life.pdb
$(OBJS)\life.exe: $(LIFE_OBJECTS) $(OBJS)\life_life.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\life.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(LIFE_OBJECTS) $(LIFE_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(__LIB_WEBP_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib gdiplus.lib msimg32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
<<
data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (breeder.lif) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\life_life.obj: .\life.cpp
$(CXX) /c /nologo /TP /Fo$@ $(LIFE_CXXFLAGS) .\life.cpp
$(OBJS)\life_dialogs.obj: .\dialogs.cpp
$(CXX) /c /nologo /TP /Fo$@ $(LIFE_CXXFLAGS) .\dialogs.cpp
$(OBJS)\life_game.obj: .\game.cpp
$(CXX) /c /nologo /TP /Fo$@ $(LIFE_CXXFLAGS) .\game.cpp
$(OBJS)\life_reader.obj: .\reader.cpp
$(CXX) /c /nologo /TP /Fo$@ $(LIFE_CXXFLAGS) .\reader.cpp
$(OBJS)\life_life.res: .\life.rc
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_3_p_1) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_1) $(__TARGET_CPU_COMPFLAG_p_1) /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\samples /d NOPCH .\life.rc

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,44 @@
/* XPM */
static const char *const mondrian_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 6 1",
" c Black",
". c Blue",
"X c #00bf00",
"o c Red",
"O c Yellow",
"+ c Gray100",
/* pixels */
" ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" oooooo +++++++++++++++++++++++ ",
" ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ .... ",
" ++++++ ++++++++++++++++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++++++++++++++++ ++++ ",
" ++++++ ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
" "
};

View File

@@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////
// Name: reader.cpp
// Purpose: Life! pattern reader (writer coming soon)
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Created: Jan/2000
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ==========================================================================
// headers, declarations, constants
// ==========================================================================
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/txtstrm.h"
#include "reader.h"
// ==========================================================================
// LifeReader
// ==========================================================================
#define LIFE_CHECKVAL( msg ) \
if (!m_ok) \
{ \
wxMessageBox( msg, _("Error"), wxICON_EXCLAMATION | wxOK ); \
return; \
}
LifeReader::LifeReader(wxInputStream& is)
{
wxBufferedInputStream buff_is(is);
wxTextInputStream text_is(buff_is);
wxString line, rest;
// check stream
m_ok = is.IsOk();
LIFE_CHECKVAL(_("Couldn't read any data"));
// read signature
m_ok = text_is.ReadLine().Contains(wxT("#Life 1.05"));
LIFE_CHECKVAL(_("Error reading signature. Not a Life pattern?"));
// read description
m_description = wxEmptyString;
line = text_is.ReadLine();
while (buff_is.IsOk() && line.StartsWith(wxT("#D"), &rest))
{
m_description += rest.Trim(false);
m_description += wxT("\n");
line = text_is.ReadLine();
}
m_ok = buff_is.IsOk();
LIFE_CHECKVAL(_("Unexpected EOF while reading description"));
// read rules
m_ok = line.StartsWith(wxT("#N"));
LIFE_CHECKVAL(_("Sorry, non-conway rules not supported yet"));
// read shape
while (buff_is.IsOk())
{
line = ( text_is.ReadLine() ).Trim();
if (!line.empty())
{
if (line.StartsWith(wxT("#P "), &rest))
m_shape.Add(rest);
else
m_shape.Add(line);
}
}
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
// Name: reader.h
// Purpose: Life! pattern reader (writer coming soon)
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Created: Jan/2000
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _LIFE_READER_H_
#define _LIFE_READER_H_
#include "game.h"
// --------------------------------------------------------------------------
// LifeReader
// --------------------------------------------------------------------------
class LifeReader
{
public:
LifeReader(wxInputStream& is);
inline bool IsOk() const { return m_ok; }
inline wxString GetDescription() const { return m_description; }
inline wxString GetRules() const { return m_rules; }
inline wxArrayString GetShape() const { return m_shape; }
inline LifePattern GetPattern() const
{
return LifePattern(wxEmptyString, m_description, m_rules, m_shape);
}
private:
bool m_ok;
wxString m_description;
wxString m_rules;
wxArrayString m_shape;
};
#endif // _LIFE_READER_H_

View File

@@ -0,0 +1,220 @@
/////////////////////////////////////////////////////////////////////////////
// Name: samples.inc
// Purpose: Sample configurations for Life!
// Author: Guillermo Rodriguez Garcia, <guille@iies.es>
// Created: Jan/2000
// Copyright: (c) 2000, Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// --------------------------------------------------------------------------
// sample configurations
// --------------------------------------------------------------------------
/* Format:
*
* Name,
* Description,
* Width,
* Height,
* Data ('*' = alive, '.' = dead)
*
*/
const LifePattern g_patterns[] =
{
LifePattern(
_("Glider"),
_("The glider is the first of a series of life forms, known as spaceships or fishes, which can travel along the game field retaining their original shape."),
3, 3,
".*."
"..*"
"***"),
LifePattern(
_("Heavyweight spaceship"),
_("The glider is just the smaller of the spaceships; this one, known as the heavyweight spaceship or 'big fish', is the largest spaceship which can travel alone without destroying itself. Larger ones can only travel safely if they are supported by smaller spaceships."),
7, 4,
".....*."
"......*"
"*.....*"
".******"),
LifePattern(
_("Eater"),
_("An eater is any still life that can repair itself from some attacks. This one (bottom right), also known as 'fishhook', eats gliders and fishes (spaceships) provided that they approach in a certain angle."),
10, 10,
".*........"
"..*......."
"***......."
".........."
".........."
".........."
"......**.."
"......*.*."
"........*."
"........**" ),
LifePattern(
_("Dice shaker"),
_("Oscillators have been extensively explored in Life!. The dice shaker turns around each seven tics; thus, it is an oscillator with a period of fourteen."),
7, 6,
".**.**."
".**.**."
"..*.*.."
"*.*.*.*"
"*.*.*.*"
"**...**" ),
LifePattern(
_("Hertz oscillator"),
_("The Hertz oscillator is a good example of a set of life patterns known as 'billiard tables'. A billiard table is an oscillator which is built inside a stable border. In particular, this one has a period of eight."),
14, 11,
".....**......."
".....**......."
".............."
"**...****...**"
"*.*.*....*.*.*"
"..*.**...*.*.."
"*.*.*....*.*.*"
"**...****...**"
".............."
".......**....."
".......**....." ),
LifePattern(
_("Phoenix"),
_("A phoenix is a pattern whose cells all die in every generation, and yet lives forever. For example, this is a phoenix with period two."),
8, 8,
"....*..."
"..*.*..."
"......*."
"**......"
"......**"
".*......"
"...*.*.."
"...*...." ),
LifePattern(
_("R-pentomino"),
_("The R-pentomino is a methuselah - a life form which lives for hundreds of generations without stabilizing or dying. In particular, the R-Pentomino requires more than one thousand tics to reach a stable (periodic) state."),
3, 3,
".**"
"**."
".*." ),
LifePattern(
_("Thunderbird"),
_("The thunderbird is another popular methuselah, which doesn't stabilize until the 243th generation. Note that because the initial configuration is symmetrical with respect to the vertical axis, all generations must be symmetrical as well."),
3, 5,
"***"
"..."
".*."
".*."
".*." ),
LifePattern(
_("Accorn"),
_("Probably the most popular methuselah, the accorn lives for 5206 (!) generations."),
7, 3,
".*....."
"...*..."
"**..***" ),
LifePattern(
_("Galaxy"),
_("One from my personal collection. It is really beautiful to see this configuration expand and shrink periodically for hundreds of tics before reaching a stable state."),
13, 13,
"...***......."
"......*......"
"......*......"
"......*.....*"
".....***....*"
"....*...*...*"
".****...****."
"*...*...*...."
"*....***....."
"*.....*......"
"......*......"
"......*......"
".......***..." ),
LifePattern(
_("Glider gun"),
_("A gun is a stationary pattern that emits spaceships forever. The glider gun shown here was the first known gun, and indeed the first known finite pattern with unbounded growth. It was found by Bill Gosper in November 1970. Many new guns have since been found."),
36, 9,
".........................*.........."
"......................****.........."
".............*.......****..........."
"............*.*......*..*.........**"
"...........*...**....****.........**"
"**.........*...**.....****.........."
"**.........*...**........*.........."
"............*.*....................."
".............*......................" ),
LifePattern(
_("Puffer train"),
_("A puffer is an object that moves like a spaceship, except that it leaves a trail of debris behind. The puffer train is one of the best-known puffers. Originally found by Bill Gosper, this is a very dirty puffer; the tail does not stabilize until generation 5533. It consists of a B-heptomino (the middle pattern) escorted by two light weight space ships."),
5, 18,
"...*."
"....*"
"*...*"
".****"
"....."
"....."
"....."
"*...."
".**.."
"..*.."
"..*.."
".*..."
"....."
"....."
"...*."
"....*"
"*...*"
".****" ),
LifePattern(
_("Max"),
_("Max is the fastest-growing known pattern in Conway's Game of Life (possibly the fastest possible).")
+ wxString(_(" It fills space to a density of 1/2, conjectured to be the maximum density, and does it at a speed"))
+ wxString(_(" of c/2 in each of the 4 directions, which has been proven to be the maximum possible speed.\n\nPopulation"))
+ wxString(_(" growth is:\n[(t+19)^2+463]/4 for t divisible by 4;\n[(t+19)^2+487]/4 for t even, not div. by 4;\n"))
+ wxString(_("[(t+18)^2+639]/4 for t odd.\n\nOriginal construction, top/bottom stretchers by Hartmut Holzwart;"))
+ wxString(_(" Size optimization, left/right stretchers by David Bell; Original idea, middle part, left/right stretcher"))
+ wxString(_(" connection by Al Hensel.\n\nThis spacefiller by David Bell, September 1993.")),
29, 43,
".....*.*....................."
"....*..*....................."
"...**........................"
"..*.........................."
".****........................"
"*....*......................."
"*..*........................."
"*..*........................."
".*.........***...***........."
"..****.*..*..*...*..*........"
"...*...*.....*...*..........."
"....*........*...*..........."
"....*.*......*...*..........."
"............................."
"...***.....***...***........."
"...**.......*.....*.........."
"...***......*******.........."
"...........*.......*........."
"....*.*...***********........"
"...*..*..*............**....."
"...*.....************...*...."
"...*...*.............*...*..."
"....*...************.....*..."
".....**............*..*..*..."
"........***********...*.*...."
".........*.......*..........."
"..........*******......***..."
"..........*.....*.......**..."
".........***...***.....***..."
"............................."
"...........*...*......*.*...."
"...........*...*........*...."
"...........*...*.....*...*..."
"........*..*...*..*..*.****.."
".........***...***.........*."
".........................*..*"
".........................*..*"
".......................*....*"
"........................****."
"..........................*.."
"........................**..."
".....................*..*...."
".....................*.*....." )
};