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 bf6b52fd94
9654 changed files with 4035664 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
# =========================================================================
# 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@
### Variables: ###
DESTDIR =
### Conditionally set variables: ###
### Targets: ###
all: bombs forty fractal life poem
install:
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
-(cd bombs && $(MAKE) clean)
-(cd forty && $(MAKE) clean)
-(cd fractal && $(MAKE) clean)
-(cd life && $(MAKE) clean)
-(cd poem && $(MAKE) clean)
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
-(cd bombs && $(MAKE) distclean)
-(cd forty && $(MAKE) distclean)
-(cd fractal && $(MAKE) distclean)
-(cd life && $(MAKE) distclean)
-(cd poem && $(MAKE) distclean)
bombs:
(cd bombs && $(MAKE) all)
forty:
(cd forty && $(MAKE) all)
fractal:
(cd fractal && $(MAKE) all)
life:
(cd life && $(MAKE) all)
poem:
(cd poem && $(MAKE) all)
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean bombs forty fractal life poem

View File

@@ -0,0 +1,208 @@
# =========================================================================
# 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
BOMBS_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)
BOMBS_OBJECTS = \
bombs_bombs.o \
bombs_bombs1.o \
bombs_game.o \
$(__bombs___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___bombs___os2_emxbindcmd = $(NM) bombs$(EXEEXT) | if grep -q \
pmwin.763 ; then emxbind -ep bombs$(EXEEXT) ; fi
@COND_PLATFORM_OS2_1@__bombs___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___bombs___os2_emxbindcmd)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
@COND_PLATFORM_MACOSX_1@__bombs_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1@ = bombs.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@__bombs_bundle___depname = bombs_bundle
@COND_TOOLKIT_MAC@____bombs_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ $(__bombs_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____bombs_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_CARBON@ = $(__bombs_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_COCOA@____bombs_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_COCOA@ = $(__bombs_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____bombs_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = $(__bombs_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_COCOA@____bombs_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__bombs_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@__bombs___win32rc = bombs_bombs_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: bombs$(EXEEXT) $(__bombs_bundle___depname)
install:
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f bombs$(EXEEXT)
rm -rf bombs.app
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
bombs$(EXEEXT): $(BOMBS_OBJECTS) $(__bombs___win32rc)
$(CXX) -o $@ $(BOMBS_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)
$(__bombs___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@bombs.app/Contents/PkgInfo: bombs$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1@ mkdir -p bombs.app/Contents
@COND_PLATFORM_MACOSX_1@ mkdir -p bombs.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1@ mkdir -p bombs.app/Contents/Resources
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ sed -e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.bombs/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/bombs/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/bombs/" \
@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}/bombs 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 >bombs.app/Contents/Info.plist
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >bombs.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ ln -f bombs$(EXEEXT) bombs.app/Contents/MacOS/bombs
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns bombs.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1@bombs_bundle: $(____bombs_BUNDLE_TGT_REF_DEP)
bombs_bombs.o: $(srcdir)/bombs.cpp
$(CXXC) -c -o $@ $(BOMBS_CXXFLAGS) $(srcdir)/bombs.cpp
bombs_bombs1.o: $(srcdir)/bombs1.cpp
$(CXXC) -c -o $@ $(BOMBS_CXXFLAGS) $(srcdir)/bombs1.cpp
bombs_game.o: $(srcdir)/game.cpp
$(CXXC) -c -o $@ $(BOMBS_CXXFLAGS) $(srcdir)/game.cpp
bombs_bombs_rc.o: $(srcdir)/bombs.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 bombs_bundle

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" ?>
<makefile>
<include file="../../build/bakefiles/common_samples.bkl"/>
<exe id="bombs" template="wx_sample" template_append="wx_append">
<sources>bombs.cpp bombs1.cpp game.cpp</sources>
<wx-lib>core</wx-lib>
<wx-lib>base</wx-lib>
<win32-res>bombs.rc</win32-res>
</exe>
</makefile>

View File

@@ -0,0 +1,316 @@
///////////////////////////////////////////////////////////////////////////////
// Name: bombs.cpp
// Purpose: Bombs game
// Author: P. Foggia 1996
// Modified by: Wlodzimierz Skiba (ABX) since 2003
// Created: 1996
// Copyright: (c) 1996 P. Foggia
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif //precompiled headers
#include "wx/stockitem.h"
#include "bombs.h"
#include <stdlib.h>
#include <time.h>
#ifndef wxHAS_IMAGES_IN_RESOURCES
# include "bombs.xpm"
#endif
wxIMPLEMENT_APP(BombsApp);
// Called to initialize the program
bool BombsApp::OnInit()
{
srand((unsigned) time(nullptr));
m_frame = new BombsFrame(&m_game);
m_frame->NewGame(bombsID_EASY, false);
return true;
}
wxBEGIN_EVENT_TABLE(BombsFrame, wxFrame)
EVT_MENU(wxID_NEW, BombsFrame::OnNewGame)
EVT_MENU(bombsID_EASY, BombsFrame::OnEasyGame)
EVT_MENU(bombsID_MEDIUM, BombsFrame::OnMediumGame)
EVT_MENU(bombsID_HARD, BombsFrame::OnHardGame)
EVT_MENU(bombsID_EASYCORNER, BombsFrame::OnEasyCorner)
EVT_MENU(wxID_EXIT, BombsFrame::OnExit)
EVT_MENU(wxID_ABOUT, BombsFrame::OnAbout)
wxEND_EVENT_TABLE()
BombsFrame::BombsFrame(BombsGame *game)
: wxFrame(nullptr, wxID_ANY, wxT("wxBombs"), wxDefaultPosition,
wxSize(300, 300), wxDEFAULT_DIALOG_STYLE|wxMINIMIZE_BOX)
{
m_game = game;
m_easyCorner = false;
m_lastLevel = bombsID_EASY;
SetIcon(wxICON(bombs));
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif
// Create a menu bar for the frame
wxMenuBar *menuBar = new wxMenuBar;
wxMenu *menuFile = new wxMenu;
wxMenu *menuLevel = new wxMenu;
menuLevel->AppendRadioItem(bombsID_EASY, wxT("&Easy (10x10)\tCtrl-1"));
menuLevel->AppendRadioItem(bombsID_MEDIUM, wxT("&Medium (15x15)\tCtrl-2"));
menuLevel->AppendRadioItem(bombsID_HARD, wxT("&Hard (25x20)\tCtrl-3"));
menuFile->Append(wxID_NEW, wxT("&New game\tCtrl-N"));
menuFile->Append(bombsID_LEVEL, wxT("&Level"),menuLevel, wxT("Starts a new game"));
menuFile->AppendCheckItem(bombsID_EASYCORNER, wxT("&Easy corner"));
menuFile->AppendSeparator();
menuFile->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT), wxT("Quits the application"));
menuBar->Append(menuFile, wxT("&File"));
wxMenu *menuHelp = new wxMenu;
menuHelp->Append(wxID_ABOUT, wxT("&About"),
wxT("Displays the program information") );
menuBar->Append(menuHelp, wxT("&Help"));
SetMenuBar(menuBar);
// Create child subwindows.
m_canvas = new BombsCanvas(this, m_game);
// Ensure the subwindows get resized o.k.
// OnSize(width, height);
// Centre frame on the screen.
Centre(wxBOTH);
// Show the frame.
Show();
}
void BombsFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{
Close();
}
void BombsFrame::NewGame(int level, bool query)
{
if(query)
{
int ok = wxMessageBox(
wxT("Start new game regardless previous board?"),
wxT("Confirm"),
wxYES_NO | wxICON_QUESTION,
this
);
if(ok!=wxYES)return;
}
int numHorzCells = 20, numVertCells = 20;
m_lastLevel = level;
switch(level)
{
case bombsID_EASY:
numHorzCells = numVertCells = 10;
break;
case bombsID_MEDIUM:
numHorzCells = numVertCells = 15;
break;
case bombsID_HARD:
numHorzCells = 25; numVertCells = 20;
break;
default :
wxFAIL_MSG(wxT("Invalid level"));
break;
}
m_game->Init(numHorzCells, numVertCells, m_easyCorner);
GetMenuBar()->Check(level, true);
m_canvas->UpdateGridSize();
SetClientSize(m_canvas->GetGridSizeInPixels());
}
void BombsFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox(
wxT("wxBombs (c) 1996 by P. Foggia\n<foggia@amalfi.dis.unina.it>"),
wxT("About wxBombs") );
}
void BombsFrame::OnNewGame(wxCommandEvent& WXUNUSED(event))
{
NewGame(m_lastLevel, true);
}
void BombsFrame::OnEasyGame(wxCommandEvent& WXUNUSED(event))
{
NewGame(bombsID_EASY, true);
}
void BombsFrame::OnMediumGame(wxCommandEvent& WXUNUSED(event))
{
NewGame(bombsID_MEDIUM, true);
}
void BombsFrame::OnHardGame(wxCommandEvent& WXUNUSED(event))
{
NewGame(bombsID_HARD, true);
}
void BombsFrame::OnEasyCorner(wxCommandEvent& WXUNUSED(event))
{
wxString msg;
if(m_easyCorner)
msg = wxT("disable");
else
msg = wxT("enable");
msg = wxT("Do you really want to ") + msg + wxT(" having\ntop left corner always empty for easier start?");
int ok = wxMessageBox(
msg,
wxT("Confirm"),
wxYES_NO | wxICON_QUESTION,
this
);
if(ok!=wxYES)
{
// Undo the automatic change to the menu bar, keeping it in sync with the actual option value.
GetMenuBar()->Check(bombsID_EASYCORNER, m_easyCorner);
return;
}
m_easyCorner = !m_easyCorner;
NewGame(m_lastLevel, true);
}
wxBEGIN_EVENT_TABLE(BombsCanvas, wxPanel)
EVT_PAINT(BombsCanvas::OnPaint)
EVT_MOUSE_EVENTS(BombsCanvas::OnMouseEvent)
EVT_CHAR(BombsCanvas::OnChar)
wxEND_EVENT_TABLE()
BombsCanvas::BombsCanvas(wxFrame *parent, BombsGame *game)
: wxPanel(parent, wxID_ANY)
{
m_game = game;
int sx, sy;
wxClientDC dc(this);
dc.SetFont(BOMBS_FONT);
wxCoord chw, chh;
wxString buf = wxT("M");
dc.GetTextExtent(buf, &chw, &chh);
dc.SetFont(wxNullFont);
dc.SetMapMode(wxMM_METRIC);
int xcm = dc.LogicalToDeviceX(10);
int ycm = dc.LogicalToDeviceY(10);
// To have a square cell, there must be :
// sx*ycm == sy*xcm
if (chw*ycm < chh*xcm)
{
sy = chh;
sx = chh*xcm/ycm;
}
else
{
sx = chw;
sy = chw*ycm/xcm;
}
m_cellWidth = (sx+3+X_UNIT)/X_UNIT;
m_cellHeight = (sy+3+Y_UNIT)/Y_UNIT;
dc.SetMapMode(wxMM_TEXT);
m_bmp = nullptr;
}
BombsCanvas::~BombsCanvas()
{
if (m_bmp)
{
delete m_bmp;
m_bmp = nullptr;
}
}
// Called when canvas needs to be repainted.
void BombsCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
const int numHorzCells = m_game->GetWidth();
const int numVertCells = m_game->GetHeight();
// Insert your drawing code here.
if (!m_bmp)
{
wxSize size = dc.GetSize();
m_bmp = new wxBitmap(size.GetWidth(), size.GetHeight());
if (m_bmp)
{
wxMemoryDC memDC;
memDC.SelectObject(*m_bmp);
DrawField(&memDC, 0, 0, numHorzCells-1, numVertCells-1);
memDC.SelectObject(wxNullBitmap);
}
}
if (m_bmp)
{
wxMemoryDC memDC;
memDC.SelectObject(*m_bmp);
wxSize size = dc.GetSize();
dc.Blit(0, 0, size.GetWidth(), size.GetHeight(),
&memDC, 0, 0, wxCOPY);
memDC.SelectObject(wxNullBitmap);
}
else
{
DrawField(&dc, 0, 0, numHorzCells-1, numVertCells-1);
}
}
void BombsCanvas::UpdateGridSize()
{
if (m_bmp)
{
delete m_bmp;
m_bmp = nullptr;
}
SetSize(GetGridSizeInPixels());
Refresh();
}
wxSize BombsCanvas::GetGridSizeInPixels() const
{
return wxSize(m_cellWidth*X_UNIT*m_game->GetWidth(),
m_cellHeight*Y_UNIT*m_game->GetHeight());
}

View File

@@ -0,0 +1,124 @@
///////////////////////////////////////////////////////////////////////////////
// Name: bombs.h
// Purpose: Bombs game
// Author: P. Foggia 1996
// Modified by: Wlodzimierz Skiba (ABX) since 2003
// Created: 1996
// Copyright: (c) 1996 P. Foggia
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DEMOS_BOMBS_BOMBS_H_
#define _WX_DEMOS_BOMBS_BOMBS_H_
#include "game.h"
class BombsFrame;
/*
* Class representing the entire Application
*/
class BombsApp: public wxApp
{
public:
virtual bool OnInit() override;
private :
BombsFrame *m_frame;
BombsGame m_game;
};
wxDECLARE_APP(BombsApp);
class BombsCanvas;
class BombsFrame : public wxFrame
{
public:
BombsFrame(BombsGame *bombsGame);
void NewGame(int level, bool query);
private:
void OnNewGame(wxCommandEvent& event);
void OnEasyGame(wxCommandEvent& event);
void OnMediumGame(wxCommandEvent& event);
void OnHardGame(wxCommandEvent& event);
void OnEasyCorner(wxCommandEvent& event);
void OnExit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
BombsGame *m_game;
bool m_easyCorner;
int m_lastLevel;
// Subwindows for reference within the program.
BombsCanvas *m_canvas;
wxDECLARE_EVENT_TABLE();
};
// App specific menu identifiers
enum
{
bombsID_LEVEL = wxID_HIGHEST,
bombsID_EASY,
bombsID_MEDIUM,
bombsID_HARD,
bombsID_EASYCORNER
};
class BombsCanvas : public wxPanel
{
public:
// Constructor and destructor
BombsCanvas(wxFrame *parent, BombsGame *game);
void UpdateGridSize();
wxSize GetGridSizeInPixels() const;
virtual ~BombsCanvas();
private:
void OnPaint(wxPaintEvent& event);
void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2);
void RefreshField(int xc1, int yc1, int xc2, int yc2);
void Uncover(int x, int y);
void OnMouseEvent(wxMouseEvent& event);
void OnChar(wxKeyEvent& event);
BombsGame *m_game;
wxBitmap *m_bmp;
// Cell size in pixels
int m_cellWidth;
int m_cellHeight;
wxDECLARE_EVENT_TABLE();
};
/* The following sizes should probably be redefined */
/* dimensions of a scroll unit, in pixels */
#define X_UNIT 4
#define Y_UNIT 4
/* the dimensions of a cell, in scroll units are in
* BombsCanvas::x_cell and y_cell
*/
#define BOMBS_FONT wxFont(wxFontInfo(14).Family(wxFONTFAMILY_ROMAN))
#endif // #ifndef _WX_DEMOS_BOMBS_BOMBS_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,3 @@
bombs ICON "bombs.ico"
#include "wx/msw/wx.rc"

View File

@@ -0,0 +1,44 @@
/* XPM */
static const char *const bombs_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,337 @@
///////////////////////////////////////////////////////////////////////////////
// Name: bombs1.cpp
// Purpose: Bombs game
// Author: P. Foggia 1996
// Modified by: Wlodzimierz Skiba (ABX) since 2003
// Created: 1996
// Copyright: (c) 1996 P. Foggia
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/*
* implementation of the methods DrawField and OnEvent of the
* class BombsCanvas
*/
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif //precompiled headers
#include "bombs.h"
// Draws the field on the device context dc
// xc1,yc1 etc. are the (inclusive) limits of the area to be drawn,
// expressed in cells.
void BombsCanvas::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
{
wxString buf;
wxCoord chw, chh;
dc->SetPen(*wxBLACK_PEN);
int x, y;
int xMax = this->GetGridSizeInPixels().GetWidth();
int yMax = this->GetGridSizeInPixels().GetHeight();
for(x=xc1; x<=xc2; x++)
dc->DrawLine(x*m_cellWidth*X_UNIT, 0, x*m_cellWidth*X_UNIT, yMax);
for(y=xc1; y<=yc2; y++)
dc->DrawLine(0, y*m_cellHeight*Y_UNIT, xMax, y*m_cellHeight*Y_UNIT);
dc->SetFont(BOMBS_FONT);
for(x=xc1; x<=xc2; x++)
for(y=yc1; y<=yc2; y++)
{
if (m_game->IsMarked(x,y))
{
dc->SetPen(*wxBLACK_PEN);
if (m_game->IsFocussed(x, y))
dc->SetBrush(*wxMEDIUM_GREY_BRUSH);
else
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
dc->DrawRectangle( x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
m_cellWidth*X_UNIT+1, m_cellHeight*Y_UNIT+1);
buf = wxT("M");
if (!m_game->IsHidden(x,y) && m_game->IsBomb(x,y))
dc->SetTextForeground(*wxBLUE);
else
dc->SetTextForeground(*wxRED);
dc->SetTextBackground(*wxLIGHT_GREY);
dc->GetTextExtent(buf, &chw, &chh);
dc->DrawText( buf,
x*m_cellWidth*X_UNIT + (m_cellWidth*X_UNIT-chw)/2,
y*m_cellHeight*Y_UNIT + (m_cellHeight*Y_UNIT-chh)/2 );
if (!m_game->IsHidden(x,y) && m_game->IsBomb(x,y))
{
dc->SetPen(*wxRED_PEN);
dc->DrawLine(x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
(x+1)*m_cellWidth*X_UNIT, (y+1)*m_cellHeight*Y_UNIT);
dc->DrawLine(x*m_cellWidth*X_UNIT, (y+1)*m_cellHeight*Y_UNIT,
(x+1)*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT);
}
}
else if (m_game->IsHidden(x,y))
{
dc->SetPen(*wxBLACK_PEN);
if (m_game->IsFocussed(x, y))
dc->SetBrush(*wxMEDIUM_GREY_BRUSH);
else
dc->SetBrush(*wxLIGHT_GREY_BRUSH);
dc->DrawRectangle( x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
m_cellWidth*X_UNIT+1, m_cellHeight*Y_UNIT+1);
}
else if (m_game->IsBomb(x,y))
{
dc->SetPen(*wxBLACK_PEN);
dc->SetBrush(*wxRED_BRUSH);
dc->DrawRectangle( x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
m_cellWidth*X_UNIT+1, m_cellHeight*Y_UNIT+1);
buf = wxT("B");
dc->SetTextForeground(*wxBLACK);
dc->SetTextBackground(*wxRED);
dc->GetTextExtent(buf, &chw, &chh);
dc->DrawText( buf,
x*m_cellWidth*X_UNIT + (m_cellWidth*X_UNIT-chw)/2,
y*m_cellHeight*Y_UNIT + (m_cellHeight*Y_UNIT-chh)/2);
if (m_game->IsExploded(x,y))
{
dc->SetPen(*wxBLUE_PEN);
dc->DrawLine(x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
(x+1)*m_cellWidth*X_UNIT, (y+1)*m_cellHeight*Y_UNIT);
dc->DrawLine(x*m_cellWidth*X_UNIT, (y+1)*m_cellHeight*Y_UNIT,
(x+1)*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT);
}
}
else // Display a digit
{
dc->SetPen(*wxBLACK_PEN);
if (m_game->IsFocussed(x, y))
dc->SetBrush(*wxMEDIUM_GREY_BRUSH);
else if (m_game->IsSelected(x,y))
dc->SetBrush(*wxWHITE_BRUSH);
else
dc->SetBrush(*wxYELLOW_BRUSH);
dc->DrawRectangle( x*m_cellWidth*X_UNIT, y*m_cellHeight*Y_UNIT,
m_cellWidth*X_UNIT+1, m_cellHeight*Y_UNIT+1);
int digit_value = m_game->Get(x,y) & BG_MASK;
switch(digit_value)
{
case 0:
buf = wxT("0");
dc->SetTextForeground(*wxGREEN);
break;
case 1:
buf = wxT("1");
dc->SetTextForeground(*wxBLUE);
break;
default:
buf.Printf(wxT("%d"),digit_value);
dc->SetTextForeground(*wxBLACK);
break;
}
dc->GetTextExtent(buf, &chw, &chh);
dc->SetTextBackground(*wxWHITE);
dc->DrawText( buf,
x*m_cellWidth*X_UNIT + (m_cellWidth*X_UNIT-chw)/2,
y*m_cellHeight*Y_UNIT + (m_cellHeight*Y_UNIT-chh)/2);
}
}
dc->SetFont(wxNullFont);
wxString msg;
msg.Printf(wxT("%d bombs, %u marked, %d remaining cells"),
m_game->GetNumBombs(), m_game->GetNumMarkedCells(),
m_game->GetNumRemainingCells() );
#if wxUSE_LOG && wxUSE_STATUSBAR
wxLogStatus(msg);
#else
this->GetParent()->SetTitle(msg);
#endif
}
// Refreshes the field image
// xc1,yc1 etc. are the (inclusive) limits of the area to be drawn,
// expressed in cells.
void BombsCanvas::RefreshField(int xc1, int yc1, int xc2, int yc2)
{
wxClientDC dc(this);
DrawField(& dc, xc1, yc1, xc2, yc2);
if (m_bmp)
{
wxMemoryDC memDC;
memDC.SelectObject(*m_bmp);
DrawField(&memDC, xc1, yc1, xc2, yc2);
memDC.SelectObject(wxNullBitmap);
}
}
// Called when uncovering a cell.
void BombsCanvas::Uncover(int x, int y)
{
m_game->Unhide(x,y,true);
RefreshField(x, y, x, y);
const int gridWidth = m_game->GetWidth();
const int gridHeight = m_game->GetHeight();
const bool hasWon = m_game->GetNumRemainingCells() == 0;
if (m_game->IsBomb(x,y) || hasWon)
{
wxBell();
if (hasWon)
{
wxMessageBox(wxT("Nice! You found all the bombs!"),
wxT("wxWin Bombs"), wxOK|wxCENTRE);
}
else // x,y is a bomb
{
m_game->Explode(x, y);
}
for(x=0; x<gridWidth; x++)
for(y=0; y<gridHeight; y++)
m_game->Unhide(x,y,false);
RefreshField(0, 0, gridWidth-1, gridHeight-1);
}
else if (0 == (m_game->Get(x, y) & BG_MASK))
{
int left = ( x > 0 ) ? x-1 : 0;
int right = ( x < gridWidth - 1 )
? x+1
: gridWidth - 1;
int top = ( y > 0 ) ? y-1 : 0;
int bottom = ( y < gridHeight - 1 )
? y+1
: gridHeight - 1;
int i, j;
for (j=top; j<=bottom; j++)
for (i=left; i<=right; i++)
if ( (i != x || j != y) && m_game->IsHidden(i, j)
&& !m_game->IsMarked(i, j) )
{
Uncover(i, j);
}
}
}
// Called when the canvas receives a mouse event.
void BombsCanvas::OnMouseEvent(wxMouseEvent& event)
{
const int gridWidth = m_game->GetWidth();
const int gridHeight = m_game->GetHeight();
wxCoord fx, fy;
event.GetPosition(&fx, &fy);
int x = fx/(m_cellWidth*X_UNIT);
int y = fy/(m_cellHeight*Y_UNIT);
if (x<gridWidth && y<gridHeight)
{
if ( (event.RightDown() || (event.LeftDown() && event.ShiftDown()))
&& (m_game->IsHidden(x,y)
|| !m_game->GetNumRemainingCells() ) )
{
// store previous and current field
int prevFocusX = m_game->m_gridFocusX;
int prevFocusY = m_game->m_gridFocusY;
m_game->m_gridFocusX = x;
m_game->m_gridFocusY = y;
RefreshField(prevFocusX, prevFocusY, prevFocusX, prevFocusY);
m_game->Mark(x, y);
RefreshField(x, y, x, y);
return;
}
else if (event.LeftDown() && m_game->IsHidden(x,y)
&& !m_game->IsMarked(x,y))
{
// store previous and current field
int prevGridFocusX = m_game->m_gridFocusX;
int prevGridFocusY = m_game->m_gridFocusY;
m_game->m_gridFocusX = x;
m_game->m_gridFocusY = y;
RefreshField(prevGridFocusX, prevGridFocusY,
prevGridFocusX, prevGridFocusY);
Uncover(x, y);
return;
}
}
}
void BombsCanvas::OnChar(wxKeyEvent& event)
{
int keyCode = event.GetKeyCode();
int prevGridFocusX = m_game->m_gridFocusX;
int prevGridFocusY = m_game->m_gridFocusY;
const int gridWidth = m_game->GetWidth();
const int gridHeight = m_game->GetHeight();
switch(keyCode)
{
case WXK_RIGHT:
m_game->m_gridFocusX++;
if (m_game->m_gridFocusX >= gridWidth) m_game->m_gridFocusX = 0;
break;
case WXK_LEFT:
m_game->m_gridFocusX--;
if (m_game->m_gridFocusX<0) m_game->m_gridFocusX = gridWidth-1;
break;
case WXK_DOWN:
m_game->m_gridFocusY++;
if (m_game->m_gridFocusY >= gridHeight) m_game->m_gridFocusY = 0;
break;
case WXK_UP:
m_game->m_gridFocusY--;
if (m_game->m_gridFocusY<0) m_game->m_gridFocusY = gridHeight-1;
break;
case WXK_RETURN:
if ( (prevGridFocusX == m_game->m_gridFocusX)
&& (prevGridFocusY == m_game->m_gridFocusY)
&& (m_game->IsHidden(m_game->m_gridFocusX, m_game->m_gridFocusY)) )
{
m_game->Mark(m_game->m_gridFocusX, m_game->m_gridFocusY);
if (!m_game->IsMarked(m_game->m_gridFocusX, m_game->m_gridFocusY))
{
Uncover(m_game->m_gridFocusX, m_game->m_gridFocusY);
}
RefreshField(m_game->m_gridFocusX, m_game->m_gridFocusY,
m_game->m_gridFocusX, m_game->m_gridFocusY);
}
break;
default:
event.Skip();
}
if ((prevGridFocusX != m_game->m_gridFocusX)
|| (prevGridFocusY != m_game->m_gridFocusY))
{
// cause focused field to be visible after first key hit after launching new game
if( m_game->m_gridFocusX < 0 ) m_game->m_gridFocusX = 0;
if( m_game->m_gridFocusY < 0 ) m_game->m_gridFocusY = 0;
// refresh previous field and focused field
RefreshField(prevGridFocusX, prevGridFocusY,
prevGridFocusX, prevGridFocusY);
RefreshField(m_game->m_gridFocusX, m_game->m_gridFocusY,
m_game->m_gridFocusX, m_game->m_gridFocusY);
}
}

