Browse Source

Merge remote-tracking branch 'upstream/master'

Paul Smith 13 years ago
parent
commit
bddcec05bc
44 changed files with 467 additions and 166 deletions
  1. BIN
      Assets/Icons/main_icon.png
  2. BIN
      Assets/UIThemes.pak
  3. BIN
      Assets/UIThemes/default/menu_bg.png
  4. 13 10
      Assets/UIThemes/default/theme.xml
  5. 1 0
      Bindings/Scripts/create_lua_library/create_lua_library.py
  6. 7 1
      Core/Contents/Include/PolyCore.h
  7. 0 1
      Core/Contents/Include/PolyCoreInput.h
  8. 1 1
      Core/Contents/Include/PolyCoreServices.h
  9. 14 4
      Core/Contents/Source/PolyCocoaCore.mm
  10. 15 2
      Core/Contents/Source/PolyCore.cpp
  11. 7 2
      Core/Contents/Source/PolyCoreServices.cpp
  12. 13 12
      Core/Contents/Source/PolyScreen.cpp
  13. 5 5
      Core/Contents/Source/PolyScreenEntity.cpp
  14. 8 8
      Documentation/Doxygen/base/footer.html
  15. 24 25
      Documentation/Doxygen/base/header.html
  16. 1 1
      Examples/Lua/2D_Graphics/2DParticles/2DParticles.polyproject
  17. 1 1
      Examples/Lua/2D_Graphics/2DParticles/Scripts/2DParticles.lua
  18. 1 1
      Examples/Lua/2D_Graphics/BasicText/BasicText.polyproject
  19. 2 4
      Examples/Lua/2D_Physics/2DPhysics_Basic/2DPhysics_Basic.polyproject
  20. 2 4
      Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.polyproject
  21. 16 24
      Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/Scripts/2DPhysics_CollisionOnly.lua
  22. 2 4
      Examples/Lua/2D_Physics/2DPhysics_Contacts/2DPhysics_Contacts.polyproject
  23. 9 18
      Examples/Lua/2D_Physics/2DPhysics_Contacts/Scripts/2DPhysics_Contacts.lua
  24. 2 4
      Examples/Lua/2D_Physics/2DPhysics_Joints/2DPhysics_Joints.polyproject
  25. 2 4
      Examples/Lua/2D_Physics/2DPhysics_PointCollision/2DPhysics_PointCollision.polyproject
  26. 3 3
      Examples/Lua/Audio/3DAudio/3DAudio.polyproject
  27. 1 1
      Examples/Lua/Audio/PlayingSounds/PlayingSounds.polyproject
  28. 2 2
      Examples/Lua/UI/UIDemo/Scripts/Main.lua
  29. 4 4
      IDE/Contents/Include/PolycodeEditorManager.h
  30. 5 0
      IDE/Contents/Include/PolycodeFrame.h
  31. 3 0
      IDE/Contents/Include/PolycodeIDEApp.h
  32. 1 1
      IDE/Contents/Include/PolycodeProjectManager.h
  33. 34 0
      IDE/Contents/Include/PolycodeProps.h
  34. 1 0
      IDE/Contents/Include/PolycodeScreenEditor.h
  35. 2 2
      IDE/Contents/Source/ExportProjectWindow.cpp
  36. 9 1
      IDE/Contents/Source/PolycodeEditorManager.cpp
  37. 35 0
      IDE/Contents/Source/PolycodeFrame.cpp
  38. 27 4
      IDE/Contents/Source/PolycodeIDEApp.cpp
  39. 2 1
      IDE/Contents/Source/PolycodeProjectManager.cpp
  40. 154 1
      IDE/Contents/Source/PolycodeProps.cpp
  41. 1 1
      IDE/Contents/Source/PolycodeRemoteDebugger.cpp
  42. 12 2
      IDE/Contents/Source/PolycodeScreenEditor.cpp
  43. 1 1
      Modules/Contents/UI/Source/PolyUIComboBox.cpp
  44. 24 6
      Player/Contents/Source/PolycodePlayer.cpp

BIN
Assets/Icons/main_icon.png


BIN
Assets/UIThemes.pak


BIN
Assets/UIThemes/default/menu_bg.png


+ 13 - 10
Assets/UIThemes/default/theme.xml

@@ -67,13 +67,13 @@
 	<uiWindowSkinB>17</uiWindowSkinB>
 	<uiWindowSkinB>17</uiWindowSkinB>
 	<uiWindowSkinL>17</uiWindowSkinL>
 	<uiWindowSkinL>17</uiWindowSkinL>
 	<uiWindowSkinPadding>15</uiWindowSkinPadding>		
 	<uiWindowSkinPadding>15</uiWindowSkinPadding>		
-	<uiWindowTitleFont>mono</uiWindowTitleFont>
+	<uiWindowTitleFont>sans</uiWindowTitleFont>
 	<uiWindowFontColor>0xe4e0e3c8</uiWindowFontColor>	
 	<uiWindowFontColor>0xe4e0e3c8</uiWindowFontColor>	
 	<uiWindowTitleFontSize>14</uiWindowTitleFontSize>
 	<uiWindowTitleFontSize>14</uiWindowTitleFontSize>
 	<uiWindowTitleX>15</uiWindowTitleX>	
 	<uiWindowTitleX>15</uiWindowTitleX>	
-	<uiWindowTitleY>10</uiWindowTitleY>	
+	<uiWindowTitleY>10</uiWindowTitleY>
 	<uiWindowTitleBarHeight>25</uiWindowTitleBarHeight>
 	<uiWindowTitleBarHeight>25</uiWindowTitleBarHeight>
-	<uiWindowTitleBarOffset>5</uiWindowTitleBarOffset>	
+	<uiWindowTitleBarOffset>5</uiWindowTitleBarOffset>
 	<uiWindowCloseIcon>UIThemes/default/closeIcon.png</uiWindowCloseIcon>
 	<uiWindowCloseIcon>UIThemes/default/closeIcon.png</uiWindowCloseIcon>
 	<uiCloseIconX>11</uiCloseIconX>	
 	<uiCloseIconX>11</uiCloseIconX>	
 	<uiCloseIconY>11</uiCloseIconY>		
 	<uiCloseIconY>11</uiCloseIconY>		
@@ -120,20 +120,20 @@
 	<uiMenuFontSize>12</uiMenuFontSize>
 	<uiMenuFontSize>12</uiMenuFontSize>
 	<uiMenuTextOffsetX>10</uiMenuTextOffsetX>
 	<uiMenuTextOffsetX>10</uiMenuTextOffsetX>
 	<uiMenuTextOffsetY>-1</uiMenuTextOffsetY>		
 	<uiMenuTextOffsetY>-1</uiMenuTextOffsetY>		
-	<uiMenuPaddingX>7</uiMenuPaddingX>
-	<uiMenuPaddingY>20</uiMenuPaddingY>
+	<uiMenuPaddingX>3</uiMenuPaddingX>
+	<uiMenuPaddingY>10</uiMenuPaddingY>
 	<uiMenuItemHeight>22</uiMenuItemHeight>
 	<uiMenuItemHeight>22</uiMenuItemHeight>
 	<uiMenuBgImage>UIThemes/default/menu_bg.png</uiMenuBgImage>	
 	<uiMenuBgImage>UIThemes/default/menu_bg.png</uiMenuBgImage>	
-	<uiMenuBgT>25</uiMenuBgT>
-	<uiMenuBgR>18</uiMenuBgR>
-	<uiMenuBgB>22</uiMenuBgB>
-	<uiMenuBgL>18</uiMenuBgL>			
+	<uiMenuBgT>4</uiMenuBgT>
+	<uiMenuBgR>6</uiMenuBgR>
+	<uiMenuBgB>9</uiMenuBgB>
+	<uiMenuBgL>6</uiMenuBgL>			
 	<uiMenuSelectorBgImage>UIThemes/default/menu_selector.png</uiMenuSelectorBgImage>	
 	<uiMenuSelectorBgImage>UIThemes/default/menu_selector.png</uiMenuSelectorBgImage>	
 	<uiMenuSelectorBgT>0</uiMenuSelectorBgT>
 	<uiMenuSelectorBgT>0</uiMenuSelectorBgT>
 	<uiMenuSelectorBgR>0</uiMenuSelectorBgR>
 	<uiMenuSelectorBgR>0</uiMenuSelectorBgR>
 	<uiMenuSelectorBgB>0</uiMenuSelectorBgB>
 	<uiMenuSelectorBgB>0</uiMenuSelectorBgB>
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
-	<uiMenuSelectorPadding>2</uiMenuSelectorPadding>
+	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
 
 	<uiColorBoxFrameImage>UIThemes/default/colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImage>UIThemes/default/colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>7</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageT>7</uiColorBoxFrameImageT>
@@ -157,4 +157,7 @@
 	<uiHSliderBgB>5</uiHSliderBgB>
 	<uiHSliderBgB>5</uiHSliderBgB>
 	<uiHSliderBgL>6</uiHSliderBgL>
 	<uiHSliderBgL>6</uiHSliderBgL>
 
 
+	<uiFileBrowserFileIcon>UIThemes/default/file.png</uiFileBrowserFileIcon>
+	<uiFileBrowserFolderIcon>UIThemes/default/folder.png</uiFileBrowserFolderIcon>
+	<uiFileBrowserPlaceIcon>UIThemes/default/boxIcon.png</uiFileBrowserPlaceIcon>
 </PolyConfig>
 </PolyConfig>

+ 1 - 0
Bindings/Scripts/create_lua_library/create_lua_library.py

