2
0

HelloPolycodeApp.cpp 955 B

12345678910111213141516171819202122232425262728293031
  1. #include "HelloPolycodeApp.h"
  2. HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
  3. #ifdef __APPLE__
  4. core = new CocoaCore(view, 640,480,false,false,0,0,90);
  5. #else
  6. core = new SDLCore(view, 640,480,false,false,0,0,90);
  7. #endif
  8. CoreServices::getInstance()->getResourceManager()->addArchive("Resources/default.pak");
  9. CoreServices::getInstance()->getResourceManager()->addDirResource("default", false);
  10. Scene *scene = new Scene();
  11. ScenePrimitive *ground = new ScenePrimitive(ScenePrimitive::TYPE_PLANE, 5,5);
  12. ground->loadTexture("Resources/green_texture.png");
  13. scene->addEntity(ground);
  14. ScenePrimitive *box = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 1,1,1);
  15. box->loadTexture("Resources/pink_texture.png");
  16. box->setPosition(0.0, 0.5, 0.0);
  17. scene->addEntity(box);
  18. scene->getDefaultCamera()->setPosition(7,7,7);
  19. scene->getDefaultCamera()->lookAt(Vector3(0,0,0));
  20. }
  21. bool HelloPolycodeApp::Update() {
  22. return core->Update();
  23. }