Quellcode durchsuchen

Numerous windows fixes and windows IDE project

Ivan Safrin vor 13 Jahren
Ursprung
Commit
c8d1c08f26

+ 8 - 0
.gitignore

@@ -77,6 +77,14 @@ Player/Build/Mac OS X/Polycode Player.xcodeproj/project.xcworkspace/xcuserdata/i
 
 /IDE/Contents/Resources/Standalone
 
+/IDE/Build/Windows/*
+!/IDE/Build/Windows/main.cpp
+!/IDE/Build/Windows/Polycode.props
+!/IDE/Build/Windows/Polycode.sln
+!/IDE/Build/Windows/Polycode.vcxproj
+!/IDE/Build/Windows/Polycode.vcxproj.filters
+!/IDE/Build/Windows/Polycode.vcxproj.user
+
 /IDE/Build/Linux/Build
 
 /Core/Build/Mac\ OS\ X/build

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

@@ -225,6 +225,8 @@ public:
 
 		void initTouch();
 
+		void handleViewResize(int width, int height);
+
 		// NEED TO IMPLEMENT:
 
 		String executeExternalCommand(String command) { return "";}
@@ -244,6 +246,8 @@ public:
 		
 		std::vector<GamepadDeviceEntry*> gamepads;
 
+		HWND hWnd;
+
 	private:
 
 		unsigned int nextDeviceID;
@@ -254,7 +258,6 @@ public:
 
 		void initMultisample(int numSamples);
 
-		HWND hWnd;
 
 		int lastMouseX;
 		int lastMouseY;

+ 9 - 5
Core/Contents/PolycodeView/MSVC/PolycodeView.cpp

@@ -25,8 +25,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 	case WM_SIZE:
 		nWidth = LOWORD(lParam); 
 		nHeight = HIWORD(lParam);
-		if(core)
-			core->getServices()->getRenderer()->Resize(nWidth, nHeight);
+		if(core) {
+			core->handleViewResize(nWidth, nHeight);
+		}
 	break;
 
 	case WM_MOUSEMOVE:
@@ -114,7 +115,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 }
 
 
-PolycodeView::PolycodeView(HINSTANCE hInstance, int nCmdShow, LPCTSTR windowTitle) : PolycodeViewBase() {
+PolycodeView::PolycodeView(HINSTANCE hInstance, int nCmdShow, LPCTSTR windowTitle, bool resizable) : PolycodeViewBase() {
 
 WNDCLASSEX wcex;
 
@@ -133,8 +134,11 @@ WNDCLASSEX wcex;
 
 	RegisterClassEx(&wcex);
 
-  hwnd = CreateWindowEx(WS_EX_APPWINDOW, L"POLYCODEAPPLICATION", windowTitle, WS_OVERLAPPED|WS_SYSMENU,
-      0, 0, 640, 480, NULL, NULL, hInstance, NULL);
+	if(resizable) {
+		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);
+	}
 
   windowData = (void*)&hwnd;
 

+ 1 - 1
Core/Contents/PolycodeView/MSVC/PolycodeView.h

@@ -10,7 +10,7 @@ namespace Polycode {
 
 class _PolyExport PolycodeView : public PolycodeViewBase {
 public:
-	PolycodeView(HINSTANCE hInstance, int nCmdShow, LPCTSTR windowTitle);
+	PolycodeView(HINSTANCE hInstance, int nCmdShow, LPCTSTR windowTitle, bool resizable=false);
 	~PolycodeView();
 
 	HWND hwnd;

+ 38 - 6
Core/Contents/Source/PolyWinCore.cpp

@@ -30,6 +30,12 @@
 #include "PolyLogger.h"
 #include "PolyThreaded.h"
 
+#include <direct.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <Shlobj.h>
+
 #include <GL/gl.h>
 #include <GL/glext.h>
 #ifndef _MINGW
@@ -76,6 +82,16 @@ Win32Core::Win32Core(PolycodeViewBase *view, int _xRes, int _yRes, bool fullScre
 	hWnd = *((HWND*)view->windowData);
 	core = this;
 
+	char *buffer = _getcwd(NULL, 0);
+	defaultWorkingDirectory = String(buffer);
+	free(buffer);
+
+	WCHAR path[MAX_PATH];
+	if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_PROFILE, NULL, 0, path))) {
+		userHomeDirectory = String(path);
+	}
+
+
 	initKeymap();
 	initGamepad();
 	initTouch();
@@ -83,6 +99,8 @@ Win32Core::Win32Core(PolycodeViewBase *view, int _xRes, int _yRes, bool fullScre
 	hDC = NULL;
 	hRC = NULL;
 	PixelFormat = 0;
+
+	this->aaLevel = 999;
 	
 	lastMouseX = -1;
 	lastMouseY = -1;
@@ -162,6 +180,12 @@ void Win32Core::setVSync(bool vSyncVal) {
 
 void Win32Core::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel) {
 
+	bool resetContext = false;
+
+	if(aaLevel != this->aaLevel) {
+		resetContext = true;
+	}
+
 	this->xRes = xRes;
 	this->yRes = yRes;
 	this->fullScreen = fullScreen;
@@ -183,9 +207,6 @@ void Win32Core::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, in
 
 		SetWindowPos(hWnd, NULL, 0, 0, xRes, yRes, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
 	} else {
-		if(isFullScreen) {
-			ChangeDisplaySettings(NULL,0);		
-		}
 	//	SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED|WS_SYSMENU);
 	//	ShowWindow(hWnd, SW_SHOW);
 		ClientResize(hWnd, xRes, yRes);
@@ -194,16 +215,20 @@ void Win32Core::setVideoMode(int xRes, int yRes, bool fullScreen, bool vSync, in
 
 	isFullScreen = fullScreen;
 
-	initContext(false, 0);
+	if(resetContext) {
+		initContext(false, 0);
 
-	if(aaLevel > 0) {
-		initMultisample(aaLevel);
+		if(aaLevel > 0) {
+			initMultisample(aaLevel);
+		}
 	}
 
 	setVSync(vSync);
 
 	renderer->setAnisotropyAmount(anisotropyLevel);
 	renderer->Resize(xRes, yRes);
+
+	core->dispatchEvent(new Event(), Core::EVENT_CORE_RESIZE);
 }
 
 void Win32Core::initContext(bool usePixelFormat, unsigned int pixelFormat) {
@@ -439,6 +464,13 @@ void Win32Core::initKeymap() {
 
 }
 
+void Win32Core::handleViewResize(int width, int height) {
+	this->xRes = width;
+	this->yRes = height;
+	renderer->Resize(width, height);
+	dispatchEvent(new Event(), EVENT_CORE_RESIZE);
+}
+
 PolyKEY Win32Core::mapKey(LPARAM lParam, WPARAM wParam) {
 		switch (wParam) {
 				case VK_CONTROL:

+ 79 - 0
IDE/Build/Windows/Polycode.props

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ImportGroup Label="PropertySheets" />
+  <PropertyGroup Label="UserMacros">
+    <PolycodeDir>$(SolutionDir)..\..\..\Release\Windows\Framework\</PolycodeDir>
+    <PolycodeCoreLibsDebug>Polycore_d.lib</PolycodeCoreLibsDebug>
+    <PolycodeCoreLibsRelease>Polycore.lib</PolycodeCoreLibsRelease>
+    <PolycodeDependLibsDebug>PolycodeUI_d.lib;Polycore_d.lib;zlibd.lib;freetype_d.lib;liboggd.lib;libvorbisd.lib;libvorbisfiled.lib;OpenAL32d.lib;physfsd.lib;libpng15_staticd.lib</PolycodeDependLibsDebug>
+    <PolycodeDependLibsRelease>PolycodeUI.lib;Polycore.lib;zlib.lib;freetype.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;OpenAL32.lib;physfs.lib;libpng15_static.lib</PolycodeDependLibsRelease>
+    <PolycodeWinLibsDebug>opengl32.lib;glu32.lib;winmm.lib;ws2_32.lib</PolycodeWinLibsDebug>
+    <PolycodeWinLibsRelease>opengl32.lib;glu32.lib;winmm.lib;ws2_32.lib</PolycodeWinLibsRelease>
+    <PolycodeLibsDebug>$(PolycodeCoreLibsDebug);$(PolycodeDependLibsDebug);$(PolycodeWinLibsDebug)</PolycodeLibsDebug>
+    <PolycodeLibsRelease>$(PolycodeCoreLibsRelease);$(PolycodeDependLibsRelease);$(PolycodeWinLibsRelease)</PolycodeLibsRelease>
+  </PropertyGroup>
+  <PropertyGroup>
+    <IncludePath>..\..\Contents\Include;$(PolycodeDir)Core\include;$(PolycodeDir)Modules\include;$(PolycodeDir)Core\Dependencies\include;$(PolycodeDir)Core\PolycodeView;$(PolycodeDir)Core\Dependencies\include\AL;$(IncludePath)</IncludePath>
+  </PropertyGroup>
+  <PropertyGroup>
+    <LibraryPath>$(PolycodeDir)Core\lib;$(PolycodeDir)Core\Dependencies\lib;$(PolycodeDir)Modules\lib;$(PolycodeDir)Modules\Dependencies\lib;$(LibraryPath)</LibraryPath>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <WarningLevel>Level3</WarningLevel>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+    <PostBuildEvent>
+ <Command>if not exist "$(ProjectDir)default.pak" copy "$(PolycodeDir)Core\Assets\default.pak" "$(ProjectDir)"
+if not exist "$(ProjectDir)hdr.pak" copy "$(PolycodeDir)Core\Assets\hdr.pak" "$(ProjectDir)"
+
+if not exist "$(ProjectDir)FileTemplates" xcopy /E /Y "..\..\Contents\Resources" "$(ProjectDir)"
+if not exist "$(ProjectDir)Standalone" (
+  mkdir "$(ProjectDir)Standalone"
+  xcopy /E /Y "$(PolycodeDir)..\Standalone" "$(ProjectDir)Standalone"
+)
+
+if "$(ConfigurationName)" == "Debug" (
+  if not exist "$(TargetDir)OpenAL32d.dll" copy "$(PolycodeDir)Core\Dependencies\bin\OpenAL32d.dll" "$(TargetDir)"
+) else (
+    if not exist "$(TargetDir)OpenAL32.dll" copy "$(PolycodeDir)Core\Dependencies\bin\OpenAL32.dll" "$(TargetDir)"
+)</Command>    
+    </PostBuildEvent>
+    <PostBuildEvent>
+      <Message>Copying polycode pak files and dlls to project</Message>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <BuildMacro Include="PolycodeDir">
+      <Value>$(PolycodeDir)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeCoreLibsDebug">
+      <Value>$(PolycodeCoreLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeCoreLibsRelease">
+      <Value>$(PolycodeCoreLibsRelease)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeDependLibsDebug">
+      <Value>$(PolycodeDependLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeDependLibsRelease">
+      <Value>$(PolycodeDependLibsRelease)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeWinLibsDebug">
+      <Value>$(PolycodeWinLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeWinLibsRelease">
+      <Value>$(PolycodeWinLibsRelease)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeLibsDebug">
+      <Value>$(PolycodeLibsDebug)</Value>
+    </BuildMacro>
+    <BuildMacro Include="PolycodeLibsRelease">
+      <Value>$(PolycodeLibsRelease)</Value>
+    </BuildMacro>
+  </ItemGroup>
+</Project>

+ 20 - 0
IDE/Build/Windows/Polycode.sln

@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Polycode", "Polycode.vcxproj", "{D6C2171B-9167-4FB6-851A-DC1CEDCFC43D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{D6C2171B-9167-4FB6-851A-DC1CEDCFC43D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D6C2171B-9167-4FB6-851A-DC1CEDCFC43D}.Debug|Win32.Build.0 = Debug|Win32
+		{D6C2171B-9167-4FB6-851A-DC1CEDCFC43D}.Release|Win32.ActiveCfg = Release|Win32
+		{D6C2171B-9167-4FB6-851A-DC1CEDCFC43D}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 134 - 0
IDE/Build/Windows/Polycode.vcxproj

@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\Contents\Source\ExampleBrowserWindow.cpp" />
+    <ClCompile Include="..\..\Contents\Source\ExportProjectWindow.cpp" />
+    <ClCompile Include="..\..\Contents\Source\NewFileWindow.cpp" />
+    <ClCompile Include="..\..\Contents\Source\NewProjectWindow.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeConsole.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeEditorManager.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeFontEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeFrame.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeIDEApp.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeImageEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeMaterialEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeProject.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeProjectBrowser.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeProjectEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeProjectManager.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeProps.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeRemoteDebugger.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeScreenEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeSpriteEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeTextEditor.cpp" />
+    <ClCompile Include="..\..\Contents\Source\PolycodeToolLauncher.cpp" />
+    <ClCompile Include="..\..\Contents\Source\TextureBrowser.cpp" />
+    <ClCompile Include="..\..\Contents\Source\ToolWindows.cpp" />
+    <ClCompile Include="main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\Contents\Include\ExampleBrowserWindow.h" />
+    <ClInclude Include="..\..\Contents\Include\ExportProjectWindow.h" />
+    <ClInclude Include="..\..\Contents\Include\NewFileWindow.h" />
+    <ClInclude Include="..\..\Contents\Include\NewProjectWindow.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeConsole.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeEditorManager.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeFontEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeFrame.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeGlobals.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeIDEApp.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeImageEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeMaterialEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeProject.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeProjectBrowser.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeProjectEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeProjectManager.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeProps.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeRemoteDebugger.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeScreenEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeSpriteEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeTextEditor.h" />
+    <ClInclude Include="..\..\Contents\Include\PolycodeToolLauncher.h" />
+    <ClInclude Include="..\..\Contents\Include\TextureBrowser.h" />
+    <ClInclude Include="..\..\Contents\Include\ToolWindows.h" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{D6C2171B-9167-4FB6-851A-DC1CEDCFC43D}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>PolycodeTemplate</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="Polycode.props" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="Polycode.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>USE_POLYCODEUI_MENUBAR;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>$(PolycodeLibsDebug);%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>$(PolycodeLibsRelease);%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 165 - 0
IDE/Build/Windows/Polycode.vcxproj.filters

@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Include">
+      <UniqueIdentifier>{c0fd43dc-9f4f-4164-8d43-384e62b31325}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Source">
+      <UniqueIdentifier>{657f1126-62d1-4cc4-9067-f71f9825c377}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\Contents\Source\ExampleBrowserWindow.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\ExportProjectWindow.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\NewFileWindow.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\NewProjectWindow.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeConsole.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeEditorManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeFontEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeFrame.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeIDEApp.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeImageEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeMaterialEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeProject.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeProjectBrowser.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeProjectEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeProjectManager.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeProps.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeRemoteDebugger.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeScreenEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeSpriteEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeTextEditor.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\PolycodeToolLauncher.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\TextureBrowser.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\Contents\Source\ToolWindows.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+    <ClCompile Include="main.cpp">
+      <Filter>Source</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\..\Contents\Include\ExampleBrowserWindow.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\ExportProjectWindow.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\NewFileWindow.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\NewProjectWindow.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeConsole.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeEditorManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeFontEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeFrame.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeGlobals.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeIDEApp.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeImageEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeMaterialEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeProject.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeProjectBrowser.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeProjectEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeProjectManager.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeProps.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeRemoteDebugger.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeScreenEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeSpriteEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeTextEditor.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\PolycodeToolLauncher.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\TextureBrowser.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\Contents\Include\ToolWindows.h">
+      <Filter>Include</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 7 - 0
IDE/Build/Windows/Polycode.vcxproj.user

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LocalDebuggerWorkingDirectory>$(ProjectDir)</LocalDebuggerWorkingDirectory>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+</Project>

+ 21 - 0
IDE/Build/Windows/main.cpp

@@ -0,0 +1,21 @@
+#include <Polycode.h>
+#include "PolycodeIDEApp.h"
+#include "PolycodeView.h"
+#include "windows.h"
+
+using namespace Polycode;
+
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
+{
+	PolycodeView *view = new PolycodeView(hInstance, nCmdShow, L"Polycode", true);
+	PolycodeIDEApp *app = new PolycodeIDEApp(view);
+
+	MSG Msg;
+	do {
+		if(PeekMessage(&Msg, NULL, 0,0,PM_REMOVE)) {
+			TranslateMessage(&Msg);
+			DispatchMessage(&Msg);
+		}
+	} while(app->Update());
+	return Msg.wParam;
+}

+ 1 - 1
IDE/Contents/Include/PolycodeEditor.h

@@ -34,7 +34,7 @@ public:
 	PolycodeEditor(bool _isReadOnly);
 	virtual ~PolycodeEditor();
 	
-	virtual bool openFile(OSFileEntry filePath){ this->filePath = filePath.fullPath; }
+	virtual bool openFile(OSFileEntry filePath){ this->filePath = filePath.fullPath; return true;}
 	virtual void Resize(int x, int y);
 	
 	virtual void Activate() {};

+ 4 - 0
IDE/Contents/Include/PolycodeFrame.h

@@ -156,6 +156,8 @@ public:
 	~PolycodeFrame();
 	
 	void Resize(int x, int y);
+
+	void Update();
 	
 	void showModal(UIWindow *modalChild);
 	void hideModal();
@@ -206,6 +208,8 @@ private:
 	int frameSizeX;
 	int frameSizeY;
 	
+	bool willHideModal;
+
 	ScreenShape *fileDialogBlocker;
 
 	ScreenShape *topBarBg;

+ 5 - 1
IDE/Contents/Include/PolycodeIDEApp.h

@@ -19,8 +19,12 @@
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
  */
