Ivan Safrin преди 14 години
родител
ревизия
3f300899cd
променени са 79 файла, в които са добавени 1050 реда и са изтрити 63 реда
  1. 6 0
      Core/Contents/Include/PolyCore.h
  2. 2 0
      Core/Contents/Source/PolyCocoaCore.mm
  3. 4 0
      Core/Contents/Source/PolyCore.cpp
  4. 11 8
      Core/Contents/Source/PolyEntity.cpp
  5. 34 0
      Examples/Lua/2D_Graphics/2DParticles/2DParticles.lua
  6. 7 0
      Examples/Lua/2D_Graphics/2DParticles/2DParticles.xml
  7. BIN
      Examples/Lua/2D_Graphics/2DParticles/particle.png
  8. 9 0
      Examples/Lua/2D_Graphics/2DTransforms/2DTransforms.lua
  9. 7 0
      Examples/Lua/2D_Graphics/2DTransforms/2DTransforms.xml
  10. BIN
      Examples/Lua/2D_Graphics/2DTransforms/polycode_logo.png
  11. 3 0
      Examples/Lua/2D_Graphics/BasicImage/BasicImage.lua
  12. 7 0
      Examples/Lua/2D_Graphics/BasicImage/BasicImage.xml
  13. BIN
      Examples/Lua/2D_Graphics/BasicImage/polycode_logo.png
  14. 3 0
      Examples/Lua/2D_Graphics/BasicText/BasicText.lua
  15. 4 0
      Examples/Lua/2D_Graphics/BasicText/BasicText.xml
  16. 28 0
      Examples/Lua/2D_Graphics/ScreenEntities/ScreenEntities.lua
  17. 4 0
      Examples/Lua/2D_Graphics/ScreenEntities/ScreenEntities.xml
  18. 12 0
      Examples/Lua/2D_Physics/2DPhysics_Basic/2DPhysics_Basic.lua
  19. 7 0
      Examples/Lua/2D_Physics/2DPhysics_Basic/2DPhysics_Basic.xml
  20. 44 0
      Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.lua
  21. 7 0
      Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.xml
  22. 34 0
      Examples/Lua/2D_Physics/2DPhysics_Contacts/2DPhysics_Contacts.lua
  23. 10 0
      Examples/Lua/2D_Physics/2DPhysics_Contacts/2DPhysics_Contacts.xml
  24. BIN
      Examples/Lua/2D_Physics/2DPhysics_Contacts/collision.wav
  25. 36 0
      Examples/Lua/2D_Physics/2DPhysics_Joints/2DPhysics_Joints.lua
  26. 7 0
      Examples/Lua/2D_Physics/2DPhysics_Joints/2DPhysics_Joints.xml
  27. 20 0
      Examples/Lua/2D_Physics/2DPhysics_PointCollision/2DPhysics_PointCollision.lua
  28. 7 0
      Examples/Lua/2D_Physics/2DPhysics_PointCollision/2DPhysics_PointCollision.xml
  29. 13 0
      Examples/Lua/3D_Graphics/3DBasics/3DBasics.lua
  30. 8 0
      Examples/Lua/3D_Graphics/3DBasics/3DBasics.xml
  31. BIN
      Examples/Lua/3D_Graphics/3DBasics/green_texture.png
  32. BIN
      Examples/Lua/3D_Graphics/3DBasics/pink_texture.png
  33. 50 0
      Examples/Lua/3D_Graphics/AdvancedLighting/AdvancedLighting.lua
  34. 7 0
      Examples/Lua/3D_Graphics/AdvancedLighting/AdvancedLighting.xml
  35. 26 0
      Examples/Lua/3D_Graphics/AdvancedLighting/Resources/example.mat
  36. BIN
      Examples/Lua/3D_Graphics/AdvancedLighting/Resources/green_texture.png
  37. BIN
      Examples/Lua/3D_Graphics/AdvancedLighting/Resources/pink_texture.png
  38. 18 0
      Examples/Lua/3D_Graphics/BasicLighting/BasicLighting.lua
  39. 7 0
      Examples/Lua/3D_Graphics/BasicLighting/BasicLighting.xml
  40. 26 0
      Examples/Lua/3D_Graphics/BasicLighting/Resources/example.mat
  41. BIN
      Examples/Lua/3D_Graphics/BasicLighting/Resources/green_texture.png
  42. BIN
      Examples/Lua/3D_Graphics/BasicLighting/Resources/pink_texture.png
  43. 28 0
      Examples/Lua/Audio/2DAudio/2DAudio.lua
  44. 7 0
      Examples/Lua/Audio/2DAudio/2DAudio.xml
  45. BIN
      Examples/Lua/Audio/2DAudio/test.wav
  46. 26 0
      Examples/Lua/Audio/3DAudio/3DAudio.lua
  47. 7 0
      Examples/Lua/Audio/3DAudio/3DAudio.xml
  48. BIN
      Examples/Lua/Audio/3DAudio/test.wav
  49. 17 0
      Examples/Lua/Audio/PlayingSounds/PlayingSounds.lua
  50. 7 0
      Examples/Lua/Audio/PlayingSounds/PlayingSounds.xml
  51. BIN
      Examples/Lua/Audio/PlayingSounds/test.wav
  52. 22 0
      Examples/Lua/Events_And_Input/EventHandling/EventHandling.lua
  53. 7 0
      Examples/Lua/Events_And_Input/EventHandling/EventHandling.xml
  54. BIN
      Examples/Lua/Events_And_Input/EventHandling/polycode_logo.png
  55. 46 0
      Examples/Lua/Events_And_Input/KeyboardInput/KeyboardInput.lua
  56. 7 0
      Examples/Lua/Events_And_Input/KeyboardInput/KeyboardInput.xml
  57. BIN
      Examples/Lua/Events_And_Input/KeyboardInput/polycode_logo.png
  58. 33 0
      Examples/Lua/Events_And_Input/MouseInput/MouseInput.lua
  59. 7 0
      Examples/Lua/Events_And_Input/MouseInput/MouseInput.xml
  60. BIN
      Examples/Lua/Events_And_Input/MouseInput/polycode_logo.png
  61. 80 25
      IDE/Build/Mac OS X/English.lproj/MainMenu.xib
  62. 6 0
      IDE/Build/Mac OS X/Polycode.xcodeproj/project.pbxproj
  63. 1 0
      IDE/Build/Mac OS X/PolycodeAppDelegate.h
  64. 4 0
      IDE/Build/Mac OS X/PolycodeAppDelegate.m
  65. 58 0
      IDE/Contents/Include/ExampleBrowserWindow.h
  66. 2 0
      IDE/Contents/Include/PolycodeFrame.h
  67. 1 0
      IDE/Contents/Include/PolycodeIDEApp.h
  68. 2 2
      IDE/Contents/Include/PolycodeToolLauncher.h
  69. 4 16
      IDE/Contents/Resources/ProjectTemplates/Basic/Empty Project/template.polyproject
  70. 1 0
      IDE/Contents/Resources/UIThemes/default/theme.xml
  71. 139 0
      IDE/Contents/Source/ExampleBrowserWindow.cpp
  72. 1 1
      IDE/Contents/Source/NewProjectWindow.cpp
  73. 17 3
      IDE/Contents/Source/PolycodeFrame.cpp
  74. 23 3
      IDE/Contents/Source/PolycodeIDEApp.cpp
  75. 15 3
      IDE/Contents/Source/PolycodeProjectManager.cpp
  76. 8 1
      Modules/Contents/UI/Source/PolyUITextInput.cpp
  77. 2 0
      Modules/Contents/UI/Source/PolyUIWindow.cpp
  78. 2 0
      Standalone/CMakeLists.txt
  79. 2 1
      Tools/Contents/polybuild/Source/polybuild.cpp

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

