diff options
author | Larry Hajali <larryhaja[at]gmail[dot]com> | 2010-05-13 00:26:25 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-13 00:26:25 +0200 |
commit | 971596f5c35c82f9698c2866c16c7684cd6184eb (patch) | |
tree | effb137a45c936565d94553fe2e6fc10288d9cce /games/glest/patches/g3d_viewer.patch | |
parent | a2b88d12b1bf7a747702a52f0500cbbdccf9e521 (diff) | |
download | slackbuilds-971596f5c35c82f9698c2866c16c7684cd6184eb.tar.gz |
games/glest: Updated for version 3.2.2
Diffstat (limited to 'games/glest/patches/g3d_viewer.patch')
-rw-r--r-- | games/glest/patches/g3d_viewer.patch | 277 |
1 files changed, 277 insertions, 0 deletions
diff --git a/games/glest/patches/g3d_viewer.patch b/games/glest/patches/g3d_viewer.patch new file mode 100644 index 0000000000..279f602be9 --- /dev/null +++ b/games/glest/patches/g3d_viewer.patch @@ -0,0 +1,277 @@ +Index: source/g3d_viewer/main.cpp +=================================================================== +--- source/g3d_viewer/main.cpp (Revision 191) ++++ source/g3d_viewer/main.cpp (Arbeitskopie) +@@ -2,7 +2,6 @@ + + #include <stdexcept> + +-#include "graphics_factory_basic_gl.h" + #include "graphics_interface.h" + #include "util.h" + +@@ -11,8 +10,15 @@ + using namespace Shared::Graphics::Gl; + using namespace Shared::Util; + +-using namespace std; ++using std::exception; + ++#if (wxUSE_UNICODE == 1) ++#define STRCONV(x) wxConvUTF8.cMB2WC(x) ++#else ++#define STRCONV(x) x ++#endif ++ ++ + namespace Shared{ namespace G3dViewer{ + + // =============================================== +@@ -24,7 +30,7 @@ + + MainWindow::MainWindow(const string &modelPath): + wxFrame( +- NULL, -1, winHeader.c_str(), ++ NULL, -1, STRCONV(winHeader.c_str()), + wxPoint(Renderer::windowX, Renderer::windowY), + wxSize(Renderer::windowW, Renderer::windowH)) + { +@@ -37,38 +43,33 @@ + + glCanvas = new GlCanvas(this); + +- glCanvas->SetCurrent(); +- +- renderer->init(); +- +- + menu= new wxMenuBar(); + + //menu + menuFile= new wxMenu(); +- menuFile->Append(miFileLoad, "Load"); +- menu->Append(menuFile, "File"); ++ menuFile->Append(miFileLoad, wxT("Load")); ++ menu->Append(menuFile, wxT("File")); + + //mode + menuMode= new wxMenu(); +- menuMode->AppendCheckItem(miModeNormals, "Normals"); +- menuMode->AppendCheckItem(miModeWireframe, "Wireframe"); +- menuMode->AppendCheckItem(miModeGrid, "Grid"); +- menu->Append(menuMode, "Mode"); ++ menuMode->AppendCheckItem(miModeNormals, wxT("Normals")); ++ menuMode->AppendCheckItem(miModeWireframe, wxT("Wireframe")); ++ menuMode->AppendCheckItem(miModeGrid, wxT("Grid")); ++ menu->Append(menuMode, wxT("Mode")); + + //mode + menuSpeed= new wxMenu(); +- menuSpeed->Append(miSpeedSlower, "Slower"); +- menuSpeed->Append(miSpeedFaster, "Faster"); +- menu->Append(menuSpeed, "Speed"); ++ menuSpeed->Append(miSpeedSlower, wxT("Slower")); ++ menuSpeed->Append(miSpeedFaster, wxT("Faster")); ++ menu->Append(menuSpeed, wxT("Speed")); + + //custom color + menuCustomColor= new wxMenu(); +- menuCustomColor->AppendCheckItem(miColorRed, "Red"); +- menuCustomColor->AppendCheckItem(miColorBlue, "Blue"); +- menuCustomColor->AppendCheckItem(miColorYellow, "Yellow"); +- menuCustomColor->AppendCheckItem(miColorGreen, "Green"); +- menu->Append(menuCustomColor, "Custom Color"); ++ menuCustomColor->AppendCheckItem(miColorRed, wxT("Red")); ++ menuCustomColor->AppendCheckItem(miColorBlue, wxT("Blue")); ++ menuCustomColor->AppendCheckItem(miColorYellow, wxT("Yellow")); ++ menuCustomColor->AppendCheckItem(miColorGreen, wxT("Green")); ++ menu->Append(menuCustomColor, wxT("Custom Color")); + + menuMode->Check(miModeGrid, true); + menuCustomColor->Check(miColorRed, true); +@@ -88,13 +89,6 @@ + + timer = new wxTimer(this); + timer->Start(40); +- +- if(!modelPath.empty()){ +- Model *tmpModel= new ModelGl(); +- renderer->loadTheModel(tmpModel, modelPath); +- model= tmpModel; +- GetStatusBar()->SetStatusText(getModelInfo().c_str()); +- } + } + + MainWindow::~MainWindow(){ +@@ -104,6 +98,17 @@ + delete glCanvas; + } + ++void MainWindow::init(){ ++ glCanvas->SetCurrent(); ++ renderer->init(); ++ if(!modelPath.empty()){ ++ Model *tmpModel= new ModelGl(); ++ renderer->loadTheModel(tmpModel, modelPath); ++ model= tmpModel; ++ GetStatusBar()->SetStatusText(STRCONV(getModelInfo().c_str())); ++ } ++} ++ + void MainWindow::onPaint(wxPaintEvent &event){ + renderer->reset(GetClientSize().x, GetClientSize().y, playerColor); + renderer->transform(rotX, rotY, zoom); +@@ -141,13 +146,14 @@ + void MainWindow::onMenuFileLoad(wxCommandEvent &event){ + string fileName; + wxFileDialog fileDialog(this); +- fileDialog.SetWildcard("G3D files (*.g3d)|*.g3d"); ++ fileDialog.SetWildcard(wxT("G3D files (*.g3d)|*.g3d")); + if(fileDialog.ShowModal()==wxID_OK){ + delete model; + Model *tmpModel= new ModelGl(); +- renderer->loadTheModel(tmpModel, fileDialog.GetPath().c_str()); ++ fileName = wxFNCONV(fileDialog.GetPath()); ++ renderer->loadTheModel(tmpModel, fileName); + model= tmpModel; +- GetStatusBar()->SetStatusText(getModelInfo().c_str()); ++ GetStatusBar()->SetStatusText(wxString(getModelInfo().c_str(), wxConvUTF8)); + } + } + +@@ -252,7 +258,7 @@ + // ===================================================== + + GlCanvas::GlCanvas(MainWindow * mainWindow): +- wxGLCanvas(mainWindow, -1) ++ wxGLCanvas(mainWindow, -1, wxDefaultPosition) + { + this->mainWindow = mainWindow; + } +@@ -261,13 +267,8 @@ + mainWindow->onMouseMove(event); + } + +-void GlCanvas::onPaint(wxPaintEvent &event){ +- mainWindow->onPaint(event); +-} +- + BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas) + EVT_MOTION(GlCanvas::onMouseMove) +- EVT_PAINT(GlCanvas::onPaint) + END_EVENT_TABLE() + + // =============================================== +@@ -277,11 +278,12 @@ + bool App::OnInit(){ + string modelPath; + if(argc==2){ +- modelPath= argv[1]; ++ modelPath = wxFNCONV(argv[1]); + } + + mainWindow= new MainWindow(modelPath); + mainWindow->Show(); ++ mainWindow->init(); + return true; + } + +@@ -290,9 +292,9 @@ + return wxApp::MainLoop(); + } + catch(const exception &e){ +- wxMessageDialog(NULL, e.what(), "Exception", wxOK | wxICON_ERROR).ShowModal(); +- return 0; ++ wxMessageDialog(NULL, STRCONV(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal(); + } ++ return 0; + } + + int App::OnExit(){ +Index: source/g3d_viewer/main.h +=================================================================== +--- source/g3d_viewer/main.h (Revision 191) ++++ source/g3d_viewer/main.h (Arbeitskopie) +@@ -7,12 +7,13 @@ + #include <wx/timer.h> + #include <wx/glcanvas.h> + ++#include "graphics_factory_basic_gl.h" + #include "renderer.h" + #include "util.h" + #include "window.h" + +-using Shared::Platform::Window; +-using Shared::Platform::MouseState; ++//using Shared::Platform::Window; ++//using Shared::Platform::MouseState; + + using std::string; + +@@ -70,6 +71,8 @@ + MainWindow(const string &modelPath); + ~MainWindow(); + ++ void init(); ++ + void Notify(); + + void onPaint(wxPaintEvent &event); +Index: mk/linux/Jamfile +=================================================================== +--- mk/linux/Jamfile (Revision 191) ++++ mk/linux/Jamfile (Arbeitskopie) +@@ -26,7 +26,7 @@ + } + + Library glestlib : $(LIB_SOURCES) ; +-ExternalLibs glestlib : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ; ++ExternalLibs glestlib : SDL GL GLU XERCES VORBISFILE OPENAL LUA ; + IncludeDir glestlib : $(LIB_INCLUDE_DIRS) ; + + #### Game #### +@@ -55,7 +55,7 @@ + + Application glest : $(GLEST_SOURCES) ; + LinkWith glest : glestlib ; +-ExternalLibs glest : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ; ++ExternalLibs glest : SDL GL GLU XERCES VORBISFILE OPENAL LUA ; + IncludeDir glest : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_DIRS) ; + + #### Editor #### +@@ -69,7 +69,22 @@ + + Application glest_editor : $(GLEST_MAP_SOURCES) ; + LinkWith glest_editor : glestlib ; +- ExternalLibs glest_editor : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL WX ; ++ ExternalLibs glest_editor : SDL GL GLU XERCES VORBISFILE OPENAL WX ; + IncludeDir glest_editor : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_MAP_DIRS) ; + } + ++### Viewer ### ++if $(WX_AVAILABLE) = "yes" { ++ SubDir TOP g3d_viewer ; ++ ++ GLEST_VIEWER_DIRS = . ; ++ for i in $(GLEST_DIRS) { ++ GLEST_VIEWER_SOURCES += [ Wildcard $(i) : *.cpp *.h ] ; ++ } ++ ++ Application glest_g3dviewer : $(GLEST_VIEWER_SOURCES) ; ++ LinkWith glest_g3dviewer : glestlib ; ++ ExternalLibs glest_g3dviewer : SDL GL GLU XERCES VORBISFILE OPENAL WX ; ++ IncludeDir glest_g3dviewer : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_VIEWER_DIRS) ; ++} ++ +Index: mk/linux/autogen.sh +=================================================================== +--- mk/linux/autogen.sh (Revision 191) ++++ mk/linux/autogen.sh (Arbeitskopie) +@@ -34,4 +34,6 @@ + if [ ! -d glest_map_editor ]; then + ln -sf ../../source/glest_map_editor . + fi +- ++if [ ! -d g3d_viewer ]; then ++ ln -sf ../../source/g3d_viewer . ++fi |