diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-09-15 11:33:30 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-09-15 11:33:30 -0300 |
commit | 8cab401d08f8e25aa9b2dc710204785858ff3dbb (patch) | |
tree | 1a4cec868f937fb24d340ee33fbeba2f1c6fa9f2 /drivers/windows | |
parent | 1a2cb755e2d8b9d59178f36702f6dff7235b9088 (diff) |
3D Physics Rework, Other Stuff
-=-=-=-=-=-=-=-=-=-=-=-=-=-
3D Physics:
-Fixed "Bounce" parameter in 3D
-Fixed bug affecting Area (sometims it would not detect properly)
-Vehicle Body has seen heavy work
-Added Query API for doing space queries in 3D. Needs some docs though.
-Added JOINTS! Adapted Bullet Joints: and created easy gizmos for setting them up:
-PinJoint
-HingeJoint (with motor)
-SliderJoint
-ConeTwistJoint
-Generic6DOFJoint
-Added OBJECT PICKING! based on the new query API. Any physics object now (Area or Body) has the following signals and virtual functions:
-input_event (mouse or multitouch input over the body)
-mouse_enter (mouse entered the body area)
-mouse_exit (mouse exited body area)
For Area it needs to be activated manually, as it isn't by default (ray goes thru).
Other:
-Begun working on Windows 8 (RT) port. Compiles but does not work yet.
-Added TheoraPlayer library for improved to-texture and portable video support.
-Fixed a few bugs in the renderer, collada importer, collada exporter, etc.
Diffstat (limited to 'drivers/windows')
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 63 | ||||
-rw-r--r-- | drivers/windows/mutex_windows.cpp | 6 | ||||
-rw-r--r-- | drivers/windows/semaphore_windows.cpp | 25 | ||||
-rw-r--r-- | drivers/windows/shell_windows.cpp | 9 | ||||
-rw-r--r-- | drivers/windows/thread_windows.cpp | 2 |
5 files changed, 84 insertions, 21 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index aacd02ca24..e07c9bb354 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifdef WINDOWS_ENABLED +#if defined(WINDOWS_ENABLED) #include "dir_access_windows.h" @@ -36,6 +36,13 @@ #include <wchar.h> #include <stdio.h> #include "print_string.h" + +#ifdef WINRT_ENABLED +#include <Synchapi.h> +#include <collection.h> +#include <ppltasks.h> +#endif + /* [03:57] <reduz> yessopie, so i dont havemak to rely on unicows @@ -56,6 +63,7 @@ struct DirAccessWindowsPrivate { WIN32_FIND_DATAW fu; //unicode version }; +// CreateFolderAsync bool DirAccessWindows::list_dir_begin() { @@ -63,13 +71,13 @@ bool DirAccessWindows::list_dir_begin() { if (unicode) { list_dir_end(); - p->h = FindFirstFileW((current_dir+"\\*").c_str(), &p->fu); + p->h = FindFirstFileExW((current_dir+"\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0); return (p->h==INVALID_HANDLE_VALUE); } else { list_dir_end(); - p->h = FindFirstFileA((current_dir+"\\*").ascii().get_data(), &p->f); + p->h = FindFirstFileExA((current_dir+"\\*").ascii().get_data(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0); return (p->h==INVALID_HANDLE_VALUE); @@ -144,6 +152,15 @@ Error DirAccessWindows::change_dir(String p_dir) { GLOBAL_LOCK_FUNCTION +#ifdef WINRT_ENABLED + + p_dir = fix_path(p_dir); + current_dir = normalize_path(p_dir); + + return OK; +#else + + p_dir=fix_path(p_dir); if (unicode) { @@ -201,13 +218,19 @@ Error DirAccessWindows::change_dir(String p_dir) { } return OK; - +#endif } Error DirAccessWindows::make_dir(String p_dir) { GLOBAL_LOCK_FUNCTION +#ifdef WINRT_ENABLED + + return ERR_CANT_CREATE; + +#else + p_dir=fix_path(p_dir); p_dir.replace("/","\\"); @@ -248,6 +271,8 @@ Error DirAccessWindows::make_dir(String p_dir) { }; return ERR_CANT_CREATE; + +#endif } @@ -280,11 +305,13 @@ bool DirAccessWindows::file_exists(String p_file) { p_file.replace("/","\\"); + WIN32_FILE_ATTRIBUTE_DATA fileInfo; + if (unicode) { DWORD fileAttr; - fileAttr = GetFileAttributesW(p_file.c_str()); + fileAttr = GetFileAttributesExW(p_file.c_str(), GetFileExInfoStandard, &fileInfo); if (0xFFFFFFFF == fileAttr) return false; @@ -293,7 +320,7 @@ bool DirAccessWindows::file_exists(String p_file) { } else { DWORD fileAttr; - fileAttr = GetFileAttributesA(p_file.ascii().get_data()); + fileAttr = GetFileAttributesExA(p_file.ascii().get_data(), GetFileExInfoStandard, &fileInfo); if (0xFFFFFFFF == fileAttr) return false; return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY); @@ -313,11 +340,13 @@ bool DirAccessWindows::dir_exists(String p_dir) { p_dir.replace("/","\\"); + WIN32_FILE_ATTRIBUTE_DATA fileInfo; + if (unicode) { DWORD fileAttr; - fileAttr = GetFileAttributesW(p_dir.c_str()); + fileAttr = GetFileAttributesExW(p_dir.c_str(), GetFileExInfoStandard, &fileInfo); if (0xFFFFFFFF == fileAttr) return false; @@ -326,7 +355,7 @@ bool DirAccessWindows::dir_exists(String p_dir) { } else { DWORD fileAttr; - fileAttr = GetFileAttributesA(p_dir.ascii().get_data()); + fileAttr = GetFileAttributesExA(p_dir.ascii().get_data(), GetFileExInfoStandard, &fileInfo); if (0xFFFFFFFF == fileAttr) return false; return (fileAttr&FILE_ATTRIBUTE_DIRECTORY); @@ -355,7 +384,8 @@ Error DirAccessWindows::remove(String p_path) { p_path=fix_path(p_path); printf("erasing %s\n",p_path.utf8().get_data()); - DWORD fileAttr = GetFileAttributesW(p_path.c_str()); + WIN32_FILE_ATTRIBUTE_DATA fileInfo; + DWORD fileAttr = GetFileAttributesExW(p_path.c_str(), GetFileExInfoStandard, &fileInfo); if (fileAttr == INVALID_FILE_ATTRIBUTES) return FAILED; @@ -378,7 +408,8 @@ FileType DirAccessWindows::get_file_type(const String& p_file) const { DWORD attr; if (worked) { - attr = GetFileAttributesW(p_file.c_str()); + WIN32_FILE_ATTRIBUTE_DATA fileInfo; + attr = GetFileAttributesExW(p_file.c_str(), GetFileExInfoStandard, &fileInfo); } @@ -399,9 +430,18 @@ size_t DirAccessWindows::get_space_left() { DirAccessWindows::DirAccessWindows() { p = memnew( DirAccessWindowsPrivate ); + p->h=INVALID_HANDLE_VALUE; current_dir="."; drive_count=0; + +#ifdef WINRT_ENABLED + Windows::Storage::StorageFolder ^install_folder = Windows::ApplicationModel::Package::Current->InstalledLocation; + change_dir(install_folder->Path->Data()); + +#else + + DWORD mask=GetLogicalDrives(); for (int i=0;i<MAX_DRIVES;i++) { @@ -415,12 +455,13 @@ DirAccessWindows::DirAccessWindows() { unicode=true; + /* We are running Windows 95/98/ME, so no unicode allowed */ if ( SetCurrentDirectoryW ( L"." ) == FALSE && GetLastError () == ERROR_CALL_NOT_IMPLEMENTED ) unicode=false; - p->h=INVALID_HANDLE_VALUE; change_dir("."); +#endif } diff --git a/drivers/windows/mutex_windows.cpp b/drivers/windows/mutex_windows.cpp index d42c45fd13..3b2004285a 100644 --- a/drivers/windows/mutex_windows.cpp +++ b/drivers/windows/mutex_windows.cpp @@ -81,7 +81,11 @@ MutexWindows::MutexWindows() { #ifdef WINDOWS_USE_MUTEX mutex = CreateMutex( NULL, FALSE, NULL ); #else - InitializeCriticalSection( &mutex ); + #ifdef WINRT_ENABLED + InitializeCriticalSectionEx( &mutex, 0, 0 ); + #else + InitializeCriticalSection( &mutex ); + #endif #endif } diff --git a/drivers/windows/semaphore_windows.cpp b/drivers/windows/semaphore_windows.cpp index 28a04f4acf..bfd53f9837 100644 --- a/drivers/windows/semaphore_windows.cpp +++ b/drivers/windows/semaphore_windows.cpp @@ -28,13 +28,13 @@ /*************************************************************************/ #include "semaphore_windows.h" -#ifdef WINDOWS_ENABLED +#if defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED) #include "os/memory.h" Error SemaphoreWindows::wait() { - WaitForSingleObject(semaphore,INFINITE); + WaitForSingleObjectEx(semaphore,INFINITE, false); return OK; } Error SemaphoreWindows::post() { @@ -44,7 +44,7 @@ Error SemaphoreWindows::post() { } int SemaphoreWindows::get() const { long previous; - switch (WaitForSingleObject(semaphore, 0)) { + switch (WaitForSingleObjectEx(semaphore, 0, false)) { case WAIT_OBJECT_0: { ERR_FAIL_COND_V(!ReleaseSemaphore(semaphore, 1, &previous),-1); return previous + 1; @@ -71,12 +71,21 @@ void SemaphoreWindows::make_default() { SemaphoreWindows::SemaphoreWindows() { +#ifdef WINRT_ENABLED + semaphore=CreateSemaphoreEx( + NULL, + 0, + 0xFFFFFFF, //wathever + NULL, + 0, + SEMAPHORE_ALL_ACCESS); +#else semaphore=CreateSemaphore( - NULL, - 0, - 0xFFFFFFF, //wathever - NULL); - + NULL, + 0, + 0xFFFFFFF, //wathever + NULL); +#endif } diff --git a/drivers/windows/shell_windows.cpp b/drivers/windows/shell_windows.cpp index 2e5f663b96..3994252c48 100644 --- a/drivers/windows/shell_windows.cpp +++ b/drivers/windows/shell_windows.cpp @@ -27,6 +27,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #ifdef WINDOWS_ENABLED + +#ifdef WINRT_ENABLED + +// Use Launcher class on windows 8 + +#else + // // C++ Implementation: shell_windows // @@ -59,3 +66,5 @@ ShellWindows::~ShellWindows() } #endif + +#endif diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index 748e9661fa..40efa5acd5 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -28,7 +28,7 @@ /*************************************************************************/ #include "thread_windows.h" -#ifdef WINDOWS_ENABLED +#if defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED) #include "os/memory.h" |