Просмотр исходного кода

Merge branch 'master' of https://github.com/taylor001/crown

mikymod 12 лет назад
Родитель
Сommit
afa350ab2d

+ 1 - 1
CMakeLists.txt

@@ -65,7 +65,7 @@ endif (CROWN_BUILD MATCHES "linux-debug-32")
 
 # executable name
 set (CROWN_EXECUTABLE_NAME crown-${CROWN_BUILD})
-set (CROWN_LIBRARY_NAME crown-${CROWN_BUILD})
+set (CROWN_LIBRARY_NAME crown-lib-${CROWN_BUILD})
 
 # always build the engine
 add_subdirectory(engine)

+ 1 - 1
engine/core/filesystem/DiskFilesystem.h

@@ -38,7 +38,7 @@ namespace crown
 /// to its absolute counterpart based on the file source's root path.
 /// Accessing files using absolute path directly is also possible,
 /// but platform-specific and thus generally not recommended.
-class DiskFilesystem : public Filesystem
+class CE_EXPORT  DiskFilesystem : public Filesystem
 {
 public:
 

+ 2 - 2
engine/core/json/JSONParser.h

@@ -39,7 +39,7 @@ class DynamicString;
 /// Represents a JSON element.
 /// The objects of this class are valid until the parser
 /// which has generated them, will exist.
-class JSONElement
+class CE_EXPORT JSONElement
 {
 public:
 
@@ -158,7 +158,7 @@ private:
 };
 
 /// Parses JSON documents.
-class JSONParser
+class CE_EXPORT JSONParser
 {
 public:
 

+ 7 - 22
engine/os/win/AtomicInt.h

@@ -27,6 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Types.h"
+#include "windows.h"
 
 namespace crown
 {
@@ -38,35 +39,19 @@ struct AtomicInt
 		m_value = value;
 	}
 
-	AtomicInt& operator+=(int32_t value)
+	int load() const
 	{
-		InterlockedAdd(&m_value, value);
-		return *this;
-	}
-
-	AtomicInt& operator++(void)
-	{
-		InterlockedIncrement(&m_value);
-	}
-
-	AtomicInt& operator--(void)
-	{
-		InterlockedDecrement(&m_value);
-	}
-
-	AtomicInt& operator=(int32_t value)
-	{
-		InterlockedExchange(&m_value, value);
+		InterlockedExchangeAdd(&m_value, (int32_t)0);
+		return m_value;
 	}
 
-	operator int32_t()
+	void store(int val)
 	{
-		return m_value;
+		InterlockedExchange(&m_value, val);
 	}
 
 private:
-
-	LONG m_value;
+	mutable LONG m_value;
 };
 
 } // namespace crown

+ 3 - 1
engine/os/win/WinOS.cpp

@@ -141,7 +141,9 @@ bool is_directory(const char* path)
 //-----------------------------------------------------------------------------
 bool is_file(const char* path)
 {
-	return !is_directory(path);
+	DWORD fileAttr;
+	fileAttr = GetFileAttributes(path);
+	return (fileAttr != INVALID_FILE_ATTRIBUTES && (fileAttr & FILE_ATTRIBUTE_DIRECTORY) == 0);
 }
 
 //-----------------------------------------------------------------------------

+ 3 - 3
engine/os/win/main.cpp

@@ -429,7 +429,7 @@ public:
 		OsEvent event;
 		do
 		{
-			m_queue.pop_event(&event);
+			m_queue.pop_event(event);
 
 			if (event.type != OsEvent::NONE)
 			{
@@ -841,7 +841,7 @@ public:
 			DynamicString boot;
 			root.key("boot").to_string(boot);
 
-			string::strncpy(m_boot_file, boot, (boot.length() > MAX_PATH_LENGTH) ? MAX_PATH_LENGTH : boot.length() + 1);
+			string::strncpy(m_boot_file, boot.c_str(), (boot.length() > MAX_PATH_LENGTH) ? MAX_PATH_LENGTH : boot.length() + 1);
 		}
 
 		// Window width
@@ -914,4 +914,4 @@ int main(int argc, char** argv)
 	shutdown();
 
 	return ret;
-}
+}