View File

@@ -0,0 +1,49 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 24 August 2012 *
# *
#*****************************************************************************
.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) game.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) game_gtk.exe
.endif
.endif
.ifdef __WXMOTIF__
game.exe : game.obj bombs1.obj bombs.obj
cxxlink game,bombs1,bombs,[--.lib]vms/opt
.else
.ifdef __WXGTK__
game_gtk.exe : game.obj bombs1.obj bombs.obj
cxxlink/exec=game_gtk.exe game,bombs1,bombs,[--.lib]vms_gtk/opt
.endif
.endif
game.obj : game.cpp [--.include.wx]setup.h
bombs1.obj : bombs1.cpp [--.include.wx]setup.h
bombs.obj : bombs.cpp [--.include.wx]setup.h

View File

@@ -0,0 +1,130 @@
///////////////////////////////////////////////////////////////////////////////
// Name: bombs1.cpp
// Purpose: Implementation of the class BombsGame
// Author: P. Foggia 1996
// Modified by: Wlodzimierz Skiba (ABX) since 2003
// Created: 1996
// Copyright: (c) 1996 P. Foggia
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif
#include "game.h"
#include <stdlib.h>
#include <limits.h>
#define PROB 0.2
#ifndef RAND_MAX
# define RAND_MAX INT_MAX
#endif
BombsGame::~BombsGame()
{
if (m_field)
{
delete[] m_field;
}
}
// Initialize the play field. Returns false on failure
bool BombsGame::Init(int aWidth, int aHeight, bool easyCorner)
{
m_gridFocusX = m_gridFocusY = -1;
int x, y;
int xx, yy;
if (m_field)
{
delete[] m_field;
}
m_field = new short[aWidth*aHeight];
if (!m_field)
{
m_width = m_height = 0;
return false;
}
m_width = aWidth;
m_height = aHeight;
for(x=0; x<m_width; x++)
{
for(y=0; y<m_height; y++)
{
m_field[x+y*m_width] = (rand()/(float)RAND_MAX <PROB)
? BG_HIDDEN | BG_BOMB
: BG_HIDDEN;
}
}
/* Force (0,0) not to have a bomb for those that don't want to have
to guess on the first move. Better would be to for the MS rule that
whatever is picked first isn't a bomb.
*/
if(easyCorner)
{
m_field[0] = BG_HIDDEN;
}
m_numBombCells = 0;
for(x=0; x<m_width; x++)
for(y=0; y<m_height; y++)
if (m_field[x+y*m_width] & BG_BOMB)
{
m_numBombCells++;
for(xx=x-1; xx<=x+1; xx++)
if (xx>=0 && xx<m_width)
for(yy=y-1; yy<=y+1; yy++)
if (yy>=0 && yy<m_height && (yy!=y || xx!=x))
m_field[xx+yy*m_width]++;
}
m_numRemainingCells = m_height*m_width-m_numBombCells;
m_numMarkedCells = 0;
return true;
}
void BombsGame::Mark(int x, int y)
{
m_field[x+y*m_width] ^= BG_MARKED;
if (IsMarked(x, y))
m_numMarkedCells++;
else
m_numMarkedCells--;
}
void BombsGame::Unhide(int x, int y, bool b_selected)
{
if (!IsHidden(x,y))
{
return;
}
if (b_selected)
m_field[x+y*m_width] |= BG_SELECTED;
m_field[x+y*m_width] &= ~BG_HIDDEN;
if (!IsBomb(x,y))
{
m_numRemainingCells--;
}
}
void BombsGame::Explode(int x, int y)
{
m_field[x+y*m_width] |= BG_EXPLODED;
}

View File

@@ -0,0 +1,114 @@
///////////////////////////////////////////////////////////////////////////////
// Name: game.h
// Purpose: Bombs game
// Author: P. Foggia 1996
// Modified by: Wlodzimierz Skiba (ABX) since 2003
// Created: 1996
// Copyright: (c) 1996 P. Foggia
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DEMOS_BOMBS_GAME_H_
#define _WX_DEMOS_BOMBS_GAME_H_
#define BG_HIDDEN 0x100
#define BG_BOMB 0x200
#define BG_MARKED 0x400
#define BG_EXPLODED 0x800
#define BG_SELECTED 0x080
#define BG_MASK 0x03F
#include <stddef.h>
class BombsGame
{
public:
BombsGame()
{
m_width = m_height = 0;
m_field = nullptr;
}
~BombsGame();
int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; }
int Get(int x, int y) const
{
return m_field[x+y*m_width];
}
int IsFocussed(int x, int y) const
{
return (m_gridFocusX == x) && (m_gridFocusY == y);
}
int IsHidden(int x, int y) const
{
return Get(x,y) & BG_HIDDEN;
}
int IsMarked(int x, int y) const
{
return Get(x,y) & BG_MARKED;
}
int IsBomb(int x, int y) const
{
return Get(x,y) & BG_BOMB;
}
int IsExploded(int x, int y) const
{
return Get(x,y) & BG_EXPLODED;
}
int IsSelected(int x, int y) const
{
return Get(x,y) & BG_SELECTED;
}
int GetNumBombs() const
{
return m_numBombCells;
}
int GetNumRemainingCells() const
{
return m_numRemainingCells;
}
int GetNumMarkedCells() const
{
return m_numMarkedCells;
}
bool Init(int width, int height, bool easyCorner = false);
// Marks/unmarks a cell
void Mark(int x, int y);
// Unhides a cell
void Unhide(int x, int y, bool b_selected);
// Makes a cell exploded
void Explode(int x, int y);
int m_gridFocusX;
int m_gridFocusY;
private:
// Current difficulty level (Determines grid size).
//int m_level;
int m_width, m_height;
short *m_field;
int m_numBombCells, m_numRemainingCells, m_numMarkedCells;
};
#endif // #ifndef _WX_DEMOS_BOMBS_GAME_H_

View File

@@ -0,0 +1,236 @@
# =========================================================================
# 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)
BOMBS_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)
BOMBS_OBJECTS = \
$(OBJS)\bombs_bombs.o \
$(OBJS)\bombs_bombs1.o \
$(OBJS)\bombs_game.o \
$(OBJS)\bombs_bombs_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)\bombs.exe
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
-if exist $(OBJS)\*.d del $(OBJS)\*.d
-if exist $(OBJS)\bombs.exe del $(OBJS)\bombs.exe
$(OBJS)\bombs.exe: $(BOMBS_OBJECTS) $(OBJS)\bombs_bombs_rc.o
$(foreach f,$(subst \,/,$(BOMBS_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
$(OBJS)\bombs_bombs.o: ./bombs.cpp
$(CXX) -c -o $@ $(BOMBS_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bombs_bombs1.o: ./bombs1.cpp
$(CXX) -c -o $@ $(BOMBS_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bombs_game.o: ./game.cpp
$(CXX) -c -o $@ $(BOMBS_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\bombs_bombs_rc.o: ./bombs.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
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 = bombs
OBJECTS = $(PROGRAM).o game.o bombs1.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,449 @@
# =========================================================================
# 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)
BOMBS_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
$(__DEBUGINFO_0) /Fd$(OBJS)\bombs.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)
BOMBS_OBJECTS = \
$(OBJS)\bombs_bombs.obj \
$(OBJS)\bombs_bombs1.obj \
$(OBJS)\bombs_game.obj
BOMBS_RESOURCES = \
$(OBJS)\bombs_bombs.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)\bombs.exe
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)\bombs.exe del $(OBJS)\bombs.exe
-if exist $(OBJS)\bombs.ilk del $(OBJS)\bombs.ilk
-if exist $(OBJS)\bombs.pdb del $(OBJS)\bombs.pdb
$(OBJS)\bombs.exe: $(BOMBS_OBJECTS) $(OBJS)\bombs_bombs.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\bombs.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(BOMBS_OBJECTS) $(BOMBS_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
<<
$(OBJS)\bombs_bombs.obj: .\bombs.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BOMBS_CXXFLAGS) .\bombs.cpp
$(OBJS)\bombs_bombs1.obj: .\bombs1.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BOMBS_CXXFLAGS) .\bombs1.cpp
$(OBJS)\bombs_game.obj: .\game.cpp
$(CXX) /c /nologo /TP /Fo$@ $(BOMBS_CXXFLAGS) .\game.cpp
$(OBJS)\bombs_bombs.res: .\bombs.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 .\bombs.rc

View File

@@ -0,0 +1,78 @@
wxWin Bombs
by Pasquale Foggia
1. The aim of the program
wxWin Bombs is the wxWin implementation of the minesweeper game you find
under MSWindows 3.1+. Later the rules of the game will be explained for
the lucky ones of you that have never used Windows.
2. Installation
If you are reading this file, I suppose you have successfully unpacked the
files in a directory of your hard disk :-). You should already have
installed wxWin on your system.
Now you have to modify makefile.bcc
(if a Windows user) or makefile.unx (if you use a real OS) setting the
proper values for the directories. Finally, you have to run:
make -f makefile.gcc
for Windows or
nmake -f makefile.vc
if you use a MicroSoft compiler, or:
make -f makefile.unx
for Unix.
If you are lucky, you will find the bombs executable, ready to be run.
3. Test
Bombs has been tested under the following platforms:
PC + MSWindos 3.1 + wxWin 1.60 + Borland C 3.1
Sun SPARCstation 20 + SunOS + xview + wxWin 1.63 + gcc 2.3.3
and all seems to work fine.
4. The author
This program has been developed by Pasquale Foggia, a PhD student
in Computer Engineering at the "Federico II" University of Naples, Italy.
You can contacting him using the following address:
foggia@amalfi.dis.unina.it
5. Disclaimer
This program is freeware. You can do everything you want with it, including
copying and modifying, without the need of a permission from the author.
On the other hand, this program is provided AS IS, with NO KIND OF WARRANTY.
The author will be in NO CASE responsible for damages directly or indirectly
caused by this program. Use it AT YOUR OWN RISK, or don't use it at all.
6. The rules of the game
Your aim is to discover all the bombs in a mined field. If you click with
the left mouse button on a cell containing a bomb, your game ends.
Otherwise, the number of bombs in the 8 neighbour cells will be displayed.
When you have clicked all the cells without a bomb, you win.
You can also use the right button (or left button+shift) to mark a cell
you think hides a bomb, in order to not click it accidentally.
7. Concluding remarks
I hope someone of you will enjoy this program. However, I enjoyed writing
it (thanks to Julian Smart and all the other wxWin developers).
In the near future I plan to implement under wxWin the great 'empire'
(is there someone that still remember it?), IMHO one of the most addictive
strategy games. If someone is interested, please contact me by e-mail.
I beg you pardon for my approximative english.
Pasquale Foggia
foggia@amalfi.dis.unina.it
------
A note from Julian Smart: Many thanks to Pasquale for the contribution.
I've taken the liberty of making a few changes.
1) I've made the status line have a single field so that you
can see the 'cells remaining' message properly.
2) I've changed the title from "wxWin Bombs" (which, as a statement,
is an unfortunate reflection of the reality of earlier versions of
wxWindows :-)) to wxBombs.
3) Added SetClientData to resize the window on Restart; eliminated
scrollbars; made the frame unresizable.
4) Added makefile.dos for VC++ 1.x, makefile.wat for Watcom C++.

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" ?>
<makefile>
<include file="../build/bakefiles/config.bkl"/>
<template id="sub">
<dir>$(id)</dir>
<installable>no</installable>
<dependency-of>all</dependency-of>
</template>
<subproject id="bombs" template="sub"/>
<subproject id="forty" template="sub"/>
<subproject id="fractal" template="sub"/>
<subproject id="life" template="sub"/>
<subproject id="poem" template="sub"/>
</makefile>

View File

