--- /dev/null
+<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>
+
+
#include "card.h"
#include "scoredg.h"
+#if wxUSE_HTML
+#include "wx/file.h"
+#include "wx/html/htmlwin.h"
+#endif
+
BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
EVT_MENU(NEW_GAME, FortyFrame::NewGame)
EVT_MENU(EXIT, FortyFrame::Exit)
optionsMenu->Check(LARGE_CARDS, largecards ? TRUE : FALSE);
wxMenu* helpMenu = new wxMenu;
- helpMenu->Append(ABOUT, "&About", "Displays program version information");
+ helpMenu->Append(ABOUT, "&About...", "Displays information about the game");
m_menuBar = new wxMenuBar;
m_menuBar->Append(gameMenu, "&Game");
void
FortyFrame::About(wxCommandEvent&)
{
- wxMessageBox(
- "Forty Thieves\n\n"
- "A freeware program using the wxWindows\n"
- "portable C++ GUI toolkit.\n"
- "http://www.wxwindows.org\n"
- "http://www.freiburg.linux.de/~wxxt\n\n"
- "Author: Chris Breeze (c) 1992-1998\n"
- "email: chris.breeze@iname.com",
- "About Forty Thieves",
- wxOK, this
- );
+#if wxUSE_HTML
+ if (wxFileExists(wxT("about.htm")))
+ {
+ FortyAboutDialog dialog(this, -1, wxT("About Forty Thieves"));
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ }
+ }
+ else
+#endif
+ {
+ wxMessageBox(
+ "Forty Thieves\n\n"
+ "A freeware program using the wxWindows\n"
+ "portable C++ GUI toolkit.\n"
+ "http://www.wxwindows.org\n"
+ "http://www.freiburg.linux.de/~wxxt\n\n"
+ "Author: Chris Breeze (c) 1992-1998\n"
+ "email: chris.breeze@iname.com",
+ "About Forty Thieves",
+ wxOK, this
+ );
+ }
}
void
m_canvas->Refresh();
}
+//----------------------------------------------------------------------------
+// stAboutDialog
+//----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(FortyAboutDialog,wxDialog)
+END_EVENT_TABLE()
+
+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(wxT("about.htm"));
+
+ //if (!wxGetApp().GetMemoryTextResource(wxT("about.htm"), htmlText))
+ {
+// wxSetWorkingDirectory(wxGetApp().GetAppDir());
+// wxString htmlFile(wxGetApp().GetFullAppPath(wxT("about.htm")));
+
+ if (wxFileExists(htmlFile))
+ {
+ wxFile file;
+ file.Open(htmlFile, wxFile::read);
+ long len = file.Length();
+ char* buf = htmlText.GetWriteBuf(len + 1);
+ file.Read(buf, len);
+ buf[len] = 0;
+ htmlText.UngetWriteBuf();
+ }
+ }
+
+ if (htmlText.IsEmpty())
+ {
+ 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
+#if 0
+ wxString verString;
+ verString.Printf("%.2f", stVERSION_NUMBER);
+ htmlText.Replace(wxT("$VERSION$"), verString);
+#endif
+ htmlText.Replace(wxT("$DATE$"), __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_CANCEL, "&Close", wxDefaultPosition, wxDefaultSize, 0 );
+ item2->SetDefault();
+ item2->SetFocus();
+
+ item0->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
+
+ parent->SetAutoLayout( TRUE );
+ parent->SetSizer( item0 );
+ parent->Layout();
+ item0->Fit( parent );
+ item0->SetSizeHints( parent );
+#endif
+
+ return TRUE;
+}
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);
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+#define ID_ABOUT_HTML_WINDOW 1000
+
#endif
// enable constraints
SetAutoLayout (TRUE);
- wxStaticText* msg = new wxStaticText(this, -1, "Please select a name from the list");
+ wxStaticText* msg = new wxStaticText(this, -1, "Please select a name or type a new one:");
wxListBox* list = new wxListBox(
this, ID_LISTBOX,
m_textField->SetValue(prevPlayer);
}
+ m_textField->SetFocus();
+
Layout();
CentreOnParent();