- 
+
+#if defined(__APPLE__) && defined(__MACH__)
 #import "PolycodeView.h"
+#else
+#include "PolycodeView.h"
+#endif
 
 #include "PolycodeGlobals.h"
 #include "PolycodeProjectManager.h"

+ 4 - 0
IDE/Contents/Include/PolycodeScreenEditor.h

@@ -29,6 +29,10 @@
 
 using namespace Polycode;
 
+#ifdef _WINDOWS
+#define round (int)
+#endif
+
 class EntityBrowserData  {
 	public:
 		Entity *entity;

+ 12 - 3
IDE/Contents/Source/PolycodeFrame.cpp

@@ -362,6 +362,8 @@ CurveEditor::CurveEditor() : UIWindow("", 750, 300) {
 	
 	selectorImage->setPosition(selectButton->getPosition().x - 4, selectButton->getPosition().y - 4);
 
+	selectedCurve = NULL;
+
 	setMode(0);
 	
 	treeContainer = new UITreeContainer("boxIcon.png", L"Curves", 145, 280);
@@ -370,8 +372,7 @@ CurveEditor::CurveEditor() : UIWindow("", 750, 300) {
 	treeContainer->setPosition(12, 33);
 	
 	treeContainer->getRootNode()->setUserData(NULL);
-	
-	selectedCurve = NULL;
+
 	
 	addChild(treeContainer);	
 
@@ -497,6 +498,7 @@ PolycodeFrame::PolycodeFrame() : ScreenEntity() {
 
 	globalFrame = this;
 	processInputEvents = true;
+	willHideModal = false;
 
 	modalChild = NULL;
 	
@@ -692,6 +694,13 @@ void PolycodeFrame::hideModal() {
 	modalBlocker->enabled = false;		
 }
 
+void PolycodeFrame::Update() {
+	if(willHideModal) {
+		hideModal();
+		willHideModal = false;
+	}
+}
+
 void PolycodeFrame::showAssetBrowser(std::vector<String> extensions) {
 	if(!projectManager->getActiveProject()) {
 		return;
@@ -749,7 +758,7 @@ void PolycodeFrame::handleEvent(Event *event) {
 
 	if(event->getDispatcher() == modalChild) {
 		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLOSE_EVENT) {
-			hideModal();
+			willHideModal = true;
 		}
 	} else {
 		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT && event->getDispatcher() == newProjectButton) {

+ 1 - 1
IDE/Contents/Source/PolycodeScreenEditor.cpp

@@ -742,7 +742,7 @@ void PolycodeScreenEditorMain::setGrid(int gridSize) {
 
 	this->gridSize = gridSize;
 
-	Polygon *gridPoly = new Polygon();
+	Polycode::Polygon *gridPoly = new Polycode::Polygon();
 	int gridLen = 300;
 	
 	for(int x=0; x < gridLen+1; x++) {

+ 2 - 2
Modules/Contents/UI/Source/PolyUITextInput.cpp

@@ -661,7 +661,7 @@ void UITextInput::dragSelectionTo(Number x, Number y) {
 	String selectToLine = lines[lineOffset];
 	
 	int len = selectToLine.length();
-	Number slen;
+	Number slen = 0;
 	int caretPosition = bufferLines[0]->getLabel()->getTextWidthForString(selectToLine.substr(0,len));
 	for(int i=0; i < len; i++) {
 		slen = bufferLines[0]->getLabel()->getTextWidthForString(selectToLine.substr(0,i));
@@ -816,7 +816,7 @@ void UITextInput::setCaretToMouse(Number x, Number y) {
 	//}
 	
 	int len = lines[lineOffset].length();
-	Number slen;
+	Number slen= 0;
 	
 	int newCaretPosition = -1;