Pārlūkot izejas kodu

Screenshot support and image saving

Added renderScreenToImage() to Renderer and saveImage() to Image
Ivan Safrin 14 gadi atpakaļ
vecāks
revīzija
7bb90f1f18
62 mainītis faili ar 87 papildinājumiem un 826 dzēšanām
  1. 0 150
      Assets/Default asset pack/default/NorColSpecHDR.frag
  2. 2 3
      Core/Contents/Include/PolyGLRenderer.h
  3. 9 0
      Core/Contents/Include/PolyImage.h
  4. 2 3
      Core/Contents/Include/PolyRenderer.h
  5. 6 11
      Core/Contents/Source/PolyGLRenderer.cpp
  6. 68 0
      Core/Contents/Source/PolyImage.cpp
  7. 0 28
      Examples/Lua/2DAudio/2DAudio.lua
  8. 0 7
      Examples/Lua/2DAudio/2DAudio.xml
  9. BIN
      Examples/Lua/2DAudio/test.wav
  10. 0 34
      Examples/Lua/2DParticles/2DParticles.lua
  11. 0 7
      Examples/Lua/2DParticles/2DParticles.xml
  12. BIN
      Examples/Lua/2DParticles/particle.png
  13. 0 12
      Examples/Lua/2DPhysics_Basic/2DPhysics_Basic.lua
  14. 0 7
      Examples/Lua/2DPhysics_Basic/2DPhysics_Basic.xml
  15. 0 44
      Examples/Lua/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.lua
  16. 0 7
      Examples/Lua/2DPhysics_CollisionOnly/2DPhysics_CollisionOnly.xml
  17. 0 34
      Examples/Lua/2DPhysics_Contacts/2DPhysics_Contacts.lua
  18. 0 10
      Examples/Lua/2DPhysics_Contacts/2DPhysics_Contacts.xml
  19. BIN
      Examples/Lua/2DPhysics_Contacts/collision.wav
  20. 0 36
      Examples/Lua/2DPhysics_Joints/2DPhysics_Joints.lua
  21. 0 7
      Examples/Lua/2DPhysics_Joints/2DPhysics_Joints.xml
  22. 0 20
      Examples/Lua/2DPhysics_PointCollision/2DPhysics_PointCollision.lua
  23. 0 7
      Examples/Lua/2DPhysics_PointCollision/2DPhysics_PointCollision.xml
  24. 0 9
      Examples/Lua/2DTransforms/2DTransforms.lua
  25. 0 7
      Examples/Lua/2DTransforms/2DTransforms.xml
  26. BIN
      Examples/Lua/2DTransforms/polycode_logo.png
  27. 0 26
      Examples/Lua/3DAudio/3DAudio.lua
  28. 0 7
      Examples/Lua/3DAudio/3DAudio.xml
  29. BIN
      Examples/Lua/3DAudio/test.wav
  30. 0 13
      Examples/Lua/3DBasics/3DBasics.lua
  31. 0 8
      Examples/Lua/3DBasics/3DBasics.xml
  32. BIN
      Examples/Lua/3DBasics/green_texture.png
  33. BIN
      Examples/Lua/3DBasics/pink_texture.png
  34. 0 50
      Examples/Lua/AdvancedLighting/AdvancedLighting.lua
  35. 0 7
      Examples/Lua/AdvancedLighting/AdvancedLighting.xml
  36. 0 26
      Examples/Lua/AdvancedLighting/Resources/example.mat
  37. BIN
      Examples/Lua/AdvancedLighting/Resources/green_texture.png
  38. BIN
      Examples/Lua/AdvancedLighting/Resources/pink_texture.png
  39. 0 3
      Examples/Lua/BasicImage/BasicImage.lua
  40. 0 7
      Examples/Lua/BasicImage/BasicImage.xml
  41. BIN
      Examples/Lua/BasicImage/polycode_logo.png
  42. 0 18
      Examples/Lua/BasicLighting/BasicLighting.lua
  43. 0 7
      Examples/Lua/BasicLighting/BasicLighting.xml
  44. 0 26
      Examples/Lua/BasicLighting/Resources/example.mat
  45. BIN
      Examples/Lua/BasicLighting/Resources/green_texture.png
  46. BIN
      Examples/Lua/BasicLighting/Resources/pink_texture.png
  47. 0 3
      Examples/Lua/BasicText/BasicText.lua
  48. 0 4
      Examples/Lua/BasicText/BasicText.xml
  49. 0 22
      Examples/Lua/EventHandling/EventHandling.lua
  50. 0 7
      Examples/Lua/EventHandling/EventHandling.xml
  51. BIN
      Examples/Lua/EventHandling/polycode_logo.png
  52. 0 46
      Examples/Lua/KeyboardInput/KeyboardInput.lua
  53. 0 7
      Examples/Lua/KeyboardInput/KeyboardInput.xml
  54. BIN
      Examples/Lua/KeyboardInput/polycode_logo.png
  55. 0 33
      Examples/Lua/MouseInput/MouseInput.lua
  56. 0 7
      Examples/Lua/MouseInput/MouseInput.xml
  57. BIN
      Examples/Lua/MouseInput/polycode_logo.png
  58. 0 17
      Examples/Lua/PlayingSounds/PlayingSounds.lua
  59. 0 7
      Examples/Lua/PlayingSounds/PlayingSounds.xml
  60. BIN
      Examples/Lua/PlayingSounds/test.wav
  61. 0 28
      Examples/Lua/ScreenEntities/ScreenEntities.lua
  62. 0 4
      Examples/Lua/ScreenEntities/ScreenEntities.xml

