Commits

Christian Fischer committed fa88967

fixed some compiler issues (mainly visual studio)

  • Participants
  • Parent commits 0ab813c

Comments (0)

Files changed (12)

File build/build.cmake

 
 
 
+# some default preprocessor flags
+add_definitions(-DNOMINMAX)
+
+# windows specific preprocessor flags
+if (WIN32)
+	add_definitions(-DUNICODE)
+endif(WIN32)
+
+
 # enable warnings?
 option(WIESEL_BUILD_WARN_ALL "Enable all warnings on build. (gcc option -Wall)" ON)
 if (WIESEL_BUILD_WARN_ALL)

File samples/HelloWiesel/android/jni/Android.mk

 # configure the application's build
 LOCAL_MODULE                  := main
 LOCAL_SRC_FILES               := $(MY_FILES)
+LOCAL_C_INCLUDES              := $(MY_LOCAL_FOLDERS)
 LOCAL_LDLIBS                  :=
 LOCAL_STATIC_LIBRARIES        := wiesel-common wiesel-core
 LOCAL_WHOLE_STATIC_LIBRARIES  := wiesel-android wiesel-opengl

File src/base/wiesel/util/thread.h

 
 #include "wiesel/wiesel-base-config.h"
 
+#include <stdint.h>
+
 #if WIESEL_THREADAPI_PTHREAD
 #	include <pthread.h>
 #endif

File src/common/wiesel/io/generic_root_fs.cpp

 using namespace std;
 
 
+
+#if defined(_MSC_VER)
+	static std::wstring str2wstr(const std::string& str) {
+		wchar_t *buffer = new wchar_t[str.length() + 1];
+		buffer[str.size()] = '\0';
+		MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, buffer, (int)str.length());
+
+		std::wstring result = buffer;
+		delete[] buffer;
+
+		return result;
+	}
+
+
+	static std::string wstr2str(const std::wstring& wstr) {
+		char *buffer = new char[wstr.length() + 1];
+		buffer[wstr.size()] = '\0';
+		WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, buffer, (int)wstr.length(), NULL, NULL);
+
+		std::string result = buffer;
+		delete[] buffer;
+
+		return result;
+	}
+#endif
+
+
 GenericFileSystem::GenericFileSystem() {
 	root = new GenericFileSystemDirectory(this, NULL, "");
 	keep(root);
 		HANDLE hFind;
 		WIN32_FIND_DATA ffd;
 
-		if ((hFind = FindFirstFile(fullpath.c_str(), &ffd)) != INVALID_HANDLE_VALUE){
+		if ((hFind = FindFirstFile(str2wstr(fullpath).c_str(), &ffd)) != INVALID_HANDLE_VALUE){
 			do {
 				if((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
 					continue;
 				}
 
-				directories.push_back(new GenericFileSystemDirectory(fs, this, ffd.cFileName));
+				directories.push_back(new GenericFileSystemDirectory(fs, this, wstr2str(ffd.cFileName)));
 			}
 			while(FindNextFile(hFind, &ffd));
 
 		HANDLE hFind;
 		WIN32_FIND_DATA ffd;
 
-		if ((hFind = FindFirstFile((getFullPath() + "/*").c_str(), &ffd)) != INVALID_HANDLE_VALUE){
+		if ((hFind = FindFirstFile(str2wstr(getFullPath() + "/*").c_str(), &ffd)) != INVALID_HANDLE_VALUE){
 			do {
 				if((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
 					continue;
 				}
 
-				files.push_back(new GenericFileSystemFile(this, ffd.cFileName));
+				files.push_back(new GenericFileSystemFile(this, wstr2str(ffd.cFileName)));
 			}
 			while(FindNextFile(hFind, &ffd));
 

File src/core/wiesel/application.h

 		 * @brief Get the topmost scene in the scene stack.
 		 * @return the topmost scene, or \c NULL, when the scene stack is empty.
 		 */
-		inline Scene *getTopScene();
+		Scene *getTopScene();
 
 		/**
 		 * @brief Provides access to the scene stack.

File src/core/wiesel/engine.cpp

 
 
 Engine::Engine() {
-	mainthread			= new Thread();
+	mainthread			= keep(new Thread());
 
 	exit_requested		= false;
 	application			= NULL;
 
 Engine::~Engine() {
 	shutdown();
+
+	safe_release(mainthread);
+
 	return;
 }
 

File src/core/wiesel/engine.h

 	
 	// instance members
 	private:
-		ref<Thread>						mainthread;
+		Thread*							mainthread;
 
 		std::vector<IRunnable*>			run_once;
 		std::vector<IUpdateable*>		updateables;

File src/directx11/wiesel/dx11/dx11.h

 
 #include <wiesel/wiesel-directx11.def>
 
-#define UNICODE
 #include <Windows.h>
 #include <d3dcommon.h>
 #include <d3d11.h>

File src/directx11/wiesel/dx11/video/dx11_texture_content.cpp

 	releaseTexture();
 
 	DataSource *data = getTexture()->getSource();
-	Image *image = NULL;
+	ref<Image> image = NULL;
 	dimension new_original_size;
 
 	std::vector<ModuleLoader<IImageLoader>*> loaders = ModuleRegistry::getInstance()->findModules<IImageLoader>();

File src/net/wiesel/io/net/connection.h

 #include <wiesel/util/listener_support.h>
 #include <wiesel/wiesel-net.def>
 
+#include <stdint.h>
 #include <string>
 
 namespace wiesel {

File src/win32/wiesel/win32/loaders/gdiplus_image_loader.cpp

 #include <stdint.h>
 #include <string>
 
+// dirty, dirty...
+#if defined(NOMINMAX)
+#	define min(a,b)		std::min(a,b)
+#	define max(a,b)		std::max(a,b)
+#endif
+
+#include <gdiplus.h>
+
 
 using namespace wiesel;
 using namespace wiesel::win32;

File src/win32/wiesel/win32/loaders/gdiplus_image_loader.h

 #include <wiesel/wiesel-win32.def>
 
 #include <windows.h>
-#include <gdiplus.h>
 
 
 namespace wiesel {