@@ -0,0 +1,247 @@
# =========================================================================
# 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_HTML = @EXTRALIBS_HTML@
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
FORTY_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)
FORTY_OBJECTS = \
forty_forty.o \
forty_canvas.o \
forty_card.o \
forty_game.o \
forty_pile.o \
forty_playerdg.o \
forty_scoredg.o \
forty_scorefil.o \
$(__forty___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___forty___os2_emxbindcmd = $(NM) forty$(EXEEXT) | if grep -q \
pmwin.763 ; then emxbind -ep forty$(EXEEXT) ; fi
@COND_PLATFORM_OS2_1@__forty___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___forty___os2_emxbindcmd)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
@COND_PLATFORM_MACOSX_1@__forty_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1@ = forty.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@__forty_bundle___depname = forty_bundle
@COND_TOOLKIT_MAC@____forty_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ $(__forty_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____forty_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_CARBON@ = $(__forty_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_COCOA@____forty_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_COCOA@ = $(__forty_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____forty_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = $(__forty_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_COCOA@____forty_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__forty_app_Contents_PkgInfo___depname)
COND_MONOLITHIC_0___WXLIB_HTML_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_HTML_p = $(COND_MONOLITHIC_0___WXLIB_HTML_p)
COND_MONOLITHIC_0___WXLIB_XML_p = \
-lwx_base$(WXBASEPORT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_XML_p = $(COND_MONOLITHIC_0___WXLIB_XML_p)
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@__forty___win32rc = forty_forty_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: forty$(EXEEXT) $(__forty_bundle___depname) data
install:
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f forty$(EXEEXT)
rm -rf forty.app
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
forty$(EXEEXT): $(FORTY_OBJECTS) $(__forty___win32rc)
$(CXX) -o $@ $(FORTY_OBJECTS) -L$(LIBDIRNAME) $(DYLIB_RPATH_FLAG) $(LDFLAGS_GUI) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__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)
$(__forty___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@forty.app/Contents/PkgInfo: forty$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1@ mkdir -p forty.app/Contents
@COND_PLATFORM_MACOSX_1@ mkdir -p forty.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1@ mkdir -p forty.app/Contents/Resources
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ sed -e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.forty/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/forty/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/forty/" \
@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}/forty 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 >forty.app/Contents/Info.plist
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >forty.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ ln -f forty$(EXEEXT) forty.app/Contents/MacOS/forty
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns forty.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1@forty_bundle: $(____forty_BUNDLE_TGT_REF_DEP)
data:
@mkdir -p .
@for f in about.htm; 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
forty_forty.o: $(srcdir)/forty.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/forty.cpp
forty_canvas.o: $(srcdir)/canvas.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/canvas.cpp
forty_card.o: $(srcdir)/card.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/card.cpp
forty_game.o: $(srcdir)/game.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/game.cpp
forty_pile.o: $(srcdir)/pile.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/pile.cpp
forty_playerdg.o: $(srcdir)/playerdg.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/playerdg.cpp
forty_scoredg.o: $(srcdir)/scoredg.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/scoredg.cpp
forty_scorefil.o: $(srcdir)/scorefil.cpp
$(CXXC) -c -o $@ $(FORTY_CXXFLAGS) $(srcdir)/scorefil.cpp
forty_forty_rc.o: $(srcdir)/forty.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 forty_bundle data

View File

@@ -0,0 +1,110 @@
<html>
<body bgcolor="#FFFFFF" TEXT="#000000" VLINK="#000000" LINK="#000000" ALINK="#000000">
<font color="#000000">
<center>
<font size=+1><b>Forty Thieves</b></font> <p>
a game of patience<P>
(c) Chris Breeze, 1998-2002
<p>
</center>
<P>
Forty Thieves is a patience game played with two full packs of
cards. At the start of the game forty cards are dealt on the
eight 'bases' along the top of the window. The object of the
game is to place all the cards onto the eight 'foundations'. The
foundations are built starting with the ace and adding cards of
the same suit up to the king. Cards are dealt from the pack and
placed on the discard pile. Cards may be moved from the discard
pile or one of the bases to a base or a foundation. Only one
card can be moved at a time. Cards can only be placed on a base
if the top card of the base is of the same suit and is one
higher in pip value or the base is empty e.g. the eight of
spades can only be placed on top of the nine of spades.<P>
When the mouse cursor is over a card which can be moved it
changes to the 'hand' cursor. The card can then be moved by
double clicking the left button.<P>
The mouse cursor also changes to a hand when a card is dragged
by placing the cursor over the card and holding down the left
button. This feature can be enabled and disabled by selecting
the 'Helping hand' option from the Edit menu.<P>
The 'foundations' are the eight piles of cards down the left
side of the window. When the game starts these piles are empty.
The object of the game is to place all the cards on the
foundations. An ace can be placed on any empty foundation. Other
cards can only be placed on a foundation if the top card is of
the same suit and is one lower in pip value e.g. the three of
clubs can be placed on the four of clubs.<P>
The 'bases' are the ten piles of cards along the top of the
window. At the start of the game four cards are dealt face up on
each of the bases. A card can be added to a base if the base is
empty or if the top card is of the same suit and is one higher
in pip value e.g. the queen of hearts can be placed on the king
of hearts The top card of a base can be moved onto another base
or a foundation.<P>
Cards can be only moved one at a time. The top card of the pack
can be dealt onto discard pile by placing the mouse cursor over
the pack and pressing the left button. The number of cards
remaining is displayed to the right of the pack.<P>
Cards can be moved from the discard pile or the bases either by
'double-clicking' or by dragging. If the left button is
double-clicked when the mouse cursor is over a card and it can
move to another pile, it will do so. This is a quick way of
moving cards when their destination is unambiguous.<P>
A card can be dragged by placing the mouse cursor over the card
and holding down the left button. The card will follow the mouse
cursor until the left button is released. If the card is over a
pile on which it can be placed it will be added to that pile,
otherwise it will be returned to the pile from which it was
dragged.<P>
One point is scored for every card that is placed on a
foundation. Since there are two packs of 52 cards the maximum
score is 104. A record is kept of the number of games played,
the number of games won, the current score and the average
score. This information is displayed at bottom right of the
window and is stored on disk between games. A game is deemed to
have started if the cards have been dealt and any card has been
moved. If the game is abandoned before it is finished (i.e. by
starting a new game or closing window) it counts as a lost game.
New players can be added by selecting the 'Player' option from
the Game menu. A summary of players' scores can be displayed by
selecting the 'Scores...' option from the Game menu.<P>
All moves are recorded and can be undone. To undo a move select
the undo menu item from the Edit menu. A quicker way of undoing
is to press the right mouse button (it doesn't matter where the
mouse cursor is). Right button undo can be enabled and disabled
by selecting the 'Right button undo' option from the Edit menu.
Pressing the right mouse button with the control key pressed
re-does a previously undone move.<P>
An empty base or two is very useful as it gives the opportunity
to unscramble other bases. Try not to build onto kings which
obscure valuable cards as it will be difficult to get to them
later. The undo facility is very useful for going back and using
'hindsight'.<P>
Don't be put off if you can't win every game. I reckon winning 1
in 10 is pretty good (winning 1 in 3 is excellent).
</font>
</body>
</html>

View File

@@ -0,0 +1,273 @@
/////////////////////////////////////////////////////////////////////////////
// Name: canvas.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "forty.h"
#include "card.h"
#include "game.h"
#include "scorefil.h"
#include "playerdg.h"
#include "canvas.h"
wxBEGIN_EVENT_TABLE(FortyCanvas, wxScrolledWindow)
EVT_MOUSE_EVENTS(FortyCanvas::OnMouseEvent)
wxEND_EVENT_TABLE()
FortyCanvas::FortyCanvas(wxWindow* parent, const wxPoint& pos, const wxSize& size) :
wxScrolledWindow(parent, wxID_ANY, pos, size, 0),
m_helpingHand(true),
m_rightBtnUndo(true),
m_playerDialog(0),
m_leftBtnDown(false)
{
#ifdef __WXMSW__
// Unfortunately the redraw logic here is incompatible with double
// buffering under MSW, so we have to disable it. The proper solution would
// be to rewrite this logic, as this is also required to make it work under
// GTK/Wayland and macOS, where the game currently doesn't update its
// display at all.
MSWDisableComposited();
#endif
SetScrollbars(0, 0, 0, 0);
#ifdef __WXGTK__
m_font = wxTheFontList->FindOrCreateFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
#else
m_font = wxTheFontList->FindOrCreateFont(wxFontInfo(10).Family(wxFONTFAMILY_SWISS));
#endif
SetBackgroundColour(FortyApp::BackgroundColour());
m_handCursor = new wxCursor(wxCURSOR_HAND);
m_arrowCursor = new wxCursor(wxCURSOR_ARROW);
wxString name = wxTheApp->GetAppName();
if ( name.empty() ) name = wxT("forty");
m_scoreFile = new ScoreFile(name);
m_game = new Game(0, 0, 0);
m_game->Deal();
}
FortyCanvas::~FortyCanvas()
{
UpdateScores();
delete m_game;
delete m_scoreFile;
delete m_handCursor;
delete m_arrowCursor;
}
/*
Write the current player's score back to the score file
*/
void FortyCanvas::UpdateScores()
{
if (!m_player.empty() && m_scoreFile && m_game)
{
m_scoreFile->WritePlayersScore(
m_player,
m_game->GetNumWins(),
m_game->GetNumGames(),
m_game->GetScore()
);
}
}
void FortyCanvas::OnDraw(wxDC& dc)
{
dc.SetFont(* m_font);
m_game->Redraw(dc);
#if 0
// if player name not set (and selection dialog is not displayed)
// then ask the player for their name
if (m_player.empty() && !m_playerDialog)
{
m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
m_playerDialog->ShowModal();
m_player = m_playerDialog->GetPlayersName();
if ( !m_player.empty() )
{
// user entered a name - lookup their score
int wins, games, score;
m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
m_game->NewPlayer(wins, games, score);
m_game->DisplayScore(dc);
m_playerDialog->Destroy();
m_playerDialog = 0;
Refresh(false);
}
else
{
// user cancelled the dialog - exit the app
((wxFrame*)GetParent())->Close(true);
}
}
#endif
}
void FortyCanvas::ShowPlayerDialog()
{
// if player name not set (and selection dialog is not displayed)
// then ask the player for their name
if (m_player.empty() && !m_playerDialog)
{
m_playerDialog = new PlayerSelectionDialog(this, m_scoreFile);
m_playerDialog->ShowModal();
m_player = m_playerDialog->GetPlayersName();
if ( !m_player.empty() )
{
// user entered a name - lookup their score
int wins, games, score;
m_scoreFile->ReadPlayersScore(m_player, wins, games, score);
m_game->NewPlayer(wins, games, score);
wxClientDC dc(this);
dc.SetFont(* m_font);
m_game->DisplayScore(dc);
m_playerDialog->Destroy();
m_playerDialog = 0;
Refresh(false);
}
else
{
// user cancelled the dialog - exit the app
((wxFrame*)GetParent())->Close(true);
}
}
}
/*
Called when the main frame is closed
*/
bool FortyCanvas::OnCloseCanvas()
{
if (m_game->InPlay() &&
wxMessageBox(wxT("Are you sure you want to\nabandon the current game?"),
wxT("Warning"), wxYES_NO | wxICON_QUESTION) == wxNO)
{
return false;
}
return true;
}
void FortyCanvas::OnMouseEvent(wxMouseEvent& event)
{
int mouseX = (int)event.GetX();
int mouseY = (int)event.GetY();
wxClientDC dc(this);
PrepareDC(dc);
dc.SetFont(* m_font);
if (event.LeftDClick())
{
if (m_leftBtnDown)
{
m_leftBtnDown = false;
ReleaseMouse();
m_game->LButtonUp(dc, mouseX, mouseY);
}
m_game->LButtonDblClk(dc, mouseX, mouseY);
}
else if (event.LeftDown())
{
if (!m_leftBtnDown)
{
m_leftBtnDown = true;
CaptureMouse();
m_game->LButtonDown(dc, mouseX, mouseY);
}
}
else if (event.LeftUp())
{
if (m_leftBtnDown)
{
m_leftBtnDown = false;
ReleaseMouse();
m_game->LButtonUp(dc, mouseX, mouseY);
}
}
else if (event.RightDown() && !event.LeftIsDown())
{
// only allow right button undo if m_rightBtnUndo is true
if (m_rightBtnUndo)
{
if (event.ControlDown() || event.ShiftDown())
{
m_game->Redo(dc);
}
else
{
m_game->Undo(dc);
}
}
}
else if (event.Dragging())
{
m_game->MouseMove(dc, mouseX, mouseY);
}
if (!event.LeftIsDown())
{
SetCursorStyle(mouseX, mouseY);
}
}
void FortyCanvas::SetCursorStyle(int x, int y)
{
// Only set cursor to a hand if 'helping hand' is enabled and
// the card under the cursor can go somewhere
if (m_game->CanYouGo(x, y) && m_helpingHand)
{
SetCursor(* m_handCursor);
}
else
{
SetCursor(* m_arrowCursor);
}
}
void FortyCanvas::NewGame()
{
m_game->Deal();
Refresh();
}
void FortyCanvas::Undo()
{
wxClientDC dc(this);
PrepareDC(dc);
dc.SetFont(* m_font);
m_game->Undo(dc);
}
void FortyCanvas::Redo()
{
wxClientDC dc(this);
PrepareDC(dc);
dc.SetFont(* m_font);
m_game->Redo(dc);
}
void FortyCanvas::LayoutGame()
{
m_game->Layout();
}

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: canvas.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
#ifndef _CANVAS_H_
#define _CANVAS_H_
class Card;
class Game;
class ScoreFile;
class PlayerSelectionDialog;
class FortyCanvas: public wxScrolledWindow
{
public:
FortyCanvas(wxWindow* parent, const wxPoint& pos, const wxSize& size);
virtual ~FortyCanvas();
virtual void OnDraw(wxDC& dc) override;
bool OnCloseCanvas();
void OnMouseEvent(wxMouseEvent& event);
void SetCursorStyle(int x, int y);
void NewGame();
void Undo();
void Redo();
ScoreFile* GetScoreFile() const { return m_scoreFile; }
void UpdateScores();
void EnableHelpingHand(bool enable) { m_helpingHand = enable; }
void EnableRightButtonUndo(bool enable) { m_rightBtnUndo = enable; }
void LayoutGame();
void ShowPlayerDialog();
wxDECLARE_EVENT_TABLE();
private:
wxFont* m_font;
Game* m_game;
ScoreFile* m_scoreFile;
wxCursor* m_arrowCursor;
wxCursor* m_handCursor;
bool m_helpingHand;
bool m_rightBtnUndo;
wxString m_player;
PlayerSelectionDialog* m_playerDialog;
bool m_leftBtnDown;
};
#endif

View File

@@ -0,0 +1,551 @@
/////////////////////////////////////////////////////////////////////////////
// Name: card.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
//+-------------------------------------------------------------+
//| Description
//| A class for drawing playing cards.
//| Currently assumes that the card symbols have been
//| loaded into hbmap_symbols and the pictures for the
//| Jack, Queen and King have been loaded into
//| hbmap_pictures.
//+-------------------------------------------------------------+
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "forty.h"
#include "card.h"
#include "pictures.xpm"
#include "symbols.xpm"
wxBitmap* Card::m_pictureBmap = 0;
wxBitmap* Card::m_symbolBmap = 0;
double Card::m_scale = 1.0;
int Card::m_width = 50;
int Card::m_height = 70;
//+-------------------------------------------------------------+
//| Card::Card() |
//+-------------------------------------------------------------+
//| Description: |
//| Constructor for a playing card. |
//| Checks that the value is in the range 1..52 and then |
//| initialises the suit, colour, pipValue and wayUp. |
//+-------------------------------------------------------------+
Card::Card(int value, WayUp way_up) :
m_wayUp(way_up)
{
if (!m_symbolBmap)
{
m_symbolBmap = new wxBitmap(symbols_xpm);
if (!m_symbolBmap->IsOk())
{
::wxMessageBox(wxT("Failed to load bitmap CardSymbols"), wxT("Error"));
}
}
if (!m_pictureBmap)
{
m_pictureBmap = new wxBitmap(Pictures);
if (!m_pictureBmap->IsOk())
{
::wxMessageBox(wxT("Failed to load bitmap CardPictures"), wxT("Error"));
}
}
if (value >= 1 && value <= PackSize)
{
switch ((value - 1) / 13)
{
case 0:
m_suit = clubs;
m_colour = black;
break;
case 1:
m_suit = diamonds;
m_colour = red;
break;
case 2:
m_suit = hearts;
m_colour = red;
break;
case 3:
m_suit = spades;
m_colour = black;
break;
}
m_pipValue = 1 + (value - 1) % 13;
m_status = true;
}
else
{
m_status = false;
}
} // Card::Card()
//+-------------------------------------------------------------+
//| Card::SetScale() |
//+-------------------------------------------------------------+
//| Description: |
//| Scales the cards |
//+-------------------------------------------------------------+
void Card::SetScale(double scale)
{
m_scale = scale;
m_width = int(50*scale);
m_height = int(70*scale);
}
//+-------------------------------------------------------------+
//| Card::Erase() |
//+-------------------------------------------------------------+
//| Description: |
//| Erase the card at (x, y) by drawing a rectangle in the |
//| background colour. |
//+-------------------------------------------------------------+
void Card::Erase(wxDC& dc, int x, int y)
{
wxPen* pen = wxThePenList->FindOrCreatePen(
FortyApp::BackgroundColour()
);
dc.SetPen(* pen);
dc.SetBrush(FortyApp::BackgroundBrush());
dc.DrawRectangle(x, y, m_width, m_height);
} // Card::Erase()
//+-------------------------------------------------------------+
//| Card::Draw() |
//+-------------------------------------------------------------+
//| Description: |
//| Draw the card at (x, y). |
//| If the card is facedown draw the back of the card. |
//| If the card is faceup draw the front of the card. |
//| Cards are not held in bitmaps, instead they are drawn |
//| from their constituent parts when required. |
//| hbmap_symbols contains large and small suit symbols and |
//| pip values. These are copied to the appropriate part of |
//| the card. Picture cards use the pictures defined in |
//| hbmap_pictures. Note that only one picture is defined |
//| for the Jack, Queen and King, unlike a real pack where |
//| each suit is different. |
//| |
//| WARNING: |
//| The locations of these symbols is 'hard-wired' into the |
//| code. Editing the bitmaps or the numbers below will |
//| result in the wrong symbols being displayed. |
//+-------------------------------------------------------------+
void Card::Draw(wxDC& dc, int x, int y)
{
wxBrush backgroundBrush( dc.GetBackground() );
dc.SetBrush(* wxWHITE_BRUSH);
dc.SetPen(* wxBLACK_PEN);
dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
if (m_wayUp == facedown)
{
dc.SetBackground(* wxRED_BRUSH);
dc.SetBackgroundMode(wxBRUSHSTYLE_SOLID);
wxBrush* brush = wxTheBrushList->FindOrCreateBrush(
*wxBLACK, wxBRUSHSTYLE_CROSSDIAG_HATCH
);
dc.SetBrush(* brush);
dc.DrawRoundedRectangle(
x + 4, y + 4,
m_width - 8, m_height - 8,
2
);
}
else
{
wxMemoryDC memoryDC;
memoryDC.SelectObject(*m_symbolBmap);
// dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
dc.SetTextBackground(*wxWHITE);
switch (m_suit)
{
case spades:
case clubs:
dc.SetTextForeground(*wxBLACK);
break;
case diamonds:
case hearts:
dc.SetTextForeground(*wxRED);
break;
}
int symsize = 11;
int sympos = 14;
int sympos2 = 25;
int symdist = 5;
int symdist2 = 6;
int pipsize,pippos,valueheight,valuewidth;
int valuepos;
if (m_scale > 1.2)
{
pipsize = symsize;
pippos = sympos;
valueheight = 10;
valuewidth = 9;
valuepos = 50;
}
else
{
pipsize = 7;
pippos = 0;
valueheight = 7;
valuewidth = 6;
valuepos = 36;
}
// Draw the value
dc.Blit((wxCoord)(x + m_scale*3),
(wxCoord)(y + m_scale*3),
valuewidth,
valueheight,
&memoryDC,
valuewidth * (m_pipValue - 1),
valuepos,
wxCOPY);
dc.Blit((wxCoord)(x + m_width - m_scale*3 - valuewidth),
(wxCoord)(y + m_height - valueheight - m_scale*3),
valuewidth,
valueheight,
&memoryDC,
valuewidth * (m_pipValue - 1),
valuepos+valueheight,
wxCOPY);
// Draw the pips
dc.Blit((wxCoord)(x + m_scale*3 + valuewidth+2),
(wxCoord)(y + m_scale*3),
pipsize,
pipsize,
&memoryDC,
pipsize * m_suit,
pippos,
wxCOPY);
dc.Blit((wxCoord)(x + m_width - m_scale*3-valuewidth-pipsize-2),
(wxCoord)(y + m_height - pipsize - m_scale*3),
pipsize,
pipsize,
&memoryDC,
pipsize * m_suit,
pipsize+pippos,
wxCOPY);
switch (m_pipValue)
{
case 1:
dc.Blit((wxCoord)(x - symdist + m_width / 2),
(wxCoord)(y - m_scale*5 + m_height / 2),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
break;
case 3:
dc.Blit((wxCoord)(x - symdist + m_width / 2),
(wxCoord)(y - symdist + m_height / 2),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
wxFALLTHROUGH;
case 2:
dc.Blit((wxCoord)(x - symdist + m_width / 2),
(wxCoord)(y - symdist + m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 2),
(wxCoord)(y - symdist + 3 * m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
break;
case 5:
dc.Blit((wxCoord)(x - symdist + m_width / 2),
(wxCoord)(y - symdist + m_height / 2),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
wxFALLTHROUGH;
case 4:
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist + m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist + 3 * m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist + m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist + 3 * m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
break;
case 8:
dc.Blit((wxCoord)(x - symdist + 5 * m_width / 10),
(wxCoord)(y - symdist + 5 * m_height / 8),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
wxFALLTHROUGH;
case 7:
dc.Blit((wxCoord)(x - symdist + 5 * m_width / 10),
(wxCoord)(y - symdist + 3 * m_height / 8),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
wxFALLTHROUGH;
case 6:
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist + m_height / 4),
symsize,
symsize,
&memoryDC, symsize * m_suit, sympos, wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist + m_height / 2),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist + 3 * m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist + m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist + m_height / 2),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist + 3 * m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
break;
case 10:
dc.Blit((wxCoord)(x - symdist + m_width / 2),
(wxCoord)(y - symdist + 2 * m_height / 3),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
wxFALLTHROUGH;
case 9:
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist2 + m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist2 + 5 * m_height / 12),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist + 7 * m_height / 12),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 4),
(wxCoord)(y - symdist + 3 * m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist2 + m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist2 + 5 * m_height / 12),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist + 7 * m_height / 12),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + 3 * m_width / 4),
(wxCoord)(y - symdist + 3 * m_height / 4),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
dc.Blit((wxCoord)(x - symdist + m_width / 2),
(wxCoord)(y - symdist + m_height / 3),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
break;
case 11:
wxFALLTHROUGH;
case 12:
wxFALLTHROUGH;
case 13:
memoryDC.SelectObject(*m_pictureBmap);
int picwidth = 40,picheight = 45;
dc.Blit((wxCoord)(x + (m_width-picwidth)/2),
(wxCoord)(y - picheight/2 + m_height/2),
picwidth,
picheight,
&memoryDC,
picwidth * (m_pipValue - 11),
0,
wxCOPY);
memoryDC.SelectObject(*m_symbolBmap);
dc.Blit((wxCoord)(x + m_width-(m_width-picwidth)/2-symsize-3),
(wxCoord)(y - picheight/2+m_height/2+1),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos,
wxCOPY);
dc.Blit((wxCoord)(x + (m_width-picwidth)/2+2),
(wxCoord)(y + picheight/2 + m_height/2-symsize),
symsize,
symsize,
&memoryDC,
symsize * m_suit,
sympos2,
wxCOPY);
break;
}
}
dc.SetBackground( backgroundBrush );
} // Card:Draw()
//+-------------------------------------------------------------+
//| Card::DrawNullCard() |
//+-------------------------------------------------------------+
//| Description: |
//| Draws the outline of a card at (x, y). |
//| Used to draw place holders for empty piles of cards. |
//+-------------------------------------------------------------+
void Card::DrawNullCard(wxDC& dc, int x, int y)
{
wxPen* pen = wxThePenList->FindOrCreatePen(FortyApp::TextColour());
dc.SetBrush(FortyApp::BackgroundBrush());
dc.SetPen(*pen);
dc.DrawRoundedRectangle(x, y, m_width, m_height, 4);
} // Card::DrawNullCard()

View File

@@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////
// Name: card.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
//+-------------------------------------------------------------+
//| Description: |
//| A class for drawing playing cards. |
//| InitCards() must be called before using the Card class, |
//| otherwise the card bitmaps will not be loaded. |
//| CloseCards() must be called before terminating the |
//| program so that the bitmaps are deleted and the memory |
//| given back to Windows. |
//+-------------------------------------------------------------+
#ifndef _CARD_H_
#define _CARD_H_
// Constants
const int PackSize = 52;
#define CardHeight Card::GetHeight()
#define CardWidth Card::GetWidth()
// Data types
enum Suit { clubs = 0, diamonds = 1, hearts = 2, spades = 3 };
enum SuitColour { red = 0, black = 1 };
enum WayUp { faceup, facedown };
//--------------------------------//
// A class defining a single card //
//--------------------------------//
class Card {
friend class FortyApp;
static double m_scale;
static int m_width,m_height;
public:
Card(int value, WayUp way_up = facedown);
virtual ~Card(){}
void Draw(wxDC& pDC, int x, int y);
static void DrawNullCard(wxDC& pDC, int x, int y); // Draw card place-holder
void Erase(wxDC& pDC, int x, int y);
void TurnCard(WayUp way_up = faceup) { m_wayUp = way_up; }
WayUp GetWayUp() const { return m_wayUp; }
int GetPipValue() const { return m_pipValue; }
Suit GetSuit() const { return m_suit; }
SuitColour GetColour() const { return m_colour; }
static void SetScale(double scale);
static int GetHeight() { return m_height; }
static int GetWidth() { return m_width; }
static double GetScale() { return m_scale; }
private:
Suit m_suit;
int m_pipValue; // in the range 1 (Ace) to 13 (King)
SuitColour m_colour; // red or black
bool m_status;
WayUp m_wayUp;
static wxBitmap* m_symbolBmap;
static wxBitmap* m_pictureBmap;
};
#endif // _CARD_H_

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -0,0 +1,57 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 3 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) forty.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) forty_gtk.exe
.endif
.endif
OBJS=canvas.obj,card.obj,forty.obj,game.obj,pile.obj,playerdg.obj,scoredg.obj,\
scorefil.obj
.ifdef __WXMOTIF__
forty.exe : $(OBJS)
cxxlink/exec=forty.exe $(OBJS),[--.lib]vms/opt
.else
.ifdef __WXGTK__
forty_gtk.exe : $(OBJS)
cxxlink/exec=forty_gtk.exe $(OBJS),[--.lib]vms_gtk/opt
.endif
.endif
canvas.obj : canvas.cpp
card.obj : card.cpp
forty.obj : forty.cpp
game.obj : game.cpp
pile.obj : pile.cpp
playerdg.obj : playerdg.cpp
scoredg.obj : scoredg.cpp
scorefil.obj : scorefil.cpp

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" ?>
<makefile>
<include file="../../build/bakefiles/common_samples.bkl"/>
<exe id="forty" template="wx_sample" template_append="wx_append">
<sources>
forty.cpp
canvas.cpp
card.cpp
game.cpp
pile.cpp
playerdg.cpp
scoredg.cpp
scorefil.cpp
</sources>
<wx-lib>html</wx-lib>
<wx-lib>xml</wx-lib>
<wx-lib>core</wx-lib>
<wx-lib>base</wx-lib>
<win32-res>forty.rc</win32-res>
</exe>
<wx-data id="data">
<files>
about.htm
</files>
</wx-data>
</makefile>

View File

@@ -0,0 +1,369 @@
/////////////////////////////////////////////////////////////////////////////
// Name: forty.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "canvas.h"
#include "forty.h"
#include "card.h"
#include "scoredg.h"
#include "forty.xpm"
#if wxUSE_HTML
#include "wx/textfile.h"
#include "wx/html/htmlwin.h"
#endif
#include "wx/stockitem.h"
wxBEGIN_EVENT_TABLE(FortyFrame, wxFrame)
EVT_MENU(wxID_NEW, FortyFrame::NewGame)
EVT_MENU(wxID_EXIT, FortyFrame::Exit)
EVT_MENU(wxID_ABOUT, FortyFrame::About)
EVT_MENU(wxID_HELP_CONTENTS, FortyFrame::Help)
EVT_MENU(wxID_UNDO, FortyFrame::Undo)
EVT_MENU(wxID_REDO, FortyFrame::Redo)
EVT_MENU(SCORES, FortyFrame::Scores)
EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
EVT_MENU(LARGE_CARDS, FortyFrame::ToggleCardSize)
EVT_CLOSE(FortyFrame::OnCloseWindow)
wxEND_EVENT_TABLE()
// Create a new application object
wxIMPLEMENT_APP(FortyApp);
wxColour* FortyApp::m_backgroundColour = 0;
wxColour* FortyApp::m_textColour = 0;
wxBrush* FortyApp::m_backgroundBrush = 0;
FortyApp::~FortyApp()
{
delete m_backgroundColour;
delete m_textColour;
delete m_backgroundBrush;
delete Card::m_symbolBmap;
delete Card::m_pictureBmap;
}
bool FortyApp::OnInit()
{
bool largecards = false;
m_helpFile = wxGetCwd() + wxFILE_SEP_PATH + wxT("about.htm");
if (!wxFileExists(m_helpFile))
{
m_helpFile = wxPathOnly(argv[0]) + wxFILE_SEP_PATH + wxT("about.htm");
}
wxSize size(668,510);
if ((argc > 1) && (!wxStrcmp(argv[1],wxT("-L"))))
{
largecards = true;
size = wxSize(1000,750);
}
FortyFrame* frame = new FortyFrame(
0,
wxT("Forty Thieves"),
wxDefaultPosition,
size,
largecards
);
// Show the frame
frame->Show(true);
frame->GetCanvas()->ShowPlayerDialog();
return true;
}
const wxColour& FortyApp::BackgroundColour()
{
if (!m_backgroundColour)
{
m_backgroundColour = new wxColour(0, 128, 0);
}
return *m_backgroundColour;
}
const wxBrush& FortyApp::BackgroundBrush()
{
if (!m_backgroundBrush)
{
m_backgroundBrush = new wxBrush(BackgroundColour());
}
return *m_backgroundBrush;
}
const wxColour& FortyApp::TextColour()
{
if (!m_textColour)
{
m_textColour = new wxColour(*wxBLACK);
}
return *m_textColour;
}
// My frame constructor
FortyFrame::FortyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, const wxSize& size, bool largecards):
wxFrame(frame, wxID_ANY, title, pos, size)
{
#ifdef __WXMAC__
wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
#endif
// set the icon
#ifdef __WXMSW__
SetIcon(wxIcon(wxT("CardsIcon")));
#else
SetIcon(wxIcon(forty_xpm));
#endif
// Make a menu bar
wxMenu* gameMenu = new wxMenu;
gameMenu->Append(wxID_NEW, wxGetStockLabel(wxID_NEW), wxT("Start a new game"));
gameMenu->Append(SCORES, wxT("&Scores..."), wxT("Displays scores"));
gameMenu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT), wxT("Exits Forty Thieves"));
wxMenu* editMenu = new wxMenu;
editMenu->Append(wxID_UNDO, wxGetStockLabel(wxID_UNDO), wxT("Undo the last move"));
editMenu->Append(wxID_REDO, wxGetStockLabel(wxID_REDO), wxT("Redo a move that has been undone"));
wxMenu* optionsMenu = new wxMenu;
optionsMenu->Append(RIGHT_BUTTON_UNDO,
wxT("&Right button undo"),
wxT("Enables/disables right mouse button undo and redo"),
true
);
optionsMenu->Append(HELPING_HAND,
wxT("&Helping hand"),
wxT("Enables/disables hand cursor when a card can be moved"),
true
);
optionsMenu->Append(LARGE_CARDS,
wxT("&Large cards"),
wxT("Enables/disables large cards for high resolution displays"),
true
);
optionsMenu->Check(HELPING_HAND, true);
optionsMenu->Check(RIGHT_BUTTON_UNDO, true);
optionsMenu->Check(LARGE_CARDS, largecards ? true : false);
wxMenu* helpMenu = new wxMenu;
helpMenu->Append(wxID_HELP_CONTENTS, wxT("&Help Contents"), wxT("Displays information about playing the game"));
helpMenu->Append(wxID_ABOUT, wxT("&About"), wxT("About Forty Thieves"));
m_menuBar = new wxMenuBar;
m_menuBar->Append(gameMenu, wxT("&Game"));
m_menuBar->Append(editMenu, wxT("&Edit"));
m_menuBar->Append(optionsMenu, wxT("&Options"));
m_menuBar->Append(helpMenu, wxT("&Help"));
SetMenuBar(m_menuBar);
if (largecards)
Card::SetScale(1.3);
m_canvas = new FortyCanvas(this, wxDefaultPosition, size);
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( m_canvas, 1, wxEXPAND | wxALL, 0);
SetSizer( topsizer );
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
topsizer->SetSizeHints( this );
}
void FortyFrame::OnCloseWindow(wxCloseEvent& event)
{
if (m_canvas->OnCloseCanvas() )
{
this->Destroy();
}
else
event.Veto();
}
void
FortyFrame::NewGame(wxCommandEvent&)
{
m_canvas->NewGame();
}
void
FortyFrame::Exit(wxCommandEvent&)
{
Close(true);
}
void
FortyFrame::Help(wxCommandEvent& event)
{
#if wxUSE_HTML
if (wxFileExists(wxGetApp().GetHelpFile()))
{
FortyAboutDialog dialog(this, wxID_ANY, wxT("Forty Thieves Instructions"));
if (dialog.ShowModal() == wxID_OK)
{
}
}
else
#endif
{
About(event);
}
}
void
FortyFrame::About(wxCommandEvent&)
{
wxMessageBox(
wxT("Forty Thieves\n\n")
wxT("A free card game written with the wxWidgets toolkit\n")
wxT("Author: Chris Breeze (c) 1992-2004\n")
wxT("email: chris@breezesys.com"),
wxT("About Forty Thieves"),
wxOK|wxICON_INFORMATION, this
);
}
void
FortyFrame::Undo(wxCommandEvent&)
{
m_canvas->Undo();
}
void
FortyFrame::Redo(wxCommandEvent&)
{
m_canvas->Redo();
}
void
FortyFrame::Scores(wxCommandEvent&)
{
m_canvas->UpdateScores();
ScoreDialog scores(this, m_canvas->GetScoreFile());
scores.Display();
}
void
FortyFrame::ToggleRightButtonUndo(wxCommandEvent& event)
{
bool checked = m_menuBar->IsChecked(event.GetId());
m_canvas->EnableRightButtonUndo(checked);
}
void
FortyFrame::ToggleHelpingHand(wxCommandEvent& event)
{
bool checked = m_menuBar->IsChecked(event.GetId());
m_canvas->EnableHelpingHand(checked);
}
void
FortyFrame::ToggleCardSize(wxCommandEvent& event)
{
bool checked = m_menuBar->IsChecked(event.GetId());
Card::SetScale(checked ? 1.3 : 1);
m_canvas->LayoutGame();
m_canvas->Refresh();
}
//----------------------------------------------------------------------------
// stAboutDialog
//----------------------------------------------------------------------------
FortyAboutDialog::FortyAboutDialog( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style ) :
wxDialog( parent, id, title, position, size, style )
{
AddControls(this);
Centre(wxBOTH);
}
bool FortyAboutDialog::AddControls(wxWindow* parent)
{
#if wxUSE_HTML
wxString htmlText;
wxString htmlFile = wxGetApp().GetHelpFile();
{
wxTextFile file(htmlFile);
if (file.Exists())
{
file.Open();
for ( htmlText = file.GetFirstLine();
!file.Eof();
htmlText << file.GetNextLine() << wxT("\n") ) ;
}
}
if (htmlText.empty())
{
htmlText.Printf(wxT("<html><head><title>Warning</title></head><body><P>Sorry, could not find resource for About dialog<P></body></html>"));
}
// Customize the HTML
htmlText.Replace(wxT("$DATE$"), wxT(__DATE__));
wxSize htmlSize(400, 290);
// Note: in later versions of wxWin this will be fixed so wxRAISED_BORDER
// does the right thing. Meanwhile, this is a workaround.
#ifdef __WXMSW__
long borderStyle = wxDOUBLE_BORDER;
#else
long borderStyle = wxRAISED_BORDER;
#endif
wxHtmlWindow* html = new wxHtmlWindow(this, ID_ABOUT_HTML_WINDOW, wxDefaultPosition, htmlSize, borderStyle);
html -> SetBorders(10);
html -> SetPage(htmlText);
//// Start of sizer-based control creation
wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
wxWindow *item1 = parent->FindWindow( ID_ABOUT_HTML_WINDOW );
wxASSERT( item1 );
item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 );
wxButton *item2 = new wxButton( parent, wxID_CLOSE );
item2->SetDefault();
item2->SetFocus();
SetAffirmativeId(wxID_CLOSE);
item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
parent->SetSizer( item0 );
parent->Layout();
item0->Fit( parent );
item0->SetSizeHints( parent );
#endif
return true;
}

