2
0

HelloPolycodeApp.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "HelloPolycodeApp.h"
  2. HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
  3. core = new POLYCODE_CORE(view, 640,480,false,false,0,0,90);
  4. CoreServices::getInstance()->getResourceManager()->addArchive("Resources/default.pak");
  5. CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
  6. Scene *scene = new Scene();
  7. sourceEntity = new SceneEntity();
  8. SceneSound *testSound = new SceneSound("Resources/test.wav", 20, 50);
  9. testSound->getSound()->Play(true);
  10. sourceEntity->addChild(testSound);
  11. ScenePrimitive *soundShape = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 1,1,1);
  12. soundShape->setMaterialByName("Default");
  13. sourceEntity->addChild(soundShape);
  14. scene->addEntity(sourceEntity);
  15. SceneLight *light = new SceneLight(SceneLight::AREA_LIGHT, scene, 1000);
  16. scene->addLight(light);
  17. SceneSoundListener *soundListener = new SceneSoundListener();
  18. scene->addEntity(soundListener);
  19. positionValue = 0;
  20. }
  21. HelloPolycodeApp::~HelloPolycodeApp() {
  22. }
  23. bool HelloPolycodeApp::Update() {
  24. positionValue += core->getElapsed();
  25. sourceEntity->setPosition((sin(positionValue) * 20), 0, cos(positionValue) * 50);
  26. sourceEntity->Roll(core->getElapsed() * 120);
  27. sourceEntity->Pitch(core->getElapsed()* 120);
  28. return core->Update();
  29. }