فهرست منبع

Bugfixes and more examples

Ivan Safrin 14 سال پیش
والد
کامیت
b53915032a
41فایلهای تغییر یافته به همراه692 افزوده شده و 13 حذف شده
  1. 69 1
      Core/Build/Linux/.deps/PolySDLCore.Po
  2. 10 1
      Core/Build/Linux/.deps/PolycodeView.Po
  3. 69 1
      Core/Build/Linux/.deps/libPolyCore_la-PolySDLCore.Plo
  4. 10 1
      Core/Build/Linux/.deps/libPolyCore_la-PolycodeView.Plo
  5. 23 0
      Core/Contents/Include/PolySDLCore.h
  6. 5 4
      Core/Contents/Source/PolyImage.cpp
  7. 2 2
      Core/Contents/Source/PolyLabel.cpp
  8. 25 0
      Core/Contents/Source/PolySDLCore.cpp
  9. 1 1
      Core/Contents/Source/PolyWinCore.cpp
  10. 33 0
      Examples/C++/2DShapes/HelloPolycodeApp.cpp
  11. 14 0
      Examples/C++/2DShapes/HelloPolycodeApp.h
  12. 21 0
      Examples/C++/2DTransforms/HelloPolycodeApp.cpp
  13. 14 0
      Examples/C++/2DTransforms/HelloPolycodeApp.h
  14. 42 0
      Examples/C++/3DAudio/HelloPolycodeApp.cpp
  15. 17 0
      Examples/C++/3DAudio/HelloPolycodeApp.h
  16. 61 0
      Examples/C++/AdvancedLighting/HelloPolycodeApp.cpp
  17. 14 0
      Examples/C++/AdvancedLighting/HelloPolycodeApp.h
  18. 30 0
      Examples/C++/BasicLighting/HelloPolycodeApp.cpp
  19. 14 0
      Examples/C++/BasicLighting/HelloPolycodeApp.h
  20. 15 0
      Examples/C++/BasicText/HelloPolycodeApp.cpp
  21. 14 0
      Examples/C++/BasicText/HelloPolycodeApp.h
  22. BIN
      Examples/C++/LeagueScript.otf
  23. 24 2
      Examples/C++/Makefile
  24. 19 0
      Examples/C++/Resources/example.mat
  25. BIN
      Examples/C++/Resources/green_texture.png
  26. BIN
      Examples/C++/Resources/pink_texture.png
  27. 40 0
      Examples/C++/ScreenEntities/HelloPolycodeApp.cpp
  28. 23 0
      Examples/C++/ScreenEntities/HelloPolycodeApp.h
  29. 20 0
      Examples/C++/ScreenSprites/HelloPolycodeApp.cpp
  30. 14 0
      Examples/C++/ScreenSprites/HelloPolycodeApp.h
  31. 25 0
      Examples/C++/SkeletalAnimation/HelloPolycodeApp.cpp
  32. 14 0
      Examples/C++/SkeletalAnimation/HelloPolycodeApp.h
  33. BIN
      Examples/C++/green_texture.png
  34. 10 0
      Examples/C++/main.cpp
  35. BIN
      Examples/C++/ninja.mesh
  36. BIN
      Examples/C++/ninja.png
  37. BIN
      Examples/C++/ninja.skeleton
  38. BIN
      Examples/C++/pink_texture.png
  39. BIN
      Examples/C++/run.anim
  40. BIN
      Examples/C++/sprite_sheet.png
  41. BIN
      Examples/C++/test.wav

+ 69 - 1
Core/Build/Linux/.deps/PolySDLCore.Po

@@ -173,7 +173,27 @@ PolySDLCore.o: ../../Contents/Source/PolySDLCore.cpp \
  /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include/stdint.h \
  /usr/include/stdint.h /usr/include/GL/glu.h \
  ../../Contents/Include/PolyGLCubemap.h \