View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////
// Name: forty.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
#ifndef _FORTY_H_
#define _FORTY_H_
class FortyApp: public wxApp
{
public:
FortyApp(){}
virtual ~FortyApp();
bool OnInit() override;
static const wxColour& BackgroundColour();
static const wxColour& TextColour();
static const wxBrush& BackgroundBrush();
const wxString& GetHelpFile() const { return m_helpFile; }
private:
static wxColour* m_backgroundColour;
static wxColour* m_textColour;
static wxBrush* m_backgroundBrush;
wxString m_helpFile;
};
wxDECLARE_APP(FortyApp);
class FortyCanvas;
class FortyFrame: public wxFrame
{
public:
FortyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, const wxSize& size, bool largecards);
virtual ~FortyFrame(){}
void OnCloseWindow(wxCloseEvent& event);
// Menu callbacks
void NewGame(wxCommandEvent& event);
void Exit(wxCommandEvent& event);
void About(wxCommandEvent& event);
void Help(wxCommandEvent& event);
void Undo(wxCommandEvent& event);
void Redo(wxCommandEvent& event);
void Scores(wxCommandEvent& event);
void ToggleRightButtonUndo(wxCommandEvent& event);
void ToggleHelpingHand(wxCommandEvent& event);
void ToggleCardSize(wxCommandEvent& event);
FortyCanvas* GetCanvas() { return m_canvas; }
wxDECLARE_EVENT_TABLE();
private:
enum MenuCommands {
SCORES = 10,
RIGHT_BUTTON_UNDO,
HELPING_HAND,
LARGE_CARDS
};
wxMenuBar* m_menuBar;
FortyCanvas* m_canvas;
};
//----------------------------------------------------------------------------
// stAboutDialog
//----------------------------------------------------------------------------
class FortyAboutDialog: public wxDialog
{
public:
// constructors and destructors
FortyAboutDialog( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE );
bool AddControls(wxWindow* parent);
};
#define ID_ABOUT_HTML_WINDOW 1000
#endif

View File

@@ -0,0 +1,6 @@
aaaaa ICON "cards.ico"
#include "wx/msw/wx.rc"
CardsIcon ICON "cards.ico"

View File

@@ -0,0 +1,43 @@
/* XPM */
static const char *const forty_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 5 1",
". c Black",
"X c #FFFFFF",
" c None",
"O c #FF0000",
"o c #848484",
/* pixels */
" ............................ ",
"..XXXXXXXXXXXXXXXXXXXXXXXXXX.. ",
".XXXXXXXXXXXXXXXXXXXXXXXXXXXX.o ",
".XXXXXX...XXXXXXXXXXXOXXXXXXX.oo",
".XXXXX.....XXXXXXXXXOOOXXXXXX.oo",
".XXXXX.....XXXXXXXXXOOOXXXXXX.oo",
".XXXXXX...XXXXXXXXXOOOOOXXXXX.oo",
".XXX..XX.XX..XXXXXOOOOOOOXXXX.oo",
".XX....X.X....XXXOOOOOOOOOXXX.oo",
".XX...........XXXXOOOOOOOXXXX.oo",
".XX....X.X....XXXXXOOOOOXXXXX.oo",
".XXX..XX.XX..XXXXXXXOOOXXXXXX.oo",
".XXXXXX...XXXXXXXXXXOOOXXXXXX.oo",
".XXXX.......XXXXXXXXXOXXXXXXX.oo",
".XXXXXXXXXXXXXXXXXXXXXXXXXXXX.oo",
".XXXXXXXXXXXXXXXXXXXXXXXXXXXX.oo",
".XXXXOOXXXOOXXXXXXXXX.XXXXXXX.oo",
".XXXOOOOXOOOOXXXXXXX...XXXXXX.oo",
".XXOOOOOOOOOOOXXXXX.....XXXXX.oo",
".XXOOOOOOOOOOOXXXX.......XXXX.oo",
".XXOOOOOOOOOOOXXX.........XXX.oo",
".XXOOOOOOOOOOOXX...........XX.oo",
".XXXOOOOOOOOOXXX...........XX.oo",
".XXXXOOOOOOOXXXX....X.X....XX.oo",
".XXXXXOOOOOXXXXXX..XX.XX..XXX.oo",
".XXXXXXOOOXXXXXXXXXX...XXXXXX.oo",
".XXXXXXXOXXXXXXXXX.......XXXX.oo",
".XXXXXXXXXXXXXXXXXXXXXXXXXXXX.oo",
"..XXXXXXXXXXXXXXXXXXXXXXXXXX.ooo",
" ...........................oooo",
" oooooooooooooooooooooooooooo ",
" oooooooooooooooooooooooooo "
};

View File

