HelloPolycodeApp.cpp 873 B

1234567891011121314151617181920212223242526272829303132
  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. PhysicsScreen *screen = new PhysicsScreen(10, 60);
  9. ScreenShape *shape = new ScreenShape(ScreenShape::SHAPE_RECT, 600,30);
  10. shape->setColor(0.0,0.0,0.0,1.0);
  11. shape->setPosition(640/2, 400);
  12. screen->addPhysicsChild(shape, PhysicsScreenEntity::ENTITY_RECT, true);
  13. for(int i=0; i < 200; i++) {
  14. shape = new ScreenShape(ScreenShape::SHAPE_RECT, 20,5);
  15. shape->setRotation(rand() % 360);
  16. shape->setPosition(rand() % 640, rand() % 300);
  17. screen->addPhysicsChild(shape, PhysicsScreenEntity::ENTITY_RECT, false);
  18. }
  19. }
  20. HelloPolycodeApp::~HelloPolycodeApp() {
  21. }
  22. bool HelloPolycodeApp::Update() {
  23. return core->Update();
  24. }