- ../../Contents/Include/PolyGLVertexBuffer.h /usr/include/SDL/SDL.h \
+ ../../Contents/Include/PolyGLVertexBuffer.h \
+ ../../Contents/Include/PolyGLSLShaderModule.h \
+ ../../Contents/Include/Polycode.h ../../Contents/Include/PolyData.h \
+ ../../Contents/Include/PolyObject.h \
+ ../../Contents/Include/PolyScreenLine.h \
+ ../../Contents/Include/PolyScreenMesh.h \
+ ../../Contents/Include/PolyScreenShape.h \
+ ../../Contents/Include/PolyScreenImage.h \
+ ../../Contents/Include/PolyScreenSprite.h \
+ ../../Contents/Include/PolyScreenLabel.h \
+ ../../Contents/Include/PolyScreenCurve.h \
+ ../../Contents/Include/PolyScenePrimitive.h \
+ ../../Contents/Include/PolyParticleEmitter.h \
+ ../../Contents/Include/PolyParticle.h ../../Contents/Include/PolySound.h \
+ /usr/local/include/vorbis/vorbisfile.h /usr/local/include/vorbis/codec.h \
+ /usr/local/include/ogg/ogg.h /usr/local/include/ogg/os_types.h \
+ /usr/local/include/ogg/config_types.h \
+ ../../Contents/Include/PolySceneSound.h \
+ ../../Contents/Include/PolyScreenSound.h \
+ ../../Contents/Include/PolyGLSLProgram.h \
+ ../../Contents/Include/PolyGLSLShader.h /usr/include/SDL/SDL.h \
  /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \
  /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \
  /usr/include/strings.h /usr/include/iconv.h \
@@ -689,6 +709,54 @@ PolySDLCore.o: ../../Contents/Source/PolySDLCore.cpp \
 
 ../../Contents/Include/PolyGLVertexBuffer.h:
 
+../../Contents/Include/PolyGLSLShaderModule.h:
+
+../../Contents/Include/Polycode.h:
+
+../../Contents/Include/PolyData.h:
+
+../../Contents/Include/PolyObject.h:
+
+../../Contents/Include/PolyScreenLine.h:
+
+../../Contents/Include/PolyScreenMesh.h:
+
+../../Contents/Include/PolyScreenShape.h:
+
+../../Contents/Include/PolyScreenImage.h:
+
+../../Contents/Include/PolyScreenSprite.h:
+
+../../Contents/Include/PolyScreenLabel.h:
+
+../../Contents/Include/PolyScreenCurve.h:
+
+../../Contents/Include/PolyScenePrimitive.h:
+
+../../Contents/Include/PolyParticleEmitter.h:
+
+../../Contents/Include/PolyParticle.h:
+
+../../Contents/Include/PolySound.h:
+
+/usr/local/include/vorbis/vorbisfile.h:
+
+/usr/local/include/vorbis/codec.h:
+
+/usr/local/include/ogg/ogg.h:
+
+/usr/local/include/ogg/os_types.h:
+
+/usr/local/include/ogg/config_types.h:
+
+../../Contents/Include/PolySceneSound.h:
+
+../../Contents/Include/PolyScreenSound.h:
+
+../../Contents/Include/PolyGLSLProgram.h:
+
+../../Contents/Include/PolyGLSLShader.h:
+
 /usr/include/SDL/SDL.h:
 
 /usr/include/SDL/SDL_main.h:

+ 10 - 1
Core/Build/Linux/.deps/PolycodeView.Po

@@ -188,7 +188,10 @@ PolycodeView.o: PolycodeView.cpp PolycodeView.h \
  ../../Contents/Include/PolyGLTexture.h /usr/include/GL/gl.h \
  /usr/include/GL/glext.h /usr/include/GL/glu.h \
  ../../Contents/Include/PolyGLCubemap.h \
- ../../Contents/Include/PolyGLVertexBuffer.h /usr/include/SDL/SDL.h \
+ ../../Contents/Include/PolyGLVertexBuffer.h \
+ ../../Contents/Include/PolyGLSLShaderModule.h \
+ ../../Contents/Include/PolyGLSLProgram.h \
+ ../../Contents/Include/PolyGLSLShader.h /usr/include/SDL/SDL.h \
  /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \
  /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \
  /usr/include/strings.h /usr/include/iconv.h \
@@ -748,6 +751,12 @@ PolycodeView.h:
 
 ../../Contents/Include/PolyGLVertexBuffer.h:
 