@@ -0,0 +1,973 @@
/////////////////////////////////////////////////////////////////////////////
// Name: game.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include "forty.h"
#include "game.h"
Game::Game(int wins, int games, int score) :
m_inPlay(false),
m_moveIndex(0),
m_redoIndex(0),
m_bmap(0),
m_bmapCard(0)
{
int i;
m_pack = new Pack(2, 2 + 4 * (CardHeight + 2));
srand(time(0));
for (i = 0; i < 5; i++) m_pack->Shuffle();
m_discard = new Discard(2, 2 + 5 * (CardHeight + 2));
for (i = 0; i < 8; i++)
{
m_foundations[i] = new Foundation(2 + (i / 4) * (CardWidth + 2),
2 + (i % 4) * (CardHeight + 2));
}
for (i = 0; i < 10; i++)
{
m_bases[i] = new Base(8 + (i + 2) * (CardWidth + 2), 2);
}
Deal();
m_srcPile = 0;
m_liftedCard = 0;
// copy the input parameters for future reference
m_numWins = wins;
m_numGames = games;
m_totalScore = score;
m_currentScore = 0;
}
void Game::Layout()
{
int i;
m_pack->SetPos(2, 2 + 4 * (CardHeight + 2));
m_discard->SetPos(2, 2 + 5 * (CardHeight + 2));
for (i = 0; i < 8; i++)
{
m_foundations[i]->SetPos(2 + (i / 4) * (CardWidth + 2),
2 + (i % 4) * (CardHeight + 2));
}
for (i = 0; i < 10; i++)
{
m_bases[i]->SetPos(8 + (i + 2) * (CardWidth + 2), 2);
}
delete m_bmap;
delete m_bmapCard;
m_bmap = 0;
m_bmapCard = 0;
}
// Make sure we delete all objects created by the game object
Game::~Game()
{
int i;
delete m_pack;
delete m_discard;
for (i = 0; i < 8; i++)
{
delete m_foundations[i];
}
for (i = 0; i < 10; i++)
{
delete m_bases[i];
}
delete m_bmap;
delete m_bmapCard;
}
/*
Set the score for a new player.
NB: call Deal() first if the new player is to start
a new game
*/
void Game::NewPlayer(int wins, int games, int score)
{
m_numWins = wins;
m_numGames = games;
m_totalScore = score;
m_currentScore = 0;
}
// Undo the last move
void Game::Undo(wxDC& dc)
{
if (m_moveIndex > 0)
{
m_moveIndex--;
Card* card = m_moves[m_moveIndex].dest->RemoveTopCard(dc);
m_moves[m_moveIndex].src->AddCard(dc, card);
DisplayScore(dc);
}
}
// Redo the last move
void Game::Redo(wxDC& dc)
{
if (m_moveIndex < m_redoIndex)
{
Card* card = m_moves[m_moveIndex].src->RemoveTopCard(dc);
if (m_moves[m_moveIndex].src == m_pack)
{
m_pack->Redraw(dc);
card->TurnCard(faceup);
}
m_moves[m_moveIndex].dest->AddCard(dc, card);
DisplayScore(dc);
m_moveIndex++;
}
}
void Game::DoMove(wxDC& dc, Pile* src, Pile* dest)
{
if (m_moveIndex < MaxMoves)
{
if (src == dest)
{
wxMessageBox(wxT("Game::DoMove() src == dest"), wxT("Debug message"),
wxOK | wxICON_EXCLAMATION);
}
m_moves[m_moveIndex].src = src;
m_moves[m_moveIndex].dest = dest;
m_moveIndex++;
// when we do a move any moves in redo buffer are discarded
m_redoIndex = m_moveIndex;
}
else
{
wxMessageBox(wxT("Game::DoMove() Undo buffer full"), wxT("Debug message"),
wxOK | wxICON_EXCLAMATION);
}
if (!m_inPlay)
{
m_inPlay = true;
m_numGames++;
}
DisplayScore(dc);
if (HaveYouWon())
{
wxWindow *frame = wxTheApp->GetTopWindow();
wxWindow *canvas = nullptr;
if (frame)
{
wxWindowList::compatibility_iterator node = frame->GetChildren().GetFirst();
if (node) canvas = (wxWindow*)node->GetData();
}
// This game is over
m_inPlay = false;
// Redraw the score box to update games won
DisplayScore(dc);
if (wxMessageBox(wxT("Do you wish to play again?"),
wxT("Well Done, You have won!"), wxYES_NO | wxICON_QUESTION) == wxYES)
{
Deal();
canvas->Refresh();
}
else
{
// user cancelled the dialog - exit the app
((wxFrame*)canvas->GetParent())->Close(true);
}
}
}
void Game::DisplayScore(wxDC& dc)
{
wxColour bgColour = FortyApp::BackgroundColour();
wxPen* pen = wxThePenList->FindOrCreatePen(bgColour);
dc.SetTextBackground(bgColour);
dc.SetTextForeground(FortyApp::TextColour());
dc.SetBrush(FortyApp::BackgroundBrush());
dc.SetPen(* pen);
// count the number of cards in foundations
m_currentScore = 0;
for (int i = 0; i < 8; i++)
{
m_currentScore += m_foundations[i]->GetNumCards();
}
int x, y;
m_pack->GetTopCardPos(x, y);
x += 12 * CardWidth - 105;
wxCoord w, h;
{
wxCoord width, height;
dc.GetTextExtent(wxT("Average score:m_x"), &width, &height);
w = width;
h = height;
}
dc.DrawRectangle(x + w, y, 20, 4 * h);
wxString str;
str.Printf(wxT("%d"), m_currentScore);
dc.DrawText(wxT("Score:"), x, y);
dc.DrawText(str, x + w, y);
y += h;
str.Printf(wxT("%d"), m_numGames);
dc.DrawText(wxT("Games played:"), x, y);
dc.DrawText(str, x + w, y);
y += h;
str.Printf(wxT("%d"), m_numWins);
dc.DrawText(wxT("Games won:"), x, y);
dc.DrawText(str, x + w, y);
y += h;
int average = 0;
if (m_numGames > 0)
{
average = (2 * (m_currentScore + m_totalScore) + m_numGames ) / (2 * m_numGames);
}
str.Printf(wxT("%d"), average);
dc.DrawText(wxT("Average score:"), x, y);
dc.DrawText(str, x + w, y);
}
// Shuffle the m_pack and deal the cards
void Game::Deal()
{
int i, j;
Card* card;
// Reset all the piles, the undo buffer and shuffle the m_pack
m_moveIndex = 0;
m_pack->ResetPile();
for (i = 0; i < 5; i++)
{
m_pack->Shuffle();
}
m_discard->ResetPile();
for (i = 0; i < 10; i++)
{
m_bases[i]->ResetPile();
}
for (i = 0; i < 8; i++)
{
m_foundations[i]->ResetPile();
}
// Deal the initial 40 cards onto the bases
for (i = 0; i < 10; i++)
{
for (j = 1; j <= 4; j++)
{
card = m_pack->RemoveTopCard();
card->TurnCard(faceup);
m_bases[i]->AddCard(card);
}
}
if (m_inPlay)
{
// player has started the game and then redealt
// and so we must add the score for this game to the total score
m_totalScore += m_currentScore;
}
m_currentScore = 0;
m_inPlay = false;
}
// Redraw the m_pack, discard pile, the bases and the foundations
void Game::Redraw(wxDC& dc)
{
int i;
m_pack->Redraw(dc);
m_discard->Redraw(dc);
for (i = 0; i < 8; i++)
{
m_foundations[i]->Redraw(dc);
}
for (i = 0; i < 10; i++)
{
m_bases[i]->Redraw(dc);
}
DisplayScore(dc);
if (m_bmap == 0)
{
m_bmap = new wxBitmap(CardWidth, CardHeight);
m_bmapCard = new wxBitmap(CardWidth, CardHeight);
// Initialise the card bitmap to the background colour
wxMemoryDC memoryDC;
memoryDC.SelectObject(*m_bmapCard);
memoryDC.SetPen( *wxTRANSPARENT_PEN );
memoryDC.SetBrush(FortyApp::BackgroundBrush());
memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
memoryDC.SelectObject(*m_bmap);
memoryDC.DrawRectangle(0, 0, CardWidth, CardHeight);
memoryDC.SelectObject(wxNullBitmap);
}
}
// Test to see if the point (x, y) is over the top card of one of the piles
// Returns pointer to the pile, or 0 if (x, y) is not over a pile
// or the pile is empty
Pile* Game::WhichPile(int x, int y)
{
if (m_pack->GetCard(x, y) &&
m_pack->GetCard(x, y) == m_pack->GetTopCard())
{
return m_pack;
}
if (m_discard->GetCard(x, y) &&
m_discard->GetCard(x, y) == m_discard->GetTopCard())
{
return m_discard;
}
int i;
for (i = 0; i < 8; i++)
{
if (m_foundations[i]->GetCard(x, y) &&
m_foundations[i]->GetCard(x, y) == m_foundations[i]->GetTopCard())
{
return m_foundations[i];
}
}
for (i = 0; i < 10; i++)
{
if (m_bases[i]->GetCard(x, y) &&
m_bases[i]->GetCard(x, y) == m_bases[i]->GetTopCard())
{
return m_bases[i];
}
}
return 0;
}
// Left button is pressed - if cursor is over the m_pack then deal a card
// otherwise if it is over a card pick it up ready to be dragged - see MouseMove()
bool Game::LButtonDown(wxDC& dc, int x, int y)
{
m_srcPile = WhichPile(x, y);
if (m_srcPile == m_pack)
{
Card* card = m_pack->RemoveTopCard();
if (card)
{
m_pack->Redraw(dc);
card->TurnCard(faceup);
m_discard->AddCard(dc, card);
DoMove(dc, m_pack, m_discard);
}
m_srcPile = 0;
}
else if (m_srcPile)
{
m_srcPile->GetTopCardPos(m_xPos, m_yPos);
m_xOffset = m_xPos - x;
m_yOffset = m_yPos - y;
// Copy the area under the card
// Initialise the card bitmap to the background colour
{
wxMemoryDC memoryDC;
memoryDC.SelectObject(*m_bmap);
m_liftedCard = m_srcPile->RemoveTopCard(memoryDC, m_xPos, m_yPos);
}
// Draw the card in card bitmap ready for blitting onto
// the screen
{
wxMemoryDC memoryDC;
memoryDC.SelectObject(*m_bmapCard);
m_liftedCard->Draw(memoryDC, 0, 0);
}
}
return m_srcPile != 0;
}
// Called when the left button is double clicked
// If a card is under the pointer and it can move elsewhere then move it.
// Move onto a foundation as first choice, a populated base as second and
// an empty base as third choice.
// NB Cards in the m_pack cannot be moved in this way - they aren't in play
// yet
void Game::LButtonDblClk(wxDC& dc, int x, int y)
{
Pile* pile = WhichPile(x, y);
if (!pile) return;
// Double click on m_pack is the same as left button down
if (pile == m_pack)
{
LButtonDown(dc, x, y);
}
else
{
Card* card = pile->GetTopCard();
if (card)
{
int i;
// if the card is an ace then try to place it next
// to an ace of the same suit
if (card->GetPipValue() == 1)
{
for(i = 0; i < 4; i++)
{
Card* m_topCard = m_foundations[i]->GetTopCard();
if ( m_topCard )
{
if (m_topCard->GetSuit() == card->GetSuit() &&
m_foundations[i + 4] != pile &&
m_foundations[i + 4]->GetTopCard() == 0)
{
pile->RemoveTopCard(dc);
m_foundations[i + 4]->AddCard(dc, card);
DoMove(dc, pile, m_foundations[i + 4]);
return;
}
}
}
}
// try to place the card on a foundation
for(i = 0; i < 8; i++)
{
if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
{
pile->RemoveTopCard(dc);
m_foundations[i]->AddCard(dc, card);
DoMove(dc, pile, m_foundations[i]);
return;
}
}
// try to place the card on a populated base
for(i = 0; i < 10; i++)
{
if (m_bases[i]->AcceptCard(card) &&
m_bases[i] != pile &&
m_bases[i]->GetTopCard())
{
pile->RemoveTopCard(dc);
m_bases[i]->AddCard(dc, card);
DoMove(dc, pile, m_bases[i]);
return;
}
}
// try to place the card on any base
for(i = 0; i < 10; i++)
{
if (m_bases[i]->AcceptCard(card) && m_bases[i] != pile)
{
pile->RemoveTopCard(dc);
m_bases[i]->AddCard(dc, card);
DoMove(dc, pile, m_bases[i]);
return;
}
}
}
}
}
// Test to see whether the game has been won:
// i.e. m_pack, discard and bases are empty
bool Game::HaveYouWon()
{
if (m_pack->GetTopCard()) return false;
if (m_discard->GetTopCard()) return false;
for(int i = 0; i < 10; i++)
{
if (m_bases[i]->GetTopCard()) return false;
}
m_numWins++;
m_totalScore += m_currentScore;
m_currentScore = 0;
return true;
}
// See whether the card under the cursor can be moved somewhere else
// Returns 'true' if it can be moved, 'false' otherwise
bool Game::CanYouGo(int x, int y)
{
Pile* pile = WhichPile(x, y);
if (pile && pile != m_pack)
{
Card* card = pile->GetTopCard();
if (card)
{
int i;
for(i = 0; i < 8; i++)
{
if (m_foundations[i]->AcceptCard(card) && m_foundations[i] != pile)
{
return true;
}
}
for(i = 0; i < 10; i++)
{
if (m_bases[i]->GetTopCard() &&
m_bases[i]->AcceptCard(card) &&
m_bases[i] != pile)
{
return true;
}
}
}
}
return false;
}
// Called when the left button is released after dragging a card
// Scan the piles to see if this card overlaps a pile and can be added
// to the pile. If the card overlaps more than one pile on which it can be placed
// then put it on the nearest pile.
void Game::LButtonUp(wxDC& dc, int x, int y)
{
if (m_srcPile)
{
// work out the position of the dragged card
x += m_xOffset;
y += m_yOffset;
Pile* nearestPile = 0;
int distance = (CardHeight + CardWidth) * (CardHeight + CardWidth);
// find the nearest pile which will accept the card
int i;
for (i = 0; i < 8; i++)
{
if (DropCard(x, y, m_foundations[i], m_liftedCard))
{
if (m_foundations[i]->CalcDistance(x, y) < distance)
{
nearestPile = m_foundations[i];
distance = nearestPile->CalcDistance(x, y);
}
}
}
for (i = 0; i < 10; i++)
{
if (DropCard(x, y, m_bases[i], m_liftedCard))
{
if (m_bases[i]->CalcDistance(x, y) < distance)
{
nearestPile = m_bases[i];
distance = nearestPile->CalcDistance(x, y);
}
}
}
// Restore the area under the card
wxMemoryDC memoryDC;
memoryDC.SelectObject(*m_bmap);
dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
&memoryDC, 0, 0, wxCOPY);
// Draw the card in its new position
if (nearestPile)
{
// Add to new pile
nearestPile->AddCard(dc, m_liftedCard);
if (nearestPile != m_srcPile)
{
DoMove(dc, m_srcPile, nearestPile);
}
}
else
{
// Return card to src pile
m_srcPile->AddCard(dc, m_liftedCard);
}
m_srcPile = 0;
m_liftedCard = 0;
}
}
bool Game::DropCard(int x, int y, Pile* pile, Card* card)
{
bool retval = false;
if (pile->Overlap(x, y))
{
if (pile->AcceptCard(card))
{
retval = true;
}
}
return retval;
}
void Game::MouseMove(wxDC& dc, int mx, int my)
{
if (m_liftedCard)
{
wxMemoryDC memoryDC;
memoryDC.SelectObject(*m_bmap);
int dx = mx + m_xOffset - m_xPos;
int dy = my + m_yOffset - m_yPos;
if (abs(dx) >= CardWidth || abs(dy) >= CardHeight)
{
// Restore the area under the card
dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
&memoryDC, 0, 0, wxCOPY);
// Copy the area under the card in the new position
memoryDC.Blit(0, 0, CardWidth, CardHeight,
&dc, m_xPos + dx, m_yPos + dy, wxCOPY);
}
else if (dx >= 0)
{
// dx >= 0
dc.Blit(m_xPos, m_yPos, dx, CardHeight, &memoryDC, 0, 0, wxCOPY);
if (dy >= 0)
{
// dy >= 0
dc.Blit(m_xPos + dx, m_yPos, CardWidth - dx, dy, &memoryDC, dx, 0, wxCOPY);
memoryDC.Blit(0, 0, CardWidth - dx, CardHeight - dy,
&memoryDC, dx, dy, wxCOPY);
memoryDC.Blit(0, CardHeight - dy, CardWidth - dx, dy,
&dc, m_xPos + dx, m_yPos + CardHeight, wxCOPY);
}
else
{
// dy < 0
dc.Blit(m_xPos + dx, m_yPos + dy + CardHeight, CardWidth - dx, -dy,
&memoryDC, dx, CardHeight + dy, wxCOPY);
memoryDC.Blit(0, -dy, CardWidth - dx, CardHeight + dy,
&memoryDC, dx, 0, wxCOPY);
memoryDC.Blit(0, 0, CardWidth - dx, -dy,
&dc, m_xPos + dx, m_yPos + dy, wxCOPY);
}
memoryDC.Blit(CardWidth - dx, 0, dx, CardHeight,
&dc, m_xPos + CardWidth, m_yPos + dy, wxCOPY);
}
else
{
// dx < 0
dc.Blit(m_xPos + CardWidth + dx, m_yPos, -dx, CardHeight,
&memoryDC, CardWidth + dx, 0, wxCOPY);
if (dy >= 0)
{
dc.Blit(m_xPos, m_yPos, CardWidth + dx, dy, &memoryDC, 0, 0, wxCOPY);
memoryDC.Blit(-dx, 0, CardWidth + dx, CardHeight - dy,
&memoryDC, 0, dy, wxCOPY);
memoryDC.Blit(-dx, CardHeight - dy, CardWidth + dx, dy,
&dc, m_xPos, m_yPos + CardHeight, wxCOPY);
}
else
{
// dy < 0
dc.Blit(m_xPos, m_yPos + CardHeight + dy, CardWidth + dx, -dy,
&memoryDC, 0, CardHeight + dy, wxCOPY);
memoryDC.Blit(-dx, -dy, CardWidth + dx, CardHeight + dy,
&memoryDC, 0, 0, wxCOPY);
memoryDC.Blit(-dx, 0, CardWidth + dx, -dy,
&dc, m_xPos, m_yPos + dy, wxCOPY);
}
memoryDC.Blit(0, 0, -dx, CardHeight,
&dc, m_xPos + dx, m_yPos + dy, wxCOPY);
}
m_xPos += dx;
m_yPos += dy;
// draw the card in its new position
memoryDC.SelectObject(*m_bmapCard);
dc.Blit(m_xPos, m_yPos, CardWidth, CardHeight,
&memoryDC, 0, 0, wxCOPY);
}
}
//----------------------------------------------//
// The Pack class: holds the two decks of cards //
//----------------------------------------------//
Pack::Pack(int x, int y) : Pile(x, y, 0, 0)
{
for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
{
m_cards[m_topCard] = new Card(1 + m_topCard / 2, facedown);
}
m_topCard = NumCards - 1;
}
void Pack::Shuffle()
{
Card* temp[NumCards];
int i;
// Don't try to shuffle an empty m_pack!
if (m_topCard < 0) return;
// Copy the cards into a temporary array. Start by clearing
// the array and then copy the card into a random position.
// If the position is occupied then find the next lower position.
for (i = 0; i <= m_topCard; i++)
{
temp[i] = 0;
}
for (i = 0; i <= m_topCard; i++)
{
int pos = rand() % (m_topCard + 1);
while (temp[pos])
{
pos--;
if (pos < 0) pos = m_topCard;
}
m_cards[i]->TurnCard(facedown);
temp[pos] = m_cards[i];
m_cards[i] = 0;
}
// Copy each card back into the m_pack in a random
// position. If position is occupied then find nearest
// unoccupied position after the random position.
for (i = 0; i <= m_topCard; i++)
{
int pos = rand() % (m_topCard + 1);
while (m_cards[pos])
{
pos++;
if (pos > m_topCard) pos = 0;
}
m_cards[pos] = temp[i];
}
}
void Pack::Redraw(wxDC& dc)
{
Pile::Redraw(dc);
wxString str;
str.Printf(wxT("%d "), m_topCard + 1);
dc.SetBackgroundMode( wxBRUSHSTYLE_SOLID );
dc.SetTextBackground(FortyApp::BackgroundColour());
dc.SetTextForeground(FortyApp::TextColour());
dc.DrawText(str, m_x + CardWidth + 5, m_y + CardHeight / 2);
}
void Pack::AddCard(Card* card)
{
if (card == m_cards[m_topCard + 1])
{
m_topCard++;
}
else
{
wxMessageBox(wxT("Pack::AddCard() Undo error"), wxT("Forty Thieves: Warning"),
wxOK | wxICON_EXCLAMATION);
}
card->TurnCard(facedown);
}
Pack::~Pack()
{
for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
{
delete m_cards[m_topCard];
}
}
//------------------------------------------------------//
// The Base class: holds the initial pile of four cards //
//------------------------------------------------------//
Base::Base(int x, int y) : Pile(x, y, 0, 12)
{
m_topCard = -1;
}
bool Base::AcceptCard(Card* card)
{
bool retval = false;
if (m_topCard >= 0)
{
if (m_cards[m_topCard]->GetSuit() == card->GetSuit() &&
m_cards[m_topCard]->GetPipValue() - 1 == card->GetPipValue())
{
retval = true;
}
}
else
{
// pile is empty - ACCEPT
retval = true;
}
return retval;
}
//----------------------------------------------------------------//
// The Foundation class: holds the cards built up from the ace... //
//----------------------------------------------------------------//
Foundation::Foundation(int x, int y) : Pile(x, y, 0, 0)
{
m_topCard = -1;
}
bool Foundation::AcceptCard(Card* card)
{
bool retval = false;
if (m_topCard >= 0)
{
if (m_cards[m_topCard]->GetSuit() == card->GetSuit() &&
m_cards[m_topCard]->GetPipValue() + 1 == card->GetPipValue())
{
retval = true;
}
}
else if (card->GetPipValue() == 1)
{
// It's an ace and the pile is empty - ACCEPT
retval = true;
}
return retval;
}
//----------------------------------------------------//
// The Discard class: holds cards dealt from the m_pack //
//----------------------------------------------------//
Discard::Discard(int x, int y) : Pile(x, y, 19, 0)
{
m_topCard = -1;
}
void Discard::Redraw(wxDC& dc)
{
if (m_topCard >= 0)
{
if (m_dx == 0 && m_dy == 0)
{
m_cards[m_topCard]->Draw(dc, m_x, m_y);
}
else
{
int x = m_x;
int y = m_y;
for (int i = 0; i <= m_topCard; i++)
{
m_cards[i]->Draw(dc, x, y);
x += m_dx;
y += m_dy;
if (i == 31)
{
x = m_x;
y = m_y + CardHeight / 3;
}
}
}
}
else
{
Card::DrawNullCard(dc, m_x, m_y);
}
}
void Discard::GetTopCardPos(int& x, int& y)
{
if (m_topCard < 0)
{
x = m_x;
y = m_y;
}
else if (m_topCard > 31)
{
x = m_x + m_dx * (m_topCard - 32);
y = m_y + CardHeight / 3;
}
else
{
x = m_x + m_dx * m_topCard;
y = m_y;
}
}
Card* Discard::RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset)
{
Card* card;
if (m_topCard <= 31)
{
card = Pile::RemoveTopCard(dc, m_xOffset, m_yOffset);
}
else
{
int topX, topY, x, y;
GetTopCardPos(topX, topY);
card = Pile::RemoveTopCard();
card->Erase(dc, topX - m_xOffset, topY - m_yOffset);
GetTopCardPos(x, y);
dc.SetClippingRegion(topX - m_xOffset, topY - m_yOffset,
CardWidth, CardHeight);
for (int i = m_topCard - 31; i <= m_topCard - 31 + CardWidth / m_dx; i++)
{
m_cards[i]->Draw(dc, m_x - m_xOffset + i * m_dx, m_y - m_yOffset);
}
if (m_topCard > 31)
{
m_cards[m_topCard]->Draw(dc, topX - m_xOffset - m_dx, topY - m_yOffset);
}
dc.DestroyClippingRegion();
}
return card;
}

View File

@@ -0,0 +1,134 @@
/////////////////////////////////////////////////////////////////////////////
// Name: game.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
#ifndef _GAME_H_
#define _GAME_H_
#include "card.h"
#include "pile.h"
const int MaxMoves = 800;
//---------------------------------------//
// A class which holds the pack of cards //
//---------------------------------------//
class Pack : public Pile {
public:
Pack(int x, int y);
virtual ~Pack();
void Redraw(wxDC& dc) override;
void ResetPile() override { m_topCard = NumCards - 1; }
void Shuffle();
void AddCard(Card* card) override; // Add card
void AddCard(wxDC& dc, Card* card) override { AddCard(card); Redraw(dc); }
};
//----------------------------------------------------------//
// A class which holds a base i.e. the initial 10 x 4 cards //
//----------------------------------------------------------//
class Base : public Pile {
public:
Base(int x, int y);
virtual ~Base(){}
bool AcceptCard(Card* card) override;
};
//----------------------------------------------------//
// A class which holds a foundation i.e. Ace, 2, 3... //
//----------------------------------------------------//
class Foundation : public Pile {
public:
Foundation(int x, int y);
virtual ~Foundation(){}
bool AcceptCard(Card* card) override;
};
//--------------------------------------//
// A class which holds the discard pile //
//--------------------------------------//
class Discard : public Pile {
public:
Discard(int x, int y);
virtual ~Discard(){}
void Redraw(wxDC& dc) override;
void GetTopCardPos(int& x, int& y) override;
Card* RemoveTopCard(wxDC& dc, int m_xOffset, int m_yOffset) override;
};
class Game {
public:
Game(int wins, int games, int score);
virtual ~Game();
void Layout();
void NewPlayer(int wins, int games, int score);
void Deal(); // Shuffle and deal a new game
bool CanYouGo(int x, int y); // can card under (x,y) go somewhere?
bool HaveYouWon(); // have you won the game?
void Undo(wxDC& dc); // Undo the last go
void Redo(wxDC& dc); // Redo the last go
void Redraw(wxDC& dc);
void DisplayScore(wxDC& dc);
bool LButtonDown(wxDC& dc, int mx, int my);
void LButtonUp(wxDC& dc, int mx, int my);
void LButtonDblClk(wxDC& dc, int mx, int my);
void MouseMove(wxDC& dc, int mx, int my);
int GetNumWins() const { return m_numWins; }
int GetNumGames() const { return m_numGames; }
int GetScore() const { return m_currentScore + m_totalScore; }
bool InPlay() const { return m_inPlay; }
private:
bool DropCard(int x, int y, Pile* pile, Card* card);
// can the card at (x, y) be dropped on the pile?
Pile* WhichPile(int x, int y); // which pile is (x, y) over?
void DoMove(wxDC& dc, Pile* src, Pile* dest);
bool m_inPlay; // flag indicating that the game has started
// undo buffer
struct {
Pile* src;
Pile* dest;
} m_moves[MaxMoves];
int m_moveIndex; // current position in undo/redo buffer
int m_redoIndex; // max move index available for redo
// the various piles of cards
Pack* m_pack;
Discard* m_discard;
Base* m_bases[10];
Foundation* m_foundations[8];
// variables to do with dragging cards
Pile* m_srcPile;
Card* m_liftedCard;
int m_xPos, m_yPos; // current coords of card being dragged
int m_xOffset, m_yOffset; // card/mouse offset when dragging a card
wxBitmap* m_bmap;
wxBitmap* m_bmapCard;
// variables to do with scoring
int m_numGames;
int m_numWins;
int m_totalScore;
int m_currentScore;
};
#endif // _GAME_H_

