mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 11:54:00 +02:00
some bugfixes for silly compile errors and painting issues in windoze
This commit is contained in:
Binary file not shown.
@@ -117,7 +117,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalOptions="/arch:SSE2"
|
AdditionalOptions="/arch:SSE2"
|
||||||
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\msw";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common"
|
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\msw";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.14/include""
|
||||||
PreprocessorDefinitions="MWIN;__WXMSW__"
|
PreprocessorDefinitions="MWIN;__WXMSW__"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
ExceptionHandling="2"
|
ExceptionHandling="2"
|
||||||
|
@@ -10,15 +10,14 @@
|
|||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
#include "conversion.h"
|
#include "conversion.h"
|
||||||
|
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
|
#include "platform_common.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using namespace Shared::Util;
|
using namespace Shared::Util;
|
||||||
|
using namespace Shared::PlatformCommon;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace MapEditor {
|
namespace MapEditor {
|
||||||
@@ -288,10 +287,10 @@ MainWindow::MainWindow()
|
|||||||
this->panel->SetSizer(boxsizer);
|
this->panel->SetSizer(boxsizer);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
|
||||||
#ifndef WIN32
|
//#ifndef WIN32
|
||||||
timer = new wxTimer(this);
|
timer = new wxTimer(this);
|
||||||
timer->Start(100);
|
timer->Start(100);
|
||||||
#endif
|
//#endif
|
||||||
glCanvas->SetFocus();
|
glCanvas->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,13 +300,14 @@ void MainWindow::onToolPlayer(wxCommandEvent& event){
|
|||||||
|
|
||||||
void MainWindow::init(string fname) {
|
void MainWindow::init(string fname) {
|
||||||
glCanvas->SetCurrent();
|
glCanvas->SetCurrent();
|
||||||
|
|
||||||
program = new Program(glCanvas->GetClientSize().x, glCanvas->GetClientSize().y);
|
program = new Program(glCanvas->GetClientSize().x, glCanvas->GetClientSize().y);
|
||||||
|
|
||||||
fileName = "New (unsaved) Map";
|
fileName = "New (unsaved) Map";
|
||||||
if (!fname.empty() && fileExists(fname)) {
|
if (!fname.empty() && fileExists(fname)) {
|
||||||
program->loadMap(fname);
|
program->loadMap(fname);
|
||||||
currentFile = fname;
|
currentFile = fname;
|
||||||
fileName = cutLastExt(basename(fname.c_str()));
|
fileName = cutLastExt(extractFileFromDirectoryPath(fname.c_str()));
|
||||||
}
|
}
|
||||||
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
||||||
setDirty(false);
|
setDirty(false);
|
||||||
@@ -355,6 +355,9 @@ void MainWindow::setExtension() {
|
|||||||
void MainWindow::onTimer(wxTimerEvent &event) {
|
void MainWindow::onTimer(wxTimerEvent &event) {
|
||||||
wxPaintEvent paintEvent;
|
wxPaintEvent paintEvent;
|
||||||
onPaint(paintEvent);
|
onPaint(paintEvent);
|
||||||
|
#ifdef WIN32
|
||||||
|
Update();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) {
|
void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) {
|
||||||
@@ -414,7 +417,7 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
|
|||||||
if (fileDialog.ShowModal() == wxID_OK) {
|
if (fileDialog.ShowModal() == wxID_OK) {
|
||||||
currentFile = fileDialog.GetPath().ToAscii();
|
currentFile = fileDialog.GetPath().ToAscii();
|
||||||
program->loadMap(currentFile);
|
program->loadMap(currentFile);
|
||||||
fileName = cutLastExt(basename(currentFile.c_str()));
|
fileName = cutLastExt(extractFileFromDirectoryPath(currentFile.c_str()));
|
||||||
setDirty(false);
|
setDirty(false);
|
||||||
setExtension();
|
setExtension();
|
||||||
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
||||||
@@ -439,7 +442,7 @@ void MainWindow::onMenuFileSaveAs(wxCommandEvent &event) {
|
|||||||
currentFile = fileDialog.GetPath().ToAscii();
|
currentFile = fileDialog.GetPath().ToAscii();
|
||||||
setExtension();
|
setExtension();
|
||||||
program->saveMap(currentFile);
|
program->saveMap(currentFile);
|
||||||
fileName = cutLastExt(basename(currentFile.c_str()));
|
fileName = cutLastExt(extractFileFromDirectoryPath(currentFile.c_str()));
|
||||||
setDirty(false);
|
setDirty(false);
|
||||||
}
|
}
|
||||||
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
||||||
@@ -910,6 +913,7 @@ void GlCanvas::onKeyDown(wxKeyEvent &event) {
|
|||||||
mainWindow->onKeyDown(event);
|
mainWindow->onKeyDown(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas)
|
BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas)
|
||||||
EVT_KEY_DOWN(GlCanvas::onKeyDown)
|
EVT_KEY_DOWN(GlCanvas::onKeyDown)
|
||||||
|
|
||||||
@@ -926,7 +930,7 @@ void SimpleDialog::addValue(const string &key, const string &value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string SimpleDialog::getValue(const string &key) {
|
string SimpleDialog::getValue(const string &key) {
|
||||||
for (int i = 0; i < values.size(); ++i) {
|
for (unsigned int i = 0; i < values.size(); ++i) {
|
||||||
if (values[i].first == key) {
|
if (values[i].first == key) {
|
||||||
return values[i].second;
|
return values[i].second;
|
||||||
}
|
}
|
||||||
@@ -952,7 +956,7 @@ void SimpleDialog::show() {
|
|||||||
|
|
||||||
ShowModal();
|
ShowModal();
|
||||||
|
|
||||||
for (int i = 0; i < texts.size(); ++i) {
|
for (unsigned int i = 0; i < texts.size(); ++i) {
|
||||||
values[i].second = texts[i]->GetValue().ToAscii();
|
values[i].second = texts[i]->GetValue().ToAscii();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -970,6 +974,15 @@ bool App::OnInit() {
|
|||||||
mainWindow = new MainWindow();
|
mainWindow = new MainWindow();
|
||||||
mainWindow->Show();
|
mainWindow->Show();
|
||||||
mainWindow->init(fileparam);
|
mainWindow->init(fileparam);
|
||||||
|
mainWindow->Update();
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
wxPoint pos = mainWindow->GetScreenPosition();
|
||||||
|
wxSize size = mainWindow->GetSize();
|
||||||
|
mainWindow->SetSize(pos.x, pos.y, size.x-1, size.y, wxSIZE_FORCE);
|
||||||
|
mainWindow->Update();
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,11 +22,10 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "checksum.h"
|
#include "checksum.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
@@ -112,6 +111,7 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(ve
|
|||||||
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector<std::pair<string,int32> > *recursiveMap);
|
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector<std::pair<string,int32> > *recursiveMap);
|
||||||
|
|
||||||
void createDirectoryPaths(string Path);
|
void createDirectoryPaths(string Path);
|
||||||
|
string extractFileFromDirectoryPath(string filename);
|
||||||
string extractDirectoryPathFromFile(string filename);
|
string extractDirectoryPathFromFile(string filename);
|
||||||
string extractExtension(const string& filename);
|
string extractExtension(const string& filename);
|
||||||
|
|
||||||
|
@@ -558,9 +558,32 @@ vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(co
|
|||||||
return crcTreeCache[cacheKey];
|
return crcTreeCache[cacheKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string extractFileFromDirectoryPath(string filename)
|
||||||
|
{
|
||||||
|
size_t lastDirectory_Win = filename.find_last_of('\\');
|
||||||
|
size_t lastDirectory_Lin = filename.find_last_of('/');
|
||||||
|
size_t lastDirectory = (lastDirectory_Win<lastDirectory_Lin)?lastDirectory_Lin:lastDirectory_Win;
|
||||||
|
|
||||||
|
//return filename.substr( 0, filename.rfind("/")+1 );
|
||||||
|
if (lastDirectory == string::npos) {
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename.erase( 0, lastDirectory + 1);
|
||||||
|
}
|
||||||
|
|
||||||
string extractDirectoryPathFromFile(string filename)
|
string extractDirectoryPathFromFile(string filename)
|
||||||
{
|
{
|
||||||
return filename.substr( 0, filename.rfind("/")+1 );
|
size_t lastDirectory_Win = filename.find_last_of('\\');
|
||||||
|
size_t lastDirectory_Lin = filename.find_last_of('/');
|
||||||
|
size_t lastDirectory = (lastDirectory_Win<lastDirectory_Lin)?lastDirectory_Lin:lastDirectory_Win;
|
||||||
|
|
||||||
|
//return filename.substr( 0, filename.rfind("/")+1 );
|
||||||
|
if (lastDirectory == string::npos) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename.substr( 0, lastDirectory + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
string extractExtension(const string& filepath) {
|
string extractExtension(const string& filepath) {
|
||||||
|
Reference in New Issue
Block a user