From 35d531b1e655085b3456fddace9934bd98185a57 Mon Sep 17 00:00:00 2001 From: Matthew Blaine Date: Wed, 28 Mar 2012 02:24:41 -0400 Subject: [PATCH] Fixing compiler warnings. Tried to update build instructions for windows. --- DiamondsFrame.cpp | 13 +++-- SDL_util.cpp | 2 +- SDL_util.h | 2 +- build-win32-mingw/BUILD-WIN32-MINGW.txt | 16 ++++++- build-win32-mingw/Makefile | 63 +++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 build-win32-mingw/Makefile diff --git a/DiamondsFrame.cpp b/DiamondsFrame.cpp index aff1e9a..455bb9f 100644 --- a/DiamondsFrame.cpp +++ b/DiamondsFrame.cpp @@ -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(); @@ -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" @@ -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(); diff --git a/SDL_util.cpp b/SDL_util.cpp index b7e41a0..d272334 100644 --- a/SDL_util.cpp +++ b/SDL_util.cpp @@ -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; diff --git a/SDL_util.h b/SDL_util.h index 6f3d8b0..340e3cd 100644 --- a/SDL_util.h +++ b/SDL_util.h @@ -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); diff --git a/build-win32-mingw/BUILD-WIN32-MINGW.txt b/build-win32-mingw/BUILD-WIN32-MINGW.txt index 8966192..3895b66 100644 --- a/build-win32-mingw/BUILD-WIN32-MINGW.txt +++ b/build-win32-mingw/BUILD-WIN32-MINGW.txt @@ -20,6 +20,15 @@ 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. @@ -27,9 +36,12 @@ Building Diamonds on Windows with MinGW 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 diff --git a/build-win32-mingw/Makefile b/build-win32-mingw/Makefile new file mode 100644 index 0000000..d371d15 --- /dev/null +++ b/build-win32-mingw/Makefile @@ -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