+ 0 - 150
Assets/Default asset pack/default/NorColSpecHDR.frag

@@ -1,150 +0,0 @@
-varying vec3 normal;
-varying vec3 tangent;
-varying vec3 binormal;
-varying vec4 pos;
-varying vec4 vertexColor;
-uniform sampler2D diffuse;
-uniform sampler2D normal_map;
-uniform sampler2D specular_map;
-
-float calculateAttenuation(in int i, in float dist)
-{
-    return(1.0 / (gl_LightSource[i].constantAttenuation +
-                  gl_LightSource[i].linearAttenuation * dist +
-                  gl_LightSource[i].quadraticAttenuation * dist * dist));
-}
-
-void pointLight(in int i, in vec3 bump, in vec3 normal, in vec3 tangent, in vec3 binormal, in vec4 pos, inout vec4 diffuse, inout vec4 specular) {
-	vec4 color = gl_FrontMaterial.diffuse;
-	vec4 matspec = gl_FrontMaterial.specular;
-	float shininess = gl_FrontMaterial.shininess;
-	vec4 lightspec = gl_LightSource[i].specular;
-	vec4 lpos = gl_LightSource[i].position;
-	
-	vec3 tmpVec = lpos.xyz - pos.xyz;	
-	lpos.x = dot(tmpVec, tangent);
-	lpos.y = dot(tmpVec, binormal);
-	lpos.z = dot(tmpVec, normal);	
-	
-	float distSqr = dot(lpos.xyz, lpos.xyz);
-	vec3 lVec = lpos.xyz * inversesqrt(distSqr);
-	
-	tmpVec = -pos.xyz;
-	vec3 v;
-	v.x = dot(tmpVec, tangent);
-	v.y = dot(tmpVec, binormal);
-	v.z = dot(tmpVec, normal);	
-	
-	v = normalize(v);
-
-	float nDotL = dot(lVec, bump);
-	if(nDotL > 0.0) {
-		float dist = length(lpos.xyz);    
-		float attenuation = calculateAttenuation(i, dist);
-
-		diffuse  += color * max(0.0, nDotL) * gl_LightSource[i].diffuse * attenuation;
-
-	  if (shininess != 0.0) {
-    	specular += lightspec * matspec * pow(clamp(dot(reflect(-lVec, bump), v),0.0,1.0), shininess) * attenuation;
-	  }
-	}
-}
-
-
-void spotLight(in int i, in vec3 bump, in vec3 normal, in vec3 tangent, in vec3 binormal, in vec4 pos, inout vec4 diffuse, inout vec4 specular) {
-	vec4 color = gl_FrontMaterial.diffuse;
-	vec4 matspec = gl_FrontMaterial.specular;
-	float shininess = gl_FrontMaterial.shininess;
-	vec4 lightspec = gl_LightSource[i].specular;
-	vec4 lpos = gl_LightSource[i].position;
-	
-	vec3 tmpVec = lpos.xyz - pos.xyz;	
-	lpos.x = dot(tmpVec, tangent);
-	lpos.y = dot(tmpVec, binormal);
-	lpos.z = dot(tmpVec, normal);	
-	
-	float distSqr = dot(lpos.xyz, lpos.xyz);
-	vec3 lVec = lpos.xyz * inversesqrt(distSqr);
-	
-	tmpVec = -pos.xyz;
-	vec3 v;
-	v.x = dot(tmpVec, tangent);
-	v.y = dot(tmpVec, binormal);
-	v.z = dot(tmpVec, normal);	
-	
-	v = normalize(v);
-	
-	tmpVec = gl_LightSource[i].spotDirection.xyz;
-	vec3 lDir;
-	lDir.x = dot(tmpVec, tangent);
-	lDir.y = dot(tmpVec, binormal);
-	lDir.z = dot(tmpVec, normal);	
-	
-	lDir = normalize(lDir);
-
-	
-	float cos_outer_cone_angle = gl_LightSource[i].spotExponent;
-	float cos_cur_angle = dot(-lDir, lVec);
-	float cos_inner_cone_angle = gl_LightSource[i].spotCosCutoff;
-
-	float cos_inner_minus_outer_angle = cos_inner_cone_angle - cos_outer_cone_angle;
-	float spot = clamp((cos_cur_angle - cos_outer_cone_angle) / cos_inner_minus_outer_angle, 0.0, 1.0);
-	       	
-
-	float nDotL = dot(lVec, bump);
-	if(nDotL > 0.0) {
-		float dist = length(lpos.xyz);    
-		float attenuation = calculateAttenuation(i, dist);
-
-		diffuse  += color * max(0.0, nDotL) * gl_LightSource[i].diffuse * attenuation * spot;
-
-	  if (shininess != 0.0) {
-    	specular += lightspec * matspec * pow(clamp(dot(reflect(-lVec, bump), v),0.0,1.0), shininess) * attenuation * spot;
-	  }
-	}}
-
-void doLights(in int numLights, in vec3 bump, in vec3 normal, in vec3 tangent, in vec3 binormal, in vec4 pos, inout vec4 diffuse, inout vec4 specular) {
-	for (int i = 0; i < numLights; i++) {
-		if (gl_LightSource[i].spotCutoff == 180.0) {
-			pointLight(i, bump, normal, tangent, binormal, pos, diffuse, specular);
-		} else {
-			spotLight(i, bump, normal, tangent, binormal, pos, diffuse, specular);
-		}
-    }
-}
-
-
-void main()
-{
-	vec4 diffuse_val  = vec4(0.0);
-	vec4 specular_val = vec4(0.0);
-	
-	vec3 bump = normalize( texture2D(normal_map, gl_TexCoord[0].st).xyz * 2.0 - 1.0);
-		
-	doLights(6, bump, normal, tangent, binormal, pos, diffuse_val, specular_val);
-	
-	specular_val.xyz *= texture2D(specular_map, gl_TexCoord[0].st).xyz * gl_FrontMaterial.specular.a;
-	
-	diffuse_val.a = 1.0;
-	specular_val.a = 1.0;
-		
-	vec4 texColor = texture2D(diffuse, gl_TexCoord[0].st);		
-		
-    vec4 color = (diffuse_val  * texColor * vertexColor) +
-                 (specular_val * 1.0)+
-                 (gl_FrontMaterial.ambient * texColor * vertexColor);
-//    color = clamp(color, 0.0, 1.0);
-    
-    // fog
-	const float LOG2 = 1.442695;
-	float z = gl_FragCoord.z / gl_FragCoord.w;
-	float fogFactor = exp2( -gl_Fog.density * 
-				   gl_Fog.density * 
-				   z * 
-				   z * 
-				   LOG2 );
-
-	fogFactor = clamp(fogFactor, 0.0, 1.0);
-	gl_FragColor = mix(gl_Fog.color, color, fogFactor );    
-	gl_FragColor.a = 1.0;
-}

