Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated.

  • Loading branch information...
commit 5cc0ffc5e61f6581edb43bbf570f3bb25039ba4c 1 parent 7dfdbcf
Alexander Staubo authored
Showing with 2,030 additions and 664 deletions.
  1. +7 −0 .gitignore
  2. +357 −100 Brick.xcodeproj/project.pbxproj
  3. +0 −54 Brick.xcodeproj/xcuserdata/alex.xcuserdatad/xcschemes/Brick.xcscheme
  4. +0 −22 Brick.xcodeproj/xcuserdata/alex.xcuserdatad/xcschemes/xcschememanagement.plist
  5. +45 −0 examples/Asteroids/Asteroids-Info.plist
  6. +47 −0 examples/Asteroids/AsteroidsAdapter.cc
  7. +25 −0 examples/Asteroids/AsteroidsAdapter.h
  8. +10 −0 examples/Asteroids/Spaceship.cc
  9. +19 −0 examples/Asteroids/Spaceship.h
  10. +43 −0 examples/Asteroids/SpaceshipAnimator.cc
  11. +36 −0 examples/Asteroids/SpaceshipAnimator.h
  12. BIN  examples/Asteroids/hat.png
  13. +12 −0 examples/Asteroids/main.mm
  14. +32 −0 src/Brick/Animator.h
  15. +59 −0 src/Brick/Body.cc
  16. +39 −0 src/Brick/Body.h
  17. +12 −12 src/Brick/Brick.h
  18. +79 −28 src/Brick/Engine.cc
  19. +25 −7 src/Brick/Engine.h
  20. +46 −0 src/Brick/Entity.cc
  21. +75 −0 src/Brick/Entity.h
  22. +29 −0 src/Brick/Event.h
  23. +9 −0 src/Brick/EventManager.h
  24. +0 −54 src/Brick/Frame.cc
  25. +0 −33 src/Brick/Frame.h
  26. +0 −27 src/Brick/InertialBodyNode.cc
  27. +0 −28 src/Brick/InertialBodyNode.h
  28. +0 −36 src/Brick/Node.cc
  29. +0 −31 src/Brick/Node.h
  30. +57 −61 src/Brick/{Renderer.cc → OpenGL/GLRenderer.cc}
  31. +46 −0 src/Brick/OpenGL/GLRenderer.h
  32. +52 −0 src/Brick/OpenGL/GLSceneNode.cc
  33. +40 −0 src/Brick/OpenGL/GLSceneNode.h
  34. +8 −0 src/Brick/OpenGL/OpenGL.h
  35. 0  src/Brick/{ → OpenGL}/Sprite.cc
  36. 0  src/Brick/{ → OpenGL}/Sprite.h
  37. +2 −1  src/Brick/{ → OpenGL}/SpriteManager.cc
  38. 0  src/Brick/{ → OpenGL}/SpriteManager.h
  39. +20 −0 src/Brick/OpenGL/SpriteSceneNode.cc
  40. +26 −0 src/Brick/OpenGL/SpriteSceneNode.h
  41. +0 −10 src/Brick/RenderContext.cc
  42. +0 −15 src/Brick/RenderContext.h
  43. +0 −18 src/Brick/RenderHandler.h
  44. +11 −34 src/Brick/Renderer.h
  45. +146 −0 src/Brick/Scene.cc
  46. +82 −0 src/Brick/Scene.h
  47. +36 −0 src/Brick/SceneNode.cc
  48. +37 −0 src/Brick/SceneNode.h
  49. +0 −25 src/Brick/StaticSpriteNode.cc
  50. +0 −25 src/Brick/StaticSpriteNode.h
  51. +0 −23 src/Brick/StaticSpriteRenderHandler.cc
  52. +0 −20 src/Brick/StaticSpriteRenderHandler.h
  53. +69 −0 src/Brick/World.cc
  54. +44 −0 src/Brick/World.h
  55. +14 −0 src/Brick/iOS/AppDelegate.h
  56. +43 −0 src/Brick/iOS/AppDelegate.mm
  57. +31 −0 src/Brick/iOS/EAGLView.h
  58. +151 −0 src/Brick/iOS/EAGLView.mm
  59. +33 −0 src/Brick/iOS/Shell.h
  60. +45 −0 src/Brick/iOS/Shell.mm
  61. +23 −0 src/Brick/iOS/ShellAdapter.h
  62. +8 −0 src/Brick/iOS/iOS.h