@@ -277,8 +277,14 @@ namespace Polycode {
 		*/
 		*/
 		String getDefaultWorkingDirectory();
 		String getDefaultWorkingDirectory();
 		
 		
+		/**
+		* Returns the default working path of the application.
+		*/
+		String getUserHomeDirectory();		
+		
 	protected:
 	protected:
 		
 		
+		String userHomeDirectory;
 		String defaultWorkingDirectory;
 		String defaultWorkingDirectory;
 		
 		
 		void *userPointer;
 		void *userPointer;

+ 2 - 0
Core/Contents/Source/PolyCocoaCore.mm

@@ -41,6 +41,8 @@ CocoaCore::CocoaCore(PolycodeView *view, int xRes, int yRes, bool fullScreen, bo
 	
 	
 	defaultWorkingDirectory = String([[[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/Contents/Resources"] UTF8String]);
 	defaultWorkingDirectory = String([[[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/Contents/Resources"] UTF8String]);
 	
 	
+	userHomeDirectory = String([NSHomeDirectory() UTF8String]);
+	
 	NSOpenGLPixelFormatAttribute attrs[32];
 	NSOpenGLPixelFormatAttribute attrs[32];
 	
 	
 	int atindx = 0;
 	int atindx = 0;

+ 4 - 0
Core/Contents/Source/PolyCore.cpp

@@ -78,6 +78,10 @@ namespace Polycode {
 		running = false;
 		running = false;
 	}
 	}
 	
 	
+	String Core::getUserHomeDirectory() {
+		return userHomeDirectory;
+	}	
+	
 	String Core::getDefaultWorkingDirectory() {
 	String Core::getDefaultWorkingDirectory() {
 		return defaultWorkingDirectory;
 		return defaultWorkingDirectory;
 	}
 	}

+ 11 - 8
Core/Contents/Source/PolyEntity.cpp

@@ -243,7 +243,7 @@ Matrix4 Entity::getConcatenatedRollMatrix() const {
 void Entity::setMask(Entity *mask) {	
 void Entity::setMask(Entity *mask) {	
 	mask->depthWrite = true;
 	mask->depthWrite = true;
 	mask->depthOnly = true;
 	mask->depthOnly = true;
-	mask->setPositionZ(0.999);
+	mask->setPositionZ(-1.0);
 	mask->isMask = true;
 	mask->isMask = true;
 	mask->enabled = false;
 	mask->enabled = false;
 	maskEntity = mask;
 	maskEntity = mask;
@@ -261,6 +261,9 @@ void Entity::clearMask() {
 	maskEntity->enabled = true;
 	maskEntity->enabled = true;
 	maskEntity = NULL;	
 	maskEntity = NULL;	
 	hasMask = false;	
 	hasMask = false;	
+	for(int i=0; i < children.size(); i++) {
+		children[i]->clearMask();
+	}	
 }
 }
 
 
 void Entity::transformAndRender() {
 void Entity::transformAndRender() {
@@ -274,12 +277,12 @@ void Entity::transformAndRender() {
 	if(hasMask) {
 	if(hasMask) {
 		renderer->clearBuffer(false, true);
 		renderer->clearBuffer(false, true);
 		maskEntity->enabled = true;
 		maskEntity->enabled = true;
-		maskEntity->transformAndRender();		
+		maskEntity->transformAndRender();			
 		maskEntity->enabled = false;		
 		maskEntity->enabled = false;		
 		renderer->setDepthFunction(Renderer::DEPTH_FUNCTION_GREATER);
 		renderer->setDepthFunction(Renderer::DEPTH_FUNCTION_GREATER);
 	}
 	}
 	
 	
-	renderer->pushMatrix();	
+	renderer->pushMatrix();
 	if(ignoreParentMatrix && parentEntity) {
 	if(ignoreParentMatrix && parentEntity) {
 		renderer->multModelviewMatrix(parentEntity->getConcatenatedMatrix().inverse());
 		renderer->multModelviewMatrix(parentEntity->getConcatenatedMatrix().inverse());
 		renderer->setCurrentModelMatrix(parentEntity->getConcatenatedMatrix().inverse());
 		renderer->setCurrentModelMatrix(parentEntity->getConcatenatedMatrix().inverse());
@@ -295,10 +298,10 @@ void Entity::transformAndRender() {
 		}
 		}
 	}
 	}
 
 
-//	if(hasMask) {
-//		renderer->enableDepthWrite(false);
-//		renderer->enableDepthTest(true);		
-//	} else {
+	if(hasMask) {
+		renderer->enableDepthWrite(false);
+		renderer->enableDepthTest(true);		
+	} else {
 	if(!depthWrite)
 	if(!depthWrite)
 		renderer->enableDepthWrite(false);
 		renderer->enableDepthWrite(false);
 	else
 	else
@@ -308,7 +311,7 @@ void Entity::transformAndRender() {
 		renderer->enableDepthTest(false);
 		renderer->enableDepthTest(false);
 	else
 	else
 		renderer->enableDepthTest(true);
 		renderer->enableDepthTest(true);
-//	}
+ 	}
 		 
 		 
 	renderer->enableAlphaTest(alphaTest);
 	renderer->enableAlphaTest(alphaTest);
 	
 	

+ 34 - 0
Examples/Lua/2D_Graphics/2DParticles/2DParticles.lua

@@ -0,0 +1,34 @@
+screen = Screen()
+emitter = ScreenParticleEmitter("particle.png", screen, BILLBOARD_PARTICLE,
+	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))
+
+emitter:getEmitter().useScaleCurves = true
+emitter:getEmitter().scaleCurve:addControlPoint2d(0, 0.3)
+emitter:getEmitter().scaleCurve:addControlPoint2d(0.5, 1)
+emitter:getEmitter().scaleCurve:addControlPoint2d(1, 0)
+
+emitter:getEmitter().useColorCurves = true
+emitter:getEmitter().colorCurveR:addControlPoint2d(0, 0.3)
+emitter:getEmitter().colorCurveR:addControlPoint2d(0.1, 1)
+emitter:getEmitter().colorCurveR:addControlPoint2d(0.4, 1)
+emitter:getEmitter().colorCurveR:addControlPoint2d(0.5, 0)
+emitter:getEmitter().colorCurveR:addControlPoint2d(1, 0)
+
+emitter:getEmitter().colorCurveG:addControlPoint2d(0, 0.3)
+emitter:getEmitter().colorCurveG:addControlPoint2d(0.1, 0.6)
+emitter:getEmitter().colorCurveG:addControlPoint2d(0.4, 0.6)
+emitter:getEmitter().colorCurveG:addControlPoint2d(0.5, 0)
+emitter:getEmitter().colorCurveG:addControlPoint2d(1, 0.0)
+
+emitter:getEmitter().colorCurveB:addControlPoint2d(0, 1)
+emitter:getEmitter().colorCurveB:addControlPoint2d(0.1, 0)
+emitter:getEmitter().colorCurveB:addControlPoint2d(1, 0)
+
+emitter:getEmitter().colorCurveA:addControlPoint2d(0, 0)
+emitter:getEmitter().colorCurveA:addControlPoint2d(0.05, 1)
+emitter:getEmitter().colorCurveA:addControlPoint2d(0.6, 1)
+emitter:getEmitter().colorCurveA:addControlPoint2d(1, 0)
+
+emitter:setPosition(640/2, 400)
+screen:addChild(emitter)

+ 7 - 0
Examples/Lua/2D_Graphics/2DParticles/2DParticles.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DParticles.lua</entryPoint>
+	<packedItems>
+		<item path="particle.png" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/2D_Graphics/2DParticles/particle.png


+ 9 - 0
Examples/Lua/2D_Graphics/2DTransforms/2DTransforms.lua

@@ -0,0 +1,9 @@
+screen = Screen()
+for i=0,9 do
+        image = ScreenImage("polycode_logo.png")
+        screen:addChild(image)
+        image:setPosition(160+(42*i), 230)
+        image:setPositionMode(POSITION_CENTER)
+        image:setRotation(45*i)
+        image:setScale(1.0-(0.1*i),1.0-(0.1*i))
+end

+ 7 - 0
Examples/Lua/2D_Graphics/2DTransforms/2DTransforms.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DTransforms.lua</entryPoint>
+	<packedItems>
+		<item path="polycode_logo.png" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/2D_Graphics/2DTransforms/polycode_logo.png


+ 3 - 0
Examples/Lua/2D_Graphics/BasicImage/BasicImage.lua

@@ -0,0 +1,3 @@
+screen = Screen()
+image = ScreenImage("polycode_logo.png")
+screen:addChild(image)

+ 7 - 0
Examples/Lua/2D_Graphics/BasicImage/BasicImage.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>BasicImage.lua</entryPoint>
+	<packedItems>
+		<item path="polycode_logo.png" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/2D_Graphics/BasicImage/polycode_logo.png


+ 3 - 0
Examples/Lua/2D_Graphics/BasicText/BasicText.lua

@@ -0,0 +1,3 @@
+screen = Screen()
+label = ScreenLabel("Hello, Polycode!", 32)
+screen:addChild(label)

+ 4 - 0
Examples/Lua/2D_Graphics/BasicText/BasicText.xml

@@ -0,0 +1,4 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>BasicText.lua</entryPoint>
+</PolycodeProject>

+ 28 - 0
Examples/Lua/2D_Graphics/ScreenEntities/ScreenEntities.lua

@@ -0,0 +1,28 @@
+screen = Screen()
+
+sun = ScreenShape(SHAPE_CIRCLE, 100,100, 30)
+sun:setPosition(640/2, 480/2)
+sun:setColor(1.0, 0.0, 0, 1)
+sun.colorAffectsChildren = false
+screen:addChild(sun)
+
+planet = ScreenShape(SHAPE_CIRCLE, 50,50, 30)
+planet:setPosition(150,0)
+planet:setColor(0.2, 0.8, 0, 1)
+planet.colorAffectsChildren = false
+sun:addChild(planet)
+
+moon = ScreenShape(SHAPE_CIRCLE, 20,20, 30)
+moon:setPosition(50,0)
+moon:setColor(1, 1, 0.6, 1)
+planet:addChild(moon)
+
+planetRotation = 0
+moonRotation = 0
+
+function Update(elapsed)
+        planetRotation = planetRotation + elapsed
+        moonRotation = moonRotation + (elapsed * 6)
+        planet:setPosition(cos(planetRotation)*150, sin(planetRotation)*150)
+        moon:setPosition(cos(moonRotation)*50, sin(moonRotation)*50)
+end

+ 4 - 0
Examples/Lua/2D_Graphics/ScreenEntities/ScreenEntities.xml

@@ -0,0 +1,4 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>ScreenEntities.lua</entryPoint>
+</PolycodeProject>

+ 12 - 0
Examples/Lua/2D_Physics/2DPhysics_Basic/2DPhysics_Basic.lua

@@ -0,0 +1,12 @@
+screen = PhysicsScreen(10, 60)
+shape = ScreenShape(SHAPE_RECT, 600,30)
+shape:setColor(0.0,0.0,0.0,1.0)
+shape:setPosition(640/2, 400)
+screen:addPhysicsChild(shape, ENTITY_RECT, true)
+
+for i=0,200 do
+        shape = ScreenShape(SHAPE_RECT, 20,5)
+        shape:setRotation(random(360))
+        shape:setPosition(random(640), random(300))
+        screen:addPhysicsChild(shape, ENTITY_RECT, false);
+end

+ 7 - 0
Examples/Lua/2D_Physics/2DPhysics_Basic/2DPhysics_Basic.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DPhysics_Basic.lua</entryPoint>
+	<modules>
+		<module>Physics2D</module>
+	</modules>
+</PolycodeProject>

+ 44 - 0
Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.lua

@@ -0,0 +1,44 @@
+class "Detector" (EventHandler)
+
+function Detector:Detector(shape)
+        self.shape = shape
+        self:EventHandler()
+end
+
+function Detector:handleEvent(e)
+        if e:getDispatcher() == screen then
+                local pe = PhysicsScreenEvent(e)
+                if e:getEventCode() == 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() == 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)
+
+checkShape = ScreenShape(SHAPE_RECT, 90,10)
+screen:addCollisionChild(checkShape, ENTITY_RECT)
+
+for i=0,50 do
+        shape = ScreenShape(SHAPE_RECT, 30,15)
+        shape:setRotation(random(360))
+        shape:setPosition(random(640), random(480))
+        screen:addCollisionChild(shape, ENTITY_RECT)
+end
+
+detector = Detector(checkShape)
+screen:addEventListener(detector, EVENT_NEW_SHAPE_COLLISION)
+screen:addEventListener(detector, EVENT_END_SHAPE_COLLISION)
+
+function Update(e)
+        local mouse = Services.Core:getInput():getMousePosition()
+        checkShape:setPosition(mouse.x, mouse.y)
+        checkShape:setRotation(checkShape:getRotation() + (e*100))
+        delete(mouse)
+end

+ 7 - 0
Examples/Lua/2D_Physics/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DPhysics_CollisionOnly.lua</entryPoint>
+	<modules>
+		<module>Physics2D</module>
+	</modules>
+</PolycodeProject>

+ 34 - 0
Examples/Lua/2D_Physics/2DPhysics_Contacts/2DPhysics_Contacts.lua

@@ -0,0 +1,34 @@
+class "ImpactNoise" (EventHandler)
+
+function ImpactNoise:ImpactNoise()
+        self.collisionSound = Sound("collision.wav")
+        self:EventHandler()
+end
+
+function ImpactNoise:handleEvent(e)
+        if e:getDispatcher() == screen then
+                local pe = PhysicsScreenEvent(e)
+                if e:getEventCode() == EVENT_NEW_SHAPE_COLLISION then
+                        if pe.impactStrength > 5 then
+                                self.collisionSound:Play()
+                        end
+                end
+        end
+end
+
+screen = PhysicsScreen(10, 60)
+shape = ScreenShape(SHAPE_RECT, 600,30)
+shape:setColor(0.0,0.0,0.0,1.0)
+shape:setPosition(640/2, 400)
+screen:addPhysicsChild(shape, ENTITY_RECT, true)
+
+for i=0,50 do
+        shape = ScreenShape(SHAPE_RECT, 20,5)
+        shape:setRotation(random(360))
+        shape:setPosition(random(640), random(300))
+        screen:addPhysicsChild(shape, ENTITY_RECT, false)
+end
+
+noiseMaker = ImpactNoise()
+
+screen:addEventListener(noiseMaker, EVENT_NEW_SHAPE_COLLISION)

+ 10 - 0
Examples/Lua/2D_Physics/2DPhysics_Contacts/2DPhysics_Contacts.xml

@@ -0,0 +1,10 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DPhysics_Contacts.lua</entryPoint>
+	<modules>
+		<module>Physics2D</module>
+	</modules>
+	<packedItems>
+		<item path="collision.wav" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/2D_Physics/2DPhysics_Contacts/collision.wav


+ 36 - 0
Examples/Lua/2D_Physics/2DPhysics_Joints/2DPhysics_Joints.lua

@@ -0,0 +1,36 @@
+screen = PhysicsScreen(10, 50)
+
+ceiling = ScreenShape(SHAPE_RECT, 640, 20)
+ceiling:setColor(0.0, 0.0, 0.0, 1.0)
+ceiling:setPosition(640/2, 10)
+screen:addPhysicsChild(ceiling, ENTITY_RECT, true)
+
+-- Revolute Joint
+shape = ScreenShape(SHAPE_RECT, 10, 30)
+shape:setPosition(150, 20+15)
+screen:addPhysicsChild(shape, ENTITY_RECT, false)
+screen:createRevoluteJoint(shape, ceiling, 0, -15)
+screen:applyImpulse(shape, 10, 0)
+
+-- Distance Joint
+shape = ScreenShape(SHAPE_RECT, 10, 30)
+shape:setPosition(250, 20+25)
+screen:addPhysicsChild(shape, ENTITY_RECT, false)
+screen:createDistanceJoint(shape, ceiling, false)
+screen:applyImpulse(shape, 200, 0)
+
+line = ScreenLine(shape, ceiling)
+line:setColor(1.0, 0.0, 0.0, 1.0)
+screen:addChild(line)
+
+-- Prismatic Joint
+shape = ScreenShape(SHAPE_RECT, 10, 30)
+shape:setPosition(450, 20+25)
+screen:addPhysicsChild(shape, ENTITY_RECT, false)
+screen:createPrismaticJoint(ceiling, shape, Vector2(0,1), 0,0, false, 100, 0, true)
+
+lineAnchor = ScreenEntity()
+lineAnchor:setPosition(450,10)
+line = ScreenLine(shape, lineAnchor)
+line:setColor(0.0, 1.0, 0.0, 1.0)
+screen:addChild(line)

+ 7 - 0
Examples/Lua/2D_Physics/2DPhysics_Joints/2DPhysics_Joints.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DPhysics_Joints.lua</entryPoint>
+	<modules>
+		<module>Physics2D</module>
+	</modules>
+</PolycodeProject>

+ 20 - 0
Examples/Lua/2D_Physics/2DPhysics_PointCollision/2DPhysics_PointCollision.lua

@@ -0,0 +1,20 @@
+screen = PhysicsScreen(10, 60)
+lastEntity = nil
+
+for i=0,50 do
+        shape = ScreenShape(SHAPE_RECT, 30,15)
+        shape:setRotation(random(360))
+        shape:setPosition(random(640), random(480))
+        screen:addCollisionChild(shape, ENTITY_RECT)
+end
+
+function Update(e)
+        if lastEntity ~= nil then lastEntity:setColor(1.0,1.0,1.0,1.0) end
+        local mouse = Services.Core:getInput():getMousePosition()
+        local entity = screen:getEntityAtPosition(mouse.x, mouse.y)
+        if entity ~= nil then
+                entity:setColor(1.0, 0.0, 0.0, 1.0)
+                lastEntity = entity
+        end
+        delete(mouse)
+end

+ 7 - 0
Examples/Lua/2D_Physics/2DPhysics_PointCollision/2DPhysics_PointCollision.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DPhysics_PointCollision.lua</entryPoint>
+	<modules>
+		<module>Physics2D</module>
+	</modules>
+</PolycodeProject>

+ 13 - 0
Examples/Lua/3D_Graphics/3DBasics/3DBasics.lua

@@ -0,0 +1,13 @@
+scene = Scene()
+ground = ScenePrimitive(TYPE_PLANE, 5,5)
+ground:loadTexture("green_texture.png")
+scene:addEntity(ground)
+
+box =  ScenePrimitive(TYPE_BOX, 1,1,1)
+box:loadTexture("pink_texture.png")
+box:setPosition(0.0, 0.5, 0.0)
+scene:addEntity(box)
+
+scene:getDefaultCamera():setPosition(7,7,7)
+scene:getDefaultCamera():lookAt(Vector3(0,0,0), Vector3(0,1,0))
+

+ 8 - 0
Examples/Lua/3D_Graphics/3DBasics/3DBasics.xml

@@ -0,0 +1,8 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>3DBasics.lua</entryPoint>
+	<packedItems>
+		<item path="pink_texture.png" type="file"/>
+		<item path="green_texture.png" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/3D_Graphics/3DBasics/green_texture.png


BIN
Examples/Lua/3D_Graphics/3DBasics/pink_texture.png


+ 50 - 0
Examples/Lua/3D_Graphics/AdvancedLighting/AdvancedLighting.lua

@@ -0,0 +1,50 @@
+Services.ResourceManager:addDirResource("Resources", false)
+
+scene = Scene()
+ground = ScenePrimitive(TYPE_PLANE, 5,5)
+ground:setMaterialByName("GroundMaterial")
+scene:addEntity(ground)
+
+box =  ScenePrimitive(TYPE_TORUS, 0.8,0.3,30,20)
+box:setMaterialByName("CubeMaterial")
+box:setPosition(0.0, 0.5, 0.0)
+scene:addEntity(box)
+
+light = SceneLight(AREA_LIGHT, scene, 20)
+light:setPosition(3,2,7)
+light:setLightColor(1,0,0)
+scene:addLight(light)
+
+light = SceneLight(AREA_LIGHT, scene, 20)
+light:setPosition(-3,2,7)
+light:setLightColor(0,1,0)
+scene:addLight(light)
+
+light = SceneLight(AREA_LIGHT, scene, 20)
+light:setPosition(-3,2,-7)
+light:setLightColor(0,0,1)
+scene:addLight(light)
+
+light = SceneLight(AREA_LIGHT, scene, 20)
+light:setPosition(3,2,-7)
+light:setLightColor(1,0,1)
+scene:addLight(light)
+
+light = SceneLight(SPOT_LIGHT, scene, 5)
+light:setPosition(0,2,2)
+light:setSpotlightProperties(30,6)
+light:setLightColor(1,1,0)
+scene:addLight(light)
+light:lookAt(Vector3(0,0,0), Vector3(0,1,0))
+light:enableShadows(true)
+
+light = SceneLight(SPOT_LIGHT, scene, 5)
+light:setPosition(0,2,-2)
+light:setSpotlightProperties(30,6)
+light:setLightColor(0,1,1)
+scene:addLight(light)
+light:lookAt(Vector3(0,0,0), Vector3(0,1,0))
+light:enableShadows(true)
+
+scene:getDefaultCamera():setPosition(7,7,7)
+scene:getDefaultCamera():lookAt(Vector3(0,0,0), Vector3(0,1,0))

+ 7 - 0
Examples/Lua/3D_Graphics/AdvancedLighting/AdvancedLighting.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>AdvancedLighting.lua</entryPoint>
+	<packedItems>
+		<item path="Resources" type="folder"/>
+        </packedItems>
+</PolycodeProject>

+ 26 - 0
Examples/Lua/3D_Graphics/AdvancedLighting/Resources/example.mat

@@ -0,0 +1,26 @@
+<?xml version="1.0" ?>
+<polycode>	
+	<materials>
+		<material name="TestParticle">
+			<shader name="DefaultParticleShader">
+				<textures>
+					<texture name="diffuse">particle.png</texture>
+				</textures>
+			</shader>
+		</material>	
+		<material name="CubeMaterial">
+			<shader name="DefaultShaderShadows">
+				<textures>
+					<texture name="diffuse">pink_texture.png</texture>
+				</textures>
+			</shader>
+		</material>			
+		<material name="GroundMaterial">
+			<shader name="DefaultShaderShadows">
+				<textures>
+					<texture name="diffuse">green_texture.png</texture>
+				</textures>
+			</shader>
+		</material>					
+	</materials>
+</polycode>

BIN
Examples/Lua/3D_Graphics/AdvancedLighting/Resources/green_texture.png


BIN
Examples/Lua/3D_Graphics/AdvancedLighting/Resources/pink_texture.png


+ 18 - 0
Examples/Lua/3D_Graphics/BasicLighting/BasicLighting.lua

@@ -0,0 +1,18 @@
+Services.ResourceManager:addDirResource("Resources", false)
+
+scene = Scene()
+ground = ScenePrimitive(TYPE_PLANE, 5,5)
+ground:setMaterialByName("GroundMaterial")
+scene:addEntity(ground)
+
+box =  ScenePrimitive(TYPE_TORUS, 0.8,0.3,30,20)
+box:setMaterialByName("CubeMaterial")
+box:setPosition(0.0, 0.5, 0.0)
+scene:addEntity(box)
+
+light = SceneLight(AREA_LIGHT, scene, 6)
+light:setPosition(1,2,1)
+scene:addLight(light)
+
+scene:getDefaultCamera():setPosition(7,7,7)
+scene:getDefaultCamera():lookAt(Vector3(0,0,0), Vector3(0,1,0))

+ 7 - 0
Examples/Lua/3D_Graphics/BasicLighting/BasicLighting.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>BasicLighting.lua</entryPoint>
+	<packedItems>
+		<item path="Resources" type="folder"/>
+        </packedItems>
+</PolycodeProject>

+ 26 - 0
Examples/Lua/3D_Graphics/BasicLighting/Resources/example.mat

@@ -0,0 +1,26 @@
+<?xml version="1.0" ?>
+<polycode>	
+	<materials>
+		<material name="TestParticle">
+			<shader name="DefaultParticleShader">
+				<textures>
+					<texture name="diffuse">particle.png</texture>
+				</textures>
+			</shader>
+		</material>	
+		<material name="CubeMaterial">
+			<shader name="DefaultShaderShadows">
+				<textures>
+					<texture name="diffuse">pink_texture.png</texture>
+				</textures>
+			</shader>
+		</material>			
+		<material name="GroundMaterial">
+			<shader name="DefaultShaderShadows">
+				<textures>
+					<texture name="diffuse">green_texture.png</texture>
+				</textures>
+			</shader>
+		</material>					
+	</materials>
+</polycode>

BIN
Examples/Lua/3D_Graphics/BasicLighting/Resources/green_texture.png


BIN
Examples/Lua/3D_Graphics/BasicLighting/Resources/pink_texture.png


+ 28 - 0
Examples/Lua/Audio/2DAudio/2DAudio.lua

@@ -0,0 +1,28 @@
+screen = Screen()
+
+sourceEntity = ScreenEntity()
+testSound = ScreenSound("test.wav", 200, 600)
+testSound:getSound():Play(true)
+sourceEntity:addChild(testSound)
+soundShape = ScreenShape(SHAPE_CIRCLE, 20,20,10)
+sourceEntity:addChild(soundShape)
+screen:addChild(sourceEntity)
+
+listenerEntity = ScreenEntity()
+soundListener = ScreenSoundListener()
+listenerEntity:addChild(soundListener)
+soundShape = ScreenShape(SHAPE_CIRCLE, 20,20,10)
+soundShape:setColor(0.0, 1.0, 0.0, 1.0)
+listenerEntity:addChild(soundShape)
+screen:addChild(listenerEntity)
+
+listenerPositionValue = 0
+positionValue = 0
+
+function Update(elapsed)
+        positionValue = positionValue + elapsed
+        listenerPositionValue = listenerPositionValue + elapsed * 0.3
+
+        sourceEntity:setPosition(300 + (sin(positionValue) * 300), 250 + cos(positionValue) * 100)
+        listenerEntity:setPosition(300 + (sin(listenerPositionValue) * 300), 250)
+end

+ 7 - 0
Examples/Lua/Audio/2DAudio/2DAudio.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>2DAudio.lua</entryPoint>
+	<packedItems>
+		<item path="test.wav" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/Audio/2DAudio/test.wav


+ 26 - 0
Examples/Lua/Audio/3DAudio/3DAudio.lua

@@ -0,0 +1,26 @@
+scene = Scene()
+
+sourceEntity = SceneEntity()
+testSound = SceneSound("test.wav", 20, 50)
+testSound:getSound():Play(true)
+sourceEntity:addChild(testSound)
+soundShape = ScenePrimitive(TYPE_BOX, 1,1,1)
+soundShape:setMaterialByName("Default")
+sourceEntity:addChild(soundShape)
+scene:addEntity(sourceEntity)
+
+light = SceneLight(AREA_LIGHT, scene, 300, 0,0)
+scene:addLight(light)
+soundListener = SceneSoundListener()
+scene:addEntity(soundListener)
+
+positionValue = 0
+
+
+function Update(elapsed)
+        positionValue = positionValue + elapsed
+
+        sourceEntity:setPosition((sin(positionValue) * 20), 0, cos(positionValue) * 50)
+        sourceEntity:Roll(elapsed * 120)
+        sourceEntity:Pitch(elapsed * 120)
+end

+ 7 - 0
Examples/Lua/Audio/3DAudio/3DAudio.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>3DAudio.lua</entryPoint>
+	<packedItems>
+		<item path="test.wav" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/Audio/3DAudio/test.wav


+ 17 - 0
Examples/Lua/Audio/PlayingSounds/PlayingSounds.lua

@@ -0,0 +1,17 @@
+class "SoundApp" (EventHandler)
+
+function SoundApp:SoundApp(image)
+        self.sound = Sound("test.wav")
+        self:EventHandler()
+end
+
+function SoundApp:handleEvent(e)
+        if e:getDispatcher() == Services.Core:getInput() then
+               if e:getEventCode() == EVENT_MOUSEDOWN then
+                        self.sound:Play(false)
+                end
+        end
+end
+
+app = SoundApp()
+Services.Core:getInput():addEventListener(app, EVENT_MOUSEDOWN)

+ 7 - 0
Examples/Lua/Audio/PlayingSounds/PlayingSounds.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>PlayingSounds.lua</entryPoint>
+	<packedItems>
+		<item path="test.wav" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/Audio/PlayingSounds/test.wav


+ 22 - 0
Examples/Lua/Events_And_Input/EventHandling/EventHandling.lua

@@ -0,0 +1,22 @@
+class "ImageRotator" (EventHandler)
+
+timer = Timer(true, 1000)
+
+function ImageRotator:ImageRotator(image)
+        self.image = image
+        self:EventHandler()
+end
+
+function ImageRotator:handleEvent(e)
+        if e:getDispatcher() == timer and e:getEventCode() == EVENT_TRIGGER then
+                self.image:setRotation(self.image:getRotation()+90)
+        end
+end
+
+screen = Screen()
+image = ScreenImage("polycode_logo.png")
+screen:addChild(image)
+
+rotator = ImageRotator(image)
+timer:addEventListener(rotator, EVENT_TRIGGER)
+

+ 7 - 0
Examples/Lua/Events_And_Input/EventHandling/EventHandling.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>EventHandling.lua</entryPoint>
+	<packedItems>
+		<item path="polycode_logo.png" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/Events_And_Input/EventHandling/polycode_logo.png


+ 46 - 0
Examples/Lua/Events_And_Input/KeyboardInput/KeyboardInput.lua

@@ -0,0 +1,46 @@
+
+class "ImageRotator" (EventHandler)
+
+function ImageRotator:ImageRotator(image)
+        self.image = image
+        self.rotationSpeed = 0
+        self:EventHandler()
+end
+
+function ImageRotator:rotate(e)
+        self.image:setRotation(self.image:getRotation() + e * self.rotationSpeed)
+end
+
+function ImageRotator:handleEvent(e)
+        if e:getDispatcher() == Services.Core:getInput() then
+                local inputEvent = InputEvent(e)
+                local key = inputEvent:keyCode()
+                if e:getEventCode() == EVENT_KEYDOWN then
+                        if key == KEY_LEFT then
+                                self.rotationSpeed = -200
+                        elseif key == KEY_RIGHT then
+                                self.rotationSpeed = 200
+                        end
+                elseif e:getEventCode() == EVENT_KEYUP then
+                        if key == KEY_LEFT or key == KEY_RIGHT then
+                                self.rotationSpeed = 0
+                        end
+                end
+        end
+end
+
+screen = Screen()
+image = ScreenImage("polycode_logo.png")
+image:setPositionMode(POSITION_CENTER)
+image:setPosition(640/2,480/2)
+screen:addChild(image)
+
+
+imageRotator = ImageRotator(image)
+
+Services.Core:getInput():addEventListener(imageRotator, EVENT_KEYDOWN)
+Services.Core:getInput():addEventListener(imageRotator, EVENT_KEYUP)
+
+function Update(elapsed)
+        imageRotator:rotate(elapsed)
+end

+ 7 - 0
Examples/Lua/Events_And_Input/KeyboardInput/KeyboardInput.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>KeyboardInput.lua</entryPoint>
+	<packedItems>
+		<item path="polycode_logo.png" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/Events_And_Input/KeyboardInput/polycode_logo.png


+ 33 - 0
Examples/Lua/Events_And_Input/MouseInput/MouseInput.lua

@@ -0,0 +1,33 @@
+class "MouseImage" (EventHandler)
+
+function MouseImage:MouseImage(image)
+        self.image = image
+        self:EventHandler()
+end
+
+function MouseImage:handleEvent(e)
+        if e:getDispatcher() == Services.Core:getInput() then
+                local inputEvent = InputEvent(e)
+                if e:getEventCode() == EVENT_MOUSEMOVE then
+                        local pos = inputEvent:getMousePosition()
+                        self.image:setPosition(pos.x, pos.y)
+                        delete(pos)
+                elseif e:getEventCode() == EVENT_MOUSEDOWN then
+                        self.image:setColor(1,0,0,1)
+                elseif e:getEventCode() == EVENT_MOUSEUP then
+                        self.image:setColor(1,1,1,1)
+                end
+        end
+end
+
+screen = Screen()
+image = ScreenImage("polycode_logo.png")
+image:setPositionMode(POSITION_CENTER)
+screen:addChild(image)
+
+mouseImage = MouseImage(image)
+
+
+Services.Core:getInput():addEventListener(mouseImage, EVENT_MOUSEMOVE)
+Services.Core:getInput():addEventListener(mouseImage, EVENT_MOUSEDOWN)
+Services.Core:getInput():addEventListener(mouseImage, EVENT_MOUSEUP)

+ 7 - 0
Examples/Lua/Events_And_Input/MouseInput/MouseInput.xml

@@ -0,0 +1,7 @@
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>MouseInput.lua</entryPoint>
+	<packedItems>
+		<item path="polycode_logo.png" type="file"/>
+        </packedItems>
+</PolycodeProject>

BIN
Examples/Lua/Events_And_Input/MouseInput/polycode_logo.png


+ 80 - 25
IDE/Build/Mac OS X/English.lproj/MainMenu.xib

@@ -192,19 +192,19 @@
 							<string key="NSTitle">File</string>
 							<string key="NSTitle">File</string>
 							<object class="NSMutableArray" key="NSMenuItems">
 							<object class="NSMutableArray" key="NSMenuItems">
 								<bool key="EncodedWithXMLCoder">YES</bool>
 								<bool key="EncodedWithXMLCoder">YES</bool>
-								<object class="NSMenuItem" id="912428392">
+								<object class="NSMenuItem" id="164447311">
 									<reference key="NSMenu" ref="720053764"/>
 									<reference key="NSMenu" ref="720053764"/>
-									<string key="NSTitle">New Project</string>
-									<string key="NSKeyEquiv">N</string>
+									<string key="NSTitle">New File</string>
+									<string key="NSKeyEquiv">n</string>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
 								</object>
-								<object class="NSMenuItem" id="164447311">
+								<object class="NSMenuItem" id="912428392">
 									<reference key="NSMenu" ref="720053764"/>
 									<reference key="NSMenu" ref="720053764"/>
-									<string key="NSTitle">New File</string>
-									<string key="NSKeyEquiv">n</string>
+									<string key="NSTitle">New Project</string>
+									<string key="NSKeyEquiv">N</string>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
@@ -221,19 +221,19 @@
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
 								</object>
-								<object class="NSMenuItem" id="722745758">
+								<object class="NSMenuItem" id="1037276792">
 									<reference key="NSMenu" ref="720053764"/>
 									<reference key="NSMenu" ref="720053764"/>
-									<string key="NSTitle">Open Project</string>
-									<string key="NSKeyEquiv">O</string>
+									<string key="NSTitle">Open File</string>
+									<string key="NSKeyEquiv">o</string>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
 								</object>
-								<object class="NSMenuItem" id="1037276792">
+								<object class="NSMenuItem" id="722745758">
 									<reference key="NSMenu" ref="720053764"/>
 									<reference key="NSMenu" ref="720053764"/>
-									<string key="NSTitle">Open File</string>
-									<string key="NSKeyEquiv">o</string>
+									<string key="NSTitle">Open Project</string>
+									<string key="NSKeyEquiv">O</string>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
@@ -250,19 +250,19 @@
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
 								</object>
-								<object class="NSMenuItem" id="776162233">
+								<object class="NSMenuItem" id="463542598">
 									<reference key="NSMenu" ref="720053764"/>
 									<reference key="NSMenu" ref="720053764"/>
-									<string key="NSTitle">Close Project</string>
-									<string key="NSKeyEquiv">W</string>
+									<string key="NSTitle">Close File</string>
+									<string key="NSKeyEquiv">w</string>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
 								</object>
-								<object class="NSMenuItem" id="463542598">
+								<object class="NSMenuItem" id="776162233">
 									<reference key="NSMenu" ref="720053764"/>
 									<reference key="NSMenu" ref="720053764"/>
-									<string key="NSTitle">Close File</string>
-									<string key="NSKeyEquiv">w</string>
+									<string key="NSTitle">Close Project</string>
+									<string key="NSKeyEquiv">W</string>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSKeyEquivModMask">1048576</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
@@ -297,6 +297,25 @@
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSOnImage" ref="35465992"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 									<reference key="NSMixedImage" ref="502551668"/>
 								</object>
 								</object>
+								<object class="NSMenuItem" id="810242391">
+									<reference key="NSMenu" ref="720053764"/>
+									<bool key="NSIsDisabled">YES</bool>
+									<bool key="NSIsSeparator">YES</bool>
+									<string key="NSTitle"/>
+									<string key="NSKeyEquiv"/>
+									<int key="NSMnemonicLoc">2147483647</int>
+									<reference key="NSOnImage" ref="35465992"/>
+									<reference key="NSMixedImage" ref="502551668"/>
+								</object>
+								<object class="NSMenuItem" id="1071799412">
+									<reference key="NSMenu" ref="720053764"/>
+									<string key="NSTitle">Browse Examples</string>
+									<string key="NSKeyEquiv">E</string>
+									<int key="NSKeyEquivModMask">1048576</int>
+									<int key="NSMnemonicLoc">2147483647</int>
+									<reference key="NSOnImage" ref="35465992"/>
+									<reference key="NSMixedImage" ref="502551668"/>
+								</object>
 							</object>
 							</object>
 						</object>
 						</object>
 					</object>
 					</object>
@@ -610,7 +629,7 @@
 				<nil key="NSViewClass"/>
 				<nil key="NSViewClass"/>
 				<nil key="NSUserInterfaceItemIdentifier"/>
 				<nil key="NSUserInterfaceItemIdentifier"/>
 				<object class="NSView" key="NSWindowView" id="439893737">
 				<object class="NSView" key="NSWindowView" id="439893737">
-					<reference key="NSNextResponder"/>
+					<nil key="NSNextResponder"/>
 					<int key="NSvFlags">256</int>
 					<int key="NSvFlags">256</int>
 					<object class="NSMutableArray" key="NSSubviews">
 					<object class="NSMutableArray" key="NSSubviews">
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<bool key="EncodedWithXMLCoder">YES</bool>
@@ -620,7 +639,6 @@
 							<object class="NSPSMatrix" key="NSDrawMatrix"/>
 							<object class="NSPSMatrix" key="NSDrawMatrix"/>
 							<string key="NSFrameSize">{800, 600}</string>
 							<string key="NSFrameSize">{800, 600}</string>
 							<reference key="NSSuperview" ref="439893737"/>
 							<reference key="NSSuperview" ref="439893737"/>
-							<reference key="NSNextKeyView"/>
 							<object class="NSOpenGLPixelFormat" key="NSPixelFormat">
 							<object class="NSOpenGLPixelFormat" key="NSPixelFormat">
 								<object class="NSMutableData" key="NSPixelAttributes">
 								<object class="NSMutableData" key="NSPixelAttributes">
 									<bytes key="NS.bytes">AAAAYAAAAAA</bytes>
 									<bytes key="NS.bytes">AAAAYAAAAAA</bytes>
@@ -629,7 +647,6 @@
 						</object>
 						</object>
 					</object>
 					</object>
 					<string key="NSFrameSize">{800, 600}</string>
 					<string key="NSFrameSize">{800, 600}</string>
-					<reference key="NSSuperview"/>
 					<reference key="NSNextKeyView" ref="633009941"/>
 					<reference key="NSNextKeyView" ref="633009941"/>
 				</object>
 				</object>
 				<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
 				<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
@@ -958,6 +975,14 @@
 					</object>
 					</object>
 					<int key="connectionID">568</int>
 					<int key="connectionID">568</int>
 				</object>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">browseExamples:</string>
+						<reference key="source" ref="976324537"/>
+						<reference key="destination" ref="1071799412"/>
+					</object>
+					<int key="connectionID">572</int>
+				</object>
 			</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
 				<object class="NSArray" key="orderedObjects">
@@ -1045,15 +1070,17 @@
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<reference ref="1023925487"/>
 							<reference ref="1023925487"/>
 							<reference ref="117038363"/>
 							<reference ref="117038363"/>
-							<reference ref="722745758"/>
-							<reference ref="776162233"/>
-							<reference ref="912428392"/>
 							<reference ref="1037276792"/>
 							<reference ref="1037276792"/>
 							<reference ref="425164168"/>
 							<reference ref="425164168"/>
 							<reference ref="1010469920"/>
 							<reference ref="1010469920"/>
 							<reference ref="268409637"/>
 							<reference ref="268409637"/>
 							<reference ref="463542598"/>
 							<reference ref="463542598"/>
+							<reference ref="776162233"/>
+							<reference ref="722745758"/>
+							<reference ref="912428392"/>
 							<reference ref="164447311"/>
 							<reference ref="164447311"/>
+							<reference ref="810242391"/>
+							<reference ref="1071799412"/>
 						</object>
 						</object>
 						<reference key="parent" ref="379814623"/>
 						<reference key="parent" ref="379814623"/>
 					</object>
 					</object>
@@ -1466,6 +1493,16 @@
 						<reference key="object" ref="26940596"/>
 						<reference key="object" ref="26940596"/>
 						<reference key="parent" ref="1048220208"/>
 						<reference key="parent" ref="1048220208"/>
 					</object>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">570</int>
+						<reference key="object" ref="810242391"/>
+						<reference key="parent" ref="720053764"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">571</int>
+						<reference key="object" ref="1071799412"/>
+						<reference key="parent" ref="720053764"/>
+					</object>
 				</object>
 				</object>
 			</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
 			<object class="NSMutableDictionary" key="flattenedProperties">
@@ -1540,6 +1577,8 @@
 					<string>562.IBPluginDependency</string>
 					<string>562.IBPluginDependency</string>
 					<string>563.IBPluginDependency</string>
 					<string>563.IBPluginDependency</string>
 					<string>57.IBPluginDependency</string>
 					<string>57.IBPluginDependency</string>
+					<string>570.IBPluginDependency</string>
+					<string>571.IBPluginDependency</string>
 					<string>58.IBPluginDependency</string>
 					<string>58.IBPluginDependency</string>
 					<string>72.IBPluginDependency</string>
 					<string>72.IBPluginDependency</string>
 					<string>73.IBPluginDependency</string>
 					<string>73.IBPluginDependency</string>
@@ -1629,6 +1668,8 @@
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 				</object>
 				</object>
 			</object>
 			</object>
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
 			<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -1643,7 +1684,7 @@
 				<reference key="dict.values" ref="0"/>
 				<reference key="dict.values" ref="0"/>
 			</object>
 			</object>
 			<nil key="sourceID"/>
 			<nil key="sourceID"/>
-			<int key="maxID">568</int>
+			<int key="maxID">572</int>
 		</object>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1722,9 +1763,11 @@
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<object class="NSArray" key="dict.sortedKeys">
 						<object class="NSArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>browseExamples:</string>
 							<string>closeProject:</string>
 							<string>closeProject:</string>
 							<string>newFile:</string>
 							<string>newFile:</string>
 							<string>newProject:</string>
 							<string>newProject:</string>
+							<string>open:</string>
 							<string>openProject:</string>
 							<string>openProject:</string>
 							<string>runProject:</string>
 							<string>runProject:</string>
 							<string>saveFile:</string>
 							<string>saveFile:</string>
@@ -1737,21 +1780,29 @@
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
+							<string>id</string>
 						</object>
 						</object>
 					</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
 					<object class="NSMutableDictionary" key="actionInfosByName">
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<bool key="EncodedWithXMLCoder">YES</bool>
 						<object class="NSArray" key="dict.sortedKeys">
 						<object class="NSArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>browseExamples:</string>
 							<string>closeProject:</string>
 							<string>closeProject:</string>
 							<string>newFile:</string>
 							<string>newFile:</string>
 							<string>newProject:</string>
 							<string>newProject:</string>
+							<string>open:</string>
 							<string>openProject:</string>
 							<string>openProject:</string>
 							<string>runProject:</string>
 							<string>runProject:</string>
 							<string>saveFile:</string>
 							<string>saveFile:</string>
 						</object>
 						</object>
 						<object class="NSMutableArray" key="dict.values">
 						<object class="NSMutableArray" key="dict.values">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<bool key="EncodedWithXMLCoder">YES</bool>
+							<object class="IBActionInfo">
+								<string key="name">browseExamples:</string>
+								<string key="candidateClassName">id</string>
+							</object>
 							<object class="IBActionInfo">
 							<object class="IBActionInfo">
 								<string key="name">closeProject:</string>
 								<string key="name">closeProject:</string>
 								<string key="candidateClassName">id</string>
 								<string key="candidateClassName">id</string>
@@ -1764,6 +1815,10 @@
 								<string key="name">newProject:</string>
 								<string key="name">newProject:</string>
 								<string key="candidateClassName">id</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							</object>
+							<object class="IBActionInfo">
+								<string key="name">open:</string>
+								<string key="candidateClassName">id</string>
+							</object>
 							<object class="IBActionInfo">
 							<object class="IBActionInfo">
 								<string key="name">openProject:</string>
 								<string key="name">openProject:</string>
 								<string key="candidateClassName">id</string>
 								<string key="candidateClassName">id</string>

+ 6 - 0
IDE/Build/Mac OS X/Polycode.xcodeproj/project.pbxproj

@@ -22,6 +22,7 @@
 		6D8A55B914B3EABB005F6411 /* main_icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A55B814B3EABB005F6411 /* main_icon.icns */; };
 		6D8A55B914B3EABB005F6411 /* main_icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A55B814B3EABB005F6411 /* main_icon.icns */; };
 		6D8A55BC14B3EACB005F6411 /* PolycodeView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D8A55BB14B3EACB005F6411 /* PolycodeView.mm */; };
 		6D8A55BC14B3EACB005F6411 /* PolycodeView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6D8A55BB14B3EACB005F6411 /* PolycodeView.mm */; };
 		6D91B3B512AF2B1D00261ED4 /* PolycodeTextEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */; };
 		6D91B3B512AF2B1D00261ED4 /* PolycodeTextEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */; };
+		6DCAFD4314B519C900039F34 /* ExampleBrowserWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCAFD4214B519C900039F34 /* ExampleBrowserWindow.cpp */; };
 		6DCE857A12AE018800566FAE /* PolycodeEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE857812AE018800566FAE /* PolycodeEditor.cpp */; };
 		6DCE857A12AE018800566FAE /* PolycodeEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE857812AE018800566FAE /* PolycodeEditor.cpp */; };
 		6DCE857B12AE018800566FAE /* PolycodeEditorManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE857912AE018800566FAE /* PolycodeEditorManager.cpp */; };
 		6DCE857B12AE018800566FAE /* PolycodeEditorManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE857912AE018800566FAE /* PolycodeEditorManager.cpp */; };
 		6DCE85B712AE082B00566FAE /* PolycodeImageEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE85B612AE082B00566FAE /* PolycodeImageEditor.cpp */; };
 		6DCE85B712AE082B00566FAE /* PolycodeImageEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DCE85B612AE082B00566FAE /* PolycodeImageEditor.cpp */; };
