Browse Source

WIP: Linux port
- Cursor clipping now clips the cursor instead of wrapping it
- Drop target now working properly

Marko Pintera 8 years ago
parent
commit
932c3ee831

+ 2 - 1
Source/BansheeCore/Linux/BsLinuxDropTarget.cpp

@@ -50,6 +50,7 @@ namespace bs
 	X11Property readX11Property(::Display *display, ::Window window, Atom type)
 	{
 		X11Property output;
+		output.data = nullptr;
 
 		unsigned long bytesLeft;
 		int bytesToFetch = 0;
@@ -522,7 +523,7 @@ namespace bs
 			return true;
 
 		// Read data
-		X11Property property = readX11Property(sXDisplay, LinuxPlatform::getMainXWindow(), sXdndTypeList);
+		X11Property property = readX11Property(sXDisplay, LinuxPlatform::getMainXWindow(), sPRIMARY);
 		if(property.format == 8)
 		{
 			// Assuming this is a file list, since we rejected any other drop type

+ 7 - 8
Source/BansheeCore/Linux/BsLinuxPlatform.cpp

@@ -153,18 +153,17 @@ namespace bs
 		INT32 clippedY = pos.y - data->cursorClipRect.y;
 
 		if(clippedX < 0)
-			clippedX = data->cursorClipRect.x + data->cursorClipRect.width + clippedX;
+			clippedX = 0;
 		else if(clippedX >= (INT32)data->cursorClipRect.width)
-			clippedX = data->cursorClipRect.x + (clippedX - data->cursorClipRect.width);
-		else
-			clippedX = data->cursorClipRect.x + clippedX;
+			clippedX = data->cursorClipRect.width > 0 ? data->cursorClipRect.width - 1 : 0;
 
 		if(clippedY < 0)
-			clippedY = data->cursorClipRect.y + data->cursorClipRect.height + clippedY;
+			clippedY = 0;
 		else if(clippedY >= (INT32)data->cursorClipRect.height)
-			clippedY = data->cursorClipRect.y + (clippedY - data->cursorClipRect.height);
-		else
-			clippedY = data->cursorClipRect.y + clippedY;
+			clippedY = data->cursorClipRect.height > 0 ? data->cursorClipRect.height - 1 : 0;
+
+		clippedX += data->cursorClipRect.x;
+		clippedY += data->cursorClipRect.y;
 
 		if(clippedX != pos.x || clippedY != pos.y)
 		{

+ 3 - 3
Source/Examples/ExampleGettingStarted/CameraFlyer.cpp

@@ -14,7 +14,7 @@ namespace bs
 	const float CameraFlyer::TOP_SPEED = 130.0f;
 	const float CameraFlyer::ACCELERATION = 10.0f;
 	const float CameraFlyer::FAST_MODE_MULTIPLIER = 2.0f;
-	const float CameraFlyer::ROTATION_SPEED = 360.0f; // Degrees/second
+	const float CameraFlyer::ROTATION_SPEED = 3.0f;
 
 	/** Wraps an angle so it always stays in [0, 360) range. */
 	Degree wrapAngle(Degree angle)
@@ -75,8 +75,8 @@ namespace bs
 		float frameDelta = gTime().getFrameDelta();
 		if (camRotating)
 		{
-			mYaw += Degree(gVirtualInput().getAxisValue(mHorizontalAxis) * ROTATION_SPEED * frameDelta);
-			mPitch += Degree(gVirtualInput().getAxisValue(mVerticalAxis) * ROTATION_SPEED * frameDelta);
+			mYaw += Degree(gVirtualInput().getAxisValue(mHorizontalAxis) * ROTATION_SPEED);
+			mPitch += Degree(gVirtualInput().getAxisValue(mVerticalAxis) * ROTATION_SPEED);
 
 			mYaw = wrapAngle(mYaw);
 			mPitch = wrapAngle(mPitch);

+ 4 - 0
Source/Examples/ExampleGettingStarted/Main.cpp

@@ -1,6 +1,10 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 // Engine includes
+#include <Platform/BsPlatform.h>
+#include <Platform/BsFolderMonitor.h>
+#include <Platform/BsCursor.h>
+#include <Platform/BsDropTarget.h>
 #include "BsApplication.h"
 #include "Resources/BsResources.h"
 #include "Resources/BsBuiltinResources.h"

+ 2 - 2
Source/SBansheeEditor/Wrappers/BsScriptSceneSelection.cpp

@@ -126,10 +126,10 @@ namespace bs
 			{
 				Vector<HSceneObject> selectedSOs = Selection::instance().getSceneObjects();
 
-				for (int i = 0; i < pickedObjects.size(); i++) 
+				for (int i = 0; i < (int)pickedObjects.size(); i++)
 				{
 					bool found = false;
-					for (int j = 0; j < selectedSOs.size(); j++)
+					for (int j = 0; j < (int)selectedSOs.size(); j++)
 					{
 						if (selectedSOs[j] == pickedObjects[i])
 						{