View File

@@ -0,0 +1,268 @@
# =========================================================================
# 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)
FORTY_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)
FORTY_OBJECTS = \
$(OBJS)\forty_forty.o \
$(OBJS)\forty_canvas.o \
$(OBJS)\forty_card.o \
$(OBJS)\forty_game.o \
$(OBJS)\forty_pile.o \
$(OBJS)\forty_playerdg.o \
$(OBJS)\forty_scoredg.o \
$(OBJS)\forty_scorefil.o \
$(OBJS)\forty_forty_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_HTML_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_XML_p = \
-lwxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml
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)\forty.exe data
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
-if exist $(OBJS)\*.d del $(OBJS)\*.d
-if exist $(OBJS)\forty.exe del $(OBJS)\forty.exe
$(OBJS)\forty.exe: $(FORTY_OBJECTS) $(OBJS)\forty_forty_rc.o
$(foreach f,$(subst \,/,$(FORTY_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_HTML_p) $(__WXLIB_XML_p) $(__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 (about.htm) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
$(OBJS)\forty_forty.o: ./forty.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_canvas.o: ./canvas.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_card.o: ./card.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_game.o: ./game.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_pile.o: ./pile.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_playerdg.o: ./playerdg.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_scoredg.o: ./scoredg.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_scorefil.o: ./scorefil.cpp
$(CXX) -c -o $@ $(FORTY_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\forty_forty_rc.o: ./forty.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.
#
CC = g++
PROGRAM = forty
OBJECTS = $(PROGRAM).o canvas.o card.o game.o pile.o playerdg.o scoredg.o scorefil.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,481 @@
# =========================================================================
# 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)
FORTY_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
$(__DEBUGINFO_0) /Fd$(OBJS)\forty.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)
FORTY_OBJECTS = \
$(OBJS)\forty_forty.obj \
$(OBJS)\forty_canvas.obj \
$(OBJS)\forty_card.obj \
$(OBJS)\forty_game.obj \
$(OBJS)\forty_pile.obj \
$(OBJS)\forty_playerdg.obj \
$(OBJS)\forty_scoredg.obj \
$(OBJS)\forty_scorefil.obj
FORTY_RESOURCES = \
$(OBJS)\forty_forty.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_HTML_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_XML_p = \
wxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml.lib
!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)\forty.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)\forty.exe del $(OBJS)\forty.exe
-if exist $(OBJS)\forty.ilk del $(OBJS)\forty.ilk
-if exist $(OBJS)\forty.pdb del $(OBJS)\forty.pdb
$(OBJS)\forty.exe: $(FORTY_OBJECTS) $(OBJS)\forty_forty.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\forty.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(FORTY_OBJECTS) $(FORTY_RESOURCES) $(__WXLIB_HTML_p) $(__WXLIB_XML_p) $(__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 (about.htm) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\forty_forty.obj: .\forty.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\forty.cpp
$(OBJS)\forty_canvas.obj: .\canvas.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\canvas.cpp
$(OBJS)\forty_card.obj: .\card.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\card.cpp
$(OBJS)\forty_game.obj: .\game.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\game.cpp
$(OBJS)\forty_pile.obj: .\pile.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\pile.cpp
$(OBJS)\forty_playerdg.obj: .\playerdg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\playerdg.cpp
$(OBJS)\forty_scoredg.obj: .\scoredg.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\scoredg.cpp
$(OBJS)\forty_scorefil.obj: .\scorefil.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FORTY_CXXFLAGS) .\scorefil.cpp
$(OBJS)\forty_forty.res: .\forty.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 .\forty.rc

View File

@@ -0,0 +1,60 @@
/* XPM */
static const char *const Pictures[] = {
/* width height num_colors chars_per_pixel */
" 120 45 8 1",
/* colors */
". c #000000",
"# c #c0c0c0",
"a c #808080",
"b c #ff0000",
"c c #ffff00",
"d c #0000ff",
"e c #00ffff",
"f c #ffffff",
/* pixels */
"........................................................................................................................",
".fff.fffffff.bb.bb.bb.b.fffffffffffffff..fffffffffff..f..bbc.cc..ffffffffffffff..fff.ffffff.bbccccbcccccbb.ffffffffffff.",
".ff.c.fffffff.bbbbbbbb.ffffffffffffffff..fff.ffffff..f.ff.bbc..c.ffffffffffffff..ff.a.ffffff.bbccbbbcccbb.fffffffffffff.",
".f.cbc.fffffff........fffffffffffffffff..ff.b.fffff.f.ffff.bb..c..fffffffffffff..f.#af.ffffff.bbbbbbbbbb.ffffffffffffff.",
".f.cbc.ffffff.fff.c.c.fffffffffffffffff..ff.b.fffff..f.ff.f.bbc.c.fffffffffffff..f.#af.ffffff............ffffffffffffff.",
".ff.c.fffffff.f..f.c.c.ffffffffffffffff..fff.ffffff.f..ff..f.bb..ffffffffffffff..f.#af.ffffff.a..f.fff.f.ffffffffffffff.",
".f.cbc.ffffff.f.ff.c.c.ffffffffffffffff..ff.c.fffff.fff.ffff..b.fffffffffffffff..f.#af.ffffff.a.f..fff..f.fffffffffffff.",
".f.cbc.fffff.fffff.c.c.ffffffffffffffff..ff.c.fffff.fff.ffff....fffffffffffffff..f.#af.ffffff.a.ffff.ffff.fffffffffffff.",
".ff.c.fffff.ffffff.c.c.ffffffffffffffff..ff.c.fffff.fff..fff.b..fffffffffffffff..f.#af.ffffff.a.fffff.fff.fffffffffffff.",
".f.cbc.ffff..###ff.c.c.ffffffffffffffff..ff.c.fffff.ffffffff..b.fffffffffffffff..f.#af.ffffff.a.ffff..fff.fffffffffffff.",
".f.cbc.ffffff...ff.c.c.ffffffffffffffff..fff.ffffff.ffbbbbff.f...ffffffffffffff..f.#af.fff..f.a..ffffffff.fffffffffffff.",
".ff....ffffff.ffff.c.c.ffffffffffffffff..ff....fffff.ffffff.f.f...fffffffffffff..f.#af.fff....a...f....f..fffffffffffff.",
".f.ffff.fffff.fffff.c.c.fffffffffffffff..f.ffff.ffff..ffff.f.f.f..fffffffffffff..f.#af.ffff.aaa.a..f.f.f...ffffffffffff.",
".f....ff.f.................ffffffffffff..f....ff.f.................ffffffffffff..f.#af.fff...................ffffffffff.",
".ff.fff....eddddddddddddddd.....fffffff..f.fffff...ffffffffff.cdbb......fffffff..f.#af.....c.cc..bbbbbb..c......fffffff.",
".ff....bbbd.dbcbbbbbbbbbcbdedbbb....fff..f....f.bc.fdddddddf.cdbb.d..f.....ffff..f.#af..cbbcc.cc..bbbb..c......b....fff.",
"...bbbb...deedbbcbbcbbcbbbd.dbb.bbbb.....f.fff.fbbc.fffffff.cdbb.d..f..dd.c..ff..........cbbcc.cc......c.....bbbdfff....",
".bb....c.ccdeedbbbcccbbbbdedbb.bbb..cc...ff...c.fbbc.fdddf.cdbb.d..f..dd.cccd.f...ffff...dcbbcc.cc....cc...ddbbbdfddddf.",
"...cc.c....bd.dbcbbcbbcbbd.db.bb..cbc.b..ff.dccc.bbc.ffff.cdbb.dd..ff...cdcdfd.........f.dcbbacc.cccccc..fdcbdbbdffddff.",
"..c....bbbbbdeddddddddddddedbb..cccc.bb..f..fdcdc.bbc.ff.cdbb.dddd..ff.cccdffdc...ffff.f.dcbbcacc.c...c.fdccccdbdffddff.",
"...bb.bb....bbbbbbbbbbbbbbbb..ccbbc.bb....ffdfdccc.bbc..cdbb..........cccdfdfbc........f.dcbbccacc.ccb.fdddbdbdbddffffd.",
".bbb.b..ccc.d.d.d.d.dd.d.d.d.cccbb.bb.b..cbdfffdccc.fdfdfdfdfdfdfdfd.cccdfffbbc...ffff.f.dcbbacca.bcdcc.caddddcddff..ff.",
".bb.bb.ccbcd.d.d.d.ff.d.d.d.dcbcc.bb.bb..cbbddddcdc.dbdbdbdbdbdbdbdb.cdcddddbbc.........ddcddaacc.cdddc.ccaddcdd........",
".b.bb.bbccc.d.d.d.dd.d.d.d.d.ccc.bb.bbb..cbbfffdccc.fdfdfdfdfdfdfdfd.cccdfffdbc..ff..ffddcddddaac.ccdcb.accbbcd.f.ffff..",
"..bb.cbbcc..bbbbbbbbbbbbbbbb....b..bb....cbfdfdccc..........bbdc..cbb.cccdfdff...dffffddcdbdbddaac.bcc.ccacbbcd.f.......",
".bb.cccc..bbdeddddddddddddedbbbbb....c...cdffdccc.ff..dddd.bbdc.ff.cbb.cdcdff.f..ffddffdbdccccdfa.c...c.ccabbcd.f.ffff..",
".b.cbc..bb.bd.dbbcbbcbbcbd.db....c.cc.....dfdcdc...ff..dd.bbdc.ffff.cbb.cccd.ff..ffddffdbbdbcdff..cccccc.ccbbcd.f.......",
"..cc..bbb.bbdedbbbbcccbbbdeedcc.c....bb..f.dccc.dd..f..d.bbdc.fdddf.cbbf.c...ff..fddddfdbbbddf...cc....cc.cbbcd...ffff..",
"....bbbb.bbd.dbbbcbbcbbcbbdeed...bbbb....ff..c.dd..f..d.bbdc.fffffff.cbbf.fff.f.....fffdbbb......c......cc.cbbc.........",
".fff....bbbdedbcbbbbbbbbbcbd.dbbb....ff..ffff.....f..d.bbdc.fdddddddf.cb.f....f..fff....bb......c..bbbb..cc.cbbc..fa#.f.",
".fffffff.....ddddddddddddddde....fff.ff..fffffff......bbdc.ffffffffff...fffff.f..fffffff.......c..bbbbbb..cc......fa#.f.",
".ffffffffffff.................f.ff....f..ffffffffffff.................f.ff....f..ffffffffff...................fff.fa#.f.",
".fffffffffffffff.c.c.fffff.fffff.ffff.f..fffffffffffff..f.f.f.ffff..ffff.ffff.f..ffffffffffff...f.f.f..a.aaa.ffff.fa#.f.",
".ffffffffffffffff.c.c.ffff.ffffff....ff..fffffffffffff...f.f.ffffff.fffff....ff..fffffffffffff..f....f...a....fff.fa#.f.",
".ffffffffffffffff.c.c.ff...ffffff.cbc.f..ffffffffffffff...f.ffbbbbff.ffffff.fff..fffffffffffff.ffffffff..a.f..fff.fa#.f.",
".ffffffffffffffff.c.c.ff###..ffff.cbc.f..fffffffffffffff.b..ffffffff.fffff.c.ff..fffffffffffff.fff..ffff.a.ffffff.fa#.f.",
".ffffffffffffffff.c.c.ffffff.fffff.c.ff..fffffffffffffff..b.fff..fff.fffff.c.ff..fffffffffffff.fff.fffff.a.ffffff.fa#.f.",
".ffffffffffffffff.c.c.fffff.fffff.cbc.f..fffffffffffffff....ffff.fff.fffff.c.ff..fffffffffffff.ffff.ffff.a.ffffff.fa#.f.",
".ffffffffffffffff.c.c.ff.f.ffffff.cbc.f..fffffffffffffff.b..ffff.fff.fffff.c.ff..fffffffffffff.f..fff..f.a.ffffff.fa#.f.",
".ffffffffffffffff.c.c.f..f.fffffff.c.ff..ffffffffffffff..bb.f..ff..f.ffffff.fff..ffffffffffffff.f.fff.ff.a.ffffff.fa#.f.",
".fffffffffffffffff.c.c.fff.ffffff.cbc.f..fffffffffffff.c.cbb.f.ff.f..fffff.b.ff..ffffffffffffff............ffffff.fa#.f.",
".fffffffffffffffff........fffffff.cbc.f..fffffffffffff..c..bb.ffff.f.fffff.b.ff..ffffffffffffff.bbbbbbbbbb.ffffff.fa#.f.",
".ffffffffffffffff.bbbbbbbb.fffffff.c.ff..ffffffffffffff.c..cbb.ff.f..ffffff.fff..fffffffffffff.bbcccbbbccbb.ffffff.a.ff.",
".fffffffffffffff.b.bb.bb.bb.fffffff.fff..ffffffffffffff..cc.cbb..f..fffffffffff..ffffffffffff.bbcccccbccccbb.ffffff.fff.",
"........................................................................................................................"
};

View File

@@ -0,0 +1,287 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pile.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
//+-------------------------------------------------------------+
//| Description: |
//| The base class for holding piles of playing cards. |
//+-------------------------------------------------------------+
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include "card.h"
#include "pile.h"
#include "forty.h"
#include "canvas.h"
#include "wx/app.h"
//+-------------------------------------------------------------+
//| Pile::Pile() |
//+-------------------------------------------------------------+
//| Description: |
//| Initialise the pile to be empty of cards. |
//+-------------------------------------------------------------+
Pile::Pile(int x, int y, int dx, int dy)
{
m_x = x;
m_y = y;
m_dx = dx;
m_dy = dy;
for (m_topCard = 0; m_topCard < NumCards; m_topCard++)
{
m_cards[m_topCard] = 0;
}
m_topCard = -1; // i.e. empty
}
//+-------------------------------------------------------------+
//| Pile::Redraw() |
//+-------------------------------------------------------------+
//| Description: |
//| Redraw the pile on the screen. If the pile is empty |
//| just draw a null card as a place holder for the pile. |
//| Otherwise draw the pile from the bottom up, starting |
//| at the origin of the pile, shifting each subsequent |
//| card by the pile's x and y offsets. |
//+-------------------------------------------------------------+
void Pile::Redraw(wxDC& dc )
{
FortyFrame *frame = (FortyFrame*) wxTheApp->GetTopWindow();
wxWindow *canvas = nullptr;
if (frame)
{
canvas = frame->GetCanvas();
}
if (m_topCard >= 0)
{
if (m_dx == 0 && m_dy == 0)
{
if ((canvas) && (canvas->IsExposed(m_x,m_y,(int)(Card::GetScale()*60),(int)(Card::GetScale()*200))))
m_cards[m_topCard]->Draw(dc, m_x, m_y);
}
else
{
int x = m_x;
int y = m_y;
for (int i = 0; i <= m_topCard; i++)
{
if ((canvas) && (canvas->IsExposed(x,y,(int)(Card::GetScale()*60),(int)(Card::GetScale()*200))))
m_cards[i]->Draw(dc, x, y);
x += (int)Card::GetScale()*m_dx;
y += (int)Card::GetScale()*m_dy;
}
}
}
else
{
if ((canvas) && (canvas->IsExposed(m_x,m_y,(int)(Card::GetScale()*60),(int)(Card::GetScale()*200))))
Card::DrawNullCard(dc, m_x, m_y);
}
}
//+-------------------------------------------------------------+
//| Pile::GetTopCard() |
//+-------------------------------------------------------------+
//| Description: |
//| Return a pointer to the top card in the pile or nullptr |
//| if the pile is empty. |
//| NB: Gets a copy of the card without removing it from the |
//| pile. |
//+-------------------------------------------------------------+
Card* Pile::GetTopCard()
{
Card* card = 0;
if (m_topCard >= 0)
{
card = m_cards[m_topCard];
}
return card;
}
//+-------------------------------------------------------------+
//| Pile::RemoveTopCard() |
//+-------------------------------------------------------------+
//| Description: |
//| If the pile is not empty, remove the top card from the |
//| pile and return the pointer to the removed card. |
//| If the pile is empty return a null pointer. |
//+-------------------------------------------------------------+
Card* Pile::RemoveTopCard()
{
Card* card = 0;
if (m_topCard >= 0)
{
card = m_cards[m_topCard--];
}
return card;
}
//+-------------------------------------------------------------+
//| Pile::RemoveTopCard() |
//+-------------------------------------------------------------+
//| Description: |
//| As RemoveTopCard() but also redraw the top of the pile |
//| after the card has been removed. |
//| NB: the offset allows for the redrawn area to be in a |
//| bitmap ready for 'dragging' cards acrosss the screen. |
//+-------------------------------------------------------------+
Card* Pile::RemoveTopCard(wxDC& dc, int xOffset, int yOffset)
{
int topX, topY;
GetTopCardPos(topX, topY);
Card* card = RemoveTopCard();
if (card)
{
int x, y;
card->Erase(dc, topX - xOffset, topY - yOffset);
GetTopCardPos(x, y);
if (m_topCard < 0)
{
Card::DrawNullCard(dc, x - xOffset, y - yOffset);
}
else
{
m_cards[m_topCard]->Draw(dc, x - xOffset, y - yOffset);
}
}
return card;
}
void Pile::GetTopCardPos(int& x, int& y)
{
if (m_topCard < 0)
{
x = m_x;
y = m_y;
}
else
{
x = m_x + (int)Card::GetScale()*m_dx * m_topCard;
y = m_y + (int)Card::GetScale()*m_dy * m_topCard;
}
}
void Pile::AddCard(Card* card)
{
if (m_topCard < -1) m_topCard = -1;
m_cards[++m_topCard] = card;
}
void Pile::AddCard(wxDC& dc, Card* card)
{
AddCard(card);
int x, y;
GetTopCardPos(x, y);
card->Draw(dc, x, y);
}
// Can the card leave this pile.
// If it is a member of the pile then the answer is yes.
// Derived classes may override this behaviour to incorporate
// the rules of the game
bool Pile::CanCardLeave(Card* card)
{
for (int i = 0; i <= m_topCard; i++)
{
if (card == m_cards[i]) return true;
}
return false;
}
// Calculate how far x, y is from top card in the pile
// Returns the square of the distance
int Pile::CalcDistance(int x, int y)
{
int cx, cy;
GetTopCardPos(cx, cy);
return ((cx - x) * (cx - x) + (cy - y) * (cy - y));
}
// Return the card at x, y. Check the top card first, then
// work down the pile. If a card is found then return a pointer
// to the card, otherwise return nullptr
Card* Pile::GetCard(int x, int y)
{
int cardX;
int cardY;
GetTopCardPos(cardX, cardY);
for (int i = m_topCard; i >= 0; i--)
{
if (x >= cardX && x <= cardX + Card::GetWidth() &&
y >= cardY && y <= cardY + Card::GetHeight())
{
return m_cards[i];
}
cardX -= (int)Card::GetScale()*m_dx;
cardY -= (int)Card::GetScale()*m_dy;
}
return 0;
}
// Return the position of the given card. If it is not a member of this pile
// return the origin of the pile.
void Pile::GetCardPos(Card* card, int& x, int& y)
{
x = m_x;
y = m_y;
for (int i = 0; i <= m_topCard; i++)
{
if (card == m_cards[i])
{
return;
}
x += (int)Card::GetScale()*m_dx;
y += (int)Card::GetScale()*m_dy;
}
// card not found in pile, return origin of pile
x = m_x;
y = m_y;
}
bool Pile::Overlap(int x, int y)
{
int cardX;
int cardY;
GetTopCardPos(cardX, cardY);
if (x >= cardX - Card::GetWidth() && x <= cardX + Card::GetWidth() &&
y >= cardY - Card::GetHeight() && y <= cardY + Card::GetHeight())
{
return true;
}
return false;
}

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pile.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
//+-------------------------------------------------------------+
//| Description: |
//| The base class for holding piles of playing cards. |
//| This is the basic building block for card games. A pile |
//| has a position on the screen and an offset for each |
//| card placed on it e.g. a pack has no offset, but the |
//| discard pile may be fanned out across the screen. |
//| |
//| The pile knows how to draw itself, though this may be |
//| overridden if the default layout needs to be changed. |
//| One or more cards can be removed from the top of a pile, |
//| and single cards can be added to the top of a pile. |
//| Functions are provided which redraw the screen when |
//| cards are added or removed. |
//| |
//| Cards know which way up they are and how to draw |
//| themselves. Piles are lists of cards. Piles know which |
//| cards they contain and where they are to be drawn. |
//+-------------------------------------------------------------+
#ifndef _PILE_H_
#define _PILE_H_
#include "card.h"
const int NumCards = 2 * PackSize;
//----------------------------------------------------------------//
// A class defining a pile of cards with a position on the screen //
//----------------------------------------------------------------//
class Pile {
public:
Pile(int x, int y, int dx = 0, int dy = 0);
virtual ~Pile(){}
// General functions
virtual void ResetPile() { m_topCard = -1; }
virtual void Redraw(wxDC& pDC);
// Card query functions
virtual Card* GetCard(int x, int y); // Get pointer to card at x, y
Card* GetTopCard(); // Get pointer to top card
virtual void GetCardPos(Card* card, int& x, int& y);
// Get position of a card
virtual void GetTopCardPos(int& x, int& y);
// Get position of the top card
int GetNumCards() { return m_topCard + 1; } // Number of cards in pile
bool Overlap(int x, int y); // does card at x,y overlap the pile?
int CalcDistance(int x, int y); // calculates the square of the distance
// of a card at (x,y) from the top of the pile
// Functions removing one or more cards from the top of a pile
virtual bool CanCardLeave(Card* card);
Card* RemoveTopCard();
virtual Card* RemoveTopCard(wxDC& pDC, int xOffset = 0, int yOffset = 0);
// Functions to add a card to the top of a pile
virtual bool AcceptCard(Card*) { return false; }
virtual void AddCard(Card* card); // Add card to top of pile
virtual void AddCard(wxDC& pDC, Card* card); // Add card + redraw it
void SetPos(int x,int y) {m_x = x;m_y = y;}
protected:
int m_x, m_y; // Position of the pile on the screen
int m_dx, m_dy; // Offset when drawing the pile
Card* m_cards[NumCards]; // Array of cards in this pile
int m_topCard; // Array index of the top card
};
#endif // _PILE_H_

View File

@@ -0,0 +1,133 @@
/////////////////////////////////////////////////////////////////////////////
// Name: playerdg.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "scorefil.h"
#include "playerdg.h"
const int ID_LISTBOX = 101;
wxBEGIN_EVENT_TABLE(PlayerSelectionDialog, wxDialog)
EVT_SIZE(PlayerSelectionDialog::OnSize)
EVT_BUTTON(wxID_OK, PlayerSelectionDialog::ButtonCallback)
EVT_BUTTON(wxID_CANCEL, PlayerSelectionDialog::ButtonCallback)
EVT_LISTBOX(ID_LISTBOX, PlayerSelectionDialog::SelectCallback)
EVT_CLOSE(PlayerSelectionDialog::OnCloseWindow)
wxEND_EVENT_TABLE()
PlayerSelectionDialog::PlayerSelectionDialog(
wxWindow* parent,
ScoreFile* file
) :
wxDialog(parent, wxID_ANY, wxT("Player Selection"), wxDefaultPosition),
m_scoreFile(file)
{
wxStaticText* msg = new wxStaticText(this, wxID_ANY, wxT("Please select a name or type a new one:"));
wxListBox* list = new wxListBox(
this, ID_LISTBOX,
wxDefaultPosition, wxSize(-1, 150),
0, 0,
wxLB_SINGLE
);
wxArrayString players;
m_scoreFile->GetPlayerList(players);
for (unsigned int i = 0; i < players.Count(); i++)
{
list->Append(players[i]);
}
m_textField = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize);
m_OK = new wxButton(this, wxID_OK);
m_cancel = new wxButton(this, wxID_CANCEL);
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( m_OK, 0, wxALL, 10 );
button_sizer->Add( m_cancel, 0, wxALL, 10 );
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( msg, 0, wxALL , 10 );
topsizer->Add( list, 1, wxEXPAND | wxLEFT | wxRIGHT, 10 );
topsizer->Add( m_textField, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 10 );
topsizer->Add( button_sizer, 0, wxALIGN_LEFT );
SetSizer( topsizer );
topsizer->SetSizeHints( this );
CentreOnParent();
m_OK->SetDefault();
}
void PlayerSelectionDialog::OnSize(wxSizeEvent& WXUNUSED(event))
{
Layout();
}
const wxString& PlayerSelectionDialog::GetPlayersName()
{
/*
m_player = wxEmptyString;
Show(true);
*/
return m_player;
}
void PlayerSelectionDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
m_player = wxEmptyString;
EndModal(wxID_CANCEL);
}
void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event)
{
if (event.GetEventType() == wxEVT_LISTBOX)
{
// if (event.IsSelection())
m_textField->SetValue(event.GetString());
}
}
void PlayerSelectionDialog::ButtonCallback(wxCommandEvent& event)
{
if (event.GetId() == wxID_OK)
{
wxString name = m_textField->GetValue();
if ( !name.empty() )
{
if (name.Contains(wxT('@')))
{
wxMessageBox(wxT("Names should not contain the '@' character"), wxT("Forty Thieves"));
}
else
{
m_player = name;
EndModal(wxID_OK);
}
}
else
{
wxMessageBox(wxT("Please enter your name"), wxT("Forty Thieves"));
}
}
else
{
m_player = wxEmptyString;
EndModal(wxID_CANCEL);
}
}

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
// Name: playerdg.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
#ifndef _PLAYERDG_H_
#define _PLAYERDG_H_
class PlayerSelectionDialog : public wxDialog
{
public:
PlayerSelectionDialog(wxWindow* parent, ScoreFile* file);
virtual ~PlayerSelectionDialog(){}
const wxString& GetPlayersName();
void ButtonCallback(wxCommandEvent& event);
void SelectCallback(wxCommandEvent& event);
void OnSize(wxSizeEvent& event);
wxDECLARE_EVENT_TABLE();
protected:
friend void SelectCallback(wxListBox&, wxCommandEvent&);
void OnCloseWindow(wxCloseEvent& event);
private:
ScoreFile* m_scoreFile;
wxString m_player;
wxButton* m_OK;
wxButton* m_cancel;
wxTextCtrl* m_textField;
};
#endif