+ 2 - 3
Core/Contents/Include/PolyGLRenderer.h

@@ -151,9 +151,8 @@ namespace Polycode {
 		void setClearColor(Number r, Number g, Number b);
 		void setClearColor(Number r, Number g, Number b);
 		
 		
 		void setTexture(Texture *texture);		
 		void setTexture(Texture *texture);		
-		
-		void renderToTexture(Texture *targetTexture);		
-		void renderZBufferToTexture(Texture *targetTexture);
+
+		Image *renderScreenToImage();
 		void clearScreen();	
 		void clearScreen();	
 		
 		
 		void translate2D(Number x, Number y);
 		void translate2D(Number x, Number y);

+ 9 - 0
Core/Contents/Include/PolyImage.h

@@ -73,6 +73,15 @@ namespace Polycode {
 			bool loadImage(const String& fileName);
 			bool loadImage(const String& fileName);
 			bool loadPNG(const String& fileName);
 			bool loadPNG(const String& fileName);
 			
 			
+			/**
+			* Saves the image to a file. Currently only PNG files are supported.
+			* @param fileName Path to image file to load.	
+			* @return True if successfully loaded, false otherwise.	
+			*/
+			bool saveImage(const String &fileName);
+			bool savePNG(const String &fileName);
+			
+			
 			/**
 			/**
 			* Recreate the image as an empty image of specified size. The image type stays the same.
 			* Recreate the image as an empty image of specified size. The image type stays the same.
 			* @param width Width of the image to create.
 			* @param width Width of the image to create.

+ 2 - 3
Core/Contents/Include/PolyRenderer.h

@@ -93,9 +93,8 @@ namespace Polycode {
 		virtual Texture *createFramebufferTexture(unsigned int width, unsigned int height) = 0;
 		virtual Texture *createFramebufferTexture(unsigned int width, unsigned int height) = 0;
 		virtual void bindFrameBufferTexture(Texture *texture) = 0;
 		virtual void bindFrameBufferTexture(Texture *texture) = 0;
 		virtual void unbindFramebuffers() = 0;
 		virtual void unbindFramebuffers() = 0;
-		
-		virtual void renderToTexture(Texture *targetTexture) = 0;
-		virtual void renderZBufferToTexture(Texture *targetTexture) = 0;
+
+		virtual Image *renderScreenToImage() = 0;
 		
 		
 		void setFOV(Number fov);		
 		void setFOV(Number fov);		
 		void setViewportSize(int w, int h);
 		void setViewportSize(int w, int h);

+ 6 - 11
Core/Contents/Source/PolyGLRenderer.cpp

@@ -446,17 +446,12 @@ Matrix4 OpenGLRenderer::getModelviewMatrix() {
 	return Matrix4(m);
 	return Matrix4(m);
 }
 }
 
 
-void OpenGLRenderer::renderZBufferToTexture(Texture *targetTexture) {
-//	OpenGLTexture *glTexture = (OpenGLTexture*)targetTexture;
-//	glBindTexture (GL_TEXTURE_2D, glTexture->getTextureID());
-//	glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 0, 0, targetTexture->getWidth(), targetTexture->getHeight(), 0);	
-}
-
-void OpenGLRenderer::renderToTexture(Texture *targetTexture) {
-	OpenGLTexture *glTexture = (OpenGLTexture*)targetTexture;
-	glBindTexture (GL_TEXTURE_2D, glTexture->getTextureID());
-	glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, targetTexture->getWidth(), targetTexture->getHeight(), 0);	
-
+Image *OpenGLRenderer::renderScreenToImage() {
+	char *imageBuffer = (char*)malloc(xRes * yRes * 4);
+	glReadPixels(0, 0, xRes, yRes, GL_RGBA, GL_UNSIGNED_BYTE, imageBuffer);
+	Image *retImage = new Image(imageBuffer, xRes, yRes, Image::IMAGE_RGBA);	
+	free(imageBuffer);
+	return retImage;
 }
 }
 
 
 void OpenGLRenderer::setFogProperties(int fogMode, Color color, Number density, Number startDepth, Number endDepth) {
 void OpenGLRenderer::setFogProperties(int fogMode, Color color, Number density, Number startDepth, Number endDepth) {

+ 68 - 0
Core/Contents/Source/PolyImage.cpp

@@ -454,6 +454,74 @@ void Image::fill(Number r, Number g, Number b, Number a) {
 	}
 	}
 }
 }
 
 
+bool Image::saveImage(const String &fileName) {
+	savePNG(fileName);
+}
+
+
+
+bool Image::savePNG(const String &fileName) {
+
+	printf("Saving %dx%d image\n", width, height);
+
+   FILE *fp;
+   png_structp png_ptr;
+   png_infop info_ptr;
+   
+   fp = fopen(fileName.c_str(), "wb");
+   if (fp == NULL)
+      return false;
+
+   png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
+
+   if (png_ptr == NULL)
+   {
+      fclose(fp);
+      return false;
+   }
+
+   info_ptr = png_create_info_struct(png_ptr);
+   if (info_ptr == NULL)
+   {
+      fclose(fp);
+      png_destroy_write_struct(&png_ptr,  NULL);
+      return false;
+   }
+
+   if (setjmp(png_jmpbuf(png_ptr)))
+   {
+      /* If we get here, we had a problem writing the file */
+      fclose(fp);
+      png_destroy_write_struct(&png_ptr, &info_ptr);
+      return false;
+   }
+
+   png_init_io(png_ptr, fp);
+   png_set_IHDR(png_ptr, info_ptr, width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA,
+      PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+ 
+	png_write_info(png_ptr, info_ptr);
+
+   png_uint_32 k;
+   png_bytep row_pointers[height];
+
+   if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep))
+     png_error (png_ptr, "Image is too tall to process in memory");
+
+   for (k = 0; k < height; k++)
+     row_pointers[height-k-1] = (png_byte*)(imageData + k*width*4);
+
+   /* One of the following output methods is REQUIRED */
+
+   png_write_image(png_ptr, row_pointers);
+
+   png_free(png_ptr, 0);
+   png_destroy_write_struct(&png_ptr, &info_ptr);
+   fclose(fp);
+   return true;
+}
+
+
 bool Image::loadImage(const String& fileName) {
 bool Image::loadImage(const String& fileName) {
 	return loadPNG(fileName);
 	return loadPNG(fileName);
 }
 }

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