+../../Contents/Include/PolyGLSLShaderModule.h:
+
+../../Contents/Include/PolyGLSLProgram.h:
+
+../../Contents/Include/PolyGLSLShader.h:
+
 /usr/include/SDL/SDL.h:
 
 /usr/include/SDL/SDL_main.h:

+ 69 - 1
Core/Build/Linux/.deps/libPolyCore_la-PolySDLCore.Plo

@@ -173,7 +173,27 @@ libPolyCore_la-PolySDLCore.lo: ../../Contents/Source/PolySDLCore.cpp \
  /usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/include/stdint.h \
  /usr/include/stdint.h /usr/include/GL/glu.h \
  ../../Contents/Include/PolyGLCubemap.h \
- ../../Contents/Include/PolyGLVertexBuffer.h /usr/include/SDL/SDL.h \
+ ../../Contents/Include/PolyGLVertexBuffer.h \
+ ../../Contents/Include/PolyGLSLShaderModule.h \
+ ../../Contents/Include/Polycode.h ../../Contents/Include/PolyData.h \
+ ../../Contents/Include/PolyObject.h \
+ ../../Contents/Include/PolyScreenLine.h \
+ ../../Contents/Include/PolyScreenMesh.h \
+ ../../Contents/Include/PolyScreenShape.h \
+ ../../Contents/Include/PolyScreenImage.h \
+ ../../Contents/Include/PolyScreenSprite.h \
+ ../../Contents/Include/PolyScreenLabel.h \
+ ../../Contents/Include/PolyScreenCurve.h \
+ ../../Contents/Include/PolyScenePrimitive.h \
+ ../../Contents/Include/PolyParticleEmitter.h \
+ ../../Contents/Include/PolyParticle.h ../../Contents/Include/PolySound.h \
+ /usr/local/include/vorbis/vorbisfile.h /usr/local/include/vorbis/codec.h \
+ /usr/local/include/ogg/ogg.h /usr/local/include/ogg/os_types.h \
+ /usr/local/include/ogg/config_types.h \
+ ../../Contents/Include/PolySceneSound.h \
+ ../../Contents/Include/PolyScreenSound.h \
+ ../../Contents/Include/PolyGLSLProgram.h \
+ ../../Contents/Include/PolyGLSLShader.h /usr/include/SDL/SDL.h \
  /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \
  /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \
  /usr/include/strings.h /usr/include/iconv.h \
@@ -689,6 +709,54 @@ libPolyCore_la-PolySDLCore.lo: ../../Contents/Source/PolySDLCore.cpp \
 
 ../../Contents/Include/PolyGLVertexBuffer.h:
 
+../../Contents/Include/PolyGLSLShaderModule.h:
+
+../../Contents/Include/Polycode.h:
+
+../../Contents/Include/PolyData.h:
+
+../../Contents/Include/PolyObject.h:
+
+../../Contents/Include/PolyScreenLine.h:
+
+../../Contents/Include/PolyScreenMesh.h:
+
+../../Contents/Include/PolyScreenShape.h:
+
+../../Contents/Include/PolyScreenImage.h:
+
+../../Contents/Include/PolyScreenSprite.h:
+
+../../Contents/Include/PolyScreenLabel.h:
+
+../../Contents/Include/PolyScreenCurve.h:
+
+../../Contents/Include/PolyScenePrimitive.h:
+
+../../Contents/Include/PolyParticleEmitter.h:
+
+../../Contents/Include/PolyParticle.h:
+
+../../Contents/Include/PolySound.h:
+
+/usr/local/include/vorbis/vorbisfile.h:
+
+/usr/local/include/vorbis/codec.h:
+
+/usr/local/include/ogg/ogg.h:
+
+/usr/local/include/ogg/os_types.h:
+
+/usr/local/include/ogg/config_types.h:
+
+../../Contents/Include/PolySceneSound.h:
+
+../../Contents/Include/PolyScreenSound.h:
+
+../../Contents/Include/PolyGLSLProgram.h:
+
+../../Contents/Include/PolyGLSLShader.h:
+
 /usr/include/SDL/SDL.h:
 
 /usr/include/SDL/SDL_main.h:

+ 10 - 1
Core/Build/Linux/.deps/libPolyCore_la-PolycodeView.Plo