@@ -89,6 +90,8 @@
 		6D8A55BB14B3EACB005F6411 /* PolycodeView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = PolycodeView.mm; path = ../../../Release/Darwin/Framework/Core/PolycodeView/PolycodeView.mm; sourceTree = "<group>"; };
 		6D8A55BB14B3EACB005F6411 /* PolycodeView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = PolycodeView.mm; path = ../../../Release/Darwin/Framework/Core/PolycodeView/PolycodeView.mm; sourceTree = "<group>"; };
 		6D91B3B312AF2B1600261ED4 /* PolycodeTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeTextEditor.h; sourceTree = "<group>"; };
 		6D91B3B312AF2B1600261ED4 /* PolycodeTextEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeTextEditor.h; sourceTree = "<group>"; };
 		6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolycodeTextEditor.cpp; sourceTree = "<group>"; };
 		6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolycodeTextEditor.cpp; sourceTree = "<group>"; };
+		6DCAFD4214B519C900039F34 /* ExampleBrowserWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExampleBrowserWindow.cpp; sourceTree = "<group>"; };
+		6DCAFD4614B51A2D00039F34 /* ExampleBrowserWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExampleBrowserWindow.h; sourceTree = "<group>"; };
 		6DCE857612AE018000566FAE /* PolycodeEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeEditor.h; sourceTree = "<group>"; };
 		6DCE857612AE018000566FAE /* PolycodeEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeEditor.h; sourceTree = "<group>"; };
 		6DCE857712AE018000566FAE /* PolycodeEditorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeEditorManager.h; sourceTree = "<group>"; };
 		6DCE857712AE018000566FAE /* PolycodeEditorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeEditorManager.h; sourceTree = "<group>"; };
 		6DCE857812AE018800566FAE /* PolycodeEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolycodeEditor.cpp; sourceTree = "<group>"; };
 		6DCE857812AE018800566FAE /* PolycodeEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolycodeEditor.cpp; sourceTree = "<group>"; };
@@ -232,6 +235,7 @@
 		6D80E91212AB53FB0037A708 /* Include */ = {
 		6D80E91212AB53FB0037A708 /* Include */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				6DCAFD4614B51A2D00039F34 /* ExampleBrowserWindow.h */,
 				6D6D3FA814B446AF00219173 /* PolycodeToolLauncher.h */,
 				6D6D3FA814B446AF00219173 /* PolycodeToolLauncher.h */,
 				6D70AB2812B29BEC00EB6D94 /* NewFileWindow.h */,
 				6D70AB2812B29BEC00EB6D94 /* NewFileWindow.h */,
 				6D91B3B312AF2B1600261ED4 /* PolycodeTextEditor.h */,
 				6D91B3B312AF2B1600261ED4 /* PolycodeTextEditor.h */,
@@ -254,6 +258,7 @@
 		6D80E91812AB53FB0037A708 /* Source */ = {
 		6D80E91812AB53FB0037A708 /* Source */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				6DCAFD4214B519C900039F34 /* ExampleBrowserWindow.cpp */,
 				6D6D3FA514B446A600219173 /* PolycodeToolLauncher.cpp */,
 				6D6D3FA514B446A600219173 /* PolycodeToolLauncher.cpp */,
 				6D70AB2912B29BF200EB6D94 /* NewFileWindow.cpp */,
 				6D70AB2912B29BF200EB6D94 /* NewFileWindow.cpp */,
 				6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */,
 				6D91B3B412AF2B1D00261ED4 /* PolycodeTextEditor.cpp */,
@@ -370,6 +375,7 @@
 				6D70AB2A12B29BF200EB6D94 /* NewFileWindow.cpp in Sources */,
 				6D70AB2A12B29BF200EB6D94 /* NewFileWindow.cpp in Sources */,
 				6D8A55BC14B3EACB005F6411 /* PolycodeView.mm in Sources */,
 				6D8A55BC14B3EACB005F6411 /* PolycodeView.mm in Sources */,
 				6D6D3FA614B446A600219173 /* PolycodeToolLauncher.cpp in Sources */,
 				6D6D3FA614B446A600219173 /* PolycodeToolLauncher.cpp in Sources */,
+				6DCAFD4314B519C900039F34 /* ExampleBrowserWindow.cpp in Sources */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};

+ 1 - 0
IDE/Build/Mac OS X/PolycodeAppDelegate.h

@@ -52,6 +52,7 @@ public:
 
 
 // Menu accessors
 // Menu accessors
 
 
+-(IBAction) browseExamples: (id) sender;
 -(IBAction) runProject: (id) sender;
 -(IBAction) runProject: (id) sender;
 -(IBAction) newProject: (id) sender;
 -(IBAction) newProject: (id) sender;
 -(IBAction) closeProject: (id) sender;
 -(IBAction) closeProject: (id) sender;

+ 4 - 0
IDE/Build/Mac OS X/PolycodeAppDelegate.m

@@ -71,6 +71,10 @@
 	return YES;
 	return YES;
 }
 }
 
 
