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,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++.