@@ -188,7 +188,10 @@ libPolyCore_la-PolycodeView.lo: PolycodeView.cpp PolycodeView.h \
  ../../Contents/Include/PolyGLTexture.h /usr/include/GL/gl.h \
  /usr/include/GL/glext.h /usr/include/GL/glu.h \
  ../../Contents/Include/PolyGLCubemap.h \
- ../../Contents/Include/PolyGLVertexBuffer.h /usr/include/SDL/SDL.h \
+ ../../Contents/Include/PolyGLVertexBuffer.h \
+ ../../Contents/Include/PolyGLSLShaderModule.h \
+ ../../Contents/Include/PolyGLSLProgram.h \
+ ../../Contents/Include/PolyGLSLShader.h /usr/include/SDL/SDL.h \
  /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \
  /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \
  /usr/include/strings.h /usr/include/iconv.h \
@@ -748,6 +751,12 @@ PolycodeView.h:
 
 ../../Contents/Include/PolyGLVertexBuffer.h:
 
+../../Contents/Include/PolyGLSLShaderModule.h:
+
+../../Contents/Include/PolyGLSLProgram.h:
+
+../../Contents/Include/PolyGLSLShader.h:
+
 /usr/include/SDL/SDL.h:
 
 /usr/include/SDL/SDL_main.h:

+ 23 - 0
Core/Contents/Include/PolySDLCore.h