+-(IBAction) browseExamples: (id) sender {
+	app->browseExamples();
+}
+
 -(IBAction) runProject: (id) sender {
 -(IBAction) runProject: (id) sender {
 	app->runProject();
 	app->runProject();
 }
 }

+ 58 - 0
IDE/Contents/Include/ExampleBrowserWindow.h

@@ -0,0 +1,58 @@
+/*
+ Copyright (C) 2012 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+ 
+#pragma once
+
+#include "PolycodeGlobals.h"
+#include "PolycodeUI.h"
+#include "Polycode.h"
+#include "OSBasics.h"
+
+using namespace Polycode;
+
+class ExampleTemplateUserData  {
+public:
+	String templateFolder;
+	int type;
+};
+
+class ExampleBrowserWindow : public UIWindow {
+	public:
+	ExampleBrowserWindow();
+	~ExampleBrowserWindow();
+	
+	void parseTemplatesIntoTree(UITree *tree, OSFileEntry folder);
+
+	String getExamplePath();
+	
+	void handleEvent(Event *event);
+	void ResetForm();
+	
+	protected:
+	
+		UITree *defaultTemplateTree;	
+		UIButton *cancelButton;
+		UIButton *okButton;
+		UITreeContainer *templateContainer;
+	
+		String templateFolder;
+};

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

@@ -25,6 +25,7 @@
 #include "PolycodeProjectBrowser.h"
 #include "PolycodeProjectBrowser.h"
 #include "PolycodeEditor.h"
 #include "PolycodeEditor.h"
 #include "NewProjectWindow.h"
 #include "NewProjectWindow.h"
+#include "ExampleBrowserWindow.h"
 #include "NewFileWindow.h"
 #include "NewFileWindow.h"
 
 
 using namespace Polycode;
 using namespace Polycode;
@@ -48,6 +49,7 @@ public:
 	PolycodeProjectBrowser *getProjectBrowser();
 	PolycodeProjectBrowser *getProjectBrowser();
 	
 	
 	NewProjectWindow *newProjectWindow;	
 	NewProjectWindow *newProjectWindow;	
+	ExampleBrowserWindow *exampleBrowserWindow;
 	NewFileWindow *newFileWindow;
 	NewFileWindow *newFileWindow;
 	
 	
 	ScreenEntity *welcomeEntity;	
 	ScreenEntity *welcomeEntity;	

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

@@ -50,6 +50,7 @@ public:
 	void loadConfigFile();
 	void loadConfigFile();
 	
 	
 	// menu commands
 	// menu commands
+	void browseExamples();
 	void newProject();
 	void newProject();
 	void newFile();	
 	void newFile();	
 	void openProject();
 	void openProject();

+ 2 - 2
IDE/Contents/Include/PolycodeToolLauncher.h

@@ -27,11 +27,11 @@
 class PolycodeToolLauncher {
 class PolycodeToolLauncher {
 	public: 
 	public: 
 		PolycodeToolLauncher();
 		PolycodeToolLauncher();
-		~PolycodeToolLauncher();
+		~PolycodeToolLauncher();		
 		
 		
 		static void execLocalBinCommand(String command);		
 		static void execLocalBinCommand(String command);		
 		static String generateTempPath();
 		static String generateTempPath();
 		static void buildProject(PolycodeProject *project, String destinationPath);
 		static void buildProject(PolycodeProject *project, String destinationPath);
 
 
 		static void runPolyapp(String polyappPath);
 		static void runPolyapp(String polyappPath);
-};	
+};

+ 4 - 16
IDE/Contents/Resources/ProjectTemplates/Basic/Empty Project/template.polyproject

@@ -1,17 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<TauProject>
-	<entryPoint>/Source/Main.lua</entryPoint>
-	<backgroundColor red="0" green="0" blue="0"></backgroundColor>
-	<defaultWidth>640</defaultWidth>
-	<defaultHeight>480</defaultHeight>
-	<frameRate>60</frameRate>
-	<antiAliasingLevel>0</antiAliasingLevel>
-	<fullScreen>false</fullScreen>
-	<openDocuments>
-		<openDocument>Source/Main.lua</openDocument>
-	</openDocuments>
-	<expandedTreeItems>
-		<expandedTreeItem></expandedTreeItem>
-		<expandedTreeItem>Source</expandedTreeItem>
-	</expandedTreeItems>
-</TauProject>
+<PolycodeProject defaultWidth="640" defaultHeight="480" antiAliasingLevel="0">
+	<backgroundColor red="0.25" green="0.25" blue="0.25" />
+	<entryPoint>Source/Main.lua</entryPoint>
+</PolycodeProject>

+ 1 - 0
IDE/Contents/Resources/UIThemes/default/theme.xml

@@ -5,6 +5,7 @@
 	<uiTextInputFontNameMultiLine>mono</uiTextInputFontNameMultiLine>
 	<uiTextInputFontNameMultiLine>mono</uiTextInputFontNameMultiLine>
 	<uiDefaultFontSize>11</uiDefaultFontSize>
 	<uiDefaultFontSize>11</uiDefaultFontSize>
 	<uiTextInputFontSize>11</uiTextInputFontSize>
 	<uiTextInputFontSize>11</uiTextInputFontSize>
+	<uiTextInputFontSizeMultiline>11</uiTextInputFontSizeMultiline>	
 	<uiTreeArrowIconImage>arrowIcon.png</uiTreeArrowIconImage>
 	<uiTreeArrowIconImage>arrowIcon.png</uiTreeArrowIconImage>
 	<uiTreeCellHeight>20</uiTreeCellHeight>
 	<uiTreeCellHeight>20</uiTreeCellHeight>
 	<uiTreeCellPadding>4</uiTreeCellPadding>
 	<uiTreeCellPadding>4</uiTreeCellPadding>

+ 139 - 0
IDE/Contents/Source/ExampleBrowserWindow.cpp

@@ -0,0 +1,139 @@
+/*
+ Copyright (C) 2012 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#include "ExampleBrowserWindow.h"
+
+ExampleBrowserWindow::ExampleBrowserWindow() : UIWindow(L"Example Browser", 320, 300){
+	
+	templateFolder = "";
+	
+	closeOnEscape = true;
+	defaultTemplateTree = NULL;
+	
+	Config *conf = CoreServices::getInstance()->getConfig();	
+	String fontName = conf->getStringValue("Polycode", "uiDefaultFontName");
+	int fontSize = conf->getNumericValue("Polycode", "uiDefaultFontSize");
+	
+	
+	templateContainer = new UITreeContainer("boxIcon.png", L"Examples", 300, 300-topPadding-padding-padding- 40);	
+	
+	ExampleTemplateUserData *data = new ExampleTemplateUserData();
+	data->type = 0;
+	templateContainer->getRootNode()->setUserData(data);			
+	
+	
+	addChild(templateContainer);		
+	templateContainer->setPosition(padding,topPadding+padding);	
+	templateContainer->getRootNode()->toggleCollapsed();
+	
+	templateContainer->getRootNode()->addEventListener(this, UITreeEvent::SELECTED_EVENT);
+	
+	vector<OSFileEntry> templates = OSBasics::parseFolder(RESOURCE_PATH"Standalone/Examples/Lua", false);
+	for(int i=0; i < templates.size(); i++) {
+		OSFileEntry entry = templates[i];
+		if(entry.type == OSFileEntry::TYPE_FOLDER) {
+			UITree *newChild = templateContainer->getRootNode()->addTreeChild("folder.png", entry.name, NULL);			
+			ExampleTemplateUserData *data = new ExampleTemplateUserData();
+			data->type = 0;
+			newChild->setUserData(data);			
+			if(i == 0) {
+				newChild->toggleCollapsed();
+			}
+			parseTemplatesIntoTree(newChild, entry);
+		}
+	}
+	
+	
+	
+	cancelButton = new UIButton(L"Cancel", 100);
+	cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(cancelButton);
+	cancelButton->setPosition(300-100-padding-80-10, 265);
+		
+	
+	okButton = new UIButton(L"Open Example", 100);
+	okButton->addEventListener(this, UIEvent::CLICK_EVENT);
+	addChild(okButton);
+	okButton->setPosition(300-80-padding, 265);
+}
+
+String ExampleBrowserWindow::getExamplePath() {
+	String suffix;
+	std::vector<String> parts = templateFolder.split("/");	
+	return templateFolder+"/"+parts[parts.size()-1]+".xml";
+}
+
+
+void ExampleBrowserWindow::ResetForm() {
+	if(defaultTemplateTree)
+		defaultTemplateTree->setSelected();
+}
+
+void ExampleBrowserWindow::handleEvent(Event *event) {
+	if(event->getEventType() == "UIEvent") {
+		if(event->getEventCode() == UIEvent::CLICK_EVENT) {
+			if(event->getDispatcher() == okButton) {
+				dispatchEvent(new UIEvent(), UIEvent::OK_EVENT);						
+			}
+			
+			if(event->getDispatcher() == cancelButton) {
+				dispatchEvent(new UIEvent(), UIEvent::CLOSE_EVENT);				
+			}									
+		}
+	}
+	
+	if(event->getEventType() == "UITreeEvent" && event->getEventCode() == UITreeEvent::SELECTED_EVENT) {
+		if(event->getDispatcher() == templateContainer->getRootNode()) {
+			UITreeEvent *treeEvent = (UITreeEvent*) event;
+			ExampleTemplateUserData *data = (ExampleTemplateUserData *)treeEvent->selection->getUserData();
+			if(data->type == 1)
+				templateFolder = data->templateFolder;
+		}
+	}
+	
+	UIWindow::handleEvent(event);	
+}
+
+void ExampleBrowserWindow::parseTemplatesIntoTree(UITree *tree, OSFileEntry folder) {
+	vector<OSFileEntry> templates = OSBasics::parseFolder(folder.fullPath, false);
+	for(int i=0; i < templates.size(); i++) {
+		OSFileEntry entry = templates[i];
+		if(entry.type == OSFileEntry::TYPE_FOLDER) {
+			UITree *newChild = tree->addTreeChild("templateIcon.png", entry.name, NULL);			
+			ExampleTemplateUserData *data = new ExampleTemplateUserData();
+			data->type = 1;
+			data->templateFolder = entry.fullPath;
+			newChild->setUserData(data);
+			if(entry.name == "Empty Project") {
+				defaultTemplateTree = newChild;
+				newChild->setSelected();
+			}
+		}
+	}	
+}
+
+
+
+ExampleBrowserWindow::~ExampleBrowserWindow() {
+	
+}
+

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

@@ -115,7 +115,7 @@ void NewProjectWindow::ResetForm() {
 		defaultTemplateTree->setSelected();
 		defaultTemplateTree->setSelected();
 	focusChild(projectNameInput);	
 	focusChild(projectNameInput);	
 	projectNameInput->setText(L"Untitled");
 	projectNameInput->setText(L"Untitled");
-	projectLocationInput->setText(L"~/Documents/Polycode");
+	projectLocationInput->setText(CoreServices::getInstance()->getCore()->getUserHomeDirectory()+"/Documents/Polycode");
 }
 }
 
 
 void NewProjectWindow::handleEvent(Event *event) {
 void NewProjectWindow::handleEvent(Event *event) {

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

@@ -36,8 +36,9 @@ PolycodeFrame::PolycodeFrame() : ScreenEntity() {
 	newProjectButton->setPosition(230,80);
 	newProjectButton->setPosition(230,80);
 	newProjectButton->addEventListener(this, UIEvent::CLICK_EVENT);
 	newProjectButton->addEventListener(this, UIEvent::CLICK_EVENT);
 	
 	
-	examplesButton = new UIButton("Open An Example Project", 220);	
+	examplesButton = new UIButton("Browse Example Projects!", 220);	
 	examplesButton->setPosition(460,80);
 	examplesButton->setPosition(460,80);
+	examplesButton->addEventListener(this, UIEvent::CLICK_EVENT);
 	
 	
 	welcomeEntity->addChild(newProjectButton);
 	welcomeEntity->addChild(newProjectButton);
 	welcomeEntity->addChild(examplesButton);
 	welcomeEntity->addChild(examplesButton);
@@ -76,6 +77,9 @@ PolycodeFrame::PolycodeFrame() : ScreenEntity() {
 	newProjectWindow = new NewProjectWindow();
 	newProjectWindow = new NewProjectWindow();
 	newProjectWindow->visible = false;
 	newProjectWindow->visible = false;
 	
 	
+	exampleBrowserWindow = new ExampleBrowserWindow();
+	exampleBrowserWindow->visible = false;
+	
 	newFileWindow = new NewFileWindow();
 	newFileWindow = new NewFileWindow();
 	newFileWindow->visible = false;
 	newFileWindow->visible = false;
 	
 	
@@ -117,10 +121,12 @@ void PolycodeFrame::showEditor(PolycodeEditor *editor) {
 
 
 void PolycodeFrame::hideModal() {
 void PolycodeFrame::hideModal() {
 	if(modalChild) {
 	if(modalChild) {
-		modalChild->hideWindow();
-		modalBlocker->enabled = false;	 
+		removeChild(modalChild);
+		modalChild->removeEventListener(this, UIEvent::CLOSE_EVENT);	
+		modalChild->hideWindow(); 
 		modalChild = NULL;
 		modalChild = NULL;
 	}
 	}
+	modalBlocker->enabled = false;		
 }
 }
 
 
 void PolycodeFrame::handleEvent(Event *event) {
 void PolycodeFrame::handleEvent(Event *event) {
@@ -135,6 +141,14 @@ void PolycodeFrame::handleEvent(Event *event) {
 			showModal(newProjectWindow);
 			showModal(newProjectWindow);
 
 
 		}	
 		}	
+		
+	if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT && event->getDispatcher() == examplesButton) {
+
+			newProjectWindow->ResetForm();
+			showModal(exampleBrowserWindow);
+
+		}			
+		
 	}
 	}
 }
 }
 
 

+ 23 - 3
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -55,6 +55,8 @@ PolycodeIDEApp::PolycodeIDEApp(PolycodeView *view) : EventDispatcher() {
 	frame->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
 	frame->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
 	
 	
 	frame->newProjectWindow->addEventListener(this, UIEvent::OK_EVENT);
 	frame->newProjectWindow->addEventListener(this, UIEvent::OK_EVENT);
+	frame->exampleBrowserWindow->addEventListener(this, UIEvent::OK_EVENT);
+	
 	frame->playButton->addEventListener(this, UIEvent::CLICK_EVENT);
 	frame->playButton->addEventListener(this, UIEvent::CLICK_EVENT);
 	
 	
 	screen->addChild(frame);
 	screen->addChild(frame);
@@ -113,6 +115,12 @@ void PolycodeIDEApp::openProject() {
 	}		
 	}		
 }
 }
 
 
+void PolycodeIDEApp::browseExamples() {
+	frame->newProjectWindow->ResetForm();
+	frame->showModal(frame->exampleBrowserWindow);
+
+}
+
 void PolycodeIDEApp::runProject() {
 void PolycodeIDEApp::runProject() {
 	if(projectManager->getActiveProject()) {
 	if(projectManager->getActiveProject()) {
 		String outPath = PolycodeToolLauncher::generateTempPath() + ".polyapp";
 		String outPath = PolycodeToolLauncher::generateTempPath() + ".polyapp";
@@ -190,6 +198,14 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 			frame->hideModal();			
 			frame->hideModal();			
 		}
 		}
 	}
 	}
+	
+	if(event->getDispatcher() == frame->exampleBrowserWindow) {
+		if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
+			String fullPath = String(core->getDefaultWorkingDirectory()+"/"+frame->exampleBrowserWindow->getExamplePath());
+			projectManager->openProject(fullPath);
+			frame->hideModal();			
+		}
+	}	
 }
 }
 
 
 void PolycodeIDEApp::saveConfigFile() {
 void PolycodeIDEApp::saveConfigFile() {
@@ -202,14 +218,14 @@ void PolycodeIDEApp::saveConfigFile() {
 		projectEntry->addChild("name", project->getProjectName());
 		projectEntry->addChild("name", project->getProjectName());
 		projectEntry->addChild("path", project->getProjectFile());
 		projectEntry->addChild("path", project->getProjectFile());
 	}
 	}
-	core->createFolder("/Users/ivansafrin/Library/Application Support/Polycode");
-	configFile.saveToXML("/Users/ivansafrin/Library/Application Support/Polycode/config.xml");		
+	core->createFolder(core->getUserHomeDirectory()+"/Library/Application Support/Polycode");
+	configFile.saveToXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");	
 }
 }
 
 
 void PolycodeIDEApp::loadConfigFile() {
 void PolycodeIDEApp::loadConfigFile() {
 
 
 	Object configFile;
 	Object configFile;
-	configFile.loadFromXML("/Users/ivansafrin/Library/Application Support/Polycode/config.xml");		
+	configFile.loadFromXML(core->getUserHomeDirectory()+"/Library/Application Support/Polycode/config.xml");		
 	if(configFile.root["open_projects"]) {
 	if(configFile.root["open_projects"]) {
 		ObjectEntry *projects = configFile.root["open_projects"];
 		ObjectEntry *projects = configFile.root["open_projects"];
 		if(projects) {
 		if(projects) {
@@ -233,6 +249,10 @@ PolycodeIDEApp::~PolycodeIDEApp() {
 
 
 bool PolycodeIDEApp::Update() {
 bool PolycodeIDEApp::Update() {
 
 
+	if(projectManager->getProjectCount() == 1) {
+		projectManager->setActiveProject(projectManager->getProjectByIndex(0));
+	}
+	
 	if(projectManager->getProjectCount() > 0) {
 	if(projectManager->getProjectCount() > 0) {
 		frame->welcomeEntity->visible =  false;
 		frame->welcomeEntity->visible =  false;
 		frame->projectBrowser->visible =  true;		
 		frame->projectBrowser->visible =  true;		

+ 15 - 3
IDE/Contents/Source/PolycodeProjectManager.cpp

@@ -36,18 +36,20 @@ PolycodeProject* PolycodeProjectManager::openProject(String path) {
 	
 	
 	FILE *f = fopen(path.c_str(), "r");
 	FILE *f = fopen(path.c_str(), "r");
 	if(!f) {
 	if(!f) {
+		printf("WARNING: PROJECT DOESNT EXIST! (%s)\n", path.c_str());
 		return NULL;
 		return NULL;
 	}
 	}
 	fclose(f);
 	fclose(f);
 	
 	
-	vector<String> bits = path.split("/.");
+	vector<String> bits = path.split("/");
 	
 	
 	String projectPath = "";
 	String projectPath = "";
-	for(int i=0; i < bits.size() - 2; i++) {
+	for(int i=0; i < bits.size() - 1; i++) {
 		projectPath += "/"+bits[i];
 		projectPath += "/"+bits[i];
 	}
 	}
 	
 	
-	String projectName = bits[bits.size()-2];
+	vector<String> bits2 = bits[bits.size()-1].split(".");
+	String projectName = bits2[bits2.size()-2];
 	
 	
 	PolycodeProject* newProject = new PolycodeProject(projectName, projectPath, path);
 	PolycodeProject* newProject = new PolycodeProject(projectName, projectPath, path);
 	projects.push_back(newProject);
 	projects.push_back(newProject);
@@ -74,7 +76,17 @@ int PolycodeProjectManager::removeProject(PolycodeProject *project) {
 
 
 
 
 void PolycodeProjectManager::createNewProject(String templateFolder, String projectName, String projectLocation) {	
 void PolycodeProjectManager::createNewProject(String templateFolder, String projectName, String projectLocation) {	
+
 	CoreServices::getInstance()->getCore()->createFolder(projectLocation);		
 	CoreServices::getInstance()->getCore()->createFolder(projectLocation);		
+	
+	if(OSBasics::isFolder(projectLocation+"/"+projectName)) {
+		int projectSuffix = 0;
+		do {
+			projectName = projectName + "_" + String::IntToString(projectSuffix);
+			
+		} while (OSBasics::isFolder(projectLocation+"/"+projectName));
+	}	
+	
 	CoreServices::getInstance()->getCore()->copyDiskItem(templateFolder, projectLocation+"/"+projectName);
 	CoreServices::getInstance()->getCore()->copyDiskItem(templateFolder, projectLocation+"/"+projectName);
 	CoreServices::getInstance()->getCore()->moveDiskItem(projectLocation+"/"+projectName+"/template.polyproject",  projectLocation+"/"+projectName+"/"+projectName+".polyproject");
 	CoreServices::getInstance()->getCore()->moveDiskItem(projectLocation+"/"+projectName+"/template.polyproject",  projectLocation+"/"+projectName+"/"+projectName+".polyproject");
 	openProject(projectLocation+"/"+projectName+"/"+projectName+".polyproject");	
 	openProject(projectLocation+"/"+projectName+"/"+projectName+".polyproject");	

+ 8 - 1
Modules/Contents/UI/Source/PolyUITextInput.cpp

@@ -54,7 +54,10 @@ UITextInput::UITextInput(bool multiLine, Number width, Number height) : ScreenEn
 	else
 	else
 		fontName = conf->getStringValue("Polycode", "uiTextInputFontName");
 		fontName = conf->getStringValue("Polycode", "uiTextInputFontName");
 	
 	
-	fontSize = conf->getNumericValue("Polycode", "uiTextInputFontSize");
+	if(multiLine)
+		fontSize = conf->getNumericValue("Polycode", "uiTextInputFontSizeMultiline");	
+	else
+		fontSize = conf->getNumericValue("Polycode", "uiTextInputFontSize");
 	
 	
 	Number rectHeight = height;
 	Number rectHeight = height;
 	if(!multiLine) {
 	if(!multiLine) {
@@ -328,8 +331,12 @@ void UITextInput::restructLines() {
 void UITextInput::setText(String text) {
 void UITextInput::setText(String text) {
 	if(!multiLine) {
 	if(!multiLine) {
 		currentLine->setText(text);
 		currentLine->setText(text);
+		caretPosition = text.length();
+		clearSelection();				
+		updateCaretPosition();		
 	} else {
 	} else {
 	}
 	}
+		
 //	this->text = text;
 //	this->text = text;
 //	currentLine->setText(text);	
 //	currentLine->setText(text);	
 }
 }

+ 2 - 0
Modules/Contents/UI/Source/PolyUIWindow.cpp

@@ -129,6 +129,7 @@ void UIWindow::onMouseDown(Number x, Number y) {
 
 
 void UIWindow::showWindow() {
 void UIWindow::showWindow() {
 //	if(!visible) {
 //	if(!visible) {
+		enabled = true;
 		visible = true;
 		visible = true;
 		windowTween = new Tween(&color.a, Tween::EASE_IN_QUAD, 0.0f, 1.0f, 0.01f);
 		windowTween = new Tween(&color.a, Tween::EASE_IN_QUAD, 0.0f, 1.0f, 0.01f);
 //	}
 //	}
@@ -160,6 +161,7 @@ void UIWindow::handleEvent(Event *event) {
 	}
 	}
 	if(event->getDispatcher() == windowTween) {
 	if(event->getDispatcher() == windowTween) {
 		visible = false;
 		visible = false;
+		enabled = false;		
 		windowTween->removeEventListener(this, Event::COMPLETE_EVENT);
 		windowTween->removeEventListener(this, Event::COMPLETE_EVENT);
 	}
 	}
 }
 }

+ 2 - 0
Standalone/CMakeLists.txt

@@ -11,6 +11,8 @@ INSTALL(FILES ../LICENSE.txt
 INSTALL(DIRECTORY ${PolycodeStandalone_SOURCE_DIR}/../Modules/Bindings/2DPhysics/API DESTINATION Modules/Physics2D)
 INSTALL(DIRECTORY ${PolycodeStandalone_SOURCE_DIR}/../Modules/Bindings/2DPhysics/API DESTINATION Modules/Physics2D)
 INSTALL(DIRECTORY ${PolycodeStandalone_SOURCE_DIR}/../Modules/Bindings/3DPhysics/API DESTINATION Modules/Physics3D)
 INSTALL(DIRECTORY ${PolycodeStandalone_SOURCE_DIR}/../Modules/Bindings/3DPhysics/API DESTINATION Modules/Physics3D)
 
 
+INSTALL(DIRECTORY ${PolycodeStandalone_SOURCE_DIR}/../Examples/Lua DESTINATION Examples)
+
 IF(MSVC)
 IF(MSVC)
 ELSEIF(APPLE)
 ELSEIF(APPLE)
 	INSTALL(DIRECTORY ${POLYCODE_RELEASE_DIR}/Framework/Player/PolycodePlayer.app DESTINATION Player USE_SOURCE_PERMISSIONS)
 	INSTALL(DIRECTORY ${POLYCODE_RELEASE_DIR}/Framework/Player/PolycodePlayer.app DESTINATION Player USE_SOURCE_PERMISSIONS)

+ 2 - 1
Tools/Contents/polybuild/Source/polybuild.cpp

@@ -149,6 +149,8 @@ Dest[i] = (char)Source[i];
 
 
 int main(int argc, char **argv) {
 int main(int argc, char **argv) {
 		
 		
+	PHYSFS_init(argv[0]);
+
 #if defined(__APPLE__) && defined(__MACH__)
 #if defined(__APPLE__) && defined(__MACH__)
     uint32_t bufsize = 2048;
     uint32_t bufsize = 2048;
 	char path[bufsize];
 	char path[bufsize];
@@ -175,7 +177,6 @@ int main(int argc, char **argv) {
 		installPath += String("\\");
 		installPath += String("\\");
 	}
 	}
 #else
 #else
-	PHYSFS_init(argv[0]);
 	String basePath = PHYSFS_getBaseDir();
 	String basePath = PHYSFS_getBaseDir();
 	vector<String> cpts = basePath.split("/");
 	vector<String> cpts = basePath.split("/");
 	String installPath = "";
 	String installPath = "";