@@ -1,28 +0,0 @@
-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

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

@@ -1,7 +0,0 @@
-<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/2DAudio/test.wav


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

@@ -1,34 +0,0 @@
-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)

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

@@ -1,7 +0,0 @@
-<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/2DParticles/particle.png


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

@@ -1,12 +0,0 @@
-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

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

@@ -1,7 +0,0 @@
-<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>

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

@@ -1,44 +0,0 @@
-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

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

@@ -1,7 +0,0 @@
-<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>

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

@@ -1,34 +0,0 @@
-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)

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

@@ -1,10 +0,0 @@
-<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/2DPhysics_Contacts/collision.wav


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

@@ -1,36 +0,0 @@
-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)

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

@@ -1,7 +0,0 @@
-<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>

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

@@ -1,20 +0,0 @@
-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

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

@@ -1,7 +0,0 @@
-<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>

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

@@ -1,9 +0,0 @@
-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

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

@@ -1,7 +0,0 @@
-<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/2DTransforms/polycode_logo.png


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

@@ -1,26 +0,0 @@
-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

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

@@ -1,7 +0,0 @@
-<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/3DAudio/test.wav


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

@@ -1,13 +0,0 @@
-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))
-

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

@@ -1,8 +0,0 @@
-<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/3DBasics/green_texture.png