@@ -1,8 +1,31 @@
+/*
+ Copyright (C) 2011 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 "PolyGlobals.h"
 #include "PolyCore.h"
 #include "PolyGLRenderer.h"
+#include "PolyGLSLShaderModule.h"
 #include "PolyRectangle.h"
 #include <vector>
 #include <SDL/SDL.h>

+ 5 - 4
Core/Contents/Source/PolyImage.cpp

@@ -81,7 +81,8 @@ Image::Image(char *data, int width, int height, int type) {
 	this->height = height;
 }
 
-Image::Image() : imageData(NULL) {
+Image::Image() {
+	imageData = NULL;
 }
 
 Image::~Image() {
@@ -461,8 +462,8 @@ bool Image::loadPNG(String fileName) {
 	char         sig[8];
 	int           bit_depth;
 	int           color_type;
-	unsigned long width;
-	unsigned long height;
+	png_uint_32 width;
+	png_uint_32 height;
 	unsigned int rowbytes;
 	image_data = NULL;
 	int i;
@@ -509,7 +510,7 @@ bool Image::loadPNG(String fileName) {
 	
 	png_set_sig_bytes(png_ptr, 8);
 	png_read_info(png_ptr, info_ptr);
-	png_get_IHDR(png_ptr, info_ptr, (png_uint_32*)&width, (png_uint_32*)&height, &bit_depth, 
+	png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, 
 				 &color_type, NULL, NULL, NULL);
 	this->width = width;
 	this->height = height;

+ 2 - 2
Core/Contents/Source/PolyLabel.cpp

@@ -27,7 +27,7 @@ using namespace Polycode;
 #define NORMAL_FT_FLAGS FT_LOAD_TARGET_LIGHT
 
 
-Label::Label(Font *font, String text, int size, int antiAliasMode) {
+Label::Label(Font *font, String text, int size, int antiAliasMode) : Image() {
 		setPixelType(Image::IMAGE_RGBA);
 		this->font = font;
 		this->size = size;
@@ -237,4 +237,4 @@ void Label::setText(String text) {
 		}
 	}
 
-}
+}

+ 25 - 0
Core/Contents/Source/PolySDLCore.cpp

@@ -1,3 +1,25 @@
+/*
+ Copyright (C) 2011 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 "PolySDLCore.h"
 
 using namespace Polycode;
@@ -19,6 +41,9 @@ SDLCore::SDLCore(PolycodeViewBase *view, int xRes, int yRes, bool fullScreen,int
 	
 	SDL_EnableUNICODE(1);
 	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+	
+	((OpenGLRenderer*)renderer)->initOSSpecific();
+	CoreServices::getInstance()->installModule(new GLSLShaderModule());	
 }
 
 void SDLCore::setVideoMode(int xRes, int yRes, bool fullScreen, int aaLevel) {	

+ 1 - 1
Core/Contents/Source/PolyWinCore.cpp

@@ -531,4 +531,4 @@ vector<Polycode::Rectangle> Win32Core::getVideoModes() {
 
 	return retVector;
 }
-	
+	

+ 33 - 0
Examples/C++/2DShapes/HelloPolycodeApp.cpp

@@ -0,0 +1,33 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
+    	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+	
+	Screen *screen = new Screen();
+
+	ScreenShape *shape = new ScreenShape(ScreenShape::SHAPE_RECT, 100,100);
+	shape->setColor(1.0, 0.0, 0.0, 1.0);
+	shape->setPosition(150,240);
+	screen->addChild(shape);
+
+	shape = new ScreenShape(ScreenShape::SHAPE_CIRCLE, 100,100);
+	shape->setColor(0.0, 1.0, 0.0, 1.0);
+	shape->setPosition(260,240);
+	screen->addChild(shape);
+
+	shape = new ScreenShape(ScreenShape::SHAPE_CIRCLE, 100,100,3);
+	shape->setColor(1.0, 0.0, 1.0, 1.0);
+	shape->setPosition(350,240);
+	screen->addChild(shape);
+
+	shape = new ScreenShape(ScreenShape::SHAPE_CIRCLE, 100,100,6);
+	shape->setColor(0.0, 1.0, 1.0, 1.0);
+	shape->setPosition(460,240);
+	screen->addChild(shape);
+}
+
+bool HelloPolycodeApp::Update() {
+    return core->Update();
+}

+ 14 - 0
Examples/C++/2DShapes/HelloPolycodeApp.h

@@ -0,0 +1,14 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp : public EventHandler {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    bool Update();
+    
+private:
+	Core *core;
+};

+ 21 - 0
Examples/C++/2DTransforms/HelloPolycodeApp.cpp

@@ -0,0 +1,21 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
+    	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+
+	Screen *screen = new Screen();			
+	for(Number i=0; i < 10; i++) {
+		ScreenImage *image = new ScreenImage("polycode_logo.png");
+		screen->addChild(image);	
+		image->setPosition(160+(42*i), 230);
+		image->setPositionMode(ScreenEntity::POSITION_CENTER);
+		image->setRotation(45*i);
+		image->setScale(1.0-(0.1*i),1.0-(0.1*i));
+	}
+}
+
+bool HelloPolycodeApp::Update() {
+    return core->Update();
+}

+ 14 - 0
Examples/C++/2DTransforms/HelloPolycodeApp.h

@@ -0,0 +1,14 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp : public EventHandler {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    bool Update();
+    
+private:
+	Core *core;
+};

+ 42 - 0
Examples/C++/3DAudio/HelloPolycodeApp.cpp

@@ -0,0 +1,42 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
+	core = new SDLCore(view, 640,480,false,0,60);	  
+	
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);	
+
+	Scene *scene = new Scene();
+	
+	sourceEntity = new SceneEntity();
+	SceneSound *testSound = new SceneSound("test.wav", 20, 50);
+	testSound->getSound()->Play(true);
+	sourceEntity->addChild(testSound);
+	ScenePrimitive *soundShape = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 1,1,1);
+	soundShape->setMaterialByName("Default");
+	sourceEntity->addChild(soundShape);	
+	scene->addEntity(sourceEntity);
+	
+	SceneLight *light = new SceneLight(SceneLight::AREA_LIGHT, scene, 300, 0,0);
+	scene->addLight(light);
+
+	SceneSoundListener *soundListener = new SceneSoundListener();
+	scene->addEntity(soundListener);
+
+	positionValue = 0;
+	
+}
+
+HelloPolycodeApp::~HelloPolycodeApp() {
+    
+}
+
+bool HelloPolycodeApp::Update() {
+	positionValue += core->getElapsed();
+	
+	sourceEntity->setPosition((sin(positionValue) * 20), 0, cos(positionValue) * 50); 
+	sourceEntity->Roll(core->getElapsed() * 120);
+	sourceEntity->Pitch(core->getElapsed()* 120);	
+		
+    return core->Update();
+}

+ 17 - 0
Examples/C++/3DAudio/HelloPolycodeApp.h

@@ -0,0 +1,17 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();    
+    bool Update();
+    
+private:
+	Number positionValue;
+	Core *core;	
+	SceneEntity *sourceEntity;	
+};
+

+ 61 - 0
Examples/C++/AdvancedLighting/HelloPolycodeApp.cpp

@@ -0,0 +1,61 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
+    	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+
+	CoreServices::getInstance()->getResourceManager()->addDirResource("Resources", false);
+	
+	Scene *scene = new Scene();
+	ScenePrimitive *ground = new ScenePrimitive(ScenePrimitive::TYPE_PLANE, 5,5);
+	ground->setMaterialByName("GroundMaterial");
+	scene->addEntity(ground);
+
+	ScenePrimitive *box = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 1,1,1);
+	box->setMaterialByName("CubeMaterial");
+	box->setPosition(0.0, 0.5, 0.0);
+	scene->addEntity(box);
+	
+	SceneLight *light = new SceneLight(SceneLight::AREA_LIGHT, scene, 3);
+	light->setPosition(3,2,3);
+	light->setLightColor(1,0,0);
+	scene->addLight(light);
+
+	light = new SceneLight(SceneLight::AREA_LIGHT, scene, 3);
+	light->setPosition(-3,2,3);
+	light->setLightColor(0,1,0);
+	scene->addLight(light);
+
+	light = new SceneLight(SceneLight::AREA_LIGHT, scene, 3);
+	light->setPosition(-3,2,-3);
+	light->setLightColor(0,0,1);
+	scene->addLight(light);
+
+	light = new SceneLight(SceneLight::AREA_LIGHT, scene, 3);
+	light->setPosition(3,2,-3);
+	light->setLightColor(1,0,1);
+	scene->addLight(light);
+
+	light = new SceneLight(SceneLight::SPOT_LIGHT, scene, 3);
+	light->setPosition(0,2,2);
+	light->setSpotlightProperties(30,6);
+	light->setLightColor(1,1,0);
+	scene->addLight(light);
+	light->lookAt(Vector3(0,0,0));
+
+	light = new SceneLight(SceneLight::SPOT_LIGHT, scene, 3);
+	light->setPosition(0,2,-2);
+	light->setSpotlightProperties(30,6);
+	light->setLightColor(0,1,1);
+	scene->addLight(light);
+	light->lookAt(Vector3(0,0,0));
+
+	scene->getDefaultCamera()->setPosition(7,7,7);
+	scene->getDefaultCamera()->lookAt(Vector3(0,0,0));
+
+}
+
+bool HelloPolycodeApp::Update() {
+    return core->Update();
+}

+ 14 - 0
Examples/C++/AdvancedLighting/HelloPolycodeApp.h

@@ -0,0 +1,14 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp : public EventHandler {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    bool Update();
+    
+private:
+	Core *core;
+};

+ 30 - 0
Examples/C++/BasicLighting/HelloPolycodeApp.cpp

@@ -0,0 +1,30 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
+    	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+
+	CoreServices::getInstance()->getResourceManager()->addDirResource("Resources", false);
+
+	Scene *scene = new Scene();
+	ScenePrimitive *ground = new ScenePrimitive(ScenePrimitive::TYPE_PLANE, 5,5);
+	ground->setMaterialByName("GroundMaterial");
+	scene->addEntity(ground);
+
+	ScenePrimitive *box = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 1,1,1);
+	box->setMaterialByName("CubeMaterial");
+	box->setPosition(0.0, 0.5, 0.0);
+	scene->addEntity(box);
+	
+	SceneLight *light = new SceneLight(SceneLight::AREA_LIGHT, scene, 3);
+	light->setPosition(1,2,1);
+	scene->addLight(light);
+
+	scene->getDefaultCamera()->setPosition(7,7,7);
+	scene->getDefaultCamera()->lookAt(Vector3(0,0,0));
+}
+
+bool HelloPolycodeApp::Update() {
+    return core->Update();
+}

+ 14 - 0
Examples/C++/BasicLighting/HelloPolycodeApp.h

@@ -0,0 +1,14 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp : public EventHandler {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    bool Update();
+    
+private:
+	Core *core;
+};

+ 15 - 0
Examples/C++/BasicText/HelloPolycodeApp.cpp

@@ -0,0 +1,15 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
+    	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+
+	Screen *screen = new Screen();
+	ScreenLabel *label = new ScreenLabel("Hello, Polycode!", 32);
+	screen->addChild(label);
+}
+
+bool HelloPolycodeApp::Update() {
+    return core->Update();
+}

+ 14 - 0
Examples/C++/BasicText/HelloPolycodeApp.h

@@ -0,0 +1,14 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp : public EventHandler {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    bool Update();
+    
+private:
+	Core *core;
+};

BIN
Examples/C++/LeagueScript.otf


+ 24 - 2
Examples/C++/Makefile

@@ -1,2 +1,24 @@
-default:
-	g++ -g `freetype-config --cflags` -IBasicImage -lPolyCore BasicImage/HelloPolycodeApp.cpp BasicImage/main.cpp -o basic_image
+default: basic_image basic_text 2d_transforms 2d_shapes screen_entities screen_sprites basic_lighting advanced_lighting 3d_audio skeletal_animation
+
+basic_image:
+	g++ -g `freetype-config --cflags` -IBasicImage -lPolyCore BasicImage/HelloPolycodeApp.cpp main.cpp -o basic_image
+basic_text:
+	g++ -g `freetype-config --cflags` -IBasicText -lPolyCore BasicText/HelloPolycodeApp.cpp main.cpp -o basic_text
+2d_transforms:
+	g++ -g `freetype-config --cflags` -I2DTransforms -lPolyCore 2DTransforms/HelloPolycodeApp.cpp main.cpp -o 2d_transforms
+2d_shapes:
+	g++ -g `freetype-config --cflags` -I2DShapes -lPolyCore 2DShapes/HelloPolycodeApp.cpp main.cpp -o 2d_shapes
+screen_entities:
+	g++ -g `freetype-config --cflags` -IScreenEntities -lPolyCore ScreenEntities/HelloPolycodeApp.cpp main.cpp -o screen_entities
+screen_sprites:
+	g++ -g `freetype-config --cflags` -IScreenSprites -lPolyCore ScreenSprites/HelloPolycodeApp.cpp main.cpp -o screen_sprites
+basic_lighting:
+	g++ -g `freetype-config --cflags` -IBasicLighting -lPolyCore BasicLighting/HelloPolycodeApp.cpp main.cpp -o basic_lighting
+advanced_lighting:
+	g++ -g `freetype-config --cflags` -IAdvancedLighting -lPolyCore AdvancedLighting/HelloPolycodeApp.cpp main.cpp -o advanced_lighting
+3d_audio:
+	g++ -g `freetype-config --cflags` -I3DAudio -lPolyCore 3DAudio/HelloPolycodeApp.cpp main.cpp -o 3d_audio
+skeletal_animation:
+	g++ -g `freetype-config --cflags` -ISkeletalAnimation -lPolyCore SkeletalAnimation/HelloPolycodeApp.cpp main.cpp -o skeletal_animation
+clean:
+	rm basic_image basic_text 2d_transforms 2d_shapes screen_entities screen_sprites basic_lighting advanced_lighting 3d_audio skeletal_animation

+ 19 - 0
Examples/C++/Resources/example.mat

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

BIN
Examples/C++/Resources/green_texture.png


BIN
Examples/C++/Resources/pink_texture.png


+ 40 - 0
Examples/C++/ScreenEntities/HelloPolycodeApp.cpp

@@ -0,0 +1,40 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
+	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+
+	Screen *screen = new Screen();			
+	sun = new ScreenShape(ScreenShape::SHAPE_CIRCLE, 100,100, 30);
+	sun->setPosition(640/2, 480/2);
+	sun->setColor(0.9, 0.8, 0, 1); 
+	sun->colorAffectsChildren = false;		
+	screen->addChild(sun);		
+	
+	planet = new ScreenShape(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 = new ScreenShape(ScreenShape::SHAPE_CIRCLE, 20,20, 30);
+	moon->setPosition(50,0);
+	moon->setColor(1, 1, 0.6, 1); 
+	planet->addChild(moon);		
+	
+	planetRotation = 0;
+	moonRotation = 0;	
+	
+}
+
+bool HelloPolycodeApp::Update() {
+	Number elapsed = core->getElapsed();
+	planetRotation += elapsed ;
+	moonRotation += elapsed * 6;	
+	planet->setPosition(cosf(planetRotation)*150, sinf(planetRotation)*150);
+	moon->setPosition(cosf(moonRotation)*50, sinf(moonRotation)*50);
+		
+    return core->Update();
+}
+

+ 23 - 0
Examples/C++/ScreenEntities/HelloPolycodeApp.h

@@ -0,0 +1,23 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    
+    bool Update();
+    
+private:
+
+	ScreenShape *sun;
+	ScreenShape *planet;
+	ScreenShape *moon;	
+	
+	Number planetRotation;
+	Number moonRotation;
+			
+    Core *core;
+};

+ 20 - 0
Examples/C++/ScreenSprites/HelloPolycodeApp.cpp

@@ -0,0 +1,20 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
+    	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+
+	CoreServices::getInstance()->getRenderer()->setTextureFilteringMode(Renderer::TEX_FILTERING_NEAREST);
+	Screen *screen = new Screen();
+	ScreenSprite *sprite = new ScreenSprite("sprite_sheet.png", 93, 78);
+	sprite->setPosition(350,150);
+	sprite->setScale(7,7);
+	screen->addChild(sprite);
+	sprite->addAnimation("ExampleAnimation", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,29,29,29,29,29,29,29,29,29", 0.04);
+	sprite->playAnimation("ExampleAnimation", 0, false);
+}
+
+bool HelloPolycodeApp::Update() {
+    return core->Update();
+}

+ 14 - 0
Examples/C++/ScreenSprites/HelloPolycodeApp.h

@@ -0,0 +1,14 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp : public EventHandler {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    bool Update();
+    
+private:
+	Core *core;
+};

+ 25 - 0
Examples/C++/SkeletalAnimation/HelloPolycodeApp.cpp

@@ -0,0 +1,25 @@
+#include "HelloPolycodeApp.h"
+
+HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
+    	core = new SDLCore(view, 640,480,false,0,90);	  
+	CoreServices::getInstance()->getResourceManager()->addArchive("default.pak");
+	CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
+
+	CoreServices::getInstance()->getRenderer()->setTextureFilteringMode(Renderer::TEX_FILTERING_NEAREST);
+
+	Scene *scene = new Scene();
+	SceneMesh *mesh = new SceneMesh("ninja.mesh");
+	mesh->loadTexture("ninja.png");
+	scene->addEntity(mesh);
+	mesh->loadSkeleton("ninja.skeleton");
+	mesh->getSkeleton()->addAnimation("Run", "run.anim");
+	mesh->getSkeleton()->playAnimation("Run");
+
+	scene->getDefaultCamera()->setPosition(25,25,25);
+	scene->getDefaultCamera()->lookAt(Vector3(0,0,0));	
+
+}
+
+bool HelloPolycodeApp::Update() {
+    return core->Update();
+}

+ 14 - 0
Examples/C++/SkeletalAnimation/HelloPolycodeApp.h

@@ -0,0 +1,14 @@
+#include <Polycode.h>
+#include "PolycodeView.h"
+
+using namespace Polycode;
+
+class HelloPolycodeApp : public EventHandler {
+public:
+    HelloPolycodeApp(PolycodeView *view);
+    ~HelloPolycodeApp();
+    bool Update();
+    
+private:
+	Core *core;
+};

BIN
Examples/C++/green_texture.png


+ 10 - 0
Examples/C++/main.cpp

@@ -0,0 +1,10 @@
+#include "Polycode.h"
+#include "PolycodeView.h"
+#include "HelloPolycodeApp.h"
+
+int main(int argc, char *argv[]) {
+	PolycodeView *view = new PolycodeView("Hello Polycode!");
+	HelloPolycodeApp *app = new HelloPolycodeApp(view);
+	while(app->Update()) {}
+	return 0;
+}

BIN
Examples/C++/ninja.mesh


BIN
Examples/C++/ninja.png


BIN
Examples/C++/ninja.skeleton


BIN
Examples/C++/pink_texture.png


BIN
Examples/C++/run.anim


BIN
Examples/C++/sprite_sheet.png


BIN
Examples/C++/test.wav