View File

@@ -0,0 +1,86 @@
Forty Thieves is a patience game played with two full packs of
cards. At the start of the game forty cards are dealt on the
eight 'bases' along the top of the window. The object of the
game is to place all the cards onto the eight 'foundations'. The
foundations are built starting with the ace and adding cards of
the same suit up to the king. Cards are dealt from the pack and
placed on the discard pile. Cards may be moved from the discard
pile or one of the bases to a base or a foundation. Only one
card can be moved at a time. Cards can only be placed on a base
if the top card of the base is of the same suit and is one
higher in pip value or the base is empty e.g. the eight of
spades can only be placed on top of the nine of spades.
When the mouse cursor is over a card which can be moved it
changes to the 'hand' cursor. The card can then be moved by
double clicking the left button.
The mouse cursor also changes to a hand when a card is dragged
by placing the cursor over the card and holding down the left
button. This feature can be enabled and disabled by selecting
the 'Helping hand' option from the Edit menu.
The 'foundations' are the eight piles of cards down the left
side of the window. When the game starts these piles are empty.
The object of the game is to place all the cards on the
foundations. An ace can be placed on any empty foundation. Other
cards can only be placed on a foundation if the top card is of
the same suit and is one lower in pip value e.g. the three of
clubs can be placed on the four of clubs.
The 'bases' are the ten piles of cards along the top of the
window. At the start of the game four cards are dealt face up on
each of the bases. A card can be added to a base if the base is
empty or if the top card is of the same suit and is one higher
in pip value e.g. the queen of hearts can be placed on the king
of hearts The top card of a base can be moved onto another base
or a foundation.
Cards can be only moved one at a time. The top card of the pack
can be dealt onto discard pile by placing the mouse cursor over
the pack and pressing the left button. The number of cards
remaining is displayed to the right of the pack.
Cards can be moved from the discard pile or the bases either by
'double-clicking' or by dragging. If the left button is
double-clicked when the mouse cursor is over a card and it can
move to another pile, it will do so. This is a quick way of
moving cards when their destination is unambiguous.
A card can be dragged by placing the mouse cursor over the card
and holding down the left button. The card will follow the mouse
cursor until the left button is released. If the card is over a
pile on which it can be placed it will be added to that pile,
otherwise it will be returned to the pile from which it was
dragged.
One point is scored for every card that is placed on a
foundation. Since there are two packs of 52 cards the maximum
score is 104. A record is kept of the number of games played,
the number of games won, the current score and the average
score. This information is displayed at bottom right of the
window and is stored on disk between games. A game is deemed to
have started if the cards have been dealt and any card has been
moved. If the game is abandoned before it is finished (i.e. by
starting a new game or closing window) it counts as a lost game.
New players can be added by selecting the 'Player' option from
the Game menu. A summary of players' scores can be displayed by
selecting the 'Scores...' option from the Game menu.
All moves are recorded and can be undone. To undo a move select
the undo menu item from the Edit menu. A quicker way of undoing
is to press the right mouse button (it doesn't matter where the
mouse cursor is). Right button undo can be enabled and disabled
by selecting the 'Right button undo' option from the Edit menu.
Pressing the right mouse button with the control key pressed
re-does a previously undone move.
An empty base or two is very useful as it gives the opportunity
to unscramble other bases. Try not to build onto kings which
obscure valuable cards as it will be difficult to get to them
later. The undo facility is very useful for going back and using
'hindsight'.
Don't be put off if you can't win every game. I reckon winning 1
in 10 is pretty good (winning 1 in 3 is excellent).

View File

@@ -0,0 +1,202 @@
/////////////////////////////////////////////////////////////////////////////
// Name: scoredg.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "scorefil.h"
#include "scoredg.h"
// adjust USE_GRID_FOR_SCORE with O or 1 to your preferences
// by default it takes wxGrid component for score display if available in target port
#define USE_GRID_FOR_SCORE wxUSE_GRID
#if USE_GRID_FOR_SCORE
#include "wx/grid.h"
#else
class ScoreCanvas : public wxScrolledWindow
{
public:
ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size);
virtual ~ScoreCanvas();
void OnDraw(wxDC& dc);
private:
wxFont *m_font;
wxString m_text;
};
ScoreCanvas::ScoreCanvas(wxWindow* parent, ScoreFile* scoreFile, const wxPoint& pos, wxSize& size) :
wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER)
{
SetBackgroundColour(*wxWHITE);
#ifdef __WXGTK__
m_font = wxTheFontList->FindOrCreateFont(wxFontInfo(12).Family(wxFONTFAMILY_ROMAN));
#else
m_font = wxTheFontList->FindOrCreateFont(wxFontInfo(10).Family(wxFONTFAMILY_SWISS));
#endif
wxArrayString players;
scoreFile->GetPlayerList( players);
wxString os;
os << wxT("Player\tWins\tGames\tScore\n");
for (unsigned int i = 0; i < players.Count(); i++)
{
int wins, games, score;
scoreFile->ReadPlayersScore(players[i], wins, games, score);
int average = 0;
if (games > 0)
{
average = (2 * score + games) / (2 * games);
}
os << players[i] << wxT('\t')
<< wins << wxT('\t')
<< games << wxT('\t')
<< average << wxT('\n');
}
os << wxT('\0');
m_text = os;
}
ScoreCanvas::~ScoreCanvas()
{
}
void ScoreCanvas::OnDraw(wxDC& dc)
{
dc.SetFont(* m_font);
const wxChar* str = m_text.c_str();
unsigned int tab = 0;
unsigned int tabstops[] = { 5, 100, 150, 200 };
// get the line spacing for the current font
int lineSpacing;
{
wxCoord w, h;
dc.GetTextExtent(wxT("Testing"), &w, &h);
lineSpacing = (int)h;
}
int y = 0;
while (*str)
{
wxChar text[256];
wxChar* dest = text;
while (*str && *str >= ' ') *dest++ = *str++;
*dest = '\0';
dc.DrawText(text, FromDIP(tabstops[tab]), y);
if (*str == '\t')
{
if (tab < sizeof(tabstops) / sizeof(tabstops[0]) - 1)
{
tab++;
}
}
else if (*str == '\n')
{
tab = 0;
y += lineSpacing;
}
if (*str) str++;
}
}
#endif
wxBEGIN_EVENT_TABLE(ScoreDialog, wxDialog)
EVT_CLOSE(ScoreDialog::OnCloseWindow)
wxEND_EVENT_TABLE()
ScoreDialog::ScoreDialog(wxWindow* parent, ScoreFile* file) :
wxDialog(parent, wxID_ANY, _("Scores"),
wxDefaultPosition, wxSize(400, 300))
{
// create grid with players
wxArrayString players;
file->GetPlayerList(players);
wxSize sz = wxSize(400, 300);
#if USE_GRID_FOR_SCORE
wxGrid* list = new wxGrid(this, wxID_ANY, wxDefaultPosition, sz, 0);
list->CreateGrid(players.Count(), 4);
for (unsigned int i = 0; i < players.Count(); i++)
{
int wins, games, score;
wxString string_value;
file->ReadPlayersScore(players[i], wins, games, score);
int average = 0;
if (games > 0)
{
average = (2 * score + games) / (2 * games);
}
list->SetCellValue(i,0,players[i]);
string_value.Printf( wxT("%u"), wins );
list->SetCellValue(i,1,string_value);
string_value.Printf( wxT("%u"), games );
list->SetCellValue(i,2,string_value);
string_value.Printf( wxT("%u"), average );
list->SetCellValue(i,3,string_value);
}
list->SetColLabelValue(0, wxT("Players"));
list->SetColLabelValue(1, wxT("Wins"));
list->SetColLabelValue(2, wxT("Games"));
list->SetColLabelValue(3, wxT("Score"));
list->EnableEditing(false);
list->AutoSizeColumns();
list->AutoSizeRows();
list->SetRowLabelSize(0);
list->EnableDragRowSize(false);
list->EnableDragColSize(false);
list->EnableDragGridSize(false);
list->ClearSelection();
list->EnableEditing(false);
sz.x = wxDefaultCoord;
#else
ScoreCanvas* list = new ScoreCanvas(this, file, wxDefaultPosition, sz);
#endif
list->SetInitialSize(sz);
// locate and resize with sizers
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( list, 1, wxALL|wxGROW, 10 );
wxButton *button = new wxButton(this, wxID_OK);
topsizer->Add( button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL , 10 );
button->SetFocus();
SetSizer( topsizer );
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
CentreOnParent();
}
void ScoreDialog::Display()
{
ShowModal();
}
void ScoreDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
EndModal(wxID_OK);
}

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: scoredg.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
#ifndef _SCOREDG_H_
#define _SCOREDG_H_
class ScoreDialog : public wxDialog
{
public:
ScoreDialog(wxWindow* parent, ScoreFile* file);
virtual ~ScoreDialog(){}
void Display();
protected:
void OnCloseWindow(wxCloseEvent& event);
private:
wxDECLARE_EVENT_TABLE();
};
#endif

View File

@@ -0,0 +1,132 @@
/////////////////////////////////////////////////////////////////////////////
// Name: scorefil.cpp
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/textfile.h"
#include "wx/config.h"
#include "wx/fileconf.h"
#include "scorefil.h"
ScoreFile::ScoreFile(const wxString& appName)
{
m_config = new wxConfig(appName, wxT("wxWidgets"), appName, wxEmptyString,
wxCONFIG_USE_LOCAL_FILE); // only local
}
ScoreFile::~ScoreFile()
{
delete m_config;
}
void ScoreFile::GetPlayerList( wxArrayString &list )
{
m_config->SetPath(wxT("/Players"));
int length = m_config->GetNumberOfGroups();
if (length <= 0) return;
wxString player;
long index;
if (m_config->GetFirstGroup(player, index))
{
list.Add( player );
while (m_config->GetNextGroup(player, index))
{
list.Add( player );
}
}
}
// Calculate an encrypted check number to prevent tampering with
// score file
long ScoreFile::CalcCheck(const wxString& name, int p1, int p2, int p3)
{
long check = 0;
size_t i, max = name.length();
for(i = 0; i < max; ++i )
{
check = (check << 1) ^ (long)name[i];
check = ((check >> 23) ^ check) & 0xFFFFFF;
}
check = (check << 1) ^ (long)p1;
check = ((check >> 23) ^ check) & 0xFFFFFF;
check = (check << 1) ^ (long)p2;
check = ((check >> 23) ^ check) & 0xFFFFFF;
check = (check << 1) ^ (long)p3;
check = ((check >> 23) ^ check) & 0xFFFFFF;
return check;
}
wxString ScoreFile::GetPreviousPlayer() const
{
wxString result;
m_config->SetPath(wxT("/General"));
m_config->Read(wxT("LastPlayer"), &result);
return result;
}
void ScoreFile::ReadPlayersScore(
const wxString& player,
int& wins,
int& games,
int& score)
{
long check = 0;
long myWins = 0, myGames = 0, myScore = 0;
games = wins = score = 0;
m_config->SetPath(wxT("/Players"));
m_config->SetPath(player);
if (m_config->Read(wxT("Score"), &myScore, 0L) &&
m_config->Read(wxT("Games"), &myGames, 0L) &&
m_config->Read(wxT("Wins"), &myWins, 0L) &&
m_config->Read(wxT("Check"), &check, 0L))
{
if (check != CalcCheck(player, myGames, myWins, myScore))
{
wxMessageBox(wxT("Score file corrupted"), wxT("Warning"),
wxOK | wxICON_EXCLAMATION);
}
else
{
games = myGames;
wins = myWins;
score = myScore;
}
}
WritePlayersScore(player, wins, games, score);
}
void ScoreFile::WritePlayersScore(const wxString& player, int wins, int games, int score)
{
if (!player.empty())
{
m_config->SetPath(wxT("/General"));
m_config->Write(wxT("LastPlayer"), wxString(player)); // Without wxString tmp, thinks it's bool in VC++
m_config->SetPath(wxT("/Players"));
m_config->SetPath(player);
m_config->Write(wxT("Score"), (long)score);
m_config->Write(wxT("Games"), (long)games);
m_config->Write(wxT("Wins"), (long)wins);
m_config->Write(wxT("Check"), CalcCheck(player, games, wins, score));
}
}

View File

@@ -0,0 +1,33 @@
/////////////////////////////////////////////////////////////////////////////
// Name: scorefil.h
// Purpose: Forty Thieves patience game
// Author: Chris Breeze
// Created: 21/07/97
// Copyright: (c) 1993-1998 Chris Breeze
// Licence: wxWindows licence
//---------------------------------------------------------------------------
// Last modified: 22nd July 1998 - ported to wxWidgets 2.0
/////////////////////////////////////////////////////////////////////////////
#ifndef _SCOREFILE_H_
#define _SCOREFILE_H_
#include <wx/config.h>
class ScoreFile {
public:
ScoreFile(const wxString& appName);
virtual ~ScoreFile();
void GetPlayerList( wxArrayString &list );
wxString GetPreviousPlayer() const;
void ReadPlayersScore(const wxString& player, int& wins, int& games, int &score);
void WritePlayersScore(const wxString& player, int wins, int games, int score);
private:
long CalcCheck(const wxString& name, int p1, int p2, int p3);
wxString m_configFilename;
wxConfig* m_config;
};
#endif

View File

