Added fractal, bombs samples; removed global app variable from dbtest.cpp
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
7e616b1050
commit
025e88c50b
@ -53,6 +53,11 @@ Using makefiles:
|
|||||||
3. Change directory to wx\samples and type 'nmake -f makefile.nt'
|
3. Change directory to wx\samples and type 'nmake -f makefile.nt'
|
||||||
to make all the samples. You can also make them individually.
|
to make all the samples. You can also make them individually.
|
||||||
|
|
||||||
|
Notes: if you wish to use templates, please edit
|
||||||
|
include\wx\msw\setup.h and set wxUSE_DEBUG_NEW_ALWAYS to 0.
|
||||||
|
Without this, the redefinition of 'new' will cause problems in
|
||||||
|
the headers. Alternatively, #undef new before including template headers.
|
||||||
|
|
||||||
Visual C++ 1.5 compilation
|
Visual C++ 1.5 compilation
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
@ -128,6 +128,8 @@
|
|||||||
// In debug mode, causes new to be defined to
|
// In debug mode, causes new to be defined to
|
||||||
// be WXDEBUG_NEW (see object.h).
|
// be WXDEBUG_NEW (see object.h).
|
||||||
// If this causes problems (e.g. link errors), set this to 0.
|
// If this causes problems (e.g. link errors), set this to 0.
|
||||||
|
// You may need to set this to 0 if using templates (at least
|
||||||
|
// for VC++).
|
||||||
|
|
||||||
#define REMOVE_UNUSED_ARG 1
|
#define REMOVE_UNUSED_ARG 1
|
||||||
// Set this to 0 if your compiler can't cope
|
// Set this to 0 if your compiler can't cope
|
||||||
|
1
samples/bombs/Makefile
Normal file
1
samples/bombs/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ../../setup/general/makeapp
|
26
samples/bombs/Makefile.in
Normal file
26
samples/bombs/Makefile.in
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# WXXT base directory
|
||||||
|
WXBASEDIR=@WXBASEDIR@
|
||||||
|
|
||||||
|
# set the OS type for compilation
|
||||||
|
OS=@OS@
|
||||||
|
# compile a library only
|
||||||
|
RULE=bin
|
||||||
|
|
||||||
|
# define library name
|
||||||
|
BIN_TARGET=bombs
|
||||||
|
# define library sources
|
||||||
|
BIN_SRC=\
|
||||||
|
bombs.cpp bombs1.cpp game.cpp
|
||||||
|
|
||||||
|
#define library objects
|
||||||
|
BIN_OBJ=\
|
||||||
|
bombs.o bombs1.o game.o
|
||||||
|
|
||||||
|
# additional things needed to link
|
||||||
|
BIN_LINK=
|
||||||
|
|
||||||
|
# additional things needed to compile
|
||||||
|
ADD_COMPILE=
|
||||||
|
|
||||||
|
# include the definitions now
|
||||||
|
include ../../../template.mak
|
BIN
samples/bombs/bombs.bmp
Normal file
BIN
samples/bombs/bombs.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 654 B |
252
samples/bombs/bombs.cpp
Normal file
252
samples/bombs/bombs.cpp
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bombs.cpp
|
||||||
|
// Purpose: Bombs game
|
||||||
|
// Author: P. Foggia 1996
|
||||||
|
// Modified by:
|
||||||
|
// Created: 1996
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 1996 P. Foggia
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif //precompiled headers
|
||||||
|
|
||||||
|
#include "bombs.h"
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||||
|
#include "bombs.xpm"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IMPLEMENT_APP(AppClass)
|
||||||
|
|
||||||
|
// Called to initialize the program
|
||||||
|
bool AppClass::OnInit()
|
||||||
|
{
|
||||||
|
srand((unsigned)time(NULL));
|
||||||
|
|
||||||
|
// Initialize all the top-level window members to NULL.
|
||||||
|
BombsFrame = NULL;
|
||||||
|
level=IDM_EASY;
|
||||||
|
|
||||||
|
BombsFrame =
|
||||||
|
new BombsFrameClass(NULL, "wxBombs", wxPoint(155, 165), wxSize(300, 300), wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION);
|
||||||
|
|
||||||
|
int xmax=BombsFrame->BombsCanvas->field_width*BombsFrame->BombsCanvas->x_cell*X_UNIT;
|
||||||
|
int ymax=BombsFrame->BombsCanvas->field_height*BombsFrame->BombsCanvas->y_cell*Y_UNIT;
|
||||||
|
BombsFrame->SetClientSize(xmax, ymax);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(BombsFrameClass, wxFrame)
|
||||||
|
EVT_MENU(IDM_EASY, BombsFrameClass::OnEasy)
|
||||||
|
EVT_MENU(IDM_MEDIUM, BombsFrameClass::OnMedium)
|
||||||
|
EVT_MENU(IDM_DIFFICULT, BombsFrameClass::OnDifficult)
|
||||||
|
EVT_MENU(IDM_EXIT, BombsFrameClass::OnExit)
|
||||||
|
EVT_MENU(IDM_ABOUT, BombsFrameClass::OnAbout)
|
||||||
|
EVT_MENU(IDM_RESTART, BombsFrameClass::OnRestart)
|
||||||
|
EVT_CLOSE(BombsFrameClass::OnCloseWindow)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
BombsFrameClass::BombsFrameClass(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
|
||||||
|
wxFrame(parent, -1, title, pos, size, style)
|
||||||
|
{
|
||||||
|
// Initialize child subwindow members.
|
||||||
|
BombsCanvas = NULL;
|
||||||
|
|
||||||
|
SetIcon(wxICON(bombs));
|
||||||
|
|
||||||
|
CreateStatusBar();
|
||||||
|
|
||||||
|
// Create a menu bar for the frame
|
||||||
|
wxMenuBar *menuBar1 = new wxMenuBar;
|
||||||
|
wxMenu *menu1 = new wxMenu;
|
||||||
|
menu1->Append(IDM_EXIT, "E&xit"); // , "Quit the program");
|
||||||
|
menu1->AppendSeparator();
|
||||||
|
menu1->Append(IDM_ABOUT, "&About..."); // , "Infos on wxBombs");
|
||||||
|
menuBar1->Append(menu1, "&File");
|
||||||
|
wxMenu *menu2 = new wxMenu;
|
||||||
|
menu2->Append(IDM_RESTART, "&Restart"); // , "Clear the play field");
|
||||||
|
menu2->AppendSeparator();
|
||||||
|
menu2->Append(IDM_EASY, "&Easy", NULL, TRUE); // "10x10 play field", TRUE);
|
||||||
|
menu2->Append(IDM_MEDIUM, "&Medium", NULL, TRUE); // "15x15 play field", TRUE);
|
||||||
|
menu2->Append(IDM_DIFFICULT, "&Difficult", NULL, TRUE); // "25x20 play field", TRUE);
|
||||||
|
menuBar1->Append(menu2, "&Game");
|
||||||
|
SetMenuBar(menuBar1);
|
||||||
|
menuBar=menuBar1;
|
||||||
|
menuBar->Check(wxGetApp().level, TRUE);
|
||||||
|
|
||||||
|
// Create child subwindows.
|
||||||
|
BombsCanvas = new BombsCanvasClass(this);
|
||||||
|
|
||||||
|
// Ensure the subwindows get resized o.k.
|
||||||
|
// OnSize(width, height);
|
||||||
|
|
||||||
|
// Centre frame on the screen.
|
||||||
|
Centre(wxBOTH);
|
||||||
|
|
||||||
|
// Show the frame.
|
||||||
|
Show(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BombsFrameClass::~BombsFrameClass(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void BombsFrameClass::OnCloseWindow(wxCloseEvent& event)
|
||||||
|
{
|
||||||
|
this->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BombsFrameClass::OnExit(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
this->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BombsFrameClass::OnRestart(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
BombsCanvas->UpdateFieldSize();
|
||||||
|
int xmax=BombsCanvas->field_width*BombsCanvas->x_cell*X_UNIT;
|
||||||
|
int ymax=BombsCanvas->field_height*BombsCanvas->y_cell*Y_UNIT;
|
||||||
|
wxGetApp().BombsFrame->SetClientSize(xmax, ymax);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BombsFrameClass::OnAbout(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
wxMessageBox("wxBombs (c) 1996 by P. Foggia\n<foggia@amalfi.dis.unina.it>", "About wxBombs");
|
||||||
|
}
|
||||||
|
|
||||||
|
void BombsFrameClass::OnEasy(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
menuBar->Check(wxGetApp().level, FALSE);
|
||||||
|
wxGetApp().level=IDM_EASY;
|
||||||
|
menuBar->Check(wxGetApp().level, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BombsFrameClass::OnMedium(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
menuBar->Check(wxGetApp().level, FALSE);
|
||||||
|
wxGetApp().level=IDM_MEDIUM;
|
||||||
|
menuBar->Check(wxGetApp().level, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BombsFrameClass::OnDifficult(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
menuBar->Check(wxGetApp().level, FALSE);
|
||||||
|
wxGetApp().level=IDM_DIFFICULT;
|
||||||
|
menuBar->Check(wxGetApp().level, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(BombsCanvasClass, wxWindow)
|
||||||
|
EVT_PAINT(BombsCanvasClass::OnPaint)
|
||||||
|
EVT_MOUSE_EVENTS(BombsCanvasClass::OnEvent)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
BombsCanvasClass::BombsCanvasClass(wxFrame *parent, const wxPoint& pos, const wxSize& size, long style):
|
||||||
|
wxWindow(parent, -1, pos, size, style)
|
||||||
|
{
|
||||||
|
int sx, sy;
|
||||||
|
wxClientDC dc(this);
|
||||||
|
wxFont font= BOMBS_FONT;
|
||||||
|
dc.SetFont(font);
|
||||||
|
|
||||||
|
long chw, chh;
|
||||||
|
char buf[]="M";
|
||||||
|
|
||||||
|
dc.GetTextExtent(buf, &chw, &chh);
|
||||||
|
dc.SetFont(wxNullFont);
|
||||||
|
|
||||||
|
dc.SetMapMode(MM_METRIC);
|
||||||
|
|
||||||
|
int xcm = dc.LogicalToDeviceX(10.0);
|
||||||
|
int ycm = dc.LogicalToDeviceY(10.0);
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
x_cell = (sx+3+X_UNIT)/X_UNIT;
|
||||||
|
y_cell = (sy+3+Y_UNIT)/Y_UNIT;
|
||||||
|
dc.SetMapMode(MM_TEXT);
|
||||||
|
bmp=NULL;
|
||||||
|
UpdateFieldSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
BombsCanvasClass::~BombsCanvasClass(void)
|
||||||
|
{
|
||||||
|
if (bmp)
|
||||||
|
delete bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when canvas needs to be repainted.
|
||||||
|
void BombsCanvasClass::OnPaint(wxPaintEvent& event)
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
|
// Insert your drawing code here.
|
||||||
|
if (!bmp)
|
||||||
|
{ bmp=new wxBitmap(field_width*x_cell*X_UNIT+1,
|
||||||
|
field_height*y_cell*Y_UNIT+1);
|
||||||
|
if (bmp)
|
||||||
|
{ wxMemoryDC memDC;
|
||||||
|
memDC.SelectObject(* bmp);
|
||||||
|
DrawField(&memDC, 0, 0, field_width-1, field_height-1);
|
||||||
|
memDC.SelectObject(wxNullBitmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bmp)
|
||||||
|
{ wxMemoryDC memDC;
|
||||||
|
memDC.SelectObject(* bmp);
|
||||||
|
dc.Blit(0, 0, field_width*x_cell*X_UNIT+1,
|
||||||
|
field_height*y_cell*Y_UNIT+1,
|
||||||
|
&memDC, 0, 0, wxCOPY);
|
||||||
|
memDC.SelectObject(wxNullBitmap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DrawField(& dc, 0, 0, field_width-1, field_height-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Updates the field size depending on wxGetApp().level and
|
||||||
|
// redraws the canvas
|
||||||
|
void BombsCanvasClass::UpdateFieldSize()
|
||||||
|
{ field_width=20;
|
||||||
|
field_height=20;
|
||||||
|
|
||||||
|
switch(wxGetApp().level)
|
||||||
|
{ case IDM_EASY:
|
||||||
|
field_width=10;
|
||||||
|
field_height=10;
|
||||||
|
break;
|
||||||
|
case IDM_MEDIUM:
|
||||||
|
field_width=15;
|
||||||
|
field_height=15;
|
||||||
|
break;
|
||||||
|
case IDM_DIFFICULT:
|
||||||
|
field_width=25;
|
||||||
|
field_height=20;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
wxGetApp().Game.Init(field_width, field_height);
|
||||||
|
|
||||||
|
if (bmp)
|
||||||
|
delete bmp;
|
||||||
|
bmp=NULL;
|
||||||
|
|
||||||
|
wxWindow::Refresh();
|
||||||
|
}
|
14
samples/bombs/bombs.def
Normal file
14
samples/bombs/bombs.def
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
; bombs
|
||||||
|
; Generated by wxBuilder
|
||||||
|
;
|
||||||
|
NAME bombsapp
|
||||||
|
DESCRIPTION 'A wxWindows application'
|
||||||
|
;
|
||||||
|
EXETYPE WINDOWS
|
||||||
|
STUB 'WINSTUB.EXE'
|
||||||
|
;
|
||||||
|
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||||
|
DATA PRELOAD MOVEABLE MULTIPLE
|
||||||
|
;
|
||||||
|
HEAPSIZE 1024
|
||||||
|
STACKSIZE 8192
|
119
samples/bombs/bombs.h
Normal file
119
samples/bombs/bombs.h
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bombs.h
|
||||||
|
// Purpose: Bombs game
|
||||||
|
// Author: P. Foggia 1996
|
||||||
|
// Modified by:
|
||||||
|
// Created: 1996
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 1996 P. Foggia
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _INC_BOMBS_H
|
||||||
|
#define _INC_BOMBS_H
|
||||||
|
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Forward declarations of all top-level window classes.
|
||||||
|
*/
|
||||||
|
class BombsFrameClass;
|
||||||
|
class AboutFrameClass;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class representing the entire Application
|
||||||
|
*/
|
||||||
|
class AppClass: public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BombsFrameClass *BombsFrame;
|
||||||
|
int level;
|
||||||
|
BombsGame Game;
|
||||||
|
|
||||||
|
bool OnInit();
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_APP(AppClass)
|
||||||
|
|
||||||
|
class BombsCanvasClass;
|
||||||
|
|
||||||
|
class BombsFrameClass: public wxFrame
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
protected:
|
||||||
|
public:
|
||||||
|
// Subwindows for reference within the program.
|
||||||
|
BombsCanvasClass *BombsCanvas;
|
||||||
|
wxMenuBar *menuBar;
|
||||||
|
|
||||||
|
// Constructor and destructor
|
||||||
|
BombsFrameClass(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
|
||||||
|
~BombsFrameClass(void);
|
||||||
|
|
||||||
|
void OnCloseWindow(wxCloseEvent& event);
|
||||||
|
void OnExit(wxCommandEvent& event);
|
||||||
|
void OnRestart(wxCommandEvent& event);
|
||||||
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
void OnEasy(wxCommandEvent& event);
|
||||||
|
void OnMedium(wxCommandEvent& event);
|
||||||
|
void OnDifficult(wxCommandEvent& event);
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Menu identifiers
|
||||||
|
*/
|
||||||
|
// File
|
||||||
|
#define BOMBSFRAMECLASS_FILE 1
|
||||||
|
// E&xit
|
||||||
|
#define IDM_EXIT 2
|
||||||
|
// About...
|
||||||
|
#define IDM_ABOUT 3
|
||||||
|
// Game
|
||||||
|
#define BOMBSFRAMECLASS_GAME 4
|
||||||
|
// &Restart
|
||||||
|
#define IDM_RESTART 5
|
||||||
|
// &Easy
|
||||||
|
#define IDM_EASY 6
|
||||||
|
// &Medium
|
||||||
|
#define IDM_MEDIUM 7
|
||||||
|
// &Difficult
|
||||||
|
#define IDM_DIFFICULT 8
|
||||||
|
|
||||||
|
class BombsCanvasClass: public wxWindow
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
protected:
|
||||||
|
public:
|
||||||
|
int field_width, field_height;
|
||||||
|
int x_cell, y_cell;
|
||||||
|
wxBitmap *bmp;
|
||||||
|
// Constructor and destructor
|
||||||
|
BombsCanvasClass(wxFrame *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
|
||||||
|
~BombsCanvasClass(void);
|
||||||
|
|
||||||
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2);
|
||||||
|
void Refresh(int xc1, int yc1, int xc2, int yc2);
|
||||||
|
void OnEvent(wxMouseEvent& event);
|
||||||
|
void UpdateFieldSize();
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Menu identifiers
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
* BombsCanvasClass::x_cell and y_cell
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
|
||||||
|
|
||||||
|
#endif /* mutual exclusion */
|
||||||
|
|
BIN
samples/bombs/bombs.ico
Normal file
BIN
samples/bombs/bombs.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
3
samples/bombs/bombs.rc
Normal file
3
samples/bombs/bombs.rc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
bombs ICON "bombs.ico"
|
||||||
|
|
||||||
|
#include "wx/msw/wx.rc"
|
44
samples/bombs/bombs.xpm
Normal file
44
samples/bombs/bombs.xpm
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *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 ++++ ",
|
||||||
|
" "
|
||||||
|
};
|
205
samples/bombs/bombs1.cpp
Normal file
205
samples/bombs/bombs1.cpp
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bombs1.cpp
|
||||||
|
// Purpose: Bombs game
|
||||||
|
// Author: P. Foggia 1996
|
||||||
|
// Modified by:
|
||||||
|
// Created: 1996
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 1996 P. Foggia
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*
|
||||||
|
* implementation of the methods DrawField and OnEvent of the
|
||||||
|
* class BombsCanvas
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif //precompiled headers
|
||||||
|
|
||||||
|
#include "bombs.h"
|
||||||
|
|
||||||
|
/*-------- BombCanvasClass::DrawField(dc, xc1, yc1, xc2, yc2) -------*/
|
||||||
|
/* 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 BombsCanvasClass::DrawField(wxDC *dc, int xc1, int yc1, int xc2, int yc2)
|
||||||
|
{ int x,y,xmax,ymax;
|
||||||
|
char buf[2];
|
||||||
|
long chw, chh;
|
||||||
|
|
||||||
|
wxColour *wxBlack = wxTheColourDatabase->FindColour("BLACK");
|
||||||
|
wxColour *wxWhite = wxTheColourDatabase->FindColour("WHITE");
|
||||||
|
wxColour *wxRed = wxTheColourDatabase->FindColour("RED");
|
||||||
|
wxColour *wxBlue = wxTheColourDatabase->FindColour("BLUE");
|
||||||
|
wxColour *wxGrey = wxTheColourDatabase->FindColour("LIGHT GREY");
|
||||||
|
wxColour *wxGreen = wxTheColourDatabase->FindColour("GREEN");
|
||||||
|
|
||||||
|
wxPen *blackPen = wxThePenList->FindOrCreatePen(*wxBlack, 1, wxSOLID);
|
||||||
|
wxPen *redPen = wxThePenList->FindOrCreatePen(*wxRed, 1, wxSOLID);
|
||||||
|
wxPen *bluePen = wxThePenList->FindOrCreatePen(*wxBlue, 1, wxSOLID);
|
||||||
|
wxPen *whitePen = wxThePenList->FindOrCreatePen(*wxWhite, 1, wxSOLID);
|
||||||
|
wxPen *greyPen = wxThePenList->FindOrCreatePen(*wxGrey, 1, wxSOLID);
|
||||||
|
wxBrush *whiteBrush = wxTheBrushList->FindOrCreateBrush(*wxWhite, wxSOLID);
|
||||||
|
wxBrush *greyBrush = wxTheBrushList->FindOrCreateBrush(*wxGrey, wxSOLID);
|
||||||
|
wxBrush *redBrush = wxTheBrushList->FindOrCreateBrush(*wxRed, wxSOLID);
|
||||||
|
|
||||||
|
xmax=field_width*x_cell*X_UNIT;
|
||||||
|
ymax=field_height*y_cell*Y_UNIT;
|
||||||
|
|
||||||
|
|
||||||
|
dc->SetPen(* blackPen);
|
||||||
|
for(x=xc1; x<=xc2; x++)
|
||||||
|
dc->DrawLine(x*x_cell*X_UNIT, 0, x*x_cell*X_UNIT, ymax);
|
||||||
|
for(y=xc1; y<=yc2; y++)
|
||||||
|
dc->DrawLine(0, y*y_cell*Y_UNIT, xmax, y*y_cell*Y_UNIT);
|
||||||
|
|
||||||
|
|
||||||
|
wxFont font= BOMBS_FONT;
|
||||||
|
dc->SetFont(font);
|
||||||
|
|
||||||
|
buf[1]='\0';
|
||||||
|
for(x=xc1; x<=xc2; x++)
|
||||||
|
for(y=yc1; y<=yc2; y++)
|
||||||
|
{ if (wxGetApp().Game.IsMarked(x,y))
|
||||||
|
{ dc->SetPen(* blackPen);
|
||||||
|
dc->SetBrush(* greyBrush);
|
||||||
|
dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
|
||||||
|
x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
|
||||||
|
*buf='M';
|
||||||
|
if (!wxGetApp().Game.IsHidden(x,y) && wxGetApp().Game.IsBomb(x,y))
|
||||||
|
dc->SetTextForeground(*wxBlue);
|
||||||
|
else
|
||||||
|
dc->SetTextForeground(*wxRed);
|
||||||
|
dc->SetTextBackground(*wxGrey);
|
||||||
|
dc->GetTextExtent(buf, &chw, &chh);
|
||||||
|
dc->DrawText( buf,
|
||||||
|
x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
|
||||||
|
y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
|
||||||
|
);
|
||||||
|
if (!wxGetApp().Game.IsHidden(x,y) && wxGetApp().Game.IsBomb(x,y))
|
||||||
|
{ dc->SetPen(*redPen);
|
||||||
|
dc->DrawLine(x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
|
||||||
|
(x+1)*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT);
|
||||||
|
dc->DrawLine(x*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT,
|
||||||
|
(x+1)*x_cell*X_UNIT, y*y_cell*Y_UNIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wxGetApp().Game.IsHidden(x,y))
|
||||||
|
{ dc->SetPen(*blackPen);
|
||||||
|
dc->SetBrush(*greyBrush);
|
||||||
|
dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
|
||||||
|
x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
|
||||||
|
}
|
||||||
|
else if (wxGetApp().Game.IsBomb(x,y))
|
||||||
|
{ dc->SetPen(* blackPen);
|
||||||
|
dc->SetBrush(* redBrush);
|
||||||
|
dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
|
||||||
|
x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
|
||||||
|
*buf='B';
|
||||||
|
dc->SetTextForeground(* wxBlack);
|
||||||
|
dc->SetTextBackground(* wxRed);
|
||||||
|
dc->GetTextExtent(buf, &chw, &chh);
|
||||||
|
dc->DrawText( buf,
|
||||||
|
x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
|
||||||
|
y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
|
||||||
|
);
|
||||||
|
if (wxGetApp().Game.IsExploded(x,y))
|
||||||
|
{ dc->SetPen(* bluePen);
|
||||||
|
dc->DrawLine(x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
|
||||||
|
(x+1)*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT);
|
||||||
|
dc->DrawLine(x*x_cell*X_UNIT, (y+1)*y_cell*Y_UNIT,
|
||||||
|
(x+1)*x_cell*X_UNIT, y*y_cell*Y_UNIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Display a digit
|
||||||
|
{ dc->SetPen(* blackPen);
|
||||||
|
dc->SetBrush(* whiteBrush);
|
||||||
|
dc->DrawRectangle( x*x_cell*X_UNIT, y*y_cell*Y_UNIT,
|
||||||
|
x_cell*X_UNIT+1, y_cell*Y_UNIT+1);
|
||||||
|
*buf = (wxGetApp().Game.Get(x,y) & BG_MASK) + '0';
|
||||||
|
dc->GetTextExtent(buf, &chw, &chh);
|
||||||
|
switch(*buf)
|
||||||
|
{ case '0': dc->SetTextForeground(* wxGreen); break;
|
||||||
|
case '1': dc->SetTextForeground(* wxBlue); break;
|
||||||
|
default: dc->SetTextForeground(* wxBlack); break;
|
||||||
|
}
|
||||||
|
dc->SetTextBackground(* wxWhite);
|
||||||
|
dc->DrawText( buf,
|
||||||
|
x*x_cell*X_UNIT + (x_cell*X_UNIT-chw)/2,
|
||||||
|
y*y_cell*Y_UNIT + (y_cell*Y_UNIT-chh)/2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dc->SetFont(wxNullFont);
|
||||||
|
|
||||||
|
if (wxGetApp().BombsFrame)
|
||||||
|
{ char buf[80];
|
||||||
|
sprintf(buf, "%d bombs %d remaining cells",
|
||||||
|
wxGetApp().Game.GetBombs(), wxGetApp().Game.GetRemainingCells());
|
||||||
|
wxGetApp().BombsFrame->SetStatusText(buf, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------- BombCanvasClass::Refresh(xc1, yc1, xc2, yc2) -------------*/
|
||||||
|
/* Refreshes the field image */
|
||||||
|
/* xc1,yc1 etc. are the (inclusive) limits of the area to be drawn, */
|
||||||
|
/* expressed in cells. */
|
||||||
|
/*---------------------------------------------------------------------*/
|
||||||
|
void BombsCanvasClass::Refresh(int xc1, int yc1, int xc2, int yc2)
|
||||||
|
{
|
||||||
|
wxClientDC dc(this);
|
||||||
|
DrawField(& dc, xc1, yc1, xc2, yc2);
|
||||||
|
if (bmp)
|
||||||
|
{ wxMemoryDC memDC;
|
||||||
|
memDC.SelectObject(* bmp);
|
||||||
|
DrawField(&memDC, xc1, yc1, xc2, yc2);
|
||||||
|
memDC.SelectObject(wxNullBitmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the canvas receives a mouse event.
|
||||||
|
void BombsCanvasClass::OnEvent(wxMouseEvent& event)
|
||||||
|
{ float fx, fy;
|
||||||
|
event.Position(&fx, &fy);
|
||||||
|
int x = fx/(x_cell*X_UNIT);
|
||||||
|
int y = fy/(y_cell*Y_UNIT);
|
||||||
|
if (x<field_width && y<field_height)
|
||||||
|
{ if ( (event.RightDown() || (event.LeftDown() && event.ShiftDown()))
|
||||||
|
&& (wxGetApp().Game.IsHidden(x,y)
|
||||||
|
|| wxGetApp().Game.GetRemainingCells()==0))
|
||||||
|
{ wxGetApp().Game.Mark(x,y);
|
||||||
|
Refresh(x, y, x, y);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (event.LeftDown() && wxGetApp().Game.IsHidden(x,y)
|
||||||
|
&& !wxGetApp().Game.IsMarked(x,y))
|
||||||
|
{ wxGetApp().Game.Unhide(x,y);
|
||||||
|
Refresh(x, y, x, y);
|
||||||
|
if (wxGetApp().Game.IsBomb(x,y) || wxGetApp().Game.GetRemainingCells()==0)
|
||||||
|
{ wxBell();
|
||||||
|
if (!wxGetApp().Game.IsBomb(x,y))
|
||||||
|
{ wxMessageBox("Nice! You found all the bombs!", "wxWin Bombs",
|
||||||
|
wxOK|wxCENTRE, wxGetApp().BombsFrame);
|
||||||
|
}
|
||||||
|
else // x,y is a bomb
|
||||||
|
{ wxGetApp().Game.Explode(x, y);
|
||||||
|
}
|
||||||
|
for(x=0; x<field_width; x++)
|
||||||
|
for(y=0; y<field_height; y++)
|
||||||
|
wxGetApp().Game.Unhide(x,y);
|
||||||
|
Refresh(0, 0, field_width-1, field_height-1);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
105
samples/bombs/game.cpp
Normal file
105
samples/bombs/game.cpp
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bombs1.cpp
|
||||||
|
// Purpose: Implementation of the class BombsGame
|
||||||
|
// Author: P. Foggia 1996
|
||||||
|
// Modified by:
|
||||||
|
// Created: 1996
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 1996 P. Foggia
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif //precompiled headers
|
||||||
|
|
||||||
|
#include "game.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#define PROB 0.2
|
||||||
|
|
||||||
|
#ifndef RAND_MAX
|
||||||
|
#define RAND_MAX INT_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------- BombsGame::~BombsGame() ---------------------*/
|
||||||
|
/*--------------------------------------------------------------------*/
|
||||||
|
BombsGame::~BombsGame()
|
||||||
|
{ if (field)
|
||||||
|
free(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------ int BombsGame::Init(width,height) -------------------*/
|
||||||
|
/* Initialize the play field. Returns 0 on failure */
|
||||||
|
/*--------------------------------------------------------------------------*/
|
||||||
|
int BombsGame::Init(int aWidth, int aHeight)
|
||||||
|
{ int x, y;
|
||||||
|
int xx, yy;
|
||||||
|
|
||||||
|
if (field)
|
||||||
|
free(field);
|
||||||
|
field=(short *)malloc(aWidth*aHeight*sizeof(short));
|
||||||
|
if (!field)
|
||||||
|
{ width=height=0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
width=aWidth;
|
||||||
|
height=aHeight;
|
||||||
|
|
||||||
|
for(x=0; x<width; x++)
|
||||||
|
for(y=0; y<height; y++)
|
||||||
|
{ field[x+y*width] = ((float)rand()/RAND_MAX <PROB)?
|
||||||
|
BG_HIDDEN | BG_BOMB :
|
||||||
|
BG_HIDDEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
bombs=0;
|
||||||
|
for(x=0; x<width; x++)
|
||||||
|
for(y=0; y<height; y++)
|
||||||
|
if (field[x+y*width] & BG_BOMB)
|
||||||
|
{ bombs++;
|
||||||
|
for(xx=x-1; xx<=x+1; xx++)
|
||||||
|
if (xx>=0 && xx<width)
|
||||||
|
for(yy=y-1; yy<=y+1; yy++)
|
||||||
|
if (yy>=0 && yy<height && (yy!=y || xx!=x))
|
||||||
|
field[xx+yy*width]++;
|
||||||
|
}
|
||||||
|
normal_cells=height*width-bombs;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------- BombsGame::Mark(x,y) -------------------------*/
|
||||||
|
/* Marks/unmarks a cell */
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
void BombsGame::Mark(int x, int y)
|
||||||
|
{
|
||||||
|
field[x+y*width] ^= BG_MARKED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------- BombsGame::Unhide(x,y) ------------------------*/
|
||||||
|
/* Unhides a cell */
|
||||||
|
/*---------------------------------------------------------------------*/
|
||||||
|
void BombsGame::Unhide(int x, int y)
|
||||||
|
{ if (!IsHidden(x,y))
|
||||||
|
return;
|
||||||
|
field[x+y*width] &= ~BG_HIDDEN;
|
||||||
|
if (!IsBomb(x,y))
|
||||||
|
normal_cells--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*------------------- BombsGame::Explode(x,y) ------------------------*/
|
||||||
|
/* Makes a cell exploded */
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
void BombsGame::Explode(int x, int y)
|
||||||
|
{
|
||||||
|
field[x+y*width] |= BG_EXPLODED;
|
||||||
|
}
|
||||||
|
|
42
samples/bombs/game.h
Normal file
42
samples/bombs/game.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//---------------------------------------------------------------
|
||||||
|
// game.h
|
||||||
|
// Definition of the class BombsGame, containing the data for a
|
||||||
|
// playfield
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
#ifndef GAME_H
|
||||||
|
#define GAME_H
|
||||||
|
|
||||||
|
#define BG_HIDDEN 0x100
|
||||||
|
#define BG_BOMB 0x200
|
||||||
|
#define BG_MARKED 0x400
|
||||||
|
#define BG_EXPLODED 0x800
|
||||||
|
#define BG_MASK 0x0FF
|
||||||
|
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
class BombsGame
|
||||||
|
{ protected:
|
||||||
|
int width,height;
|
||||||
|
short *field;
|
||||||
|
int bombs,normal_cells;
|
||||||
|
public:
|
||||||
|
BombsGame() { width=height=0; field=NULL; };
|
||||||
|
~BombsGame();
|
||||||
|
int Init(int width, int height);
|
||||||
|
int GetWidth() { return width; };
|
||||||
|
int GetHeight() { return height; };
|
||||||
|
int Get(int x, int y) { return field[x+y*width]; };
|
||||||
|
void Mark(int x, int y);
|
||||||
|
void Unhide(int x, int y);
|
||||||
|
void Explode(int x, int y);
|
||||||
|
int IsHidden(int x, int y) { return Get(x,y) & BG_HIDDEN; };
|
||||||
|
int IsMarked(int x, int y) { return Get(x,y) & BG_MARKED; };
|
||||||
|
int IsBomb(int x, int y) { return Get(x,y) & BG_BOMB; };
|
||||||
|
int IsExploded(int x, int y) { return Get(x,y) & BG_EXPLODED; };
|
||||||
|
int GetBombs() { return bombs; };
|
||||||
|
int GetRemainingCells() { return normal_cells; };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* def GAME_H */
|
||||||
|
|
68
samples/bombs/makefile.b32
Normal file
68
samples/bombs/makefile.b32
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.b32
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright:
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds bombs example
|
||||||
|
|
||||||
|
# WXWIN and BCCDIR are set by parent make
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
!include $(WXDIR)\src\makeb32.env
|
||||||
|
|
||||||
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
|
WXINC = $(WXDIR)\include\msw
|
||||||
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
|
TARGET=bombs
|
||||||
|
|
||||||
|
!if "$(FINAL)" == "0"
|
||||||
|
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS= -v
|
||||||
|
!else
|
||||||
|
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS =
|
||||||
|
!endif
|
||||||
|
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||||
|
|
||||||
|
OBJECTS = bombs.obj bombs1.obj game.obj
|
||||||
|
|
||||||
|
$(TARGET).exe: $(OBJECTS) $(TARGET).res
|
||||||
|
tlink32 $(LINKFLAGS) @&&!
|
||||||
|
c0w32.obj $(OBJECTS)
|
||||||
|
$(TARGET)
|
||||||
|
nul
|
||||||
|
$(LIBS)
|
||||||
|
$(TARGET).def
|
||||||
|
$(TARGET).res
|
||||||
|
!
|
||||||
|
|
||||||
|
.$(SRCSUFF).obj:
|
||||||
|
bcc32 $(CPPFLAGS) -c {$< }
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||||
|
|
||||||
|
bombs.obj: bombs.$(SRCSUFF)
|
||||||
|
|
||||||
|
bombs1.obj: bombs1.$(SRCSUFF)
|
||||||
|
|
||||||
|
game.obj: game.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
|
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.rws
|
||||||
|
|
19
samples/bombs/makefile.bcc
Normal file
19
samples/bombs/makefile.bcc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.bcc
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
#
|
||||||
|
# Builds a BC++ 16-bit sample
|
||||||
|
|
||||||
|
!if "$(WXWIN)" == ""
|
||||||
|
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||||
|
!endif
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
TARGET=bombs
|
||||||
|
OBJECTS=$(TARGET).obj bombs1.obj game.obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.bcc
|
||||||
|
|
17
samples/bombs/makefile.dos
Normal file
17
samples/bombs/makefile.dos
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.dos
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
#
|
||||||
|
# Makefile : Builds 16-bit sample, VC++ 1.5
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
|
# info
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
TARGET=bombs
|
||||||
|
OBJECTS=$(TARGET).obj bombs1.obj game.obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.msc
|
||||||
|
|
44
samples/bombs/makefile.g95
Normal file
44
samples/bombs/makefile.g95
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for bombs example (UNIX).
|
||||||
|
|
||||||
|
WXDIR = ../..
|
||||||
|
|
||||||
|
# All common UNIX compiler flags and options are now in
|
||||||
|
# this central makefile.
|
||||||
|
include $(WXDIR)/src/makeg95.env
|
||||||
|
|
||||||
|
OBJECTS = $(OBJDIR)/bombs.$(OBJSUFF) $(OBJDIR)/bombs1.$(OBJSUFF) $(OBJDIR)/game.$(OBJSUFF)\
|
||||||
|
$(OBJDIR)/bombs_resources.$(OBJSUFF)
|
||||||
|
|
||||||
|
all: $(OBJDIR) bombs$(GUISUFFIX)$(EXESUFF)
|
||||||
|
|
||||||
|
wx:
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
mkdir $(OBJDIR)
|
||||||
|
|
||||||
|
bombs$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||||
|
$(CC) $(LDFLAGS) -o bombs$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||||
|
|
||||||
|
$(OBJDIR)/bombs.$(OBJSUFF): bombs.$(SRCSUFF)
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ bombs.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/bombs1.$(OBJSUFF): bombs1.$(SRCSUFF)
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ bombs1.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/game.$(OBJSUFF): game.$(SRCSUFF)
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ game.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/bombs_resources.o: bombs.rc
|
||||||
|
$(RESCOMP) -i bombs.rc -o $(OBJDIR)/bombs_resources.o $(RESFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJECTS) bombs$(GUISUFFIX).exe core *.rsc *.res
|
74
samples/bombs/makefile.nt
Normal file
74
samples/bombs/makefile.nt
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.nt
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds bombs example (MS VC++).
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
|
# info
|
||||||
|
|
||||||
|
# Set WXDIR for your system
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
WXUSINGDLL=0
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\ntwxwin.mak
|
||||||
|
|
||||||
|
THISDIR = $(WXDIR)\samples\bombs
|
||||||
|
PROGRAM=bombs
|
||||||
|
|
||||||
|
OBJECTS = $(PROGRAM).obj bombs1.obj game.obj
|
||||||
|
|
||||||
|
$(PROGRAM): $(PROGRAM).exe
|
||||||
|
|
||||||
|
all: wx $(PROGRAM).exe
|
||||||
|
|
||||||
|
wx:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt FINAL=$(FINAL)
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
wxclean:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt clean
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||||
|
$(link) @<<
|
||||||
|
-out:$(PROGRAM).exe
|
||||||
|
$(LINKFLAGS)
|
||||||
|
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||||
|
$(LIBS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
bombs1.obj: bombs1.$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
game.obj: game.$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
|
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.sbr
|
||||||
|
-erase *.pdb
|
17
samples/bombs/makefile.unx
Normal file
17
samples/bombs/makefile.unx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for bombs example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=bombs
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o bombs1.o game.o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
15
samples/bombs/makefile.wat
Normal file
15
samples/bombs/makefile.wat
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#
|
||||||
|
# Makefile for WATCOM
|
||||||
|
#
|
||||||
|
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
|
||||||
|
# 8 Nov 1994
|
||||||
|
#
|
||||||
|
|
||||||
|
WXDIR = $(%WXWIN)
|
||||||
|
|
||||||
|
PROGRAM = bombs
|
||||||
|
OBJECTS = $(PROGRAM).obj bombs1.obj game.obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.wat
|
||||||
|
|
||||||
|
|
78
samples/bombs/readme.txt
Normal file
78
samples/bombs/readme.txt
Normal 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 succesfully 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.bcc
|
||||||
|
for Windows (nmake if you use a MicroSoft compiler), or:
|
||||||
|
make -f makefile.unx xview
|
||||||
|
for Unix+xview and
|
||||||
|
make -f makefile.unx motif
|
||||||
|
for Unix+motif
|
||||||
|
|
||||||
|
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 unresizeable.
|
||||||
|
|
||||||
|
4) Added makefile.dos for VC++ 1.x, makefile.wat for Watcom C++.
|
@ -59,10 +59,6 @@ extern char ListDB_Selection2[]; // Used to return the second column value for t
|
|||||||
DatabaseDemoFrame *DemoFrame; // Pointer to the main frame
|
DatabaseDemoFrame *DemoFrame; // Pointer to the main frame
|
||||||
|
|
||||||
|
|
||||||
// This statement initializes the whole application and calls OnInit
|
|
||||||
DatabaseDemoApp DatabaseDemoApp;
|
|
||||||
|
|
||||||
|
|
||||||
/* Pointer to the main database connection used in the program. This
|
/* Pointer to the main database connection used in the program. This
|
||||||
* pointer would normally be used for doing things as database lookups
|
* pointer would normally be used for doing things as database lookups
|
||||||
* for user login names and passwords, getting workstation settings, etc.
|
* for user login names and passwords, getting workstation settings, etc.
|
||||||
@ -1300,7 +1296,7 @@ CparameterDlg::CparameterDlg(wxWindow *parent) : wxDialog (parent, PARAMETER_DIA
|
|||||||
widgetPtrsSet = TRUE;
|
widgetPtrsSet = TRUE;
|
||||||
|
|
||||||
saved = FALSE;
|
saved = FALSE;
|
||||||
savedParamSettings = DatabaseDemoApp.params;
|
savedParamSettings = wxGetApp().params;
|
||||||
|
|
||||||
Centre(wxBOTH);
|
Centre(wxBOTH);
|
||||||
PutData();
|
PutData();
|
||||||
@ -1319,7 +1315,7 @@ bool CparameterDlg::OnClose()
|
|||||||
if (!Ok)
|
if (!Ok)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DatabaseDemoApp.params = savedParamSettings;
|
wxGetApp().params = savedParamSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetParent() != NULL)
|
if (GetParent() != NULL)
|
||||||
@ -1366,9 +1362,9 @@ bool CparameterDlg::PutData()
|
|||||||
FillDataSourceList();
|
FillDataSourceList();
|
||||||
|
|
||||||
// Fill in the fields from the params object
|
// Fill in the fields from the params object
|
||||||
pParamODBCSourceList->SetStringSelection(DatabaseDemoApp.params.ODBCSource);
|
pParamODBCSourceList->SetStringSelection(wxGetApp().params.ODBCSource);
|
||||||
pParamUserNameTxt->SetValue(DatabaseDemoApp.params.UserName);
|
pParamUserNameTxt->SetValue(wxGetApp().params.UserName);
|
||||||
pParamPasswordTxt->SetValue(DatabaseDemoApp.params.Password);
|
pParamPasswordTxt->SetValue(wxGetApp().params.Password);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // CparameterDlg::PutData()
|
} // CparameterDlg::PutData()
|
||||||
|
|
||||||
@ -1379,47 +1375,47 @@ bool CparameterDlg::GetData()
|
|||||||
if (pParamODBCSourceList->GetStringSelection())
|
if (pParamODBCSourceList->GetStringSelection())
|
||||||
{
|
{
|
||||||
tStr = pParamODBCSourceList->GetStringSelection();
|
tStr = pParamODBCSourceList->GetStringSelection();
|
||||||
if (tStr.Length() > (sizeof(DatabaseDemoApp.params.ODBCSource)-1))
|
if (tStr.Length() > (sizeof(wxGetApp().params.ODBCSource)-1))
|
||||||
{
|
{
|
||||||
wxString errmsg;
|
wxString errmsg;
|
||||||
errmsg.Printf("ODBC Data source name is longer than the data structure to hold it.\n'Cparameter.ODBCSource' must have a larger character array\nto handle a data source with this long of a name\n\nThe data source currently selected is %d characters long.",tStr.Length());
|
errmsg.Printf("ODBC Data source name is longer than the data structure to hold it.\n'Cparameter.ODBCSource' must have a larger character array\nto handle a data source with this long of a name\n\nThe data source currently selected is %d characters long.",tStr.Length());
|
||||||
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(DatabaseDemoApp.params.ODBCSource, tStr);
|
strcpy(wxGetApp().params.ODBCSource, tStr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
tStr = pParamUserNameTxt->GetValue();
|
tStr = pParamUserNameTxt->GetValue();
|
||||||
if (tStr.Length() > (sizeof(DatabaseDemoApp.params.UserName)-1))
|
if (tStr.Length() > (sizeof(wxGetApp().params.UserName)-1))
|
||||||
{
|
{
|
||||||
wxString errmsg;
|
wxString errmsg;
|
||||||
errmsg.Printf("User name is longer than the data structure to hold it.\n'Cparameter.UserName' must have a larger character array\nto handle a data source with this long of a name\n\nThe user name currently specified is %d characters long.",tStr.Length());
|
errmsg.Printf("User name is longer than the data structure to hold it.\n'Cparameter.UserName' must have a larger character array\nto handle a data source with this long of a name\n\nThe user name currently specified is %d characters long.",tStr.Length());
|
||||||
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(DatabaseDemoApp.params.UserName, tStr);
|
strcpy(wxGetApp().params.UserName, tStr);
|
||||||
|
|
||||||
tStr = pParamPasswordTxt->GetValue();
|
tStr = pParamPasswordTxt->GetValue();
|
||||||
if (tStr.Length() > (sizeof(DatabaseDemoApp.params.Password)-1))
|
if (tStr.Length() > (sizeof(wxGetApp().params.Password)-1))
|
||||||
{
|
{
|
||||||
wxString errmsg;
|
wxString errmsg;
|
||||||
errmsg.Printf("Password is longer than the data structure to hold it.\n'Cparameter.Password' must have a larger character array\nto handle a data source with this long of a name\n\nThe password currently specified is %d characters long.",tStr.Length());
|
errmsg.Printf("Password is longer than the data structure to hold it.\n'Cparameter.Password' must have a larger character array\nto handle a data source with this long of a name\n\nThe password currently specified is %d characters long.",tStr.Length());
|
||||||
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
wxMessageBox(errmsg,"Internal program error...",wxOK | wxICON_EXCLAMATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strcpy(DatabaseDemoApp.params.Password,tStr);
|
strcpy(wxGetApp().params.Password,tStr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} // CparameterDlg::GetData()
|
} // CparameterDlg::GetData()
|
||||||
|
|
||||||
|
|
||||||
bool CparameterDlg::Save()
|
bool CparameterDlg::Save()
|
||||||
{
|
{
|
||||||
Cparameters saveParams = DatabaseDemoApp.params;
|
Cparameters saveParams = wxGetApp().params;
|
||||||
if (!GetData())
|
if (!GetData())
|
||||||
{
|
{
|
||||||
DatabaseDemoApp.params = saveParams;
|
wxGetApp().params = saveParams;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1432,11 +1428,11 @@ bool CparameterDlg::Save()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs(DatabaseDemoApp.params.ODBCSource, paramFile);
|
fputs(wxGetApp().params.ODBCSource, paramFile);
|
||||||
fputc('\n', paramFile);
|
fputc('\n', paramFile);
|
||||||
fputs(DatabaseDemoApp.params.UserName, paramFile);
|
fputs(wxGetApp().params.UserName, paramFile);
|
||||||
fputc('\n', paramFile);
|
fputc('\n', paramFile);
|
||||||
fputs(DatabaseDemoApp.params.Password, paramFile);
|
fputs(wxGetApp().params.Password, paramFile);
|
||||||
fputc('\n', paramFile);
|
fputc('\n', paramFile);
|
||||||
fclose(paramFile);
|
fclose(paramFile);
|
||||||
|
|
||||||
|
1
samples/fractal/Makefile
Normal file
1
samples/fractal/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ../../setup/general/makeapp
|
26
samples/fractal/Makefile.in
Normal file
26
samples/fractal/Makefile.in
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# WXXT base directory
|
||||||
|
WXBASEDIR=@WXBASEDIR@
|
||||||
|
|
||||||
|
# set the OS type for compilation
|
||||||
|
OS=@OS@
|
||||||
|
# compile a library only
|
||||||
|
RULE=bin
|
||||||
|
|
||||||
|
# define library name
|
||||||
|
BIN_TARGET=fractal
|
||||||
|
# define library sources
|
||||||
|
BIN_SRC=\
|
||||||
|
fractal.cpp
|
||||||
|
|
||||||
|
#define library objects
|
||||||
|
BIN_OBJ=\
|
||||||
|
fractal.o
|
||||||
|
|
||||||
|
# additional things needed to link
|
||||||
|
BIN_LINK=
|
||||||
|
|
||||||
|
# additional things needed to compile
|
||||||
|
ADD_COMPILE=
|
||||||
|
|
||||||
|
# include the definitions now
|
||||||
|
include ../../../template.mak
|
251
samples/fractal/fractal.cpp
Normal file
251
samples/fractal/fractal.cpp
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: fractal.cpp
|
||||||
|
// Purpose: demo of wxConfig and related classes
|
||||||
|
// Author: Andrew Davison
|
||||||
|
// Modified by:
|
||||||
|
// Created: 05.04.94
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// 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 wxWindows, and my quick
|
||||||
|
hack doesn't fix.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#endif //precompiled headers
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#define Random(x) (rand() % x)
|
||||||
|
#define Randomize() (srand((unsigned int)time(NULL)))
|
||||||
|
|
||||||
|
static int detail = 9; // CHANGE THIS... 7,8,9 etc
|
||||||
|
|
||||||
|
static bool running = FALSE;
|
||||||
|
static wxMenuBar *menuBar = NULL;
|
||||||
|
|
||||||
|
// Define a new application type
|
||||||
|
class MyApp: public wxApp
|
||||||
|
{ public:
|
||||||
|
bool OnInit();
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_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);
|
||||||
|
DECLARE_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;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// `Main program' equivalent, creating windows and returning main app frame
|
||||||
|
bool MyApp::OnInit()
|
||||||
|
{
|
||||||
|
// Create the main frame window
|
||||||
|
MyFrame *frame = new MyFrame(NULL, "Fractal Mountains for wxWindows", wxPoint(-1, -1), wxSize(640, 480));
|
||||||
|
|
||||||
|
// Make a menubar
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
file_menu->Append(wxID_EXIT, "E&xit");
|
||||||
|
menuBar = new wxMenuBar;
|
||||||
|
menuBar->Append(file_menu, "&File");
|
||||||
|
frame->SetMenuBar(menuBar);
|
||||||
|
|
||||||
|
int width, height;
|
||||||
|
frame->GetClientSize(&width, &height);
|
||||||
|
|
||||||
|
(void) new MyCanvas(frame);
|
||||||
|
|
||||||
|
// Show the frame
|
||||||
|
frame->Show(TRUE);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
|
EVT_CLOSE(MyFrame::OnCloseWindow)
|
||||||
|
EVT_MENU(wxID_EXIT, MyFrame::OnExit)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// My frame constructor
|
||||||
|
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||||
|
wxFrame(frame, -1, title, pos, size)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept menu commands
|
||||||
|
void MyFrame::OnExit(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
this->Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFrame::OnCloseWindow(wxCloseEvent& event)
|
||||||
|
{
|
||||||
|
static bool destroyed = FALSE;
|
||||||
|
if (destroyed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this->Destroy();
|
||||||
|
|
||||||
|
destroyed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(MyCanvas, wxWindow)
|
||||||
|
EVT_PAINT(MyCanvas::OnPaint)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
// Define a constructor for my canvas
|
||||||
|
MyCanvas::MyCanvas(wxFrame *frame):
|
||||||
|
wxWindow(frame, -1)
|
||||||
|
{
|
||||||
|
wxColour wxCol1(255,255,255);
|
||||||
|
SnowPen = wxPen(wxCol1, 2, wxSOLID);
|
||||||
|
|
||||||
|
wxColour wxCol2(128,0,0);
|
||||||
|
MtnPen = wxPen(wxCol2, 1, wxSOLID);
|
||||||
|
|
||||||
|
wxColour wxCol3(0,128,0);
|
||||||
|
GreenPen = wxPen(wxCol3, 1, wxSOLID);
|
||||||
|
|
||||||
|
wxColour wxCol4(0,0,128);
|
||||||
|
WaterBrush = wxBrush(wxCol4, wxSOLID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::OnPaint(wxPaintEvent& event)
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
Draw(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyCanvas::Draw(wxDC& dc)
|
||||||
|
{
|
||||||
|
if (running) return;
|
||||||
|
|
||||||
|
running = TRUE;
|
||||||
|
menuBar->EnableTop(0, FALSE);
|
||||||
|
|
||||||
|
Randomize();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
9
samples/fractal/fractal.def
Normal file
9
samples/fractal/fractal.def
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
NAME Fractal
|
||||||
|
DESCRIPTION 'Fractal'
|
||||||
|
EXETYPE WINDOWS
|
||||||
|
STUB 'WINSTUB.EXE'
|
||||||
|
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||||
|
DATA PRELOAD MOVEABLE MULTIPLE
|
||||||
|
HEAPSIZE 1024
|
||||||
|
STACKSIZE 16192
|
||||||
|
|
4
samples/fractal/fractal.rc
Normal file
4
samples/fractal/fractal.rc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
wxSTD_FRAME ICON "mondrian.ico"
|
||||||
|
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
|
|
64
samples/fractal/makefile.b32
Normal file
64
samples/fractal/makefile.b32
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.b32
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright:
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds fractal example
|
||||||
|
|
||||||
|
# WXWIN and BCCDIR are set by parent make
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
!include $(WXDIR)\src\makeb32.env
|
||||||
|
|
||||||
|
WXLIBDIR = $(WXDIR)\lib
|
||||||
|
WXINC = $(WXDIR)\include\msw
|
||||||
|
WXLIB = $(WXLIBDIR)\wx32.lib
|
||||||
|
LIBS=$(WXLIB) cw32 import32 ole2w32
|
||||||
|
|
||||||
|
TARGET=fractal
|
||||||
|
|
||||||
|
!if "$(FINAL)" == "0"
|
||||||
|
LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS= -v
|
||||||
|
!else
|
||||||
|
LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib
|
||||||
|
OPT = -Od
|
||||||
|
DEBUG_FLAGS =
|
||||||
|
!endif
|
||||||
|
CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||||
|
|
||||||
|
OBJECTS = fractal.obj
|
||||||
|
|
||||||
|
$(TARGET).exe: $(OBJECTS) $(TARGET).res
|
||||||
|
tlink32 $(LINKFLAGS) @&&!
|
||||||
|
c0w32.obj $(OBJECTS)
|
||||||
|
$(TARGET)
|
||||||
|
nul
|
||||||
|
$(LIBS)
|
||||||
|
$(TARGET).def
|
||||||
|
$(TARGET).res
|
||||||
|
!
|
||||||
|
|
||||||
|
.$(SRCSUFF).obj:
|
||||||
|
bcc32 $(CPPFLAGS) -c {$< }
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
bcc32 $(CPPFLAGS) -P- -c {$< }
|
||||||
|
|
||||||
|
fractal.obj: fractal.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
|
brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.rws
|
||||||
|
|
19
samples/fractal/makefile.bcc
Normal file
19
samples/fractal/makefile.bcc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.bcc
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
#
|
||||||
|
# Builds a BC++ 16-bit sample
|
||||||
|
|
||||||
|
!if "$(WXWIN)" == ""
|
||||||
|
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
|
||||||
|
!endif
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
TARGET=fractal
|
||||||
|
OBJECTS=$(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.bcc
|
||||||
|
|
17
samples/fractal/makefile.dos
Normal file
17
samples/fractal/makefile.dos
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.dos
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
#
|
||||||
|
# Makefile : Builds 16-bit sample, VC++ 1.5
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
|
# info
|
||||||
|
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
TARGET=fractal
|
||||||
|
OBJECTS=$(TARGET).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.msc
|
||||||
|
|
37
samples/fractal/makefile.g95
Normal file
37
samples/fractal/makefile.g95
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for fractal example (UNIX).
|
||||||
|
|
||||||
|
WXDIR = ../..
|
||||||
|
|
||||||
|
# All common UNIX compiler flags and options are now in
|
||||||
|
# this central makefile.
|
||||||
|
include $(WXDIR)/src/makeg95.env
|
||||||
|
|
||||||
|
OBJECTS = $(OBJDIR)/fractal.$(OBJSUFF) $(OBJDIR)/fractal_resources.$(OBJSUFF)
|
||||||
|
|
||||||
|
all: $(OBJDIR) fractal$(GUISUFFIX)$(EXESUFF)
|
||||||
|
|
||||||
|
wx:
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
mkdir $(OBJDIR)
|
||||||
|
|
||||||
|
fractal$(GUISUFFIX)$(EXESUFF): $(OBJECTS) $(WXLIB)
|
||||||
|
$(CC) $(LDFLAGS) -o fractal$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
|
||||||
|
|
||||||
|
$(OBJDIR)/fractal.$(OBJSUFF): fractal.$(SRCSUFF)
|
||||||
|
$(CC) -c $(CPPFLAGS) -o $@ fractal.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(OBJDIR)/fractal_resources.o: fractal.rc
|
||||||
|
$(RESCOMP) -i fractal.rc -o $(OBJDIR)/fractal_resources.o $(RESFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJECTS) fractal$(GUISUFFIX).exe core *.rsc *.res
|
64
samples/fractal/makefile.nt
Normal file
64
samples/fractal/makefile.nt
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.nt
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1993
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1993, AIAI, University of Edinburgh
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile : Builds fractal example (MS VC++).
|
||||||
|
# Use FINAL=1 argument to nmake to build final version with no debugging
|
||||||
|
# info
|
||||||
|
|
||||||
|
# Set WXDIR for your system
|
||||||
|
WXDIR = $(WXWIN)
|
||||||
|
|
||||||
|
WXUSINGDLL=0
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\ntwxwin.mak
|
||||||
|
|
||||||
|
THISDIR = $(WXDIR)\samples\fractal
|
||||||
|
PROGRAM=fractal
|
||||||
|
|
||||||
|
OBJECTS = $(PROGRAM).obj
|
||||||
|
|
||||||
|
$(PROGRAM): $(PROGRAM).exe
|
||||||
|
|
||||||
|
all: wx $(PROGRAM).exe
|
||||||
|
|
||||||
|
wx:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt FINAL=$(FINAL)
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
wxclean:
|
||||||
|
cd $(WXDIR)\src\msw
|
||||||
|
nmake -f makefile.nt clean
|
||||||
|
cd $(THISDIR)
|
||||||
|
|
||||||
|
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||||
|
$(link) @<<
|
||||||
|
-out:$(PROGRAM).exe
|
||||||
|
$(LINKFLAGS)
|
||||||
|
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
|
||||||
|
$(LIBS)
|
||||||
|
<<
|
||||||
|
|
||||||
|
|
||||||
|
$(PROGRAM).obj: $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
|
||||||
|
$(cc) @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc
|
||||||
|
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-erase *.obj
|
||||||
|
-erase *.exe
|
||||||
|
-erase *.res
|
||||||
|
-erase *.map
|
||||||
|
-erase *.sbr
|
||||||
|
-erase *.pdb
|
17
samples/fractal/makefile.unx
Normal file
17
samples/fractal/makefile.unx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# File: makefile.unx
|
||||||
|
# Author: Julian Smart
|
||||||
|
# Created: 1998
|
||||||
|
# Updated:
|
||||||
|
# Copyright: (c) 1998 Julian Smart
|
||||||
|
#
|
||||||
|
# "%W% %G%"
|
||||||
|
#
|
||||||
|
# Makefile for fractal example (UNIX).
|
||||||
|
|
||||||
|
PROGRAM=fractal
|
||||||
|
|
||||||
|
OBJECTS=$(PROGRAM).o
|
||||||
|
|
||||||
|
include ../../src/makeprog.env
|
||||||
|
|
15
samples/fractal/makefile.wat
Normal file
15
samples/fractal/makefile.wat
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#
|
||||||
|
# Makefile for WATCOM
|
||||||
|
#
|
||||||
|
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
|
||||||
|
# 8 Nov 1994
|
||||||
|
#
|
||||||
|
|
||||||
|
WXDIR = $(%WXWIN)
|
||||||
|
|
||||||
|
PROGRAM = fractal
|
||||||
|
OBJECTS = $(PROGRAM).obj
|
||||||
|
|
||||||
|
!include $(WXDIR)\src\makeprog.wat
|
||||||
|
|
||||||
|
|
BIN
samples/fractal/mondrian.ico
Normal file
BIN
samples/fractal/mondrian.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
Loading…
Reference in New Issue
Block a user