Skip to content

Commit

Permalink
Fixing compiler warnings. Tried to update build instructions for wind…
Browse files Browse the repository at this point in the history
…ows.
  • Loading branch information
mblaine committed Mar 28, 2012
1 parent c236e3d commit 35d531b
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 8 deletions.
13 changes: 9 additions & 4 deletions DiamondsFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,16 @@ DiamondsFrame::DiamondsFrame() : wxFrame()
SetMenuBar(menuBar);

//program icons
#ifdef __WXMSW__
wxImage::AddHandler( new wxICOHandler );
SetIcon(wxIcon(wxT("A"), wxBITMAP_TYPE_ICO_RESOURCE));
#else
wxIconBundle icons;
wxImage::AddHandler( new wxXPMHandler );
icons.AddIcon(wxT("data/diamonds.xpm"), wxBITMAP_TYPE_XPM);
icons.AddIcon(wxT("data/diamonds16.xpm"), wxBITMAP_TYPE_XPM);
icons.AddIcon(wxT("data/diamonds.xpm"), wxBITMAP_TYPE_XPM);
SetIcons(icons);
#endif

//read in or create new high scores file
scores = new HiScore();
Expand Down Expand Up @@ -396,7 +401,7 @@ void DiamondsFrame::OnAbout(wxCommandEvent&)

wxDialog dialog(this, wxID_ANY, wxT("About Diamonds"), wxDefaultPosition, wxDefaultSize);
wxPanel panel(&dialog, wxID_ANY);
wxStaticBox box(&panel, wxID_ANY, wxT("Diamonds 0.4"), wxPoint(5, 5), wxSize(340, 175));
wxStaticBox box(&panel, wxID_ANY, wxT("Diamonds 0.4"), wxPoint(5, 5), wxSize(350, 175));
wxStaticText text(&panel, wxID_ANY,
wxT("Diamonds is a tribute to the original game, created by Oliver "
"Dreer and released by Varcon Systems in 1992.\n\n"
Expand All @@ -405,13 +410,13 @@ void DiamondsFrame::OnAbout(wxCommandEvent&)
"Source available at https://github.com/mblaine/Diamonds/\n\n"
"© 2008 Matthew Blaine"
),
wxPoint(15, 25), wxSize(325, 125));
wxPoint(15, 25), wxSize(335, 125));
wxButton okButton(&panel, wxID_OK, wxT("&OK"), wxPoint(138, 150), wxDefaultSize);

vbox->Add(&panel, 1);

dialog.SetSizer(vbox);
dialog.SetClientSize(350, 185);
dialog.SetClientSize(360, 185);
dialog.Centre();
dialog.ShowModal();
dialog.Destroy();
Expand Down
2 changes: 1 addition & 1 deletion SDL_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SDL_Color SDL_RGB(int r, int g, int b)
return color;
}