BIN
Examples/Lua/3DBasics/pink_texture.png


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

@@ -1,50 +0,0 @@
-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))

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

@@ -1,7 +0,0 @@
-<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>

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

@@ -1,26 +0,0 @@
-<?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/AdvancedLighting/Resources/green_texture.png


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


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

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

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

@@ -1,7 +0,0 @@
-<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/BasicImage/polycode_logo.png


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

@@ -1,18 +0,0 @@
-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))

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

@@ -1,7 +0,0 @@
-<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>

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

@@ -1,26 +0,0 @@
-<?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/BasicLighting/Resources/green_texture.png


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


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

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

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

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

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

@@ -1,22 +0,0 @@
-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)
-

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

@@ -1,7 +0,0 @@
-<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/EventHandling/polycode_logo.png


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

@@ -1,46 +0,0 @@
-
-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

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

@@ -1,7 +0,0 @@
-<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/KeyboardInput/polycode_logo.png


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

@@ -1,33 +0,0 @@
-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)

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

@@ -1,7 +0,0 @@
-<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/MouseInput/polycode_logo.png


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

@@ -1,17 +0,0 @@
-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)

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

@@ -1,7 +0,0 @@
-<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/PlayingSounds/test.wav


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

@@ -1,28 +0,0 @@
-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

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

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