2
0

HelloPolycodeApp.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include "HelloPolycodeApp.h"
  2. HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
  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. CoreServices::getInstance()->getResourceManager()->addDirResource("Resources", false);
  7. Scene *scene = new Scene();
  8. ScenePrimitive *ground = new ScenePrimitive(ScenePrimitive::TYPE_PLANE, 5,5);
  9. ground->setMaterialByName("GroundMaterial");
  10. scene->addEntity(ground);
  11. ScenePrimitive *box = new ScenePrimitive(ScenePrimitive::TYPE_TORUS, 0.8,0.3,30,20);
  12. box->setMaterialByName("CubeMaterial");
  13. box->setPosition(0.0, 0.5, 0.0);
  14. scene->addEntity(box);
  15. SceneLight *light = new SceneLight(SceneLight::AREA_LIGHT, scene, 5);
  16. light->setPosition(1,2,1);
  17. scene->addLight(light);
  18. scene->getDefaultCamera()->setPosition(7,7,7);
  19. scene->getDefaultCamera()->lookAt(Vector3(0,0,0));
  20. }
  21. HelloPolycodeApp::~HelloPolycodeApp() {
  22. }
  23. bool HelloPolycodeApp::Update() {
  24. return core->Update();
  25. }