2
0

HelloPolycodeApp.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "HelloPolycodeApp.h"
  2. HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
  3. core = new POLYCODE_CORE(view, 640,480,false,true,0,0,90, 0, true);
  4. CoreServices::getInstance()->getResourceManager()->addArchive("Resources/default.pak");
  5. CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
  6. Scene *scene = new Scene();
  7. sourceEntity = new Entity();
  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. sourceEntity->addChild(soundShape);
  13. scene->addEntity(sourceEntity);
  14. SceneSoundListener *soundListener = new SceneSoundListener();
  15. scene->addEntity(soundListener);
  16. positionValue = 0;
  17. }
  18. HelloPolycodeApp::~HelloPolycodeApp() {
  19. }
  20. bool HelloPolycodeApp::Update() {
  21. positionValue += core->getElapsed();
  22. sourceEntity->setPosition((sin(positionValue) * 20), 0, cos(positionValue) * 50);
  23. sourceEntity->Roll(core->getElapsed() * 120);
  24. sourceEntity->Pitch(core->getElapsed()* 120);
  25. return core->updateAndRender();
  26. }