@@ -0,0 +1,93 @@
/* XPM */
static const char *const symbols_xpm[] = {
/* width height num_colors chars_per_pixel */
" 117 70 16 1",
/* colors */
"` c #ffffff",
". c #ff0000",
"# c #000000",
"a c #b40000",
"b c #000000",
"c c #000000",
"d c #000000",
"e c #000000",
"f c #000000",
"g c #000000",
"h c #000000",
"i c #000000",
"j c #000000",
"k c #000000",
"l c #000000",
"m c #000000",
/* pixels */
"```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````",
"``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````",
"`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````",
"#######..............#######`````````````````````````````````````````````````````````````````````````````````````````",
"`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````",
"```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````",
"``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````",
"``###`````.``````.`````###```````````````````````````````````````````````````````````````````````````````````````````",
"```#`````...````...`````#````````````````````````````````````````````````````````````````````````````````````````````",
"`#`#`#``.....``.....``#####``````````````````````````````````````````````````````````````````````````````````````````",
"#######..............#######`````````````````````````````````````````````````````````````````````````````````````````",
"`#`#`#``.....`.......`#####``````````````````````````````````````````````````````````````````````````````````````````",
"``###````...``.......``###```````````````````````````````````````````````````````````````````````````````````````````",
"```#``````.````..`..````#````````````````````````````````````````````````````````````````````````````````````````````",
"````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````",
"```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````",
"```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````",
"````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````",
"`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````",
"####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````",
"###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````",
"####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````",
"`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````",
"````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````",
"``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````",
"``#######```````.``````````.```````#######```````````````````````````````````````````````````````````````````````````",
"````###````````...````````...````````###`````````````````````````````````````````````````````````````````````````````",
"`##``#``##`````...```````.....````##``#``##``````````````````````````````````````````````````````````````````````````",
"####`#`####```.....`````.......``####`#`####`````````````````````````````````````````````````````````````````````````",
"###########``.......```.........`###########`````````````````````````````````````````````````````````````````````````",
"####`#`####`.........`...........###########`````````````````````````````````````````````````````````````````````````",
"`##``#``##```.......``...........`#########``````````````````````````````````````````````````````````````````````````",
"````###```````.....```...........``#######```````````````````````````````````````````````````````````````````````````",
"```#####```````...````...........```#####````````````````````````````````````````````````````````````````````````````",
"```#####```````...`````....`....`````###`````````````````````````````````````````````````````````````````````````````",
"````###`````````.```````..```..```````#``````````````````````````````````````````````````````````````````````````````",
"``##````###``#####````#``#####``###``#####``###```###`#``##``#####``###``#```#```````````````````````````````````````",
"`#``#``#```#````#````##``#`````#`````````#`#```#`#```##`#``#````#``#```#`#``#````````````````````````````````````````",
"#````#`````#```#````#`#``####``#````````#``#```#`#```##`#``#````#``#```#`#`#`````````````````````````````````````````",
"#````#```##```###``#``#``````#`####````#````###```#####`#``#````#``#```#`##``````````````````````````````````````````",
"######``#````````#`#####`````#`#```#```#```#```#`````##`#``#````#``#`#`#`#`#`````````````````````````````````````````",
"#````#`#`````#```#````#``#```#`#```#```#```#```#````#`#`#``#`#``#``#``#``#``#````````````````````````````````````````",
"#````#`#####``###`````#```###```###````#````###````#``#``##```##````##`#`#```#```````````````````````````````````````",
"#````#`#####``###```#`````###```###````#````###````#```##``#```##``#`##``#```#```````````````````````````````````````",
"#````#`````#`#```#``#````#```#`#```#```#```#```#``#```#``#`#``#``#``#``#``#``#```````````````````````````````````````",
"######````#``#`````#####`#`````#```#```#```#```#`#````#``#`#``#````#`#`#```#`#```````````````````````````````````````",
"#````#``##````###```#``#`#`````#####```#````###``####`#``#`#``#````#```#````##```````````````````````````````````````",
"#````#`#```````#````#`#```####`````#``#````#```#`#```##``#`#``#````#```#```#`#```````````````````````````````````````",
"`#``#``#```#``#`````##```````#`````#`#`````#```#`#```##``#`#``#````#```#``#``#```````````````````````````````````````",
"``##````###``#####``#````#####``###``#####``###```###``##``#`#####``###``#```#```````````````````````````````````````",
"```##``````#####```#######``````##```#######````####```#######```#####````#####``##``###```#######```#####```##````#`",
"``####````#######``######``````###```#######```#####```#######``#######``#######`##`#####``#######``#######``##```##`",
"`######```##```##`````##``````####```##```````###``````````###``##```##``##```##`##`##`##``````##```##```##``##``###`",
"###``###``````###````##``````#####```######```##``````````###```###`###``##```##`##`##`##``````##```##```##``##`###``",
"##````##````####````####````###`##```#######``######`````###`````#####```#######`##`##`##``````##```##```##``#####```",
"########```####`````#####```##``##````````##``#######````##``````#####````######`##`##`##``````##```##```##``####````",
"########``###``````````###``#######```````##``##```##````##`````###`###``````###`##`##`##``````##```####`##``#####```",
"##````##``##```````##```##``#######``##```##``##```##````##`````##```##`````###``##`##`##``##``##```##`####``##`###``",
"##````##``#######``#######``````##```#######``#######````##`````#######````###```##`#####``######```######```##``###`",
"##````##``#######```#####```````##````#####````#####`````##``````#####````###````##``###````####`````######``##```##`",
"`##````##`#######```#####````##```````#####````#####``````##`````#####``````###````###``##```####```######```##```##`",
"`##````##`#######``#######```##``````#######``#######`````##````#######````###````#####`##``######```######``###``##`",
"`##````##``````##``##```##``#######``##```##``##```##`````##````##```##```###`````##`##`##``##``##``####`##```###`##`",
"`########`````###``###``````#######``##```````##```##`````##````###`###``###``````##`##`##``##``````##`####````#####`",
"`########```####````#####````##``##``##```````#######`````##`````#####```######```##`##`##``##``````##```##`````####`",
"`##````##``####``````####````##`###``#######```######````###`````#####```#######``##`##`##``##``````##```##````#####`",
"`###``###`###`````````##`````#####````######```````##```###`````###`###``##```##``##`##`##``##``````##```##```###`##`",
"``######``##```##````##``````####`````````##``````###``###``````##```##``##```##``##`##`##``##``````##```##``###``##`",
"```####```#######```######```###`````#######```#####```#######``#######``#######``#####`##`#######``#######``##```##`",
"````##`````#####```#######```##``````#######```####````#######```#####````#####````###``##`#######```#####```#````##`"
};

View File

@@ -0,0 +1,200 @@
# =========================================================================
# 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
FRACTAL_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)
FRACTAL_OBJECTS = \
fractal_fractal.o \
$(__fractal___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___fractal___os2_emxbindcmd = $(NM) fractal$(EXEEXT) | if \
grep -q pmwin.763 ; then emxbind -ep fractal$(EXEEXT) ; fi
@COND_PLATFORM_OS2_1@__fractal___os2_emxbindcmd = $(COND_PLATFORM_OS2_1___fractal___os2_emxbindcmd)
@COND_TOOLKIT_MSW@__RCDEFDIR_p = --include-dir \
@COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME)
@COND_PLATFORM_MACOSX_1@__fractal_app_Contents_PkgInfo___depname \
@COND_PLATFORM_MACOSX_1@ = fractal.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@__fractal_bundle___depname = fractal_bundle
@COND_TOOLKIT_MAC@____fractal_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_MAC@ $(__fractal_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_CARBON@____fractal_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_CARBON@ = $(__fractal_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_COCOA@____fractal_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_COCOA@ = $(__fractal_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_OSX_IPHONE@____fractal_BUNDLE_TGT_REF_DEP \
@COND_TOOLKIT_OSX_IPHONE@ = $(__fractal_app_Contents_PkgInfo___depname)
@COND_TOOLKIT_COCOA@____fractal_BUNDLE_TGT_REF_DEP = \
@COND_TOOLKIT_COCOA@ $(__fractal_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@__fractal___win32rc = fractal_fractal_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: fractal$(EXEEXT) $(__fractal_bundle___depname)
install:
uninstall:
install-strip: install
clean:
rm -rf ./.deps ./.pch
rm -f ./*.o
rm -f fractal$(EXEEXT)
rm -rf fractal.app
distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
fractal$(EXEEXT): $(FRACTAL_OBJECTS) $(__fractal___win32rc)
$(CXX) -o $@ $(FRACTAL_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)
$(__fractal___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@fractal.app/Contents/PkgInfo: fractal$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@COND_PLATFORM_MACOSX_1@ mkdir -p fractal.app/Contents
@COND_PLATFORM_MACOSX_1@ mkdir -p fractal.app/Contents/MacOS
@COND_PLATFORM_MACOSX_1@ mkdir -p fractal.app/Contents/Resources
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ sed -e "s/\$${MACOSX_BUNDLE_GUI_IDENTIFIER}/org.wxwidgets.fractal/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_EXECUTABLE_NAME}/fractal/" \
@COND_PLATFORM_MACOSX_1@ -e "s/\$${MACOSX_BUNDLE_BUNDLE_NAME}/fractal/" \
@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}/fractal 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 >fractal.app/Contents/Info.plist
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ /bin/echo "APPL????" >fractal.app/Contents/PkgInfo
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ ln -f fractal$(EXEEXT) fractal.app/Contents/MacOS/fractal
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@
@COND_PLATFORM_MACOSX_1@ cp -f $(top_srcdir)/src/osx/carbon/wxmac.icns fractal.app/Contents/Resources/wxmac.icns
@COND_PLATFORM_MACOSX_1@fractal_bundle: $(____fractal_BUNDLE_TGT_REF_DEP)
fractal_fractal.o: $(srcdir)/fractal.cpp
$(CXXC) -c -o $@ $(FRACTAL_CXXFLAGS) $(srcdir)/fractal.cpp
fractal_fractal_rc.o: $(srcdir)/fractal.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 fractal_bundle

View File

@@ -0,0 +1,49 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 3 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) fractal.exe
.else
.ifdef __WXGTK__
$(MMS)$(MMSQUALIFIERS) fractal_gtk.exe
.endif
.endif
OBJS=fractal.obj
.ifdef __WXMOTIF__
fractal.exe : $(OBJS)
cxxlink/exec=fractal.exe $(OBJS),[--.lib]vms/opt
.else
.ifdef __WXGTK__
fractal_gtk.exe : $(OBJS)
cxxlink/exec=fractal_gtk.exe $(OBJS),[--.lib]vms_gtk/opt
.endif
.endif
fractal.obj : fractal.cpp

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" ?>
<makefile>
<include file="../../build/bakefiles/common_samples.bkl"/>
<exe id="fractal" template="wx_sample" template_append="wx_append">
<sources>
fractal.cpp
</sources>
<wx-lib>core</wx-lib>
<wx-lib>base</wx-lib>
<win32-res>fractal.rc</win32-res>
</exe>
</makefile>

View File

@@ -0,0 +1,253 @@
///////////////////////////////////////////////////////////////////////////////
// Name: fractal.cpp
// Purpose: demo of wxConfig and related classes
// Author: Andrew Davison
// Created: 05.04.94
// Copyright: (c) 1994 Andrew Davison
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
/*
Date: Tue, 5 Apr 1994 12:01:18 +1000
From: Andrew Davison <andrewd@au.com.sfe>
To: wxwin-users@ed.aiai
Subject: Fractal mountains
Hi,
This is a quick port of a fractal mountain generator originally
done for MS-Windows. On a Sun the colours look a little washed
out and there is not as much snow or high mountains (maybe the
random number generators fault). The viewing plane is not
quite right as the original code used SetViewportOrg() which there
doesn't seem to be an equivalent of under wxWidgets, and my quick
hack doesn't fix.
*/
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif //precompiled headers
#include "wx/math.h"
#include "wx/stockitem.h"
#include <stdlib.h>
#include <time.h>
#define Random(x) (rand() % x)
#define Randomize() (srand((unsigned int)time(nullptr)))
static int detail = 9; // CHANGE THIS... 7,8,9 etc
static bool running = false;
static wxMenuBar *menuBar = nullptr;
// Define a new application type
class MyApp: public wxApp
{
public:
bool OnInit() override;
};
wxIMPLEMENT_APP(MyApp);
// Define a new frame type
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size);
void OnCloseWindow(wxCloseEvent& event);
void OnExit(wxCommandEvent& event);
wxDECLARE_EVENT_TABLE();
};
// Define a new canvas which can receive some events
class MyCanvas: public wxWindow
{
public:
MyCanvas(wxFrame *frame);
void Draw(wxDC& dc);
private:
void OnPaint(wxPaintEvent& event);
void Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio);
wxPen SnowPen, MtnPen, GreenPen;
wxBrush WaterBrush;
int Sealevel;
wxDECLARE_EVENT_TABLE();
};
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
// Create the main frame window
MyFrame *frame = new MyFrame(nullptr, wxT("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480));
// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT));
menuBar = new wxMenuBar;
menuBar->Append(file_menu, wxT("&File"));
frame->SetMenuBar(menuBar);
int width, height;
frame->GetClientSize(&width, &height);
(void) new MyCanvas(frame);
// Show the frame
frame->Show(true);
return true;
}
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_CLOSE(MyFrame::OnCloseWindow)
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
wxEND_EVENT_TABLE()
// My frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
wxFrame(frame, wxID_ANY, title, pos, size, wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE )
{
}
// Intercept menu commands
void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
{
this->Destroy();
}
void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
static bool destroyed = false;
if (destroyed)
return;
this->Destroy();
destroyed = true;
}
wxBEGIN_EVENT_TABLE(MyCanvas, wxWindow)
EVT_PAINT(MyCanvas::OnPaint)
wxEND_EVENT_TABLE()
// Define a constructor for my canvas
MyCanvas::MyCanvas(wxFrame *frame):
wxWindow(frame, wxID_ANY)
{
wxColour wxCol1(255,255,255);
SnowPen = wxPen(wxCol1, 2);
wxColour wxCol2(128,0,0);
MtnPen = wxPen(wxCol2);
wxColour wxCol3(0,128,0);
GreenPen = wxPen(wxCol3);
wxColour wxCol4(0,0,128);
WaterBrush = wxBrush(wxCol4);
}
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
PrepareDC(dc);
Draw(dc);
}
void MyCanvas::Draw(wxDC& dc)
{
if (running) return;
running = true;
menuBar->EnableTop(0, false);
Randomize();
dc.SetBackground(*wxLIGHT_GREY_BRUSH);
dc.Clear();
int Left, Top, Right, Bottom;
GetClientSize(&Right, &Bottom);
Right *= 3; Right /= 4;
Bottom *= 3; Bottom /= 4;
Left = 0;
Top = Bottom/8;
wxPoint Water[4];
Water[0].x = Left; Water[0].y = Top;
Water[1].x = Right; Water[1].y = Top;
Water[2].x = Right+Bottom/2; Water[2].y = Bottom;
Water[3].x = Bottom/2; Water[3].y = Bottom;
dc.SetBrush(WaterBrush);
dc.DrawPolygon(4, Water);
double H = 0.75;
double Scale = Bottom;
double Ratio = 1.0 / pow(2.0, H);
double Std = Scale * Ratio;
Sealevel = Random(18) - 8;
Fractal(dc, Left, Top, Right, Bottom, 0, 0, 0, 0, detail, Std, Ratio);
menuBar->EnableTop(0, true);
running = false;
}
void MyCanvas::Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio)
{
int Xmid = (X1 + X2) / 2;
int Ymid = (Y1 + Y2) / 2;
int Z23 = (Z2 + Z3) / 2;
int Z41 = (Z4 + Z1) / 2;
int Newz = (int)((Z1 + Z2 + Z3 + Z4) / 4 + (double)(Random(17) - 8) / 8.0 * Std);
if (--Iteration)
{
int Z12 = (Z1 + Z2) / 2;
int Z34 = (Z3 + Z4) / 2;
double Stdmid = Std * Ratio;
Fractal(dc, Xmid, Y1, X2, Ymid, Z12, Z2, Z23, Newz, Iteration, Stdmid, Ratio);
Fractal(dc, X1, Y1, Xmid, Ymid, Z1, Z12, Newz, Z41, Iteration, Stdmid, Ratio);
Fractal(dc, Xmid, Ymid, X2, Y2, Newz, Z23, Z3, Z34, Iteration, Stdmid, Ratio);
Fractal(dc, X1, Ymid, Xmid, Y2, Z41, Newz, Z34, Z4, Iteration, Stdmid, Ratio);
}
else
{
if (Newz <= Sealevel)
{
wxPoint P[4];
P[0].x = Y1 / 2 + X1; P[0].y = Y1 + Z1;
P[1].x = Y1 / 2 + X2; P[1].y = Y1 + Z2;
P[2].x = Y2 / 2 + X2; P[2].y = Y2 + Z3;
P[3].x = Y2 / 2 + X1; P[3].y = Y2 + Z4;
dc.SetPen(* wxBLACK_PEN);
dc.SetBrush(* wxBLACK_BRUSH);
dc.DrawPolygon(4, P);
if (Z1 >= -(60+Random(25)))
dc.SetPen(GreenPen);
else if (Z1 >= -(100+Random(25)))
dc.SetPen(MtnPen);
else
dc.SetPen(SnowPen);
dc.DrawLine(Ymid/2+X2, Ymid+Z23, Ymid/2+X1, Ymid+Z41);
}
}
}

View File

@@ -0,0 +1,2 @@
#include "wx/msw/wx.rc"

View File

@@ -0,0 +1,228 @@
# =========================================================================
# 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)
FRACTAL_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)
FRACTAL_OBJECTS = \
$(OBJS)\fractal_fractal.o \
$(OBJS)\fractal_fractal_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)\fractal.exe
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
-if exist $(OBJS)\*.d del $(OBJS)\*.d
-if exist $(OBJS)\fractal.exe del $(OBJS)\fractal.exe
$(OBJS)\fractal.exe: $(FRACTAL_OBJECTS) $(OBJS)\fractal_fractal_rc.o
$(foreach f,$(subst \,/,$(FRACTAL_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
$(OBJS)\fractal_fractal.o: ./fractal.cpp
$(CXX) -c -o $@ $(FRACTAL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\fractal_fractal_rc.o: ./fractal.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
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 = fractal
OBJECTS = $(PROGRAM).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,441 @@
# =========================================================================
# 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)
FRACTAL_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
$(__DEBUGINFO_0) /Fd$(OBJS)\fractal.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)
FRACTAL_OBJECTS = \
$(OBJS)\fractal_fractal.obj
FRACTAL_RESOURCES = \
$(OBJS)\fractal_fractal.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)\fractal.exe
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)\fractal.exe del $(OBJS)\fractal.exe
-if exist $(OBJS)\fractal.ilk del $(OBJS)\fractal.ilk
-if exist $(OBJS)\fractal.pdb del $(OBJS)\fractal.pdb
$(OBJS)\fractal.exe: $(FRACTAL_OBJECTS) $(OBJS)\fractal_fractal.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\fractal.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(FRACTAL_OBJECTS) $(FRACTAL_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
<<
$(OBJS)\fractal_fractal.obj: .\fractal.cpp
$(CXX) /c /nologo /TP /Fo$@ $(FRACTAL_CXXFLAGS) .\fractal.cpp
$(OBJS)\fractal_fractal.res: .\fractal.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 .\fractal.rc

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,
".....*.*....................."
"....*..*....................."
"...**........................"
"..*.........................."
".****........................"
"*....*......................."
"*..*........................."
"*..*........................."
".*.........***...***........."
"..****.*..*..*...*..*........"
"...*...*.....*...*..........."
"....*........*...*..........."
"....*.*......*...*..........."
"............................."
"...***.....***...***........."
"...**.......*.....*.........."
"...***......*******.........."
"...........*.......*........."
"....*.*...***********........"
"...*..*..*............**....."
"...*.....************...*...."
"...*...*.............*...*..."
"....*...************.....*..."
".....**............*..*..*..."
"........***********...*.*...."
".........*.......*..........."
"..........*******......***..."
"..........*.....*.......**..."
".........***...***.....***..."
"............................."
"...........*...*......*.*...."
"...........*...*........*...."
"...........*...*.....*...*..."
"........*..*...*..*..*.****.."
".........***...***.........*."
".........................*..*"
".........................*..*"
".......................*....*"
"........................****."
"..........................*.."
"........................**..."
".....................*..*...."
".....................*.*....." )
};

View File

@@ -0,0 +1,73 @@
# =========================================================================
# 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: ###
MAKEARGS = LINK_DLL_FLAGS="$(LINK_DLL_FLAGS)" \
LINK_MODULE_FLAGS="$(LINK_MODULE_FLAGS)" CC="$(CC)" CXX="$(CXX)" \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
LDFLAGS="$(LDFLAGS)" CPP="$(CPP)" SHARED="$(SHARED)" \
TOOLKIT_VERSION="$(TOOLKIT_VERSION)" WXUNIV="$(WXUNIV)" BUILD="$(BUILD)" \
DEBUG_INFO="$(DEBUG_INFO)" DEBUG_FLAG="$(DEBUG_FLAG)" \
MONOLITHIC="$(MONOLITHIC)" USE_GUI="$(USE_GUI)" USE_HTML="$(USE_HTML)" \
USE_WEBVIEW="$(USE_WEBVIEW)" \
USE_WEBVIEW_CHROMIUM="$(USE_WEBVIEW_CHROMIUM)" USE_MEDIA="$(USE_MEDIA)" \
USE_XML="$(USE_XML)" USE_XRC="$(USE_XRC)" USE_AUI="$(USE_AUI)" \
USE_RIBBON="$(USE_RIBBON)" USE_PROPGRID="$(USE_PROPGRID)" \
USE_RICHTEXT="$(USE_RICHTEXT)" USE_STC="$(USE_STC)" \
USE_OPENGL="$(USE_OPENGL)" USE_QA="$(USE_QA)" \
USE_EXCEPTIONS="$(USE_EXCEPTIONS)" USE_RTTI="$(USE_RTTI)" \
USE_DPI_AWARE_MANIFEST="$(USE_DPI_AWARE_MANIFEST)" \
USE_THREADS="$(USE_THREADS)" USE_CAIRO="$(USE_CAIRO)" \
OFFICIAL_BUILD="$(OFFICIAL_BUILD)" VENDOR="$(VENDOR)" \
WX_FLAVOUR="$(WX_FLAVOUR)" WX_LIB_FLAVOUR="$(WX_LIB_FLAVOUR)" CFG="$(CFG)" \
RUNTIME_LIBS="$(RUNTIME_LIBS)" WINDRES="$(WINDRES)"
### Conditionally set variables: ###
### Targets: ###
all: bombs forty fractal life poem
clean:
-if exist .\*.o del .\*.o
-if exist .\*.d del .\*.d
$(MAKE) -C bombs -f makefile.gcc $(MAKEARGS) clean
$(MAKE) -C forty -f makefile.gcc $(MAKEARGS) clean
$(MAKE) -C fractal -f makefile.gcc $(MAKEARGS) clean
$(MAKE) -C life -f makefile.gcc $(MAKEARGS) clean
$(MAKE) -C poem -f makefile.gcc $(MAKEARGS) clean
bombs:
$(MAKE) -C bombs -f makefile.gcc $(MAKEARGS) all
forty:
$(MAKE) -C forty -f makefile.gcc $(MAKEARGS) all
fractal:
$(MAKE) -C fractal -f makefile.gcc $(MAKEARGS) all
life:
$(MAKE) -C life -f makefile.gcc $(MAKEARGS) all
poem:
$(MAKE) -C poem -f makefile.gcc $(MAKEARGS) all
.PHONY: all clean bombs forty fractal life poem
SHELL := $(COMSPEC)
# Dependencies tracking:
-include ./*.d

Some files were not shown because too many files have changed in this diff Show More