@@ -131,6 +131,7 @@ def createLUABindings(inputPath, prefix, mainInclude, libSmallName, libName, api
 		wrappersHeaderOut += "public:\n"
 		wrappersHeaderOut += "public:\n"
 		wrappersHeaderOut += "	LuaEventHandler() : EventHandler() {}\n"
 		wrappersHeaderOut += "	LuaEventHandler() : EventHandler() {}\n"
 		wrappersHeaderOut += "	void handleEvent(Event *e) {\n"
 		wrappersHeaderOut += "	void handleEvent(Event *e) {\n"
+		wrappersHeaderOut += "		lua_getfield (L, LUA_GLOBALSINDEX, \"__customError\");\n"
 		wrappersHeaderOut += "		int errH = lua_gettop(L);\n"
 		wrappersHeaderOut += "		int errH = lua_gettop(L);\n"
 		wrappersHeaderOut += "		lua_getfield(L, LUA_GLOBALSINDEX, \"__handleEvent\");\n"
 		wrappersHeaderOut += "		lua_getfield(L, LUA_GLOBALSINDEX, \"__handleEvent\");\n"
 		wrappersHeaderOut += "		lua_rawgeti( L, LUA_REGISTRYINDEX, wrapperIndex );\n"
 		wrappersHeaderOut += "		lua_rawgeti( L, LUA_REGISTRYINDEX, wrapperIndex );\n"

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

@@ -241,7 +241,11 @@ namespace Polycode {
 		/**
 		/**
 		* Opens a system folder picker and suspends operation.
 		* Opens a system folder picker and suspends operation.
 		* @return The selected path returned from the picker.
 		* @return The selected path returned from the picker.
-		*/																					
+		*/		
+		
+
+		void setFramerate(int frameRate);
+
 		virtual String openFolderPicker() = 0;
 		virtual String openFolderPicker() = 0;
 		
 		
 		/**
 		/**
@@ -340,6 +344,8 @@ namespace Polycode {
 		static const int CURSOR_RESIZE_UP_DOWN = 5;
 		static const int CURSOR_RESIZE_UP_DOWN = 5;
 		static const int CURSOR_OPEN_HAND = 6;		
 		static const int CURSOR_OPEN_HAND = 6;		
 		
 		
+		bool paused;
+		bool pauseOnLoseFocus;
 				
 				
 	protected:	
 	protected:	
 	
 	

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

@@ -151,7 +151,6 @@ namespace Polycode {
 		
 		
 		void clearInput();
 		void clearInput();
 		
 		
-	protected:
 		
 		
 		std::vector<JoystickInfo> joysticks;
 		std::vector<JoystickInfo> joysticks;
 		bool keyboardState[512];
 		bool keyboardState[512];

+ 1 - 1
Core/Contents/Include/PolyCoreServices.h

@@ -64,7 +64,7 @@ namespace Polycode {
 			*/			
 			*/			
 			Renderer *getRenderer();
 			Renderer *getRenderer();
 			
 			
-			void Update(int elapsed);
+			void Update(int elapsed, bool updateRenderer);
 			
 			
 			void setCore(Core *core);
 			void setCore(Core *core);
 			
 			

+ 14 - 4
Core/Contents/Source/PolyCocoaCore.mm

@@ -412,6 +412,8 @@ void CocoaCore::checkEvents() {
 						input->setMousePosition(event.mouseX, event.mouseY, getTicks());						
 						input->setMousePosition(event.mouseX, event.mouseY, getTicks());						
 						break;
 						break;
 					case InputEvent::EVENT_MOUSEDOWN:
 					case InputEvent::EVENT_MOUSEDOWN:
+						input->mousePosition.x = event.mouseX;
+						input->mousePosition.y = event.mouseY;
 						input->setMouseButtonState(event.mouseButton, true, getTicks());						
 						input->setMouseButtonState(event.mouseButton, true, getTicks());						
 						break;
 						break;
 					case InputEvent::EVENT_MOUSEWHEEL_UP:
 					case InputEvent::EVENT_MOUSEWHEEL_UP:
@@ -530,13 +532,21 @@ vector<String> CocoaCore::openFilePicker(vector<CoreFileExtension> extensions, b
 bool CocoaCore::Update() {
 bool CocoaCore::Update() {
 	if(!running)
 	if(!running)
 		return false;
 		return false;
-		
+	
 	lockMutex(CoreServices::getRenderMutex());	
 	lockMutex(CoreServices::getRenderMutex());	
 	checkEvents();
 	checkEvents();
-	renderer->BeginRender();
+	
+	if(!paused) {	
+		renderer->BeginRender();
+	}
+	
 	updateCore();
 	updateCore();
-	renderer->EndRender();
-	[context flushBuffer];
+		
+	if(!paused) {		
+		renderer->EndRender();
+		[context flushBuffer];
+	}
+	
 	unlockMutex(CoreServices::getRenderMutex());	
 	unlockMutex(CoreServices::getRenderMutex());	
 	doSleep();	
 	doSleep();	
 	return running;
 	return running;

+ 15 - 2
Core/Contents/Source/PolyCore.cpp

@@ -63,6 +63,8 @@ namespace Polycode {
 		elapsed = 0;
 		elapsed = 0;
 		xRes = _xRes;
 		xRes = _xRes;
 		yRes = _yRes;
 		yRes = _yRes;
+		paused = false;
+		pauseOnLoseFocus = false;
 		if (fullScreen && !xRes && !yRes) {
 		if (fullScreen && !xRes && !yRes) {
 			getScreenInfo(&xRes, &yRes, NULL);
 			getScreenInfo(&xRes, &yRes, NULL);
 		}
 		}
@@ -78,6 +80,10 @@ namespace Polycode {
 		threadedEventMutex = NULL;
 		threadedEventMutex = NULL;
 	}
 	}
 	
 	
+	void Core::setFramerate(int frameRate) {
+		refreshInterval = 1000 / frameRate;
+	}
+	
 	void Core::enableMouse(bool newval) {
 	void Core::enableMouse(bool newval) {
 		mouseEnabled = newval;
 		mouseEnabled = newval;
 	}
 	}
@@ -148,11 +154,17 @@ namespace Polycode {
 	}
 	}
 	
 	
 	void Core::loseFocus() {
 	void Core::loseFocus() {
+		if(pauseOnLoseFocus) {
+			paused = true;
+		}
 		input->clearInput();
 		input->clearInput();
 		dispatchEvent(new Event(), EVENT_LOST_FOCUS);
 		dispatchEvent(new Event(), EVENT_LOST_FOCUS);
 	}
 	}
 	
 	
 	void Core::gainFocus() {
 	void Core::gainFocus() {
+		if(pauseOnLoseFocus) {
+			paused = false;
+		}	
 		input->clearInput();		
 		input->clearInput();		
 		dispatchEvent(new Event(), EVENT_GAINED_FOCUS);
 		dispatchEvent(new Event(), EVENT_GAINED_FOCUS);
 	}
 	}
@@ -178,8 +190,9 @@ namespace Polycode {
 		
 		
 		if(elapsed > 1000)
 		if(elapsed > 1000)
 			elapsed = 1000;
 			elapsed = 1000;
-		services->Update(elapsed);
-
+			
+		services->Update(elapsed, !paused);
+		
 		if(frameTicks-lastFPSTicks >= 1000) {
 		if(frameTicks-lastFPSTicks >= 1000) {
 			fps = frames;
 			fps = frames;
 			frames = 0;
 			frames = 0;

+ 7 - 2
Core/Contents/Source/PolyCoreServices.cpp

@@ -205,16 +205,19 @@ Renderer *CoreServices::getRenderer() {
 	return renderer;
 	return renderer;
 }
 }
 
 
-void CoreServices::Update(int elapsed) {
+void CoreServices::Update(int elapsed, bool updateRenderer) {
 	
 	
 	for(int i=0; i < updateModules.size(); i++) {
 	for(int i=0; i < updateModules.size(); i++) {
 		updateModules[i]->Update(elapsed);
 		updateModules[i]->Update(elapsed);
 	}
 	}
 
 
 	timerManager->Update();
 	timerManager->Update();
+	
 	tweenManager->Update();
 	tweenManager->Update();
-	materialManager->Update(elapsed);
+	
+	if(updateRenderer) {
 		
 		
+	materialManager->Update(elapsed);	
 	if(drawScreensFirst) {
 	if(drawScreensFirst) {
 		if(renderer->doClearBuffer)
 		if(renderer->doClearBuffer)
 			renderer->clearScreen();	
 			renderer->clearScreen();	
@@ -232,6 +235,8 @@ void CoreServices::Update(int elapsed) {
 			renderer->clearScreen();		
 			renderer->clearScreen();		
 		sceneManager->Update();
 		sceneManager->Update();
 		screenManager->Update();	
 		screenManager->Update();	
+	}
+	
 	}	
 	}	
 }
 }
 
 

+ 13 - 12
Core/Contents/Source/PolyScreen.cpp

@@ -142,31 +142,32 @@ void Screen::drawFilter() {
 	if(!filterShaderMaterial)
 	if(!filterShaderMaterial)
 		return;
 		return;
 	
 	
-	CoreServices::getInstance()->getRenderer()->bindFrameBufferTexture(originalSceneTexture);
+	Renderer *renderer = CoreServices::getInstance()->getRenderer();
+	
+	renderer->bindFrameBufferTexture(originalSceneTexture);
 	
 	
 	Render();
 	Render();
-	CoreServices::getInstance()->getRenderer()->unbindFramebuffers();
+	renderer->unbindFramebuffers();
 	
 	
 	ShaderBinding* materialBinding;		
 	ShaderBinding* materialBinding;		
 	for(int i=0; i < filterShaderMaterial->getNumShaders(); i++) {
 	for(int i=0; i < filterShaderMaterial->getNumShaders(); i++) {
 		materialBinding = filterShaderMaterial->getShaderBinding(i);
 		materialBinding = filterShaderMaterial->getShaderBinding(i);
-		CoreServices::getInstance()->getRenderer()->applyMaterial(filterShaderMaterial, localShaderOptions[i], i);	
+		renderer->applyMaterial(filterShaderMaterial, localShaderOptions[i], i);	
 			
 			
 		if(i==filterShaderMaterial->getNumShaders()-1) {
 		if(i==filterShaderMaterial->getNumShaders()-1) {
-			CoreServices::getInstance()->getRenderer()->loadIdentity();
-			CoreServices::getInstance()->getRenderer()->drawScreenQuad(CoreServices::getInstance()->getRenderer()->getXRes(), CoreServices::getInstance()->getRenderer()->getYRes());		
+			renderer->loadIdentity();
+			renderer->drawScreenQuad(renderer->getXRes(), renderer->getYRes());		
 		} else {
 		} else {
 			for(int j=0; j < materialBinding->getNumOutTargetBindings(); j++) {
 			for(int j=0; j < materialBinding->getNumOutTargetBindings(); j++) {
-				CoreServices::getInstance()->getRenderer()->bindFrameBufferTexture(materialBinding->getOutTargetBinding(j)->texture);
+				renderer->bindFrameBufferTexture(materialBinding->getOutTargetBinding(j)->texture);
 				
 				
-				CoreServices::getInstance()->getRenderer()->drawScreenQuad(materialBinding->getOutTargetBinding(j)->width, materialBinding->getOutTargetBinding(j)->height);
-				CoreServices::getInstance()->getRenderer()->unbindFramebuffers();
+				renderer->drawScreenQuad(materialBinding->getOutTargetBinding(j)->width, materialBinding->getOutTargetBinding(j)->height);
+				renderer->unbindFramebuffers();
 			}						
 			}						
 		}
 		}
-		CoreServices::getInstance()->getRenderer()->clearShader();
-		CoreServices::getInstance()->getRenderer()->loadIdentity();
-		
-		CoreServices::getInstance()->getRenderer()->setOrthoMode();
+		renderer->clearShader();
+		renderer->loadIdentity();		
+		renderer->setOrthoMode();
 	}
 	}
 	
 	
 }
 }

+ 5 - 5
Core/Contents/Source/PolyScreenEntity.cpp

@@ -441,7 +441,7 @@ MouseEventResult ScreenEntity::_onMouseMove(Number x, Number y, int timestamp, V
 		for(int i=children.size()-1;i>=0;i--) {			
 		for(int i=children.size()-1;i>=0;i--) {			
 			Vector2 adjust = parentAdjust;
 			Vector2 adjust = parentAdjust;
 			if(positionMode == POSITION_TOPLEFT)
 			if(positionMode == POSITION_TOPLEFT)
-				adjust += Vector2(width/2.0, height/2.0);
+				adjust += Vector2(floor(width/2.0), floor(height/2.0));
 			
 			
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseMove(x,y, timestamp, adjust);
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseMove(x,y, timestamp, adjust);
 			if(childRes.hit)
 			if(childRes.hit)
@@ -503,7 +503,7 @@ MouseEventResult ScreenEntity::_onMouseUp(Number x, Number y, int mouseButton, i
 		for(int i=children.size()-1;i>=0;i--) {			
 		for(int i=children.size()-1;i>=0;i--) {			
 			Vector2 adjust = parentAdjust;
 			Vector2 adjust = parentAdjust;
 			if(positionMode == POSITION_TOPLEFT)
 			if(positionMode == POSITION_TOPLEFT)
-				adjust += Vector2(width/2.0, height/2.0);			
+				adjust += Vector2(floor(width/2.0), floor(height/2.0));
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseUp(x,y, mouseButton, timestamp, adjust);
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseUp(x,y, mouseButton, timestamp, adjust);
 			if(childRes.hit)
 			if(childRes.hit)
 				ret.hit = true;
 				ret.hit = true;
@@ -551,7 +551,7 @@ MouseEventResult ScreenEntity::_onMouseWheelUp(Number x, Number y, int timestamp
 		for(int i=children.size()-1;i>=0;i--) {			
 		for(int i=children.size()-1;i>=0;i--) {			
 			Vector2 adjust = parentAdjust;
 			Vector2 adjust = parentAdjust;
 			if(positionMode == POSITION_TOPLEFT)
 			if(positionMode == POSITION_TOPLEFT)
-				adjust += Vector2(width/2.0, height/2.0);		
+				adjust += Vector2(floor(width/2.0), floor(height/2.0));
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseWheelUp(x,y, timestamp, adjust);
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseWheelUp(x,y, timestamp, adjust);
 			if(childRes.hit)
 			if(childRes.hit)
 				ret.hit = true;
 				ret.hit = true;
@@ -595,7 +595,7 @@ MouseEventResult ScreenEntity::_onMouseWheelDown(Number x, Number y, int timesta
 		for(int i=children.size()-1;i>=0;i--) {			
 		for(int i=children.size()-1;i>=0;i--) {			
 			Vector2 adjust = parentAdjust;
 			Vector2 adjust = parentAdjust;
 			if(positionMode == POSITION_TOPLEFT)
 			if(positionMode == POSITION_TOPLEFT)
-				adjust += Vector2(width/2.0, height/2.0);
+				adjust += Vector2(floor(width/2.0), floor(height/2.0));
 			
 			
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseWheelDown(x,y, timestamp, adjust);
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseWheelDown(x,y, timestamp, adjust);
 			if(childRes.hit)
 			if(childRes.hit)
@@ -651,7 +651,7 @@ MouseEventResult ScreenEntity::_onMouseDown(Number x, Number y, int mouseButton,
 	for(int i=children.size()-1;i>=0;i--) {			
 	for(int i=children.size()-1;i>=0;i--) {			
 			Vector2 adjust = parentAdjust;
 			Vector2 adjust = parentAdjust;
 			if(positionMode == POSITION_TOPLEFT)
 			if(positionMode == POSITION_TOPLEFT)
-				adjust += Vector2(width/2.0, height/2.0);
+				adjust += Vector2(floor(width/2.0), floor(height/2.0));
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseDown(x,y, mouseButton, timestamp, adjust);
 			MouseEventResult childRes = ((ScreenEntity*)children[i])->_onMouseDown(x,y, mouseButton, timestamp, adjust);
 			if(childRes.hit)
 			if(childRes.hit)
 				ret.hit = true;
 				ret.hit = true;

+ 8 - 8
Documentation/Doxygen/base/footer.html

@@ -1,8 +1,8 @@
-              </div>
-              </div>
-               <div id="footer">
-		Polycode Framework. All content copyright Ivan Safrin, 2011.
-                </div>
-        </body>
-</html>
-
+	</div>	
+		</div>
+			<div id="footer">
+				Copyright Ivan Safrin, 2013
+			</div>
+		</div>
+	</body>
+</html>

+ 24 - 25
Documentation/Doxygen/base/header.html

@@ -1,13 +1,15 @@
 <html>
 <html>
-        <head>  
-                <title>Polycode</title>
-                 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-                <link rel="stylesheet" type="text/css" media="screen" href="/css/main.css"/>
-                <link rel="stylesheet" type="text/css" media="screen" href="/css/docs.css"/>
-		<script type="text/javascript" src="/js/docs.js"></script> 
-		<script type="text/javascript" src="/js/jquery.js"></script> 
+  <head>  
+    <title>Polycode</title>
+     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta name="description" content="Polycode is a free, open-source, cross-platform framework for creative code. "/>
+    <meta name="keywords" content="2d,3d,opengl,framework,game,engine,creative,code,sound" />
+    <link href='http://fonts.googleapis.com/css?family=Roboto:400,300' rel='stylesheet' type='text/css'>
+    <link href="/css/prettify.css" type="text/css" rel="stylesheet" />
+    <script type="text/javascript" src="/js/prettify.js"></script>
+    <link rel="image_src" type="image/jpeg" href="http://www.polycode.org/img/icon-facebook.gif" />
+    <link rel="stylesheet" type="text/css" media="screen" href="/css/main.css"/>
 <script type="text/javascript">
 <script type="text/javascript">
-
   var _gaq = _gaq || [];
   var _gaq = _gaq || [];
   _gaq.push(['_setAccount', 'UA-309912-5']);
   _gaq.push(['_setAccount', 'UA-309912-5']);
   _gaq.push(['_trackPageview']);
   _gaq.push(['_trackPageview']);
@@ -19,22 +21,19 @@
   })();
   })();
 
 
 </script>
 </script>
-        </head>
-        <body>
-                <div id="nav">
-                        <div id="nav_menu">
-			        <div class="menu_item"><a href="/">Cover</a></div>
-                                <div class="menu_item"><a href="/features">Features</a></div>
-                                <div class="menu_item"><a href="/gallery">Gallery</a></div>
-                                <div class="menu_item"><a href="/downloads">Downloads</a></div>
-                                <div class="menu_item"><a href="/modules">Modules</a></div>
-                                <div class="menu_item"><a href="/learning">Learning</a></div>
-                                <div class="menu_item"><a href="/docs">Documentation</a></div>
-                                <div class="menu_item"><a href="/forum">Forum</a></div>
-
-                        </div>
-                        <div id="nav_logo"></div>
-                </div>
-                <div id="content_pane">
+  </head>
+  <body onLoad="prettyPrint()">
+    <div id="content_pane">
+    <div id="nav">
+      <div id="nav_logo"><a href="/"><img src="/img/toplogo.png"/></a></div>
+      <div id="nav_menu">
+        <span class="menu_item"><a href="/features">FEATURES</a></span>
+        <span class="menu_item"><a href="/gallery">GALLERY</a></span>
+        <span class="menu_item"><a href="/download">DOWNLOAD</a></span>
+        <span class="menu_item"><a href="/learn">LEARN</a></span>
+        <span class="menu_item"><a href="/community">COMMUNITY</a></span>
+      </div>
+    </div>
+    <div id="page_content_main">
 		<div id="docs_page">
 		<div id="docs_page">
 			<div>
 			<div>

+ 1 - 1
Examples/Lua/2D_Graphics/2DParticles/2DParticles.polyproject

@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DParticles.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DParticles.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <polyarray:packedItems>
     <polyarray:packedItems>
         <item type="folder" path="Resources" />
         <item type="folder" path="Resources" />

+ 1 - 1
Examples/Lua/2D_Graphics/2DParticles/Scripts/2DParticles.lua

@@ -2,7 +2,7 @@
 
 
 screen = Screen()
 screen = Screen()
 
 
-emitter = ScreenParticleEmitter("Resources/particle.png", screen, Particle.BILLBOARD_PARTICLE,
+emitter = ScreenParticleEmitter("Resources/particle.png", Particle.BILLBOARD_PARTICLE,
 	ParticleEmitter.CONTINUOUS_EMITTER, 4, 200, Vector3(0.0,-50.0,0.0), Vector3(0.0,0.0,0.0),
 	ParticleEmitter.CONTINUOUS_EMITTER, 4, 200, Vector3(0.0,-50.0,0.0), Vector3(0.0,0.0,0.0),
 	Vector3(20.5, 40.0, 0.0), Vector3(0.0,0.0,0.0))
 	Vector3(20.5, 40.0, 0.0), Vector3(0.0,0.0,0.0))
 
 

+ 1 - 1
Examples/Lua/2D_Graphics/BasicText/BasicText.polyproject

@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/BasicText.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/BasicText.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <packedItems>
     <packedItems>
         <item type="folder" path="Scripts" />
         <item type="folder" path="Scripts" />

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_Basic/2DPhysics_Basic.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Basic.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Basic.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
     <packedItems>
         <item type="folder" path="Scripts" />
         <item type="folder" path="Scripts" />
     </packedItems>
     </packedItems>

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_CollisionOnly.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_CollisionOnly.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
     <packedItems>
         <item type="folder" path="Scripts" />
         <item type="folder" path="Scripts" />
     </packedItems>
     </packedItems>

+ 16 - 24
Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/Scripts/2DPhysics_CollisionOnly.lua

@@ -1,24 +1,3 @@
-class "Detector" (EventHandler)
-
-function Detector:Detector(shape)
-        self.shape = shape
-        EventHandler.EventHandler(self)
-end
-
-function Detector:handleEvent(e)
-        if e:getDispatcher() == screen then
-                local pe = PhysicsScreenEvent(e)
-                if e:getEventCode() == PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION then
-                        if pe:getFirstEntity() == self.shape or pe:getSecondEntity() == self.shape then
-                                pe:getFirstEntity():setColor(1.0, 0.0, 0.0, 1.0)
-                                pe:getSecondEntity():setColor(1.0, 0.0, 0.0, 1.0)
-                        end
-                elseif e:getEventCode() == PhysicsScreenEvent.EVENT_END_SHAPE_COLLISION then
-                        pe:getFirstEntity():setColor(1.0, 1.0, 1.0, 1.0)
-                        pe:getSecondEntity():setColor(1.0, 1.0, 1.0, 1.0)
-                end
-        end
-end
 
 
 screen = PhysicsScreen(10, 60)
 screen = PhysicsScreen(10, 60)
 
 
@@ -32,9 +11,22 @@ for i=0,50 do
         screen:addCollisionChild(shape, PhysicsScreenEntity.ENTITY_RECT)
         screen:addCollisionChild(shape, PhysicsScreenEntity.ENTITY_RECT)
 end
 end
 
 
-detector = Detector(checkShape)
-screen:addEventListener(detector, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)
-screen:addEventListener(detector, PhysicsScreenEvent.EVENT_END_SHAPE_COLLISION)
+function onNewCollision(t, event)
+	physicsEvent = safe_cast(event, PhysicsScreenEvent)
+	if same_c_class(physicsEvent:getFirstEntity(),checkShape) or same_c_class(physicsEvent:getSecondEntity(),checkShape) then
+		physicsEvent:getFirstEntity():setColor(1.0, 0.0, 0.0, 1.0)
+		physicsEvent:getSecondEntity():setColor(1.0, 0.0, 0.0, 1.0)
+	end
+end
+
+function onEndCollision(t, event)
+	physicsEvent = safe_cast(event, PhysicsScreenEvent)
+	physicsEvent:getFirstEntity():setColor(1.0, 1.0, 1.0, 1.0)
+	physicsEvent:getSecondEntity():setColor(1.0, 1.0, 1.0, 1.0)
+end
+
+screen:addEventListener(nil, onNewCollision, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)
+screen:addEventListener(nil, onEndCollision, PhysicsScreenEvent.EVENT_END_SHAPE_COLLISION)
 
 
 function onMouseMove(x,y)
 function onMouseMove(x,y)
 	checkShape:setPosition(x,y)
 	checkShape:setPosition(x,y)

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_Contacts/2DPhysics_Contacts.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Contacts.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Contacts.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <polyarray:packedItems>
     <polyarray:packedItems>
         <item type="folder" path="Resources" />
         <item type="folder" path="Resources" />
         <item type="folder" path="Scripts" />
         <item type="folder" path="Scripts" />

+ 9 - 18
Examples/Lua/2D_Physics/2DPhysics_Contacts/Scripts/2DPhysics_Contacts.lua

@@ -1,20 +1,5 @@
-class "ImpactNoise" (EventHandler)
 
 
-function ImpactNoise:ImpactNoise()
-        self.collisionSound = Sound("Resources/collision.wav")
-        EventHandler.EventHandler(self)
-end
-
-function ImpactNoise:handleEvent(e)
-        if e:getDispatcher() == screen then
-                local pe = PhysicsScreenEvent(e)
-                if e:getEventCode() == PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION then
-                        if pe.impactStrength > 5 then
-                                self.collisionSound:Play()
-                        end
-                end
-        end
-end
+-- makes a sound when a collision impact stronger than 5 happens
 
 
 screen = PhysicsScreen(10, 60)
 screen = PhysicsScreen(10, 60)
 shape = ScreenShape(ScreenShape.SHAPE_RECT, 600,30)
 shape = ScreenShape(ScreenShape.SHAPE_RECT, 600,30)
@@ -29,7 +14,13 @@ for i=0,50 do
         screen:addPhysicsChild(shape, PhysicsScreenEntity.ENTITY_RECT, false)
         screen:addPhysicsChild(shape, PhysicsScreenEntity.ENTITY_RECT, false)
 end
 end
 
 
+collisionSound = Sound("Resources/collision.wav")
 
 
-noiseMaker = ImpactNoise()
+function onCollision(t, event)
+	physicsEvent = safe_cast(event, PhysicsScreenEvent)
+	if physicsEvent.impactStrength > 5 then
+			collisionSound:Play()
+		end
+end
 
 
-screen:addEventListener(noiseMaker, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)
+screen:addEventListener(test, onCollision, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_Joints/2DPhysics_Joints.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Joints.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_Joints.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
     <packedItems>
         <item type="folder" path="Scripts" />
         <item type="folder" path="Scripts" />
     </packedItems>
     </packedItems>

+ 2 - 4
Examples/Lua/2D_Physics/2DPhysics_PointCollision/2DPhysics_PointCollision.polyproject

@@ -1,9 +1,7 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_PointCollision.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/2DPhysics_PointCollision.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <polyarray:modules>
-        <module>Physics2D</module>
-    </polyarray:modules>
+    <polyarray:modules />
     <packedItems>
     <packedItems>
         <item type="folder" path="Scripts" />
         <item type="folder" path="Scripts" />
     </packedItems>
     </packedItems>

+ 3 - 3
Examples/Lua/Audio/3DAudio/3DAudio.polyproject

@@ -1,8 +1,8 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/3DAudio.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/3DAudio.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
-    <packedItems>
+    <polyarray:packedItems>
         <item type="folder" path="Resources" />
         <item type="folder" path="Resources" />
         <item type="folder" path="Scripts" />
         <item type="folder" path="Scripts" />
-    </packedItems>
+    </polyarray:packedItems>
 </PolycodeProject>
 </PolycodeProject>

+ 1 - 1
Examples/Lua/Audio/PlayingSounds/PlayingSounds.polyproject

@@ -1,5 +1,5 @@
 <?xml version="1.0" ?>
 <?xml version="1.0" ?>
-<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/PlayingSounds.lua" vSync="false" anisotropyLevel="0" frameRate="60">
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0" entryPoint="Scripts/PlayingSounds.lua" vSync="false" anisotropyLevel="0" frameRate="60" textureFiltering="linear">
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <backgroundColor red="0.25" green="0.25" blue="0.25" />
     <polyarray:packedItems>
     <polyarray:packedItems>
         <item type="folder" path="Resources" />
         <item type="folder" path="Resources" />

+ 2 - 2
Examples/Lua/UI/UIDemo/Scripts/Main.lua

@@ -25,7 +25,7 @@ screen:addChild(window)
 -- and listen to its click event
 -- and listen to its click event
 -- **********************************************************************
 -- **********************************************************************
 
 
-button = UIButton("Rotate me", 100, 30)
+button = UIButton("Rotate me", 100, 24)
 window:addChild(button)
 window:addChild(button)
 button.position.x = 20
 button.position.x = 20
 button.position.y = 40
 button.position.y = 40
@@ -40,7 +40,7 @@ button:addEventListener(nil, onRotateButton, UIEvent.CLICK_EVENT)
 -- UITextInput is a text input field
 -- UITextInput is a text input field
 -- **********************************************************************
 -- **********************************************************************
 
 
-input = UITextInput(false, 100, 24)
+input = UITextInput(false, 100, 16)
 input:setText("DEMO")
 input:setText("DEMO")
 window:addChild(input)
 window:addChild(input)
 input.position.x = 140
 input.position.x = 140

+ 4 - 4
IDE/Contents/Include/PolycodeEditorManager.h

@@ -27,7 +27,7 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-class PolycodeEditorManager { 
+class PolycodeEditorManager : public EventDispatcher { 
 	public:
 	public:
 		PolycodeEditorManager();
 		PolycodeEditorManager();
 		~PolycodeEditorManager();
 		~PolycodeEditorManager();
@@ -36,15 +36,15 @@ class PolycodeEditorManager {
 		PolycodeEditor *createEditorForExtension(String extension);
 		PolycodeEditor *createEditorForExtension(String extension);
 		void registerEditorFactory(PolycodeEditorFactory *editorFactory);
 		void registerEditorFactory(PolycodeEditorFactory *editorFactory);
 	
 	
-		void setCurrentEditor(PolycodeEditor *editor) { currentEditor = editor; }
+		void setCurrentEditor(PolycodeEditor *editor, bool sendChangeEvent = true);
 		PolycodeEditor *getCurrentEditor() { return currentEditor; }
 		PolycodeEditor *getCurrentEditor() { return currentEditor; }
 		
 		
 	//	int close
 	//	int close
-	
+	std::vector<PolycodeEditor*> openEditors;
+		
 protected:
 protected:
 	
 	
 	PolycodeEditor *currentEditor;
 	PolycodeEditor *currentEditor;
 	
 	
-	std::vector<PolycodeEditor*> openEditors;
 	std::vector<PolycodeEditorFactory*> editorFactories;	
 	std::vector<PolycodeEditorFactory*> editorFactories;	
 };
 };

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

@@ -32,6 +32,7 @@
 #include "NewFileWindow.h"
 #include "NewFileWindow.h"
 #include "ToolWindows.h"
 #include "ToolWindows.h"
 #include "PolycodeProjectManager.h"
 #include "PolycodeProjectManager.h"
+#include "PolycodeEditorManager.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
@@ -187,6 +188,7 @@ public:
 	
 	
 	ScreenEntity *welcomeEntity;	
 	ScreenEntity *welcomeEntity;	
 	PolycodeProjectBrowser *projectBrowser;
 	PolycodeProjectBrowser *projectBrowser;
+	PolycodeEditorManager *editorManager;
 		
 		
 	UIImageButton *playButton;
 	UIImageButton *playButton;
 	UIImageButton *stopButton;
 	UIImageButton *stopButton;
@@ -223,6 +225,9 @@ private:
 	ScreenLabel *dragLabel;
 	ScreenLabel *dragLabel;
 	bool isDragging;
 	bool isDragging;
 	
 	
+	ScreenLabel *currentProjectTitle;
+	UIComboBox *currentFileSelector;
+	
 	ScreenImage *welcomeImage;	
 	ScreenImage *welcomeImage;	
 	
 	
 	
 	

+ 3 - 0
IDE/Contents/Include/PolycodeIDEApp.h

@@ -93,6 +93,9 @@ public:
 	
 	
 	void refreshProject();	
 	void refreshProject();	
 	
 	
+	bool needsRedraw;
+	bool lastConnected;
+	
 	const static int EVENT_SHOW_MENU = 1;
 	const static int EVENT_SHOW_MENU = 1;
 	
 	
 	Core *core;	
 	Core *core;	

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

@@ -29,7 +29,7 @@
 
 
 using namespace Polycode;
 using namespace Polycode;
 
 
-class PolycodeProjectManager {
+class PolycodeProjectManager : public EventDispatcher {
 	public:
 	public:
 		PolycodeProjectManager();
 		PolycodeProjectManager();
 		~PolycodeProjectManager();
 		~PolycodeProjectManager();

+ 34 - 0
IDE/Contents/Include/PolycodeProps.h

@@ -75,6 +75,21 @@ class NumberProp : public PropProp {
 		UITextInput *numberEntry;
 		UITextInput *numberEntry;
 };
 };
 
 
+
+class CustomProp : public PropProp {
+	public:
+		CustomProp(String key, String value);
+		~CustomProp();
+		void handleEvent(Event *event);
+		void set(String key, String val);
+		String getValue();
+		String getKey();
+				
+		UITextInput *keyEntry;
+		UITextInput *valueEntry;
+		UIImageButton *removeButton;
+};
+
 class StringProp : public PropProp {
 class StringProp : public PropProp {
 	public:
 	public:
 		StringProp(String caption);
 		StringProp(String caption);
@@ -249,6 +264,24 @@ class EntitySheet : public PropSheet {
 		ComboProp *blendingProp;
 		ComboProp *blendingProp;
 };
 };
 
 
+class EntityPropSheet : public PropSheet {
+	public:
+		EntityPropSheet();		
+		void handleEvent(Event *event);
+		void Update();
+		void refreshProps();
+				
+		UIButton *addButton;
+		
+		Entity *entity;
+		Entity *lastEntity;
+		
+		int lastNumProps;
+		
+		int removeIndex;
+		
+};
+
 class ShapeSheet : public PropSheet {
 class ShapeSheet : public PropSheet {
 	public:
 	public:
 		ShapeSheet();
 		ShapeSheet();
@@ -439,6 +472,7 @@ class PropList : public UIElement {
 		~PropList();
 		~PropList();
 		
 		
 		void updateProps();
 		void updateProps();
+		void updateSize();
 		
 		
 		void addPropSheet(PropSheet *sheet);
 		void addPropSheet(PropSheet *sheet);
 		void handleEvent(Event *event);
 		void handleEvent(Event *event);

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

@@ -172,6 +172,7 @@ class PolycodeScreenEditorMain : public UIElement {
 		ScreenImageSheet *imageSheet;
 		ScreenImageSheet *imageSheet;
 		ScreenLabelSheet *labelSheet;
 		ScreenLabelSheet *labelSheet;
 		SoundSheet *soundSheet;
 		SoundSheet *soundSheet;
+		EntityPropSheet *entityPropSheet;
 		ScreenEntityInstanceSheet *instanceSheet;
 		ScreenEntityInstanceSheet *instanceSheet;
 		ScreenSpriteSheet *spriteSheet;
 		ScreenSpriteSheet *spriteSheet;
 		ScreenParticleSheet *particleSheet;
 		ScreenParticleSheet *particleSheet;

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

@@ -31,7 +31,7 @@ ExportProjectWindow::ExportProjectWindow() : UIWindow(L"Publish Project", 400, 3
 	label->color.a = 0.4;	
 	label->color.a = 0.4;	
 	label->setPosition(padding, 50);
 	label->setPosition(padding, 50);
 
 
-	projectLocationInput = new UITextInput(false, 430-(padding*2.0), 12);	
+	projectLocationInput = new UITextInput(false, 420-(padding*2.0), 12);	
 	addChild(projectLocationInput);
 	addChild(projectLocationInput);
 	projectLocationInput->setPosition(padding, 80);
 	projectLocationInput->setPosition(padding, 80);
 
 
@@ -55,7 +55,7 @@ ExportProjectWindow::ExportProjectWindow() : UIWindow(L"Publish Project", 400, 3
 	addChild(winCheckBox);
 	addChild(winCheckBox);
 	winCheckBox->setPosition(padding, 205);
 	winCheckBox->setPosition(padding, 205);
 
 
-	linCheckBox = new UICheckBox("Linux (Intel 64-bit)", false);
+	linCheckBox = new UICheckBox("Linux (Intel 32-bit)", false);
 	addChild(linCheckBox);
 	addChild(linCheckBox);
 	linCheckBox->setPosition(padding, 225);
 	linCheckBox->setPosition(padding, 225);
 
 

+ 9 - 1
IDE/Contents/Source/PolycodeEditorManager.cpp

@@ -23,7 +23,7 @@
 #include "PolycodeEditorManager.h"
 #include "PolycodeEditorManager.h"
 
 
 
 
-PolycodeEditorManager::PolycodeEditorManager() {
+PolycodeEditorManager::PolycodeEditorManager()  : EventDispatcher() {
 	currentEditor = NULL;
 	currentEditor = NULL;
 }
 }
 
 
@@ -43,6 +43,14 @@ PolycodeEditor *PolycodeEditorManager::createEditorForExtension(String extension
 	return NULL;
 	return NULL;
 }
 }
 
 
+void PolycodeEditorManager::setCurrentEditor(PolycodeEditor *editor, bool sendChangeEvent) {
+	currentEditor = editor;
+	if(sendChangeEvent){
+		dispatchEvent(new Event(), Event::CHANGE_EVENT);
+	}
+}
+
+
 PolycodeEditor *PolycodeEditorManager::getEditorForPath(String path) {
 PolycodeEditor *PolycodeEditorManager::getEditorForPath(String path) {
 	for(int i=0; i < openEditors.size();i++) {
 	for(int i=0; i < openEditors.size();i++) {
 		PolycodeEditor *editor = openEditors[i];
 		PolycodeEditor *editor = openEditors[i];

+ 35 - 0
IDE/Contents/Source/PolycodeFrame.cpp

@@ -555,6 +555,16 @@ PolycodeFrame::PolycodeFrame() : ScreenEntity() {
 	addChild(stopButton);
 	addChild(stopButton);
 	stopButton->setPosition(10,4);
 	stopButton->setPosition(10,4);
 
 
+	currentProjectTitle = new ScreenLabel("", 32, "section");
+	addChild(currentProjectTitle);
+	currentProjectTitle->color.a = 0.4;
+	currentProjectTitle->setPosition(70, 0);
+
+	currentFileSelector = new UIComboBox(globalMenu, 300);
+	currentFileSelector->addEventListener(this, UIEvent::CHANGE_EVENT);
+	
+	addChild(currentFileSelector);
+
 	
 	
 	resizer = new ScreenImage("Images/corner_resize.png");	
 	resizer = new ScreenImage("Images/corner_resize.png");	
 	addChild(resizer);
 	addChild(resizer);
@@ -728,6 +738,29 @@ void PolycodeFrame::showAssetBrowser(std::vector<String> extensions) {
 
 
 void PolycodeFrame::handleEvent(Event *event) {
 void PolycodeFrame::handleEvent(Event *event) {
 	
 	
+	if(event->getDispatcher() == currentFileSelector && event->getEventType() == "UIEvent") {
+		PolycodeEditor *editor = editorManager->openEditors[currentFileSelector->getSelectedIndex()];
+		editorManager->setCurrentEditor(editor, false);
+		showEditor(editor);
+	}
+	
+	if(event->getDispatcher() == editorManager) {	
+		currentFileSelector->clearItems();
+		
+		for(int i=0; i < editorManager->openEditors.size(); i++) {
+			OSFileEntry entry(editorManager->openEditors[i]->getFilePath(), OSFileEntry::TYPE_FILE);
+			currentFileSelector->addComboItem(entry.name);
+			if(editorManager->getCurrentEditor() == editorManager->openEditors[i]) {
+				currentFileSelector->setSelectedIndex(i);
+			}
+			
+		}
+	}
+	
+	if(event->getDispatcher() == projectManager) {
+		currentProjectTitle->setText(projectManager->getActiveProject()->getProjectName());
+	}
+	
 	if(event->getDispatcher() == aboutOKButton && event->getEventType() == "UIEvent") {
 	if(event->getDispatcher() == aboutOKButton && event->getEventType() == "UIEvent") {
 		hideModal();
 		hideModal();
 	}
 	}
@@ -814,6 +847,8 @@ void PolycodeFrame::Resize(int x, int y) {
 	modalBlocker->setShapeSize(x, y);
 	modalBlocker->setShapeSize(x, y);
 	fileDialogBlocker->setShapeSize(x, y);
 	fileDialogBlocker->setShapeSize(x, y);
 		
 		
+	currentFileSelector->setPosition(x-350, 11);
+	
 	
 	
 	if(this->modalChild) {
 	if(this->modalChild) {
 		modalChild->setPosition((x-modalChild->getWidth())/2.0f, (y-modalChild->getHeight())/2.0f);
 		modalChild->setPosition((x-modalChild->getWidth())/2.0f, (y-modalChild->getHeight())/2.0f);

+ 27 - 4
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -32,8 +32,12 @@ PolycodeClipboard *globalClipboard;
 
 
 PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	core = new POLYCODE_CORE(view, 900,700,false,true, 0, 0,30, -1);	
 	core = new POLYCODE_CORE(view, 900,700,false,true, 0, 0,30, -1);	
-	core->addEventListener(this, Core::EVENT_CORE_RESIZE);
+//	core->pauseOnLoseFocus = true;
 	
 	
+	core->addEventListener(this, Core::EVENT_CORE_RESIZE);
+	core->addEventListener(this, Core::EVENT_LOST_FOCUS);
+	core->addEventListener(this, Core::EVENT_GAINED_FOCUS);
+			
 	globalClipboard = new PolycodeClipboard();
 	globalClipboard = new PolycodeClipboard();
 	
 	
 	CoreServices::getInstance()->getRenderer()->setTextureFilteringMode(Renderer::TEX_FILTERING_NEAREST);
 	CoreServices::getInstance()->getRenderer()->setTextureFilteringMode(Renderer::TEX_FILTERING_NEAREST);
@@ -63,6 +67,7 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	
 	
 	willRunProject = false;
 	willRunProject = false;
 
 
+	globalMenu	= new UIGlobalMenu();
 		
 		
 	printf("creating font editor\n"); 
 	printf("creating font editor\n"); 
 	
 	
@@ -74,6 +79,9 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	frame = new PolycodeFrame();
 	frame = new PolycodeFrame();
 	frame->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
 	frame->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
 
 
+	frame->editorManager = editorManager;
+	editorManager->addEventListener(frame, Event::CHANGE_EVENT);
+
 	frame->console->backtraceWindow->addEventListener(this, BackTraceEvent::EVENT_BACKTRACE_SELECTED);
 	frame->console->backtraceWindow->addEventListener(this, BackTraceEvent::EVENT_BACKTRACE_SELECTED);
 
 
 	frame->textInputPopup->addEventListener(this, UIEvent::OK_EVENT);	
 	frame->textInputPopup->addEventListener(this, UIEvent::OK_EVENT);	
@@ -94,6 +102,8 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	projectManager->setProjectBrowser(frame->getProjectBrowser());
 	projectManager->setProjectBrowser(frame->getProjectBrowser());
 	
 	
 	frame->projectManager = projectManager;
 	frame->projectManager = projectManager;
+
+	projectManager->addEventListener(frame, Event::CHANGE_EVENT);
 	
 	
 	frame->getProjectBrowser()->addEventListener(this, Event::CHANGE_EVENT);
 	frame->getProjectBrowser()->addEventListener(this, Event::CHANGE_EVENT);
 	frame->getProjectBrowser()->addEventListener(this, PolycodeProjectBrowserEvent::HANDLE_MENU_COMMAND);
 	frame->getProjectBrowser()->addEventListener(this, PolycodeProjectBrowserEvent::HANDLE_MENU_COMMAND);
@@ -113,7 +123,6 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	editorManager->registerEditorFactory(new PolycodeSpriteEditorFactory());
 	editorManager->registerEditorFactory(new PolycodeSpriteEditorFactory());
 
 
 		
 		
-	globalMenu	= new UIGlobalMenu();
 	screen->addChild(globalMenu);	
 	screen->addChild(globalMenu);	
 				
 				
 	loadConfigFile();
 	loadConfigFile();
@@ -158,7 +167,8 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 #endif
 #endif
 	core->setVideoMode(1100, 700, false, true, 0, 0);
 	core->setVideoMode(1100, 700, false, true, 0, 0);
 
 
-
+	needsRedraw = false;
+	lastConnected = false;
 }
 }
 
 
 void PolycodeIDEApp::renameFile() {
 void PolycodeIDEApp::renameFile() {
@@ -448,6 +458,12 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 
 
 	if(event->getDispatcher() == core) {
 	if(event->getDispatcher() == core) {
 		switch(event->getEventCode()) {
 		switch(event->getEventCode()) {
+			case Core::EVENT_LOST_FOCUS:
+				core->setFramerate(1);
+			break;		
+			case Core::EVENT_GAINED_FOCUS:
+				core->setFramerate(30);			
+			break;					
 			case Core::EVENT_CORE_RESIZE:
 			case Core::EVENT_CORE_RESIZE:
 				if(menuBar) {
 				if(menuBar) {
 					frame->Resize(core->getXRes(), core->getYRes()-25);
 					frame->Resize(core->getXRes(), core->getYRes()-25);
@@ -677,12 +693,17 @@ bool PolycodeIDEApp::Update() {
 		runProject();
 		runProject();
 	}
 	}
 
 
+	if(lastConnected != debugger->isConnected()) {
+		needsRedraw = true;
+		lastConnected = debugger->isConnected();
+	}
+
 	if(debugger->isConnected()) {
 	if(debugger->isConnected()) {
 			frame->stopButton->visible = true;
 			frame->stopButton->visible = true;
 			frame->stopButton->enabled = true;			
 			frame->stopButton->enabled = true;			
 			
 			
 			frame->playButton->visible = false;
 			frame->playButton->visible = false;
-			frame->playButton->enabled = false;			
+			frame->playButton->enabled = false;						
 			
 			
 	} else {
 	} else {
 			frame->stopButton->visible = false;
 			frame->stopButton->visible = false;
@@ -691,6 +712,7 @@ bool PolycodeIDEApp::Update() {
 			frame->playButton->visible = true;
 			frame->playButton->visible = true;
 			frame->playButton->enabled = true;				
 			frame->playButton->enabled = true;				
 	}
 	}
+	
 
 
 	if(projectManager->getProjectCount() == 1) {
 	if(projectManager->getProjectCount() == 1) {
 		projectManager->setActiveProject(projectManager->getProjectByIndex(0));
 		projectManager->setActiveProject(projectManager->getProjectByIndex(0));
@@ -706,6 +728,7 @@ bool PolycodeIDEApp::Update() {
 		frame->mainSizer->enabled = false;		
 		frame->mainSizer->enabled = false;		
 	}
 	}
 
 
+
 	return core->Update();
 	return core->Update();
 }
 }
 
 

+ 2 - 1
IDE/Contents/Source/PolycodeProjectManager.cpp

@@ -23,7 +23,7 @@
 #include "PolycodeProjectManager.h"
 #include "PolycodeProjectManager.h"
 #include "PolycodeToolLauncher.h"
 #include "PolycodeToolLauncher.h"
 
 
-PolycodeProjectManager::PolycodeProjectManager() {
+PolycodeProjectManager::PolycodeProjectManager() : EventDispatcher() {
 	activeProject = NULL;
 	activeProject = NULL;
 	activeFolder = "";
 	activeFolder = "";
 	selectedFile = "";
 	selectedFile = "";
@@ -106,6 +106,7 @@ void PolycodeProjectManager::setActiveProject(PolycodeProject* project) {
 		if(project){			
 		if(project){			
 			CoreServices::getInstance()->getResourceManager()->addArchive(project->getRootFolder());
 			CoreServices::getInstance()->getResourceManager()->addArchive(project->getRootFolder());
 		}
 		}
+		dispatchEvent(new Event(), Event::CHANGE_EVENT);
 	}
 	}
 }
 }
 
 

+ 154 - 1
IDE/Contents/Source/PolycodeProps.cpp

@@ -68,7 +68,10 @@ void PropList::updateProps() {
 	for(int i=0; i < props.size(); i++) {
 	for(int i=0; i < props.size(); i++) {
 		props[i]->Update();
 		props[i]->Update();
 	}
 	}
-	
+	updateSize();
+}
+
+void PropList::updateSize() {
 	Resize(width, height);
 	Resize(width, height);
 	scrollContainer->setScrollValue(0, 0);	
 	scrollContainer->setScrollValue(0, 0);	
 }
 }
@@ -272,6 +275,58 @@ Vector2Prop::~Vector2Prop() {
 
 
 }
 }
 
 
+CustomProp::CustomProp(String key, String value) : PropProp("") {
+	keyEntry = new UITextInput(false, 120, 12);
+	keyEntry->setText(key);
+	keyEntry->addEventListener(this, UIEvent::CHANGE_EVENT);
+	propContents->addChild(keyEntry);
+	keyEntry->setPosition(-90, 0);
+
+	valueEntry = new UITextInput(false, 120, 12);
+	valueEntry->setText(value);	
+	valueEntry->addEventListener(this, UIEvent::CHANGE_EVENT);
+	propContents->addChild(valueEntry);
+	valueEntry->setPosition(45, 0);
+	
+	removeButton = new UIImageButton("Images/remove_icon.png");
+	removeButton->addEventListener(this, UIEvent::CLICK_EVENT);	
+	propContents->addChild(removeButton);
+	removeButton->setPosition(-110, 6);
+	
+	setHeight(30);
+
+}
+
+CustomProp::~CustomProp() {
+
+}
+
+void CustomProp::handleEvent(Event *event) {
+
+	if(event->getEventType() == "UIEvent") {
+	
+		if(event->getDispatcher() == keyEntry || event->getDispatcher() == valueEntry) {
+			dispatchEvent(new Event(), Event::CHANGE_EVENT);		
+		}	
+	
+		if(event->getDispatcher() == removeButton) {
+			dispatchEvent(new Event(), Event::CANCEL_EVENT);
+		}
+	}
+}
+
+void CustomProp::set(String key, String val) {
+}
+
+String CustomProp::getValue() {
+	return valueEntry->getText();
+}
+
+String CustomProp::getKey() {
+	return keyEntry->getText();
+}
+
+
 StringProp::StringProp(String caption) : PropProp(caption) {
 StringProp::StringProp(String caption) : PropProp(caption) {
 
 
 	stringEntry = new UITextInput(false, 150, 12);
 	stringEntry = new UITextInput(false, 150, 12);
@@ -894,6 +949,104 @@ void ShapeSheet::Update() {
 	}
 	}
 }
 }
 
 
+EntityPropSheet::EntityPropSheet() : PropSheet("CUSTOM PROPERTIES", "entityProps"){
+
+	propHeight = 75;
+	
+	addButton = new UIButton("Add Property", 150);
+	addButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(addButton);
+	addButton->setPosition(15, 35);
+	
+	entity = NULL;
+	lastEntity = NULL;
+	
+	lastNumProps = 0;
+	
+	removeIndex = -1;
+}
+
+void EntityPropSheet::handleEvent(Event *event) {
+	if(!entity)
+		return;
+		
+	if(event->getDispatcher() == addButton && event->getEventType() == "UIEvent") {
+		entity->entityProps.push_back(EntityProp());
+		refreshProps();
+	}
+	
+	for(int i=0; i < props.size(); i++) {
+		if(event->getDispatcher() == props[i] && event->getEventType() == "") {
+			switch(event->getEventCode()) {						
+				case Event::CANCEL_EVENT:
+					removeIndex = i;
+				break;
+				case Event::CHANGE_EVENT:
+					if(i < entity->entityProps.size()) {
+						entity->entityProps[i].propName = ((CustomProp*)props[i])->getKey();
+						entity->entityProps[i].propValue = ((CustomProp*)props[i])->getValue();			
+					}
+				break;				
+			}
+		}
+	}
+
+}
+
+void EntityPropSheet::refreshProps() {
+
+	for(int i=0; i < props.size(); i++) {
+		contents->removeChild(props[i]);
+		props[i]->removeAllHandlersForListener(this);
+		delete props[i];
+	}
+	props.clear();
+	propHeight = 75;
+	
+	for(int i=0; i < entity->entityProps.size(); i++) {			
+		EntityProp prop = entity->entityProps[i];
+		CustomProp *newProp = new CustomProp(prop.propName, prop.propValue);
+		newProp->addEventListener(this, Event::CANCEL_EVENT);
+		newProp->addEventListener(this, Event::CHANGE_EVENT);		
+		addProp(newProp);
+		propHeight += 35;
+	}
+	
+	
+	addButton->setPosition(15, propHeight-40);	
+	
+	
+	if(lastNumProps != entity->entityProps.size()) {
+		dispatchEvent(new Event(), Event::CHANGE_EVENT);
+	}
+	
+	lastNumProps = entity->entityProps.size();
+		
+	Resize(width, height);	
+}
+
+void EntityPropSheet::Update() {
+	if(entity) {
+	
+		if(removeIndex != -1) {
+			if(removeIndex < entity->entityProps.size()) {
+				entity->entityProps.erase(entity->entityProps.begin() + removeIndex);
+			}
+			removeIndex = -1;
+			refreshProps();
+		}
+	
+		enabled = true;		
+		if(entity != lastEntity) {
+			refreshProps();
+			lastEntity = entity;
+		}
+	} else {
+		enabled = false;		
+	}
+}
+
+
 EntitySheet::EntitySheet() : PropSheet("ENTITY", "entity"){
 EntitySheet::EntitySheet() : PropSheet("ENTITY", "entity"){
 	idProp = new StringProp("ID");
 	idProp = new StringProp("ID");
 	addProp(idProp);
 	addProp(idProp);

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

@@ -127,7 +127,7 @@ void PolycodeRemoteDebugger::handleEvent(Event *event) {
 				newClient->client = serverEvent->client;
 				newClient->client = serverEvent->client;
 				newClient->client->addEventListener(this, ServerClientEvent::EVENT_CLIENT_DATA);
 				newClient->client->addEventListener(this, ServerClientEvent::EVENT_CLIENT_DATA);
 				PolycodeConsole::print("Remote debugger client connected...\n");printf("CLIENT CONNECTED\n");		
 				PolycodeConsole::print("Remote debugger client connected...\n");printf("CLIENT CONNECTED\n");		
-				debuggerClients.push_back(newClient);		
+				debuggerClients.push_back(newClient);				
 			}
 			}
 			break;
 			break;
 		}
 		}

+ 12 - 2
IDE/Contents/Source/PolycodeScreenEditor.cpp

@@ -725,6 +725,10 @@ PolycodeScreenEditorMain::PolycodeScreenEditorMain() {
 	entitySheet = new EntitySheet();
 	entitySheet = new EntitySheet();
 	entityProps->addPropSheet(entitySheet);
 	entityProps->addPropSheet(entitySheet);
 	
 	
+	entityPropSheet = new EntityPropSheet();
+	entityPropSheet->addEventListener(this, Event::CHANGE_EVENT);	
+	entityProps->addPropSheet(entityPropSheet);	
+	
 	selectEntity(NULL);	
 	selectEntity(NULL);	
 	
 	
 	entityProps->updateProps();		
 	entityProps->updateProps();		
@@ -1499,6 +1503,7 @@ void PolycodeScreenEditorMain::selectEntity(ScreenEntity *entity) {
 	instanceSheet->instance = NULL;
 	instanceSheet->instance = NULL;
 	particleSheet->emitter = NULL;
 	particleSheet->emitter = NULL;
 	spriteSheet->sprite = NULL;
 	spriteSheet->sprite = NULL;
+	entityPropSheet->entity = NULL;
 				
 				
 	if(!entity) {
 	if(!entity) {
 		selectedEntity = NULL;
 		selectedEntity = NULL;
@@ -1529,7 +1534,8 @@ void PolycodeScreenEditorMain::selectEntity(ScreenEntity *entity) {
 	}
 	}
 	
 	
 	if(entity->getEntityProp("editor_type") != "root") {
 	if(entity->getEntityProp("editor_type") != "root") {
-		entitySheet->entity = entity;	
+		entitySheet->entity = entity;
+		entityPropSheet->entity = entity;
 	}
 	}
 
 
 	if(dynamic_cast<ScreenParticleEmitter*>(entity)) {
 	if(dynamic_cast<ScreenParticleEmitter*>(entity)) {
@@ -1656,6 +1662,11 @@ void PolycodeScreenEditorMain::handleEvent(Event *event) {
 
 
 		
 		
 	}
 	}
+
+	if(event->getDispatcher() == entityPropSheet && event->getEventType() == "") {
+			entityProps->updateSize();
+			entityProps->scrollContainer->setScrollValue(0.0, 1.0);
+	}
 	
 	
 	if((event->getDispatcher() == transform2dSheet || event->getDispatcher() == labelSheet || event->getDispatcher() == imageSheet) && event->getEventType() == "") {
 	if((event->getDispatcher() == transform2dSheet || event->getDispatcher() == labelSheet || event->getDispatcher() == imageSheet) && event->getEventType() == "") {
 		syncTransformToSelected();
 		syncTransformToSelected();
@@ -1664,7 +1675,6 @@ void PolycodeScreenEditorMain::handleEvent(Event *event) {
 	
 	
 	if(event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) {
 	if(event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) {
 		if(event->getEventCode() == InputEvent::EVENT_KEYDOWN) {
 		if(event->getEventCode() == InputEvent::EVENT_KEYDOWN) {
-			printf("KEY: %d\n", inputEvent->key);
 			switch(inputEvent->key) {
 			switch(inputEvent->key) {
 				case Polycode::KEY_ESCAPE:
 				case Polycode::KEY_ESCAPE:
 					if(selectedEntity) {
 					if(selectedEntity) {

+ 1 - 1
Modules/Contents/UI/Source/PolyUIComboBox.cpp

@@ -133,7 +133,7 @@ UIComboBoxItem *UIComboBox::getSelectedItem() {
 
 
 void UIComboBox::toggleDropDown() {
 void UIComboBox::toggleDropDown() {
 	Vector2 screenPos = this->getScreenPosition();
 	Vector2 screenPos = this->getScreenPosition();
-	dropDownMenu = globalMenu->showMenu(screenPos.x, screenPos.y - height, width);
+	dropDownMenu = globalMenu->showMenu(screenPos.x, screenPos.y, width);
 	
 	
 	for(int i=0; i < items.size(); i++) {
 	for(int i=0; i < items.size(); i++) {
 		dropDownMenu->addOption(items[i]->label, String::IntToString(i));
 		dropDownMenu->addOption(items[i]->label, String::IntToString(i));

+ 24 - 6
Player/Contents/Source/PolycodePlayer.cpp

@@ -670,7 +670,7 @@ void PolycodePlayer::loadFile(const char *fileName) {
 	
 	
 	Logger::log("Core created...\n");
 	Logger::log("Core created...\n");
 
 
-	CoreServices::getInstance()->getResourceManager()->addArchive("UIThemes.zip");
+	CoreServices::getInstance()->getResourceManager()->addArchive("UIThemes.pak");
 	CoreServices::getInstance()->getConfig()->loadConfig("Polycode", "UIThemes/default/theme.xml");
 	CoreServices::getInstance()->getConfig()->loadConfig("Polycode", "UIThemes/default/theme.xml");
 	
 	
 	CoreServices::getInstance()->getResourceManager()->addArchive("api.pak");
 	CoreServices::getInstance()->getResourceManager()->addArchive("api.pak");
@@ -814,50 +814,65 @@ void PolycodePlayer::handleEvent(Event *event) {
 			case InputEvent::EVENT_KEYDOWN:
 			case InputEvent::EVENT_KEYDOWN:
 			{
 			{
 				if(L && !crashed) {
 				if(L && !crashed) {
+					lua_getfield (L, LUA_GLOBALSINDEX, "__customError");
+					errH = lua_gettop(L);					
 					lua_getfield(L, LUA_GLOBALSINDEX, "onKeyDown");
 					lua_getfield(L, LUA_GLOBALSINDEX, "onKeyDown");
 					lua_pushinteger(L, inputEvent->keyCode());
 					lua_pushinteger(L, inputEvent->keyCode());
-					lua_pcall(L, 1,0,errH);					
+					lua_pcall(L, 1,0,errH);
+					lua_settop(L, 0);
 				}
 				}
 			}
 			}
 			break;
 			break;
 			case InputEvent::EVENT_KEYUP:
 			case InputEvent::EVENT_KEYUP:
 			{
 			{
 				if(L && !crashed) {
 				if(L && !crashed) {
+					lua_getfield (L, LUA_GLOBALSINDEX, "__customError");
+					errH = lua_gettop(L);									
 					lua_getfield(L, LUA_GLOBALSINDEX, "onKeyUp");
 					lua_getfield(L, LUA_GLOBALSINDEX, "onKeyUp");
 					lua_pushinteger(L, inputEvent->keyCode());
 					lua_pushinteger(L, inputEvent->keyCode());
-					lua_pcall(L, 1,0,errH);					
+					lua_pcall(L, 1,0,errH);
+					lua_settop(L, 0);								
 				}
 				}
 			}
 			}
 			break;
 			break;
 			case InputEvent::EVENT_MOUSEDOWN:
 			case InputEvent::EVENT_MOUSEDOWN:
 			{
 			{
 				if(L && !crashed) {
 				if(L && !crashed) {
+					lua_getfield (L, LUA_GLOBALSINDEX, "__customError");
+					errH = lua_gettop(L);									
 					lua_getfield(L, LUA_GLOBALSINDEX, "onMouseDown");
 					lua_getfield(L, LUA_GLOBALSINDEX, "onMouseDown");
 					lua_pushinteger(L, inputEvent->mouseButton);
 					lua_pushinteger(L, inputEvent->mouseButton);
 					lua_pushnumber(L, inputEvent->mousePosition.x);
 					lua_pushnumber(L, inputEvent->mousePosition.x);
-					lua_pushnumber(L, inputEvent->mousePosition.y);					
+					lua_pushnumber(L, inputEvent->mousePosition.y);	
 					lua_pcall(L, 3,0,errH);					
 					lua_pcall(L, 3,0,errH);					
+					lua_settop(L, 0);					
 				}
 				}
 			}
 			}
 			break;	
 			break;	
 			case InputEvent::EVENT_MOUSEUP:
 			case InputEvent::EVENT_MOUSEUP:
 			{
 			{
 				if(L && !crashed) {
 				if(L && !crashed) {
+					lua_getfield (L, LUA_GLOBALSINDEX, "__customError");
+					errH = lua_gettop(L);									
 					lua_getfield(L, LUA_GLOBALSINDEX, "onMouseUp");
 					lua_getfield(L, LUA_GLOBALSINDEX, "onMouseUp");
 					lua_pushinteger(L, inputEvent->mouseButton);
 					lua_pushinteger(L, inputEvent->mouseButton);
 					lua_pushnumber(L, inputEvent->mousePosition.x);
 					lua_pushnumber(L, inputEvent->mousePosition.x);
-					lua_pushnumber(L, inputEvent->mousePosition.y);					
+					lua_pushnumber(L, inputEvent->mousePosition.y);		
 					lua_pcall(L, 3,0,errH);					
 					lua_pcall(L, 3,0,errH);					
+					lua_settop(L, 0);					
 				}
 				}
 			}
 			}
 			break;	
 			break;	
 			case InputEvent::EVENT_MOUSEMOVE:
 			case InputEvent::EVENT_MOUSEMOVE:
 			{
 			{
 				if(L && !crashed) {
 				if(L && !crashed) {
+					lua_getfield (L, LUA_GLOBALSINDEX, "__customError");
+					errH = lua_gettop(L);									
 					lua_getfield(L, LUA_GLOBALSINDEX, "onMouseMove");
 					lua_getfield(L, LUA_GLOBALSINDEX, "onMouseMove");
 					lua_pushnumber(L, inputEvent->mousePosition.x);
 					lua_pushnumber(L, inputEvent->mousePosition.x);
-					lua_pushnumber(L, inputEvent->mousePosition.y);					
+					lua_pushnumber(L, inputEvent->mousePosition.y);	
 					lua_pcall(L, 2,0,errH);					
 					lua_pcall(L, 2,0,errH);					
+					lua_settop(L, 0);					
 				}
 				}
 			}
 			}
 			break;																			
 			break;																			
@@ -868,6 +883,8 @@ void PolycodePlayer::handleEvent(Event *event) {
 
 
 bool PolycodePlayer::Update() {
 bool PolycodePlayer::Update() {
 	if(L) {
 	if(L) {
+		lua_getfield (L, LUA_GLOBALSINDEX, "__customError");
+		errH = lua_gettop(L);	
 		if(doCodeInject) {
 		if(doCodeInject) {
 			printf("INJECTING CODE:[%s]\n", injectCodeString.c_str());
 			printf("INJECTING CODE:[%s]\n", injectCodeString.c_str());
 			doCodeInject = false;			
 			doCodeInject = false;			
@@ -880,6 +897,7 @@ bool PolycodePlayer::Update() {
 			lua_pushnumber(L, core->getElapsed());
 			lua_pushnumber(L, core->getElapsed());
 			lua_pcall(L, 1,0,errH);
 			lua_pcall(L, 1,0,errH);
 		}
 		}
+		lua_settop(L, 0);
 	}
 	}
 	return core->Update();
 	return core->Update();
 }
 }