View
7 .gitignore
@@ -2,3 +2,10 @@
*.sublime-project
*.sublime-workspace
.DS_Store
+build/
+*~.nib/
+*.pbxuser
+*.perspective
+*.perspectivev3
+*.xcworkspace/
+xcuserdata/
View
457 Brick.xcodeproj/project.pbxproj
@@ -7,63 +7,138 @@
objects = {
/* Begin PBXBuildFile section */
+ FA2B2B5C141C2CEE0021B94F /* AppDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B4B141C2CEE0021B94F /* AppDelegate.h */; };
+ FA2B2B5E141C2CEE0021B94F /* EAGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B4D141C2CEE0021B94F /* EAGLView.h */; };
+ FA2B2B60141C2CEE0021B94F /* iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B4F141C2CEE0021B94F /* iOS.h */; };
+ FA2B2B62141C2CEE0021B94F /* Shell.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B51141C2CEE0021B94F /* Shell.h */; };
+ FA2B2B63141C2CEE0021B94F /* ShellAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B52141C2CEE0021B94F /* ShellAdapter.h */; };
+ FA2B2B64141C2CEE0021B94F /* OpenGL.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B54141C2CEE0021B94F /* OpenGL.h */; };
+ FA2B2B6B141C2CEE0021B94F /* SpriteSceneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B5B141C2CEE0021B94F /* SpriteSceneNode.h */; };
+ FA2B2B76141C33A20021B94F /* Spaceship.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2B72141C33A20021B94F /* Spaceship.h */; };
+ FA2B2B81141C35BA0021B94F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA2B2B80141C35BA0021B94F /* UIKit.framework */; };
+ FA2B2B82141C35BA0021B94F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA6B28AE1417DF4B00D54A65 /* Foundation.framework */; };
+ FA2B2B84141C35BA0021B94F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA2B2B83141C35BA0021B94F /* CoreGraphics.framework */; };
+ FA2B2B86141C35BA0021B94F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA2B2B85141C35BA0021B94F /* QuartzCore.framework */; };
+ FA2B2B88141C35BA0021B94F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA2B2B87141C35BA0021B94F /* OpenGLES.framework */; };
+ FA2B2BA8141C362C0021B94F /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B78141C34810021B94F /* main.mm */; };
+ FA2B2BA9141C362C0021B94F /* Spaceship.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B71141C33A20021B94F /* Spaceship.cc */; };
+ FA2B2BC1141C36620021B94F /* Shell.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B6C141C2D560021B94F /* Shell.mm */; };
+ FA2B2BC3141C36620021B94F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B4C141C2CEE0021B94F /* AppDelegate.mm */; };
+ FA2B2BC5141C36620021B94F /* EAGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B4E141C2CEE0021B94F /* EAGLView.mm */; };
+ FA2B2BCF141C36620021B94F /* SpriteSceneNode.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B5A141C2CEE0021B94F /* SpriteSceneNode.cc */; };
+ FA2B2BD1141C36620021B94F /* Body.cc in Sources */ = {isa = PBXBuildFile; fileRef = FAB9B24E1419879F00017413 /* Body.cc */; };
+ FA2B2BD4141C36620021B94F /* Engine.cc in Sources */ = {isa = PBXBuildFile; fileRef = FAB9B2511419879F00017413 /* Engine.cc */; };
+ FA2B2BD6141C36620021B94F /* Entity.cc in Sources */ = {isa = PBXBuildFile; fileRef = FAB9B2531419879F00017413 /* Entity.cc */; };
+ FA2B2BE1141C36A40021B94F /* libBrick.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA6B28AB1417DF4B00D54A65 /* libBrick.a */; };
+ FA2B2BE2141C38390021B94F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B4C141C2CEE0021B94F /* AppDelegate.mm */; };
+ FA2B2BED141D47360021B94F /* Animator.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2BE6141D47340021B94F /* Animator.h */; };
+ FA2B2BEF141D47360021B94F /* Renderer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2BE8141D47340021B94F /* Renderer.h */; };
+ FA2B2BF3141D47360021B94F /* SceneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2BEC141D47350021B94F /* SceneNode.h */; };
+ FA2B2BFC141D47400021B94F /* GLRenderer.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2BF4141D473F0021B94F /* GLRenderer.cc */; };
+ FA2B2BFD141D47400021B94F /* GLRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2BF5141D473F0021B94F /* GLRenderer.h */; };
+ FA2B2BFE141D47400021B94F /* GLSceneNode.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2BF6141D473F0021B94F /* GLSceneNode.cc */; };
+ FA2B2BFF141D47400021B94F /* GLSceneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2BF7141D473F0021B94F /* GLSceneNode.h */; };
+ FA2B2C00141D47400021B94F /* Sprite.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2BF8141D473F0021B94F /* Sprite.cc */; };
+ FA2B2C01141D47400021B94F /* Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2BF9141D473F0021B94F /* Sprite.h */; };
+ FA2B2C02141D47400021B94F /* SpriteManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2BFA141D47400021B94F /* SpriteManager.cc */; };
+ FA2B2C03141D47400021B94F /* SpriteManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2BFB141D47400021B94F /* SpriteManager.h */; };
+ FA2B2C06141D4C4E0021B94F /* SpaceshipAnimator.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2C04141D4C4D0021B94F /* SpaceshipAnimator.cc */; };
+ FA2B2C09141D7BDD0021B94F /* AsteroidsAdapter.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2C07141D7BDC0021B94F /* AsteroidsAdapter.cc */; };
+ FA2B2C0E141D81640021B94F /* Scene.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2C0A141D81630021B94F /* Scene.cc */; };
+ FA2B2C0F141D81640021B94F /* Scene.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2C0B141D81630021B94F /* Scene.h */; };
+ FA2B2C10141D81640021B94F /* World.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2C0C141D81630021B94F /* World.cc */; };
+ FA2B2C11141D81640021B94F /* World.h in Headers */ = {isa = PBXBuildFile; fileRef = FA2B2C0D141D81640021B94F /* World.h */; };
+ FA2B2C13141E0B350021B94F /* SceneNode.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2C12141E0B340021B94F /* SceneNode.cc */; };
+ FA2B2C15141E0F020021B94F /* hat.png in Resources */ = {isa = PBXBuildFile; fileRef = FA2B2C14141E0F020021B94F /* hat.png */; };
FA6B28AF1417DF4B00D54A65 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA6B28AE1417DF4B00D54A65 /* Foundation.framework */; };
- FA6B29061417E6F600D54A65 /* Brick.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28EE1417E6F600D54A65 /* Brick.h */; };
- FA6B29071417E6F600D54A65 /* Engine.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B28EF1417E6F600D54A65 /* Engine.cc */; };
- FA6B29081417E6F600D54A65 /* Engine.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28F01417E6F600D54A65 /* Engine.h */; };
- FA6B29091417E6F600D54A65 /* Frame.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B28F11417E6F600D54A65 /* Frame.cc */; };
- FA6B290A1417E6F600D54A65 /* Frame.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28F21417E6F600D54A65 /* Frame.h */; };
- FA6B290B1417E6F600D54A65 /* Geometry.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28F31417E6F600D54A65 /* Geometry.h */; };
- FA6B290C1417E6F600D54A65 /* InertialBodyNode.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B28F41417E6F600D54A65 /* InertialBodyNode.cc */; };
- FA6B290D1417E6F600D54A65 /* InertialBodyNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28F51417E6F600D54A65 /* InertialBodyNode.h */; };
- FA6B290E1417E6F600D54A65 /* Node.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B28F61417E6F600D54A65 /* Node.cc */; };
- FA6B290F1417E6F600D54A65 /* Node.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28F71417E6F600D54A65 /* Node.h */; };
- FA6B29101417E6F600D54A65 /* Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28F81417E6F600D54A65 /* Prefix.pch */; };
- FA6B29111417E6F600D54A65 /* RenderContext.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B28F91417E6F600D54A65 /* RenderContext.cc */; };
- FA6B29121417E6F600D54A65 /* RenderContext.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28FA1417E6F600D54A65 /* RenderContext.h */; };
- FA6B29131417E6F600D54A65 /* Renderer.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B28FB1417E6F600D54A65 /* Renderer.cc */; };
- FA6B29141417E6F600D54A65 /* Renderer.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28FC1417E6F600D54A65 /* Renderer.h */; };
- FA6B29151417E6F600D54A65 /* RenderHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28FD1417E6F600D54A65 /* RenderHandler.h */; };
- FA6B29161417E6F600D54A65 /* Sprite.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B28FE1417E6F600D54A65 /* Sprite.cc */; };
- FA6B29171417E6F600D54A65 /* Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B28FF1417E6F600D54A65 /* Sprite.h */; };
- FA6B29181417E6F600D54A65 /* SpriteManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B29001417E6F600D54A65 /* SpriteManager.cc */; };
- FA6B29191417E6F600D54A65 /* SpriteManager.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B29011417E6F600D54A65 /* SpriteManager.h */; };
- FA6B291A1417E6F600D54A65 /* StaticSpriteNode.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B29021417E6F600D54A65 /* StaticSpriteNode.cc */; };
- FA6B291B1417E6F600D54A65 /* StaticSpriteNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B29031417E6F600D54A65 /* StaticSpriteNode.h */; };
- FA6B291C1417E6F600D54A65 /* StaticSpriteRenderHandler.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA6B29041417E6F600D54A65 /* StaticSpriteRenderHandler.cc */; };
- FA6B291D1417E6F600D54A65 /* StaticSpriteRenderHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = FA6B29051417E6F600D54A65 /* StaticSpriteRenderHandler.h */; };
+ FAB9B2661419879F00017413 /* Body.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B24F1419879F00017413 /* Body.h */; };
+ FAB9B2671419879F00017413 /* Brick.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B2501419879F00017413 /* Brick.h */; };
+ FAB9B2691419879F00017413 /* Engine.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B2521419879F00017413 /* Engine.h */; };
+ FAB9B26B1419879F00017413 /* Entity.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B2541419879F00017413 /* Entity.h */; };
+ FAB9B26C1419879F00017413 /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B2551419879F00017413 /* Event.h */; };
+ FAB9B26D1419879F00017413 /* Geometry.h in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B2561419879F00017413 /* Geometry.h */; };
+ FAB9B26E1419879F00017413 /* Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B2571419879F00017413 /* Prefix.pch */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ FA2B2BAB141C36320021B94F /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = FA6B289E1417D74800D54A65 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = FA6B28AA1417DF4B00D54A65;
+ remoteInfo = Brick;
+ };
+/* End PBXContainerItemProxy section */
+
/* Begin PBXFileReference section */
+ FA2B2B4B141C2CEE0021B94F /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ FA2B2B4C141C2CEE0021B94F /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = "<group>"; };
+ FA2B2B4D141C2CEE0021B94F /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EAGLView.h; sourceTree = "<group>"; };
+ FA2B2B4E141C2CEE0021B94F /* EAGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EAGLView.mm; sourceTree = "<group>"; };
+ FA2B2B4F141C2CEE0021B94F /* iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iOS.h; sourceTree = "<group>"; };
+ FA2B2B51141C2CEE0021B94F /* Shell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Shell.h; sourceTree = "<group>"; };
+ FA2B2B52141C2CEE0021B94F /* ShellAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShellAdapter.h; sourceTree = "<group>"; };
+ FA2B2B54141C2CEE0021B94F /* OpenGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenGL.h; sourceTree = "<group>"; };
+ FA2B2B5A141C2CEE0021B94F /* SpriteSceneNode.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpriteSceneNode.cc; sourceTree = "<group>"; };
+ FA2B2B5B141C2CEE0021B94F /* SpriteSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpriteSceneNode.h; sourceTree = "<group>"; };
+ FA2B2B6C141C2D560021B94F /* Shell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Shell.mm; sourceTree = "<group>"; };
+ FA2B2B71141C33A20021B94F /* Spaceship.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Spaceship.cc; sourceTree = "<group>"; };
+ FA2B2B72141C33A20021B94F /* Spaceship.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Spaceship.h; sourceTree = "<group>"; };
+ FA2B2B78141C34810021B94F /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
+ FA2B2B7E141C35BA0021B94F /* Asteroids.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Asteroids.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ FA2B2B80141C35BA0021B94F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ FA2B2B83141C35BA0021B94F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ FA2B2B85141C35BA0021B94F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ FA2B2B87141C35BA0021B94F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
+ FA2B2BE6141D47340021B94F /* Animator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Animator.h; path = src/Brick/Animator.h; sourceTree = "<group>"; };
+ FA2B2BE8141D47340021B94F /* Renderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Renderer.h; path = src/Brick/Renderer.h; sourceTree = "<group>"; };
+ FA2B2BEC141D47350021B94F /* SceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SceneNode.h; path = src/Brick/SceneNode.h; sourceTree = "<group>"; };
+ FA2B2BF4141D473F0021B94F /* GLRenderer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GLRenderer.cc; sourceTree = "<group>"; };
+ FA2B2BF5141D473F0021B94F /* GLRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLRenderer.h; sourceTree = "<group>"; };
+ FA2B2BF6141D473F0021B94F /* GLSceneNode.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GLSceneNode.cc; sourceTree = "<group>"; };
+ FA2B2BF7141D473F0021B94F /* GLSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLSceneNode.h; sourceTree = "<group>"; };
+ FA2B2BF8141D473F0021B94F /* Sprite.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sprite.cc; sourceTree = "<group>"; };
+ FA2B2BF9141D473F0021B94F /* Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sprite.h; sourceTree = "<group>"; };
+ FA2B2BFA141D47400021B94F /* SpriteManager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpriteManager.cc; sourceTree = "<group>"; };
+ FA2B2BFB141D47400021B94F /* SpriteManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpriteManager.h; sourceTree = "<group>"; };
+ FA2B2C04141D4C4D0021B94F /* SpaceshipAnimator.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpaceshipAnimator.cc; sourceTree = "<group>"; };
+ FA2B2C05141D4C4D0021B94F /* SpaceshipAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpaceshipAnimator.h; sourceTree = "<group>"; };
+ FA2B2C07141D7BDC0021B94F /* AsteroidsAdapter.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsteroidsAdapter.cc; sourceTree = "<group>"; };
+ FA2B2C08141D7BDC0021B94F /* AsteroidsAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsteroidsAdapter.h; sourceTree = "<group>"; };
+ FA2B2C0A141D81630021B94F /* Scene.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Scene.cc; path = src/Brick/Scene.cc; sourceTree = "<group>"; };
+ FA2B2C0B141D81630021B94F /* Scene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scene.h; path = src/Brick/Scene.h; sourceTree = "<group>"; };
+ FA2B2C0C141D81630021B94F /* World.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = World.cc; path = src/Brick/World.cc; sourceTree = "<group>"; };
+ FA2B2C0D141D81640021B94F /* World.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = World.h; path = src/Brick/World.h; sourceTree = "<group>"; };
+ FA2B2C12141E0B340021B94F /* SceneNode.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SceneNode.cc; path = src/Brick/SceneNode.cc; sourceTree = "<group>"; };
+ FA2B2C14141E0F020021B94F /* hat.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = hat.png; sourceTree = "<group>"; };
FA6B28AB1417DF4B00D54A65 /* libBrick.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libBrick.a; sourceTree = BUILT_PRODUCTS_DIR; };
FA6B28AE1417DF4B00D54A65 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
- FA6B28EE1417E6F600D54A65 /* Brick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Brick.h; path = src/Brick/Brick.h; sourceTree = "<group>"; };
- FA6B28EF1417E6F600D54A65 /* Engine.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Engine.cc; path = src/Brick/Engine.cc; sourceTree = "<group>"; };
- FA6B28F01417E6F600D54A65 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Engine.h; path = src/Brick/Engine.h; sourceTree = "<group>"; };
- FA6B28F11417E6F600D54A65 /* Frame.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Frame.cc; path = src/Brick/Frame.cc; sourceTree = "<group>"; };
- FA6B28F21417E6F600D54A65 /* Frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Frame.h; path = src/Brick/Frame.h; sourceTree = "<group>"; };
- FA6B28F31417E6F600D54A65 /* Geometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Geometry.h; path = src/Brick/Geometry.h; sourceTree = "<group>"; };
- FA6B28F41417E6F600D54A65 /* InertialBodyNode.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InertialBodyNode.cc; path = src/Brick/InertialBodyNode.cc; sourceTree = "<group>"; };
- FA6B28F51417E6F600D54A65 /* InertialBodyNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InertialBodyNode.h; path = src/Brick/InertialBodyNode.h; sourceTree = "<group>"; };
- FA6B28F61417E6F600D54A65 /* Node.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Node.cc; path = src/Brick/Node.cc; sourceTree = "<group>"; };
- FA6B28F71417E6F600D54A65 /* Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Node.h; path = src/Brick/Node.h; sourceTree = "<group>"; };
- FA6B28F81417E6F600D54A65 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Prefix.pch; path = src/Brick/Prefix.pch; sourceTree = "<group>"; };
- FA6B28F91417E6F600D54A65 /* RenderContext.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderContext.cc; path = src/Brick/RenderContext.cc; sourceTree = "<group>"; };
- FA6B28FA1417E6F600D54A65 /* RenderContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderContext.h; path = src/Brick/RenderContext.h; sourceTree = "<group>"; };
- FA6B28FB1417E6F600D54A65 /* Renderer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Renderer.cc; path = src/Brick/Renderer.cc; sourceTree = "<group>"; };
- FA6B28FC1417E6F600D54A65 /* Renderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Renderer.h; path = src/Brick/Renderer.h; sourceTree = "<group>"; };
- FA6B28FD1417E6F600D54A65 /* RenderHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderHandler.h; path = src/Brick/RenderHandler.h; sourceTree = "<group>"; };
- FA6B28FE1417E6F600D54A65 /* Sprite.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite.cc; path = src/Brick/Sprite.cc; sourceTree = "<group>"; };
- FA6B28FF1417E6F600D54A65 /* Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sprite.h; path = src/Brick/Sprite.h; sourceTree = "<group>"; };
- FA6B29001417E6F600D54A65 /* SpriteManager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpriteManager.cc; path = src/Brick/SpriteManager.cc; sourceTree = "<group>"; };
- FA6B29011417E6F600D54A65 /* SpriteManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpriteManager.h; path = src/Brick/SpriteManager.h; sourceTree = "<group>"; };
- FA6B29021417E6F600D54A65 /* StaticSpriteNode.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticSpriteNode.cc; path = src/Brick/StaticSpriteNode.cc; sourceTree = "<group>"; };
- FA6B29031417E6F600D54A65 /* StaticSpriteNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StaticSpriteNode.h; path = src/Brick/StaticSpriteNode.h; sourceTree = "<group>"; };
- FA6B29041417E6F600D54A65 /* StaticSpriteRenderHandler.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StaticSpriteRenderHandler.cc; path = src/Brick/StaticSpriteRenderHandler.cc; sourceTree = "<group>"; };
- FA6B29051417E6F600D54A65 /* StaticSpriteRenderHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StaticSpriteRenderHandler.h; path = src/Brick/StaticSpriteRenderHandler.h; sourceTree = "<group>"; };
+ FAB9B24E1419879F00017413 /* Body.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Body.cc; path = src/Brick/Body.cc; sourceTree = "<group>"; };
+ FAB9B24F1419879F00017413 /* Body.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Body.h; path = src/Brick/Body.h; sourceTree = "<group>"; };
+ FAB9B2501419879F00017413 /* Brick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Brick.h; path = src/Brick/Brick.h; sourceTree = "<group>"; };
+ FAB9B2511419879F00017413 /* Engine.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Engine.cc; path = src/Brick/Engine.cc; sourceTree = "<group>"; };
+ FAB9B2521419879F00017413 /* Engine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Engine.h; path = src/Brick/Engine.h; sourceTree = "<group>"; };
+ FAB9B2531419879F00017413 /* Entity.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Entity.cc; path = src/Brick/Entity.cc; sourceTree = "<group>"; };
+ FAB9B2541419879F00017413 /* Entity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Entity.h; path = src/Brick/Entity.h; sourceTree = "<group>"; };
+ FAB9B2551419879F00017413 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Event.h; path = src/Brick/Event.h; sourceTree = "<group>"; };
+ FAB9B2561419879F00017413 /* Geometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Geometry.h; path = src/Brick/Geometry.h; sourceTree = "<group>"; };
+ FAB9B2571419879F00017413 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Prefix.pch; path = src/Brick/Prefix.pch; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ FA2B2B7B141C35BA0021B94F /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FA2B2BE1141C36A40021B94F /* libBrick.a in Frameworks */,
+ FA2B2B81141C35BA0021B94F /* UIKit.framework in Frameworks */,
+ FA2B2B82141C35BA0021B94F /* Foundation.framework in Frameworks */,
+ FA2B2B84141C35BA0021B94F /* CoreGraphics.framework in Frameworks */,
+ FA2B2B86141C35BA0021B94F /* QuartzCore.framework in Frameworks */,
+ FA2B2B88141C35BA0021B94F /* OpenGLES.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
FA6B28A81417DF4B00D54A65 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -75,9 +150,68 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ FA2B2B4A141C2CEE0021B94F /* iOS */ = {
+ isa = PBXGroup;
+ children = (
+ FA2B2B6C141C2D560021B94F /* Shell.mm */,
+ FA2B2B4B141C2CEE0021B94F /* AppDelegate.h */,
+ FA2B2B4C141C2CEE0021B94F /* AppDelegate.mm */,
+ FA2B2B4D141C2CEE0021B94F /* EAGLView.h */,
+ FA2B2B4E141C2CEE0021B94F /* EAGLView.mm */,
+ FA2B2B4F141C2CEE0021B94F /* iOS.h */,
+ FA2B2B51141C2CEE0021B94F /* Shell.h */,
+ FA2B2B52141C2CEE0021B94F /* ShellAdapter.h */,
+ );
+ name = iOS;
+ path = src/Brick/iOS;
+ sourceTree = "<group>";
+ };
+ FA2B2B53141C2CEE0021B94F /* OpenGL */ = {
+ isa = PBXGroup;
+ children = (
+ FA2B2BF4141D473F0021B94F /* GLRenderer.cc */,
+ FA2B2BF5141D473F0021B94F /* GLRenderer.h */,
+ FA2B2BF6141D473F0021B94F /* GLSceneNode.cc */,
+ FA2B2BF7141D473F0021B94F /* GLSceneNode.h */,
+ FA2B2BF8141D473F0021B94F /* Sprite.cc */,
+ FA2B2BF9141D473F0021B94F /* Sprite.h */,
+ FA2B2BFA141D47400021B94F /* SpriteManager.cc */,
+ FA2B2BFB141D47400021B94F /* SpriteManager.h */,
+ FA2B2B54141C2CEE0021B94F /* OpenGL.h */,
+ FA2B2B5A141C2CEE0021B94F /* SpriteSceneNode.cc */,
+ FA2B2B5B141C2CEE0021B94F /* SpriteSceneNode.h */,
+ );
+ name = OpenGL;
+ path = src/Brick/OpenGL;
+ sourceTree = "<group>";
+ };
+ FA2B2B6E141C33A20021B94F /* examples */ = {
+ isa = PBXGroup;
+ children = (
+ FA2B2B6F141C33A20021B94F /* Asteroids */,
+ );
+ path = examples;
+ sourceTree = "<group>";
+ };
+ FA2B2B6F141C33A20021B94F /* Asteroids */ = {
+ isa = PBXGroup;
+ children = (
+ FA2B2C14141E0F020021B94F /* hat.png */,
+ FA2B2C07141D7BDC0021B94F /* AsteroidsAdapter.cc */,
+ FA2B2C08141D7BDC0021B94F /* AsteroidsAdapter.h */,
+ FA2B2C04141D4C4D0021B94F /* SpaceshipAnimator.cc */,
+ FA2B2C05141D4C4D0021B94F /* SpaceshipAnimator.h */,
+ FA2B2B78141C34810021B94F /* main.mm */,
+ FA2B2B71141C33A20021B94F /* Spaceship.cc */,
+ FA2B2B72141C33A20021B94F /* Spaceship.h */,
+ );
+ path = Asteroids;
+ sourceTree = "<group>";
+ };
FA6B289C1417D74800D54A65 = {
isa = PBXGroup;
children = (
+ FA2B2B6E141C33A20021B94F /* examples */,
FA6B28A51417D91F00D54A65 /* src */,
FA6B28AD1417DF4B00D54A65 /* Frameworks */,
FA6B28AC1417DF4B00D54A65 /* Products */,
@@ -96,6 +230,7 @@
isa = PBXGroup;
children = (
FA6B28AB1417DF4B00D54A65 /* libBrick.a */,
+ FA2B2B7E141C35BA0021B94F /* Asteroids.app */,
);
name = Products;
sourceTree = "<group>";
@@ -104,6 +239,10 @@
isa = PBXGroup;
children = (
FA6B28AE1417DF4B00D54A65 /* Foundation.framework */,
+ FA2B2B80141C35BA0021B94F /* UIKit.framework */,
+ FA2B2B83141C35BA0021B94F /* CoreGraphics.framework */,
+ FA2B2B85141C35BA0021B94F /* QuartzCore.framework */,
+ FA2B2B87141C35BA0021B94F /* OpenGLES.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -111,30 +250,26 @@
FA6B28BC1417E29C00D54A65 /* Brick */ = {
isa = PBXGroup;
children = (
- FA6B28EE1417E6F600D54A65 /* Brick.h */,
- FA6B28EF1417E6F600D54A65 /* Engine.cc */,
- FA6B28F01417E6F600D54A65 /* Engine.h */,
- FA6B28F11417E6F600D54A65 /* Frame.cc */,
- FA6B28F21417E6F600D54A65 /* Frame.h */,
- FA6B28F31417E6F600D54A65 /* Geometry.h */,
- FA6B28F41417E6F600D54A65 /* InertialBodyNode.cc */,
- FA6B28F51417E6F600D54A65 /* InertialBodyNode.h */,
- FA6B28F61417E6F600D54A65 /* Node.cc */,
- FA6B28F71417E6F600D54A65 /* Node.h */,
- FA6B28F81417E6F600D54A65 /* Prefix.pch */,
- FA6B28F91417E6F600D54A65 /* RenderContext.cc */,
- FA6B28FA1417E6F600D54A65 /* RenderContext.h */,
- FA6B28FB1417E6F600D54A65 /* Renderer.cc */,
- FA6B28FC1417E6F600D54A65 /* Renderer.h */,
- FA6B28FD1417E6F600D54A65 /* RenderHandler.h */,
- FA6B28FE1417E6F600D54A65 /* Sprite.cc */,
- FA6B28FF1417E6F600D54A65 /* Sprite.h */,
- FA6B29001417E6F600D54A65 /* SpriteManager.cc */,
- FA6B29011417E6F600D54A65 /* SpriteManager.h */,
- FA6B29021417E6F600D54A65 /* StaticSpriteNode.cc */,
- FA6B29031417E6F600D54A65 /* StaticSpriteNode.h */,
- FA6B29041417E6F600D54A65 /* StaticSpriteRenderHandler.cc */,
- FA6B29051417E6F600D54A65 /* StaticSpriteRenderHandler.h */,
+ FA2B2C12141E0B340021B94F /* SceneNode.cc */,
+ FA2B2C0A141D81630021B94F /* Scene.cc */,
+ FA2B2C0B141D81630021B94F /* Scene.h */,
+ FA2B2C0C141D81630021B94F /* World.cc */,
+ FA2B2C0D141D81640021B94F /* World.h */,
+ FA2B2BE6141D47340021B94F /* Animator.h */,
+ FA2B2BE8141D47340021B94F /* Renderer.h */,
+ FA2B2BEC141D47350021B94F /* SceneNode.h */,
+ FA2B2B4A141C2CEE0021B94F /* iOS */,
+ FA2B2B53141C2CEE0021B94F /* OpenGL */,
+ FAB9B24E1419879F00017413 /* Body.cc */,
+ FAB9B24F1419879F00017413 /* Body.h */,
+ FAB9B2501419879F00017413 /* Brick.h */,
+ FAB9B2511419879F00017413 /* Engine.cc */,
+ FAB9B2521419879F00017413 /* Engine.h */,
+ FAB9B2531419879F00017413 /* Entity.cc */,
+ FAB9B2541419879F00017413 /* Entity.h */,
+ FAB9B2551419879F00017413 /* Event.h */,
+ FAB9B2561419879F00017413 /* Geometry.h */,
+ FAB9B2571419879F00017413 /* Prefix.pch */,
);
name = Brick;
sourceTree = "<group>";
@@ -146,26 +281,54 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- FA6B29061417E6F600D54A65 /* Brick.h in Headers */,
- FA6B29081417E6F600D54A65 /* Engine.h in Headers */,
- FA6B290A1417E6F600D54A65 /* Frame.h in Headers */,
- FA6B290B1417E6F600D54A65 /* Geometry.h in Headers */,
- FA6B290D1417E6F600D54A65 /* InertialBodyNode.h in Headers */,
- FA6B290F1417E6F600D54A65 /* Node.h in Headers */,
- FA6B29101417E6F600D54A65 /* Prefix.pch in Headers */,
- FA6B29121417E6F600D54A65 /* RenderContext.h in Headers */,
- FA6B29141417E6F600D54A65 /* Renderer.h in Headers */,
- FA6B29151417E6F600D54A65 /* RenderHandler.h in Headers */,
- FA6B29171417E6F600D54A65 /* Sprite.h in Headers */,
- FA6B29191417E6F600D54A65 /* SpriteManager.h in Headers */,
- FA6B291B1417E6F600D54A65 /* StaticSpriteNode.h in Headers */,
- FA6B291D1417E6F600D54A65 /* StaticSpriteRenderHandler.h in Headers */,
+ FAB9B2661419879F00017413 /* Body.h in Headers */,
+ FAB9B2671419879F00017413 /* Brick.h in Headers */,
+ FAB9B2691419879F00017413 /* Engine.h in Headers */,
+ FAB9B26B1419879F00017413 /* Entity.h in Headers */,
+ FAB9B26C1419879F00017413 /* Event.h in Headers */,
+ FAB9B26D1419879F00017413 /* Geometry.h in Headers */,
+ FAB9B26E1419879F00017413 /* Prefix.pch in Headers */,
+ FA2B2B5C141C2CEE0021B94F /* AppDelegate.h in Headers */,
+ FA2B2B5E141C2CEE0021B94F /* EAGLView.h in Headers */,
+ FA2B2B60141C2CEE0021B94F /* iOS.h in Headers */,
+ FA2B2B62141C2CEE0021B94F /* Shell.h in Headers */,
+ FA2B2B63141C2CEE0021B94F /* ShellAdapter.h in Headers */,
+ FA2B2B64141C2CEE0021B94F /* OpenGL.h in Headers */,
+ FA2B2B6B141C2CEE0021B94F /* SpriteSceneNode.h in Headers */,
+ FA2B2B76141C33A20021B94F /* Spaceship.h in Headers */,
+ FA2B2BED141D47360021B94F /* Animator.h in Headers */,
+ FA2B2BEF141D47360021B94F /* Renderer.h in Headers */,
+ FA2B2BF3141D47360021B94F /* SceneNode.h in Headers */,
+ FA2B2BFD141D47400021B94F /* GLRenderer.h in Headers */,
+ FA2B2BFF141D47400021B94F /* GLSceneNode.h in Headers */,
+ FA2B2C01141D47400021B94F /* Sprite.h in Headers */,
+ FA2B2C03141D47400021B94F /* SpriteManager.h in Headers */,
+ FA2B2C0F141D81640021B94F /* Scene.h in Headers */,
+ FA2B2C11141D81640021B94F /* World.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ FA2B2B7D141C35BA0021B94F /* Asteroids */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = FA2B2BA5141C35BA0021B94F /* Build configuration list for PBXNativeTarget "Asteroids" */;
+ buildPhases = (
+ FA2B2B7A141C35BA0021B94F /* Sources */,
+ FA2B2B7B141C35BA0021B94F /* Frameworks */,
+ FA2B2B7C141C35BA0021B94F /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ FA2B2BAC141C36320021B94F /* PBXTargetDependency */,
+ );
+ name = Asteroids;
+ productName = Asteroids;
+ productReference = FA2B2B7E141C35BA0021B94F /* Asteroids.app */;
+ productType = "com.apple.product-type.application";
+ };
FA6B28AA1417DF4B00D54A65 /* Brick */ = {
isa = PBXNativeTarget;
buildConfigurationList = FA6B28B61417DF4B00D54A65 /* Build configuration list for PBXNativeTarget "Brick" */;
@@ -204,31 +367,114 @@
projectRoot = "";
targets = (
FA6B28AA1417DF4B00D54A65 /* Brick */,
+ FA2B2B7D141C35BA0021B94F /* Asteroids */,
);
};
/* End PBXProject section */
+/* Begin PBXResourcesBuildPhase section */
+ FA2B2B7C141C35BA0021B94F /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FA2B2C15141E0F020021B94F /* hat.png in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
/* Begin PBXSourcesBuildPhase section */
+ FA2B2B7A141C35BA0021B94F /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FA2B2BE2141C38390021B94F /* AppDelegate.mm in Sources */,
+ FA2B2BA8141C362C0021B94F /* main.mm in Sources */,
+ FA2B2BA9141C362C0021B94F /* Spaceship.cc in Sources */,
+ FA2B2C06141D4C4E0021B94F /* SpaceshipAnimator.cc in Sources */,
+ FA2B2C09141D7BDD0021B94F /* AsteroidsAdapter.cc in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
FA6B28A71417DF4B00D54A65 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- FA6B29071417E6F600D54A65 /* Engine.cc in Sources */,
- FA6B29091417E6F600D54A65 /* Frame.cc in Sources */,
- FA6B290C1417E6F600D54A65 /* InertialBodyNode.cc in Sources */,
- FA6B290E1417E6F600D54A65 /* Node.cc in Sources */,
- FA6B29111417E6F600D54A65 /* RenderContext.cc in Sources */,
- FA6B29131417E6F600D54A65 /* Renderer.cc in Sources */,
- FA6B29161417E6F600D54A65 /* Sprite.cc in Sources */,
- FA6B29181417E6F600D54A65 /* SpriteManager.cc in Sources */,
- FA6B291A1417E6F600D54A65 /* StaticSpriteNode.cc in Sources */,
- FA6B291C1417E6F600D54A65 /* StaticSpriteRenderHandler.cc in Sources */,
+ FA2B2BC1141C36620021B94F /* Shell.mm in Sources */,
+ FA2B2BC3141C36620021B94F /* AppDelegate.mm in Sources */,
+ FA2B2BC5141C36620021B94F /* EAGLView.mm in Sources */,
+ FA2B2BCF141C36620021B94F /* SpriteSceneNode.cc in Sources */,
+ FA2B2BD1141C36620021B94F /* Body.cc in Sources */,
+ FA2B2BD4141C36620021B94F /* Engine.cc in Sources */,
+ FA2B2BD6141C36620021B94F /* Entity.cc in Sources */,
+ FA2B2BFC141D47400021B94F /* GLRenderer.cc in Sources */,
+ FA2B2BFE141D47400021B94F /* GLSceneNode.cc in Sources */,
+ FA2B2C00141D47400021B94F /* Sprite.cc in Sources */,
+ FA2B2C02141D47400021B94F /* SpriteManager.cc in Sources */,
+ FA2B2C0E141D81640021B94F /* Scene.cc in Sources */,
+ FA2B2C10141D81640021B94F /* World.cc in Sources */,
+ FA2B2C13141E0B350021B94F /* SceneNode.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ FA2B2BAC141C36320021B94F /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = FA6B28AA1417DF4B00D54A65 /* Brick */;
+ targetProxy = FA2B2BAB141C36320021B94F /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin XCBuildConfiguration section */
+ FA2B2BA6141C35BA0021B94F /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ "GCC_THUMB_SUPPORT[arch=armv6]" = "";
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = "examples/Asteroids/Asteroids-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ FA2B2BA7141C35BA0021B94F /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ "GCC_THUMB_SUPPORT[arch=armv6]" = "";
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ INFOPLIST_FILE = "examples/Asteroids/Asteroids-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
FA6B28A31417D74800D54A65 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -236,8 +482,11 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = src/Brick/Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42;
HEADER_SEARCH_PATHS = (
+ src,
/opt/local/include,
/usr/local/include,
);
@@ -254,8 +503,11 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 3;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = src/Brick/Prefix.pch;
GCC_VERSION = com.apple.compilers.llvmgcc42;
HEADER_SEARCH_PATHS = (
+ src,
/opt/local/include,
/usr/local/include,
);
@@ -273,8 +525,6 @@
COPY_PHASE_STRIP = NO;
DSTROOT = /tmp/Brick.dst;
GCC_DYNAMIC_NO_PIC = NO;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = src/brick/Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
@@ -295,8 +545,6 @@
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
DSTROOT = /tmp/Brick.dst;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = src/brick/Prefix.pch;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -309,6 +557,14 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ FA2B2BA5141C35BA0021B94F /* Build configuration list for PBXNativeTarget "Asteroids" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ FA2B2BA6141C35BA0021B94F /* Debug */,
+ FA2B2BA7141C35BA0021B94F /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
FA6B28A11417D74800D54A65 /* Build configuration list for PBXProject "Brick" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -325,6 +581,7 @@
FA6B28B81417DF4B00D54A65 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
View
54 Brick.xcodeproj/xcuserdata/alex.xcuserdatad/xcschemes/Brick.xcscheme
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
- version = "1.3">
- <BuildAction
- parallelizeBuildables = "YES"
- buildImplicitDependencies = "YES">
- <BuildActionEntries>
- <BuildActionEntry
- buildForTesting = "YES"
- buildForRunning = "YES"
- buildForProfiling = "YES"
- buildForArchiving = "YES"
- buildForAnalyzing = "YES">
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "FA6B28AA1417DF4B00D54A65"
- BuildableName = "libBrick.a"
- BlueprintName = "Brick"
- ReferencedContainer = "container:Brick.xcodeproj">
- </BuildableReference>
- </BuildActionEntry>
- </BuildActionEntries>
- </BuildAction>
- <TestAction
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
- shouldUseLaunchSchemeArgsEnv = "YES"
- buildConfiguration = "Debug">
- <Testables>
- </Testables>
- </TestAction>
- <LaunchAction
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
- launchStyle = "0"
- useCustomWorkingDirectory = "NO"
- buildConfiguration = "Debug">
- <AdditionalOptions>
- </AdditionalOptions>
- </LaunchAction>
- <ProfileAction
- shouldUseLaunchSchemeArgsEnv = "YES"
- savedToolIdentifier = ""
- useCustomWorkingDirectory = "NO"
- buildConfiguration = "Release">
- </ProfileAction>
- <AnalyzeAction
- buildConfiguration = "Debug">
- </AnalyzeAction>
- <ArchiveAction
- buildConfiguration = "Release"
- revealArchiveInOrganizer = "YES">
- </ArchiveAction>
-</Scheme>
View
22 Brick.xcodeproj/xcuserdata/alex.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>SchemeUserState</key>
- <dict>
- <key>Brick.xcscheme</key>
- <dict>
- <key>orderHint</key>
- <integer>1</integer>
- </dict>
- </dict>
- <key>SuppressBuildableAutocreation</key>
- <dict>
- <key>FA6B28AA1417DF4B00D54A65</key>
- <dict>
- <key>primary</key>
- <true/>
- </dict>
- </dict>
-</dict>
-</plist>
View
45 examples/Asteroids/Asteroids-Info.plist
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFiles</key>
+ <array>
+ <string>Icon.png</string>
+ <string>Icon-iPad.png</string>
+ </array>
+ <key>CFBundleIdentifier</key>
+ <string>net.purefiction</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>0.1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIPrerenderedIcon</key>
+ <true/>
+ <key>UIStatusBarHidden</key>
+ <true/>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
View
47 examples/Asteroids/AsteroidsAdapter.cc
@@ -0,0 +1,47 @@
+#include "AsteroidsAdapter.h"
+#include "Spaceship.h"
+#include "SpaceshipAnimator.h"
+
+#include <Brick/OpenGL/GLRenderer.h>
+
+namespace Asteroids
+{
+ float random_within(float start, float stop)
+ {
+ return start + (stop - start) * (((float) rand()) / RAND_MAX);
+ }
+
+ AsteroidsAdapter::AsteroidsAdapter() :
+ engine()
+ {
+ }
+
+ void AsteroidsAdapter::on_startup()
+ {
+ engine = Engine::get();
+ engine->init();
+
+ engine->get_scene()->register_animator_factory(
+ &typeid(Spaceship), SpaceshipAnimator::factory);
+ engine->get_scene()->set_root(
+ shared_ptr<SceneNode>(new SceneNode()));
+
+ Entity* root = new Entity();
+ engine->get_world()->set_root(shared_ptr<Entity>(root));
+
+ srand(1234);
+ for (int i = 0; i < 30; i++) {
+ Spaceship* spaceship = new Spaceship();
+ spaceship->set_position(Brick::Point(random_within(100, 600), random_within(100, 700)));
+ spaceship->set_velocity(Brick::Point(random_within(-3, 3), random_within(-3, 3)));
+ spaceship->set_rotation(random_within(0, 360));
+ root->add_child(shared_ptr<Entity>(spaceship));
+ }
+ }
+
+ shared_ptr<Engine> AsteroidsAdapter::get_engine()
+ {
+ return engine;
+ }
+
+}
View
25 examples/Asteroids/AsteroidsAdapter.h
@@ -0,0 +1,25 @@
+#include <boost/shared_ptr.hpp>
+
+#include <Brick/Brick.h>
+#include <Brick/iOS/ShellAdapter.h>
+#include <Brick/iOS/Shell.h>
+
+namespace Asteroids
+{
+ using boost::shared_ptr;
+
+ using namespace Brick;
+ using namespace Brick::iOS;
+
+ class AsteroidsAdapter : public ShellAdapter
+ {
+ public:
+ AsteroidsAdapter();
+ void on_startup();
+ shared_ptr<Engine> get_engine();
+
+ private:
+ shared_ptr<Engine> engine;
+ };
+
+}
View
10 examples/Asteroids/Spaceship.cc
@@ -0,0 +1,10 @@
+#include "Spaceship.h"
+
+namespace Asteroids
+{
+
+ Spaceship::Spaceship()
+ {
+ }
+
+}
View
19 examples/Asteroids/Spaceship.h
@@ -0,0 +1,19 @@
+#ifndef _ASTEROIDS_SPACESHIP_H
+#define _ASTEROIDS_SPACESHIP_H
+
+#include "Brick/Body.h"
+
+namespace Asteroids
+{
+
+ using namespace Brick;
+
+ class Spaceship : public Body
+ {
+ public:
+ Spaceship();
+ };
+
+}
+
+#endif
View
43 examples/Asteroids/SpaceshipAnimator.cc
@@ -0,0 +1,43 @@
+#include "SpaceshipAnimator.h"
+
+#include "Brick/Geometry.h"
+
+namespace Asteroids
+{
+
+ using std::cout;
+
+ SpaceshipAnimator::SpaceshipAnimator() :
+ spaceship()
+ {
+ }
+
+ void SpaceshipAnimator::create(shared_ptr<Scene> scene, shared_ptr<Entity> entity)
+ {
+ spaceship = shared_ptr<Spaceship>(dynamic_cast<Spaceship*>(&(*entity)));
+ spaceship_sprite = shared_ptr<SpriteSceneNode>(new SpriteSceneNode("hat"));
+ spaceship_sprite->set_position(spaceship->get_position());
+ spaceship_sprite->set_scale(spaceship->get_scale());
+ scene->get_root()->add_child(spaceship_sprite);
+ }
+
+ void SpaceshipAnimator::remove(shared_ptr<Scene> scene)
+ {
+ scene->get_root()->remove_child(spaceship_sprite);
+ }
+
+ void SpaceshipAnimator::iterate(shared_ptr<Scene> scene)
+ {
+ if (spaceship) {
+ Brick::Point& pos = spaceship_sprite->get_position();
+ pos.x += spaceship->get_velocity().x;
+ pos.y += spaceship->get_velocity().y;
+ }
+ }
+
+ Animator* SpaceshipAnimator::factory()
+ {
+ return new SpaceshipAnimator();
+ }
+
+}
View
36 examples/Asteroids/SpaceshipAnimator.h
@@ -0,0 +1,36 @@
+#ifndef _ASTEROIDS_SPACESHIP_ANIMATOR_H
+#define _ASTEROIDS_SPACESHIP_ANIMATOR_H
+
+#include <boost/shared_ptr.hpp>
+
+#include <Brick/Brick.h>
+
+#include "Spaceship.h"
+
+namespace Asteroids
+{
+
+ using namespace Brick;
+
+ using boost::shared_ptr;
+
+ class SpaceshipAnimator : public Animator
+ {
+ public:
+ SpaceshipAnimator();
+
+ // From Animator
+ void create(shared_ptr<Scene> scene, shared_ptr<Entity> entity);
+ void remove(shared_ptr<Scene> scene);
+ void iterate(shared_ptr<Scene> scene);
+
+ static Animator* factory();
+
+ private:
+ shared_ptr<Spaceship> spaceship;
+ shared_ptr<SpriteSceneNode> spaceship_sprite;
+ };
+
+}
+
+#endif
View
BIN  examples/Asteroids/hat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
12 examples/Asteroids/main.mm
@@ -0,0 +1,12 @@
+#include "AsteroidsAdapter.h"
+
+using boost::shared_ptr;
+
+using namespace Brick;
+using namespace Brick::iOS;
+
+int main(int argc, char* argv[])
+{
+ Shell::run(shared_ptr<ShellAdapter>(new Asteroids::AsteroidsAdapter()));
+ return 0;
+}
View
32 src/Brick/Animator.h
@@ -0,0 +1,32 @@
+#ifndef _BRICK_ANIMATOR_H
+#define _BRICK_ANIMATOR_H
+
+#include <boost/shared_ptr.hpp>
+
+#include "Brick/Entity.h"
+#include "Brick/Scene.h"
+
+namespace Brick
+{
+
+ using boost::shared_ptr;
+
+ /**
+ * Interface for animators. An animator adapts single entities (although possibly)
+ * entire trees of entities including children) into scene nodes in the scene graph,
+ * and animates them.
+ *
+ * The iterate() method is called for each simulation frame. The animator may
+ * add and remove nodes as required to create the animation.
+ */
+ class Animator
+ {
+ public:
+ virtual void create(shared_ptr<Scene> scene, shared_ptr<Entity> entity) = 0;
+ virtual void remove(shared_ptr<Scene> scene) = 0;
+ virtual void iterate(shared_ptr<Scene> scene) = 0;
+ };
+
+}
+
+#endif
View
59 src/Brick/Body.cc
@@ -0,0 +1,59 @@
+#include "Brick/Body.h"
+
+namespace Brick
+{
+
+ Body::Body() :
+ position(),
+ scale(1, 1),
+ rotation(0)
+ {
+ }
+
+ Point& Body::get_position()
+ {
+ return position;
+ }
+
+ void Body::set_position(Point value)
+ {
+ position = value;
+ }
+
+ float Body::get_rotation()
+ {
+ return rotation;
+ }
+
+ void Body::set_rotation(float value)
+ {
+ rotation = value;
+ }
+
+ Point& Body::get_scale()
+ {
+ return scale;
+ }
+
+ void Body::set_scale(Point value)
+ {
+ scale = value;
+ }
+
+ Point& Body::get_velocity()
+ {
+ return velocity;
+ }
+
+ void Body::set_velocity(Point value)
+ {
+ velocity = value;
+ }
+
+ void Body::iterate()
+ {
+ position.x += velocity.x;
+ position.y += velocity.y;
+ }
+
+}
View
39 src/Brick/Body.h
@@ -0,0 +1,39 @@
+#ifndef _BRICK_BODY_H
+#define _BRICK_BODY_H
+
+#include "Brick/Entity.h"
+#include "Brick/Geometry.h"
+
+namespace Brick
+{
+
+ /**
+ * A body is an entity which has a tangible presence in the world, meaning
+ * it has a position, some kind of shape, etc.
+ */
+ class Body : public Entity
+ {
+ public:
+ Body();
+ Point& get_position();
+ void set_position(Point value);
+ float get_rotation();
+ void set_rotation(float value);
+ Point& get_scale();
+ void set_scale(Point value);
+ Point& get_velocity();
+ void set_velocity(Point value);
+
+ // Body
+ void iterate();
+
+ private:
+ Point position;
+ Point scale;
+ Point velocity;
+ float rotation;
+ };
+
+}
+
+#endif
View
24 src/Brick/Brick.h
@@ -1,12 +1,12 @@
-#include "Engine.h"
-#include "Node.h"
-#include "Frame.h"
-#include "Geometry.h"
-#include "InertialBodyNode.h"
-#include "RenderContext.h"
-#include "Renderer.h"
-#include "RenderHandler.h"
-#include "Sprite.h"
-#include "SpriteManager.h"
-#include "StaticSpriteNode.h"
-#include "StaticSpriteRenderHandler.h"
+#include <Brick/Animator.h>
+#include "Brick/Event.h"
+#include "Brick/Engine.h"
+#include "Brick/Entity.h"
+#include "Brick/Body.h"
+#include "Brick/Geometry.h"
+#include "Brick/OpenGL/Sprite.h"
+#include "Brick/OpenGL/SpriteManager.h"
+#include "Brick/OpenGL/SpriteSceneNode.h"
+#include "Brick/OpenGL/OpenGL.h"
+#include "Brick/SceneNode.h"
+#include "Brick/Renderer.h"
View
107 src/Brick/Engine.cc
@@ -5,50 +5,93 @@ namespace Brick
shared_ptr<Engine> Engine::current_engine = shared_ptr<Engine>();
- shared_ptr<Engine> Engine::get()
- {
- if (!current_engine) {
- current_engine = shared_ptr<Engine>(new Engine());
- }
- return current_engine;
- }
-
Engine::Engine() :
- renderer()
+ scene()
{
}
void Engine::init()
- {
- renderer = shared_ptr<Renderer>(new Renderer());
- renderer->init();
+ {
+ if (!sprite_manager) {
+ sprite_manager = shared_ptr<SpriteManager>(new SpriteManager());
+ sprite_manager->init();
+ }
- sprite_manager = shared_ptr<SpriteManager>(new SpriteManager());
- sprite_manager->init();
+ if (!world) {
+ world = shared_ptr<World>(new World());
+ world->init();
+ }
+
+ if (!scene) {
+ scene = shared_ptr<Scene>(new Scene());
+ scene->init();
+ }
}
void Engine::teardown()
{
- renderer->teardown();
- renderer.reset();
+ if (scene) {
+ scene->teardown();
+ scene.reset();
+ }
+
+ if (world) {
+ world->teardown();
+ world.reset();
+ }
- sprite_manager->teardown();
- sprite_manager.reset();
+ if (sprite_manager) {
+ sprite_manager->teardown();
+ sprite_manager.reset();
+ }
+ }
+
+ void Engine::start()
+ {
+ if (started) {
+ return;
+ }
+ scene->start();
+ world->start();
+ started = true;
+ }
+
+ void Engine::stop()
+ {
+ if (!started) {
+ return;
+ }
+ world->stop();
+ scene->stop();
+ started = false;
+ }
+
+ bool Engine::is_started()
+ {
+ return started;
}
void Engine::iterate()
{
- iterate_node(renderer->get_root());
+ world->iterate();
+ scene->iterate();
}
void Engine::render()
{
- renderer->render();
+ // TODO: Move somewhere else?
+ scene->animate_entity(world->get_root());
+ scene->render();
}
- shared_ptr<Renderer> Engine::get_renderer()
+ shared_ptr<World> Engine::get_world()
{
- return renderer;
+ return world;
+ }
+
+ shared_ptr<Scene> Engine::get_scene()
+ {
+ return scene;
}
shared_ptr<SpriteManager> Engine::get_sprite_manager()
@@ -56,17 +99,25 @@ namespace Brick
return sprite_manager;
}
- void Engine::iterate_node(shared_ptr<Node> node)
+ void Engine::iterate_entity(shared_ptr<Entity> entity)
{
- if (node) {
- node->iterate();
- vector<shared_ptr<Node> >::const_iterator i = node->get_children().begin();
- vector<shared_ptr<Node> >::const_iterator end = node->get_children().end();
+ if (entity) {
+ entity->iterate();
+ vector<shared_ptr<Entity> >::const_iterator i = entity->get_children().begin();
+ vector<shared_ptr<Entity> >::const_iterator end = entity->get_children().end();
while (i != end) {
- iterate_node(*i);
+ iterate_entity(*i);
i++;
}
}
}
+ shared_ptr<Engine> Engine::get()
+ {
+ if (!current_engine) {
+ current_engine = shared_ptr<Engine>(new Engine());
+ }
+ return current_engine;
+ }
+
}
View
32 src/Brick/Engine.h
@@ -3,30 +3,48 @@
#include <boost/shared_ptr.hpp>
-#include "Brick/Renderer.h"
-#include "Brick/SpriteManager.h"
+#include "Brick/OpenGL/SpriteManager.h"
+#include "Brick/Scene.h"
+#include "Brick/Entity.h"
+#include "Brick/World.h"
namespace Brick
{
using boost::shared_ptr;
+ /**
+ * An engine ties together everything in one place: screen graph, world model,
+ * resource management, etc.
+ */
class Engine
{
public:
- static shared_ptr<Engine> get();
Engine();
void init();
void teardown();
+
+ void start();
+ void stop();
+ bool is_started();
+
void render();
void iterate();
- shared_ptr<Renderer> get_renderer();
+
+ shared_ptr<World> get_world();
+ shared_ptr<Scene> get_scene();
shared_ptr<SpriteManager> get_sprite_manager();
+
+ static shared_ptr<Engine> get();
+
protected:
- static shared_ptr<Engine> current_engine;
- shared_ptr<Renderer> renderer;
+ bool started;
+ shared_ptr<World> world;
+ shared_ptr<Scene> scene;
shared_ptr<SpriteManager> sprite_manager;
- void iterate_node(shared_ptr<Node> node);
+ void iterate_entity(shared_ptr<Entity> entity);
+
+ static shared_ptr<Engine> current_engine;
};
}
View
46 src/Brick/Entity.cc
@@ -0,0 +1,46 @@
+#include "Brick/Entity.h"
+
+namespace Brick
+{
+
+ Entity::Entity() :
+ children(),
+ handlers()
+ {
+ }
+
+ void Entity::iterate()
+ {
+ // Does nothing, descendants implement
+ }
+
+ const vector<shared_ptr<Entity> >& Entity::get_children() const
+ {
+ return children;
+ }
+
+ void Entity::add_child(shared_ptr<Entity> entity)
+ {
+ children.push_back(entity);
+ }
+
+ void Entity::remove_child(shared_ptr<Entity> entity)
+ {
+ for (vector<shared_ptr<Entity> >::iterator i = children.begin(); i != children.end(); i++) {
+ shared_ptr<Entity> other = *i;
+ if (entity == other) {
+ children.erase(i);
+ break;
+ }
+ }
+ }
+
+ void Entity::handle_event(Event& event)
+ {
+ function1<void, Event&> handler = handlers[event.get_name()];
+ if (handler) {
+ handler(event);
+ }
+ }
+
+}
View
75 src/Brick/Entity.h
@@ -0,0 +1,75 @@
+#ifndef _BRICK_ENTITY_H
+#define _BRICK_ENTITY_H
+
+#include <vector>
+#include <tr1/unordered_map>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+
+#include "Brick/Event.h"
+
+namespace Brick
+{
+
+ using std::string;
+ using std::vector;
+ using std::tr1::unordered_map;
+ using boost::shared_ptr;
+ using boost::function1;
+
+ class Entity;
+
+ /**
+ * An entity is an abstract element in a world. Entities do not have
+ * a shape or a position or anything that let them interact directly
+ * with other entities.
+ */
+ class Entity
+ {
+ public:
+ Entity();
+
+ virtual void iterate();
+
+ const vector<shared_ptr<Entity> >& get_children() const;
+ void add_child(shared_ptr<Entity> entity);
+ void remove_child(shared_ptr<Entity> entity);
+
+ /**
+ * Called to let the entity handle an event. May be overridden in
+ * order to modify event handling mechanics.
+ */
+ virtual void handle_event(Event& event);
+
+ /**
+ * Bind a method to an event. This is primarily a convenience to
+ * avoid overriding handle_event(); the handler will be registered
+ * by the event name, and invoked when the event arrives.
+ *
+ * We use a template function with magical unicorns to achieve this
+ * seemingly trivial goal.
+ */
+ template <class T>
+ void bind_event(const string& event_name, void (T::*handler)(Event& event));
+ private:
+ vector<shared_ptr<Entity> > children;
+ unordered_map<string, function1<void, Event&> > handlers;
+ };
+
+ // We are so lucky that C++ allows us to put implementation code in header
+ // files. Thanks, Bjarne.
+ template <class T>
+ void Entity::bind_event(const string& event_name, void (T::*handler)(Event& event))
+ {
+ // Wrap method pointer in a Boost function
+ function1<void, Event&> function =
+ boost::bind(handler, reinterpret_cast<T*>(this), _1);
+ handlers[event_name] = function;
+ }
+
+}
+
+#endif
View
29 src/Brick/Event.h
@@ -0,0 +1,29 @@
+#ifndef _BRICK_EVENT_H
+#define _BRICK_EVENT_H
+
+#include <string>
+
+namespace Brick
+{
+
+ using std::string;
+
+ class Event
+ {
+ public:
+ Event(string a_name) :
+ name(a_name)
+ {
+ }
+ string& get_name()
+ {
+ return name;
+ }
+
+ private:
+ string name;
+ };
+
+}
+
+#endif
View
9 src/Brick/EventManager.h
@@ -0,0 +1,9 @@
+#ifndef _BRICK_EVENT_MANAGER
+#define _BRICK_EVENT_MANAGER
+
+namespace Brick
+{
+
+}
+
+#endif
View
54 src/Brick/Frame.cc
@@ -1,54 +0,0 @@
-#include "Brick/Frame.h"
-
-namespace Brick
-{
-
- Frame::Frame() :
- position(),
- scale(1, 1),
- opacity(1.0),
- rotation(0)
- {
- }
-
- Point Frame::get_position() const
- {
- return position;
- }
-
- void Frame::set_position(Point value)
- {
- position = value;
- }
-
- float Frame::get_opacity() const
- {
- return opacity;
- }
-
- void Frame::set_opacity(float value)
- {
- opacity = value;
- }
-
- float Frame::get_rotation() const
- {
- return rotation;
- }
-
- void Frame::set_rotation(float value)
- {
- rotation = value;
- }
-
- Point Frame::get_scale() const
- {
- return scale;
- }
-
- void Frame::set_scale(Point value)
- {
- scale = value;
- }
-
-}
View
33 src/Brick/Frame.h
@@ -1,33 +0,0 @@
-#ifndef _BRICK_FRAME_H
-#define _BRICK_FRAME_H
-
-#include "Brick/Node.h"
-#include "Brick/Geometry.h"
-
-namespace Brick
-{
-
- class Frame : public Node
- {
- public:
- Frame();
- Point get_position() const;
- void set_position(Point value);
- float get_opacity() const;
- void set_opacity(float value);
- float get_rotation() const;
- void set_rotation(float value);
- Point get_scale() const;
- void set_scale(Point value);
-
- protected:
- Point position;
- Point scale;
- double opacity;
- double rotation;
-
- };
-
-}
-
-#endif
View
27 src/Brick/InertialBodyNode.cc
@@ -1,27 +0,0 @@
-#include "Brick/InertialBodyNode.h"
-
-namespace Brick
-{
-
- InertialBodyNode::InertialBodyNode() :
- velocity(0, 0)
- {
- }
-
- Point InertialBodyNode::get_velocity() const
- {
- return velocity;
- }
-
- void InertialBodyNode::set_velocity(Point value)
- {
- velocity = value;
- }
-
- void InertialBodyNode::iterate()
- {
- position.x += velocity.x;
- position.y += velocity.y;
- }
-
-}
View
28 src/Brick/InertialBodyNode.h
@@ -1,28 +0,0 @@
-#ifndef _BRICK_INERTIAL_BODY_H
-#define _BRICK_INERTIAL_BODY_H
-
-#include "Brick/Node.h"
-#include "Brick/Frame.h"
-#include "Brick/Geometry.h"
-
-namespace Brick
-{
-
- class InertialBodyNode : public Frame
- {
- public:
- InertialBodyNode();
- Point get_velocity() const;
- void set_velocity(Point value);
-
- // Frame
- void iterate();
-
- private:
- Point velocity;
-
- };
-
-}
-
-#endif
View
36 src/Brick/Node.cc
@@ -1,36 +0,0 @@
-#include "Brick/Node.h"
-
-namespace Brick
-{
-
- Node::Node()
- {
- }
-
- const string Node::get_type() const {
- return "Node";
- }
-
- void Node::iterate()
- {
- // Does nothing, descendants implement
- }
-
- const vector<shared_ptr<Node> >& Node::get_children() const
- {
- return children;
- }
-
- void Node::add_child(shared_ptr<Node> node)
- {
- children.push_back(node);
- }
-
- void Node::remove_child(shared_ptr<Node> node)
- {
- for (vector<shared_ptr<Node> >::iterator i = children.begin(); i != children.end(); i++) {
- children.erase(i);
- }
- }
-
-}
View
31 src/Brick/Node.h
@@ -1,31 +0,0 @@
-#ifndef _BRICK_NODE_H
-#define _BRICK_NODE_H
-
-#include <vector>
-#include <boost/shared_ptr.hpp>
-
-namespace Brick
-{
-
- using namespace std;
- using boost::shared_ptr;
-
- class Node;
-
- class Node
- {
- public:
- Node();
- virtual const string get_type() const;
- virtual void iterate();
- const vector<shared_ptr<Node> >& get_children() const;
- void add_child(shared_ptr<Node> node);
- void remove_child(shared_ptr<Node> node);
-
- private:
- vector<shared_ptr<Node> > children;
- };
-
-}
-
-#endif
View
118 src/Brick/Renderer.cc → src/Brick/OpenGL/GLRenderer.cc
@@ -1,37 +1,33 @@
-#include "Brick/Renderer.h"
-#include "Brick/StaticSpriteRenderHandler.h"
-#include "Brick/Geometry.h"
-#include "Brick/Frame.h"
+#include "Brick/OpenGL/GLRenderer.h"
namespace Brick
{
- Renderer::Renderer() :
+ GLRenderer::GLRenderer() :
width(0),
height(0),
- ready(false),
+ started(false),
render_buffer(0),
frame_buffer(0),
- depth_render_buffer(0),
- root()
+ depth_render_buffer(0)
{
-
}
- void Renderer::init()
+ void GLRenderer::init()
{
teardown();
-
+ }
+
+ void GLRenderer::prepare_buffers()
+ {
glGenFramebuffersOES(1, &frame_buffer);
glGenRenderbuffersOES(1, &render_buffer);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, frame_buffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, render_buffer);
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, render_buffer);
-
- handlers["StaticSpriteNode"] = shared_ptr<RenderHandler>(new StaticSpriteRenderHandler());
}
- void Renderer::teardown()
+ void GLRenderer::teardown()
{
if (frame_buffer) {
glDeleteFramebuffersOES(1, &frame_buffer);
@@ -47,37 +43,48 @@ namespace Brick
}
}
- void Renderer::start()
+ void GLRenderer::start()
{
- if (!ready) {
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &width);
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &height);
- if (!glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
- ready = true;
- }
+ if (started) {
+ return;
}
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glEnable(GL_TEXTURE_2D);
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &width);
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &height);
+ if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
+ return;
+ }
+ started = true;
}
- void Renderer::stop()
+ void GLRenderer::stop()
{
+ if (!started) {
+ return;
+ }
+ started = false;
}
- bool Renderer::is_started() const
+ bool GLRenderer::is_started()
{
- return ready;
+ return started;
}
- void Renderer::render()
+ void GLRenderer::render(shared_ptr<SceneNode> root)
{
+ if (!started) {
+ return;
+ }
+
glViewport(0, 0, width, height);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0.0f, width, 0.0f, height, -1.0f, 1.0f);
@@ -89,27 +96,31 @@ namespace Brick
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
- RenderContext context;
- render_node(root, context);
+ render_node(root);
+
glFlush();
}
- const shared_ptr<Node> Renderer::get_root()
+ void GLRenderer::render_node(shared_ptr<SceneNode> scene_node)
{
- return root;
- }
+ glPushMatrix();
- void Renderer::set_root(shared_ptr<Node> a_root)
- {
- root = a_root;
- }
+ scene_node->render(*this);
- void Renderer::render_node(shared_ptr<Node> node, RenderContext& context)
- {
- if (node) {
+ vector<shared_ptr<SceneNode> >::const_iterator i = scene_node->get_children().begin();
+ vector<shared_ptr<SceneNode> >::const_iterator end = scene_node->get_children().end();
+ while (i != end) {
+ render_node(*i);
+ i++;
+ }
+
+ glPopMatrix();
+
+ /*
+ if (entity) {
glPushMatrix();
- Frame* frame = dynamic_cast<Frame*>(node.get());
+ Body* frame = dynamic_cast<Body*>(entity.get());
if (frame) {
float rotation = frame->get_rotation();
glRotatef(-rotation, 0, 0, 1.0);
@@ -121,25 +132,10 @@ namespace Brick
glScalef(scale.x, scale.y, 1.0);
}
- shared_ptr<RenderHandler> handler = get_handler(node->get_type());
- if (handler) {
- handler->render(*node.get(), context);
- }
-
- vector<shared_ptr<Node> >::const_iterator i = node->get_children().begin();
- vector<shared_ptr<Node> >::const_iterator end = node->get_children().end();
- while (i != end) {
- render_node(*i, context);
- i++;
- }
glPopMatrix();
}
- }
-
- shared_ptr<RenderHandler> Renderer::get_handler(string node_type)
- {
- return handlers[node_type];
+ */
}
}
View
46 src/Brick/OpenGL/GLRenderer.h
@@ -0,0 +1,46 @@
+#ifndef _BRICK_OPENGL_GLRENDERER_H
+#define _BRICK_OPENGL_GLRENDERER_H
+
+#include <boost/shared_ptr.hpp>
+
+#include <OpenGLES/ES1/gl.h>
+#include <OpenGLES/ES1/glext.h>
+
+#include "Brick/Renderer.h"
+#include "Brick/SceneNode.h"
+#include "Brick/OpenGL/OpenGL.h"
+
+namespace Brick {
+
+ using boost::shared_ptr;
+
+ class Renderer;
+
+ class GLRenderer : public Renderer
+ {
+ public:
+ GLRenderer();
+ void init();
+ void teardown();
+ void prepare_buffers();
+
+ // From Brick::Renderer
+ void start();
+ void stop();
+ bool is_started();
+ void render(shared_ptr<SceneNode> root);
+
+ private:
+ GLint width;
+ GLint height;
+ bool started;
+ GLuint render_buffer;
+ GLuint frame_buffer;
+ GLuint depth_render_buffer;
+
+ void render_node(shared_ptr<SceneNode> scene_node);
+ };
+
+}
+
+#endif
View
52 src/Brick/OpenGL/GLSceneNode.cc
@@ -0,0 +1,52 @@
+#include "Brick/OpenGL/GLSceneNode.h"
+
+namespace Brick
+{
+
+ GLSceneNode::GLSceneNode() :
+ position(0, 0),
+ scale(1, 1),
+ rotation(0.0),
+ opacity(0.0)
+ {
+ }
+
+ void GLSceneNode::render(Renderer& renderer)
+ {
+ glRotatef(-rotation, 0, 0, 1.0);
+ glTranslatef(position.x, position.y, 0);
+ glScalef(scale.x, scale.y, 1.0);
+ render_impl();
+ }
+
+ Point& GLSceneNode::get_position()
+ {
+ return position;
+ }
+
+ void GLSceneNode::set_position(Point value)
+ {
+ position = value;
+ }
+
+ float GLSceneNode::get_rotation() const
+ {
+ return rotation;
+ }
+
+ void GLSceneNode::set_rotation(float value)
+ {
+ rotation = value;
+ }
+
+ Point GLSceneNode::get_scale() const
+ {
+ return scale;
+ }
+
+ void GLSceneNode::set_scale(Point value)
+ {
+ scale = value;
+ }
+
+}
View
40 src/Brick/OpenGL/GLSceneNode.h
@@ -0,0 +1,40 @@
+#ifndef _BRICK_OPENGL_GLSCENE_NODE_H
+#define _BRICK_OPENGL_GLSCENE_NODE_H
+
+#include "Brick/SceneNode.h"
+#include "Brick/Renderer.h"
+
+namespace Brick
+{
+
+ /**
+ * Abstract base class for OpenGL scene nodes. The render() method implements
+ * the transformation matrix, so one only needs to implement gl_render().
+ */
+ class GLSceneNode : public SceneNode
+ {
+ public:
+ GLSceneNode();
+ void render(Renderer& renderer);
+ Point& get_position();
+ void set_position(Point value);
+ float get_rotation() const;
+ void set_rotation(float value);
+ float get_opacity() const;
+ void set_opacity(float value);
+ Point get_scale() const;
+ void set_scale(Point value);
+
+ protected:
+ virtual void render_impl() = 0;
+
+ private:
+ Point position;
+ Point scale;
+ float rotation;
+ float opacity;
+ };
+
+}
+
+#endif
View
8 src/Brick/OpenGL/OpenGL.h
@@ -0,0 +1,8 @@
+#ifndef _BRICK_OPENGL_H
+#define _BRICK_OPENGL_H
+
+namespace Brick
+{
+}
+
+#endif
View
0  src/Brick/Sprite.cc → src/Brick/OpenGL/Sprite.cc
File renamed without changes
View
0  src/Brick/Sprite.h → src/Brick/OpenGL/Sprite.h
File renamed without changes
View
3  src/Brick/SpriteManager.cc → src/Brick/OpenGL/SpriteManager.cc
@@ -28,8 +28,9 @@ namespace Brick {
shared_ptr<Sprite> SpriteManager::load(string name)
{
+ // FIXME: This CoreFoundation code that needs to be moved out into a
+ // cross-platform adapter
shared_ptr<Sprite> model;
- printf("SpriteManager loading %s\n", name.c_str());
CFStringRef path = CFStringCreateWithCString(
NULL, name.c_str(), kCFStringEncodingUTF8);
if (path) {
View
0  src/Brick/SpriteManager.h → src/Brick/OpenGL/SpriteManager.h
File renamed without changes
View
20 src/Brick/OpenGL/SpriteSceneNode.cc
@@ -0,0 +1,20 @@
+#include "Brick/OpenGL/SpriteSceneNode.h"
+#include "Brick/OpenGL/SpriteManager.h"
+#include "Brick/OpenGL/Sprite.h"
+#include "Brick/Engine.h"
+
+namespace Brick
+{
+
+ SpriteSceneNode::SpriteSceneNode(string a_name) :
+ name(a_name)
+ {
+ }
+
+ void SpriteSceneNode::render_impl()
+ {
+ shared_ptr<Sprite> sprite = Engine::get()->get_sprite_manager()->get(name);
+ sprite->render();
+ }
+
+}
View
26 src/Brick/OpenGL/SpriteSceneNode.h
@@ -0,0 +1,26 @@
+#ifndef _BRICK_OPENGL_SPRITE_SCENE_NODE_H
+#define _BRICK_OPENGL_SPRITE_SCENE_NODE_H
+
+#include <string>
+
+#include "Brick/OpenGL/GLSceneNode.h"
+
+namespace Brick {
+
+ using std::string;
+
+ class Renderer;
+
+ class SpriteSceneNode : public GLSceneNode
+ {
+ public:
+ SpriteSceneNode(string a_name);
+ void render_impl();
+
+ private:
+ string name;
+ };
+
+}
+
+#endif
View
10 src/Brick/RenderContext.cc
@@ -1,10 +0,0 @@
-#include "Brick/RenderContext.h"
-
-namespace Brick
-{
-
- RenderContext::RenderContext()
- {
- }
-
-}
View
15 src/Brick/RenderContext.h
@@ -1,15 +0,0 @@
-#ifndef _BRICK_RENDER_CONTEXT_H
-#define _BRICK_RENDER_CONTEXT_H
-
-namespace Brick
-{
-
- class RenderContext
- {
- public:
- RenderContext();
- };
-
-}
-
-#endif
View
18 src/Brick/RenderHandler.h
@@ -1,18 +0,0 @@
-#ifndef _BRICK_RENDER_HANDLER_H
-#define _BRICK_RENDER_HANDLER_H
-
-#include "Brick/Node.h"
-#include "Brick/RenderContext.h"
-
-namespace Brick
-{
-
- class RenderHandler
- {
- public:
- virtual void render(Node& node, RenderContext& context) = 0;
- };
-
-}
-
-#endif
View
45 src/Brick/Renderer.h
@@ -1,49 +1,26 @@
#ifndef _BRICK_RENDERER_H
#define _BRICK_RENDERER_H
-#include <tr1/unordered_map>
-#include <string>
-
#include <boost/shared_ptr.hpp>
-#include <OpenGLES/ES1/gl.h>
-#include <OpenGLES/ES1/glext.h>
-
-#include "Brick/Node.h"
-#include "Brick/RenderContext.h"
-#include "Brick/RenderHandler.h"
+#include "Brick/SceneNode.h"
-namespace Brick
-{
+namespace Brick {
- using std::tr1::unordered_map;
using boost::shared_ptr;
+ class SceneNode;
+
+ /**
+ * Renderer interface.
+ */
class Renderer
{
public:
- Renderer();
- void init();
- void teardown();
- void start();
- void stop();
- bool is_started() const;
- void render();
- const shared_ptr<Node> get_root();
- void set_root(shared_ptr<Node> a_root);
-
- private:
- GLint width;
- GLint height;
- bool ready;
- GLuint render_buffer;
- GLuint frame_buffer;
- GLuint depth_render_buffer;
- shared_ptr<Node> root;
- unordered_map<string, shared_ptr<RenderHandler> > handlers;
-
- void render_node(shared_ptr<Node> node, RenderContext& context);
- shared_ptr<RenderHandler> get_handler(string node_type);
+ virtual void start() = 0;
+ virtual void stop() = 0;
+ virtual bool is_started() = 0;
+ virtual void render(shared_ptr<SceneNode> root) = 0;
};
}
View
146 src/Brick/Scene.cc
@@ -0,0 +1,146 @@
+#include "Brick/Scene.h"
+#include "Brick/Renderer.h"
+#include "Brick/SceneNode.h"
+#include "Brick/Animator.h"
+
+namespace Brick
+{
+
+ Scene::Scene() :
+ animator_factories(),
+ entities_to_animators(),
+ started(false)
+ {
+ }
+
+ void Scene::init()
+ {
+ }
+
+ void Scene::teardown()
+ {
+ entities_to_animators.clear();
+ animator_factories.clear();
+ }
+
+ void Scene::start()
+ {
+ if (renderer) {
+ renderer->start();
+ }
+ started = true;
+ }
+
+ void Scene::stop()
+ {
+ if (renderer) {
+ renderer->stop();
+ }
+ started = false;
+ }
+
+ bool Scene::is_started()
+ {
+ return started;
+ }
+
+ shared_ptr<SceneNode> Scene::get_root()
+ {
+ return root;
+ }
+
+ void Scene::set_root(shared_ptr<SceneNode> a_root)
+ {
+ root = a_root;
+ }
+
+ void Scene::set_renderer(shared_ptr<Renderer> a_renderer)
+ {
+ if (started) {
+ // TODO: throw exception
+ }
+ renderer = a_renderer;
+ }
+
+ shared_ptr<Renderer> Scene::get_renderer()
+ {
+ return renderer;
+ }
+
+ void Scene::render()
+ {
+ if (!(started && root)) {
+ return;
+ }
+ renderer->render(root);
+ }
+
+ void Scene::iterate()
+ {
+ if (!(started && root)) {
+ return;