SDL_Surface* LoadSurface(char* filename)
SDL_Surface* LoadSurface(const char* filename)
{
SDL_Surface *temp, *surface;

Expand Down
2 changes: 1 addition & 1 deletion SDL_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

SDL_Color SDL_RGB(int r, int g, int b);

SDL_Surface* LoadSurface(char* filename);
SDL_Surface* LoadSurface(const char* filename);

int Blit(SDL_Surface* src, int fromX, int fromY, int width, int height,
SDL_Surface* dst, int toX, int toY);
Expand Down
16 changes: 14 additions & 2 deletions build-win32-mingw/BUILD-WIN32-MINGW.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,28 @@ Building Diamonds on Windows with MinGW
Diamonds will need access to the headers from the wxWidgets include
directory and to be linked with two of the produced library files:
libwxbase*.a and libwxmsw*_core.a.

After you have the wxWidgets source, follow the instructions in
BuildCVS.txt in the root of wherever the sources where extracted. I was
able to use the command mingw32-make -f makefile.gcc SHARED=0 BUILD=release

Once that completes the *.a libraries should be in wxWidgets/lib/gcc_lib.
When building Diamonds g++ will need access to the /includes/ directory
under wxWidgets, but first you'll need to copy the setup.h referenced in
BuildCVS.txt up one directory to builds/wx.

2. Copy the contents of this directory (build-win32-mingw) one level up to
where the rest of Diamonds' source is.

If you use the Dev-C++ IDE (bloodshed.net) you should be able to open the
included Diamonds.dev file and use it to compile Diamonds.

If not, try using the included makefile, which was automatically generated
by Dev-C++.
If not, try using one of the included makefiles. You'll probably need to
edit the paths. Makefile.win was automatically generated by Dev-C++,
Makefile was edited from there manually to work by itself without an ide
filling out path information.

mingw32-make
mingw32-make -f Makefile.win

Either way, it's important g++ is able to find the necessary headers and
Expand Down
63 changes: 63 additions & 0 deletions build-win32-mingw/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES = Diamonds_private.res
OBJ = DiamondsApp.o Constants.o SDLPanel.o SDL_util.o Ball.o Field.o HiScore.o Globals.o DiamondsFrame.o SDLSound.o Levelset.o Settings.o $(RES)
LINKOBJ = DiamondsApp.o Constants.o SDLPanel.o SDL_util.o Ball.o Field.o HiScore.o Globals.o DiamondsFrame.o SDLSound.o Levelset.o Settings.o $(RES)
LIBS = -L"lib" -mwindows -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf -lwxmsw28_core -lwxbase28 -lcomdlg32 -luser32 -lgdi32 -lole32 -lwsock32 -lcomctl32 -lctl3d32 -lgcc -lstdc++ -lshell32 -loleaut32 -ladvapi32 -luuid -lwinspool -s
INCS = -I"include"
CXXINCS = -I"C:/MinGW/include/SDL" -I"C:/MinGW/include/wxWidgets" -I"include"
BIN = diamonds.exe
CXXFLAGS = $(CXXINCS) -Wall
CFLAGS = $(INCS) -Wall
RM = rm -f

.PHONY: all all-before all-after clean clean-custom

all: all-before diamonds.exe all-after


clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "diamonds.exe" $(LIBS)

DiamondsApp.o: DiamondsApp.cpp
$(CPP) -c DiamondsApp.cpp -o DiamondsApp.o $(CXXFLAGS)

Constants.o: Constants.cpp
$(CPP) -c Constants.cpp -o Constants.o $(CXXFLAGS)

SDLPanel.o: SDLPanel.cpp
$(CPP) -c SDLPanel.cpp -o SDLPanel.o $(CXXFLAGS)

SDL_util.o: SDL_util.cpp
$(CPP) -c SDL_util.cpp -o SDL_util.o $(CXXFLAGS)

Ball.o: Ball.cpp
$(CPP) -c Ball.cpp -o Ball.o $(CXXFLAGS)

Field.o: Field.cpp
$(CPP) -c Field.cpp -o Field.o $(CXXFLAGS)

HiScore.o: HiScore.cpp
$(CPP) -c HiScore.cpp -o HiScore.o $(CXXFLAGS)

Globals.o: Globals.cpp
$(CPP) -c Globals.cpp -o Globals.o $(CXXFLAGS)

DiamondsFrame.o: DiamondsFrame.cpp
$(CPP) -c DiamondsFrame.cpp -o DiamondsFrame.o $(CXXFLAGS)

SDLSound.o: SDLSound.cpp
$(CPP) -c SDLSound.cpp -o SDLSound.o $(CXXFLAGS)

Levelset.o: Levelset.cpp
$(CPP) -c Levelset.cpp -o Levelset.o $(CXXFLAGS)

Settings.o: Settings.cpp
$(CPP) -c Settings.cpp -o Settings.o $(CXXFLAGS)

Diamonds_private.res: Diamonds_private.rc
$(WINDRES) -i Diamonds_private.rc --input-format=rc -o Diamonds_private.res -O coff

0 comments on commit 35d531b

Please sign in to comment.