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

Merge pull request #613 from fodinabor/MergeFixes

Merge Fixes
Ivan Safrin 11 лет назад
Родитель
Сommit
19494a29e2

+ 1 - 0
Core/Contents/Include/PolyCore.h

@@ -57,6 +57,7 @@ namespace Polycode {
 		PolycodeViewBase() { windowData = NULL; }
 		virtual ~PolycodeViewBase(){}
 		void *windowData;
+		bool resizable;
 	};
 	
 	class _PolyExport TimeInfo {

+ 1 - 0
Core/Contents/Include/PolyWinCore.h

@@ -275,6 +275,7 @@ public:
 
 		bool isFullScreen;
 		bool retinaSupport;
+		bool resizable;
 
 		HDC hDC;
 		HGLRC hRC;

+ 4 - 2
Core/Contents/PolycodeView/MSVC/PolycodeView.cpp

@@ -184,10 +184,12 @@ PolycodeView::PolycodeView(HINSTANCE hInstance, int nCmdShow, LPCTSTR windowTitl
 
 	RegisterClassEx(&wcex);
 
+	this->resizable = resizable;
+
 	if(resizable) {
-		hwnd = CreateWindowEx(WS_EX_APPWINDOW, L"POLYCODEAPPLICATION", windowTitle, WS_OVERLAPPEDWINDOW|WS_SYSMENU, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
+		hwnd = CreateWindowEx(WS_EX_APPWINDOW, L"POLYCODEAPPLICATION", windowTitle, WS_OVERLAPPEDWINDOW | WS_SYSMENU, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
 	} else {
-		hwnd = CreateWindowEx(WS_EX_APPWINDOW, L"POLYCODEAPPLICATION", windowTitle, WS_OVERLAPPED|WS_SYSMENU, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
+		hwnd = CreateWindowEx(WS_EX_APPWINDOW, L"POLYCODEAPPLICATION", windowTitle, WS_CAPTION | WS_POPUP | WS_SYSMENU, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
 	}
 
   windowData = (void*)&hwnd;

+ 27 - 17
Core/Contents/Source/PolySceneImage.cpp

@@ -82,32 +82,42 @@ void SceneImage::applyClone(Entity *clone, bool deepClone, bool ignoreEditorOnly
 }
 
 void SceneImage::setImageCoordinates(Number x, Number y, Number width, Number height, Number realWidth, Number realHeight) {
-	
-	Number pixelSizeX = 1/imageWidth;
-	Number pixelSizeY = 1/imageHeight;
+	Number pixelSizeX = 1 / imageWidth;
+	Number pixelSizeY = 1 / imageHeight;
 
-	if(realWidth == -1)
+	if (realWidth == -1)
 		realWidth = width;
-	if(realHeight == -1)
+	if (realHeight == -1)
 		realHeight = height;
 
-
 	setWidth(realWidth);
-	setHeight(realHeight);	
-	setPrimitiveOptions(ScenePrimitive::TYPE_VPLANE, getWidth(), getHeight());	
-		
+	setHeight(realHeight);
+
+	Number whalf = realWidth / 2.0f;
+	Number hhalf = realHeight / 2.0f;
+
 	Number xFloat = x * pixelSizeX;
-	Number yFloat = 1 - (y * pixelSizeY);
+	Number yFloat = y * pixelSizeY;
 	Number wFloat = width * pixelSizeX;
 	Number hFloat = height * pixelSizeY;
 
-    mesh->vertexTexCoordArray.data.clear();
-    
-    mesh->addTexCoord(xFloat, yFloat - hFloat);
-    mesh->addTexCoord(xFloat + wFloat, yFloat - hFloat);
-    mesh->addTexCoord(xFloat + wFloat, yFloat);
-    mesh->addTexCoord(xFloat, yFloat);
-	
+	mesh->vertexPositionArray.data.clear();
+	mesh->vertexTexCoordArray.data.clear();
+
+	mesh->setMeshType(Mesh::QUAD_MESH);
+
+	mesh->addVertex(0 - whalf, 0 - hhalf, 0);
+	mesh->addTexCoord(xFloat, (1.0 - yFloat) - hFloat);
+
+	mesh->addVertex(realWidth - whalf, 0 - hhalf, 0);
+	mesh->addTexCoord(xFloat + wFloat, (1.0 - yFloat) - hFloat);
+
+	mesh->addVertex(realWidth - whalf, realHeight - hhalf, 0);
+	mesh->addTexCoord(xFloat + wFloat, 1.0 - yFloat);
+
+	mesh->addVertex(0 - whalf, realHeight - hhalf, 0);
+	mesh->addTexCoord(xFloat, 1.0 - yFloat);
+
 	rebuildTransformMatrix();
 	matrixDirty = true;
 }

+ 13 - 4
Core/Contents/Source/PolyWinCore.cpp

@@ -113,6 +113,7 @@ Win32Core::Win32Core(PolycodeViewBase *view, int _xRes, int _yRes, bool fullScre
 	eventMutex = createMutex();
 
 	isFullScreen = fullScreen;
+	this->resizable = view->resizable;
 
 	renderer = new OpenGLRenderer();
 	services->setRenderer(renderer);
@@ -171,7 +172,9 @@ void Win32Core::captureMouse(bool newval) {
 
 		GetClientRect(core->hWnd, &crect);
 		arect = crect;
-		AdjustWindowRectEx(&arect, WS_CAPTION | WS_BORDER, FALSE, 0);
+		if (!fullScreen){
+			AdjustWindowRectEx(&arect, WS_CAPTION | WS_BORDER, FALSE, 0);
+		}
 
 		rect.left += (crect.left - arect.left);
 		rect.right += (crect.right - arect.right);
@@ -268,8 +271,13 @@ void Win32Core::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, in
 		rect.top = 0;
 		rect.right = xRes;
 		rect.bottom = yRes;
-		SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE);
-		AdjustWindowRect(&rect, WS_CAPTION | WS_POPUPWINDOW, FALSE);
+		if (resizable){
+			SetWindowLongPtr(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_VISIBLE);
+			AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW | WS_SYSMENU, FALSE);
+		} else {
+			SetWindowLongPtr(hWnd, GWL_STYLE, WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_VISIBLE);
+			AdjustWindowRect(&rect, WS_CAPTION | WS_POPUP | WS_SYSMENU, FALSE);
+		}
 		MoveWindow(hWnd, 0, 0, rect.right-rect.left, rect.bottom-rect.top, TRUE);
 
 		ChangeDisplaySettings(0, 0);
@@ -1065,11 +1073,12 @@ std::vector<Polycode::Rectangle> Win32Core::getVideoModes() {
 
 String Win32Core::executeExternalCommand(String command,  String args, String inDirectory) {
 	String execInDirectory = inDirectory;
+	
 	if(inDirectory == "") {
 		execInDirectory = defaultWorkingDirectory;
 	}
 
-	String cmdString = "cd \""+execInDirectory+"\" & "+command+" "+args;
+	String cmdString = inDirectory.substr(0, inDirectory.find_first_of(":")+1)+" & cd \"" + execInDirectory + "\" & " + command + " " + args;
 
 	char   psBuffer[128];
 	FILE   *pPipe;

+ 2 - 1
IDE/Build/WindowsShared/PolycodeWinIDEView.cpp

@@ -298,7 +298,8 @@ PolycodeWinIDEView::PolycodeWinIDEView(HINSTANCE hInstance, int nCmdShow, LPCTST
 		hwnd = CreateWindowEx(WS_EX_APPWINDOW, L"POLYCODEAPPLICATION", windowTitle, WS_OVERLAPPED|WS_SYSMENU, 0, 0, 640, 480, NULL, NULL, hInstance, NULL);
 	}
 
-  windowData = (void*)&hwnd;
+	windowData = (void*)&hwnd;
+	this->resizable = resizable;
 
    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

+ 2 - 2
IDE/Contents/Source/PolycodeToolLauncher.cpp

@@ -63,7 +63,7 @@ void PolycodeRunner::runThread() {
 #endif
 
 	String ret = CoreServices::getInstance()->getCore()->executeExternalCommand(command, args, inFolder);
-	CoreServices::getInstance()->getCore()->removeDiskItem(polyappPath);	
+	CoreServices::getInstance()->getCore()->removeDiskItem(polyappPath);
 }
 
 PolycodeToolLauncher::PolycodeToolLauncher() {
@@ -181,7 +181,7 @@ String PolycodeToolLauncher::importAssets(String sourceFile, String inFolder, bo
 }
 
 void PolycodeToolLauncher::openExternalEditor(String app, String file, String inFolder) {
-	GenericRunner *runner = new GenericRunner(app, "\""+file+"\"", inFolder);
+	GenericRunner *runner = new GenericRunner("\"" + app + "\"", "\"" + file + "\"", "\"" + inFolder + "\"");
 	CoreServices::getInstance()->getCore()->createThread(runner);
 }