Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More work.

  • Loading branch information...
commit a1fb1cf77cae2a127e7db53f124fcea20561020b 1 parent 82db46c
Alexander Staubo authored
Showing with 921 additions and 310 deletions.
  1. +2 −1  .gitignore
  2. +131 −80 Brick.xcodeproj/project.pbxproj
  3. +5 −0 Rakefile
  4. +79 −6 examples/Asteroids/Asteroid.cc
  5. +5 −1 examples/Asteroids/Asteroid.h
  6. BIN  examples/Asteroids/Asteroid1.png
  7. BIN  examples/Asteroids/Asteroid1_piece0.png
  8. BIN  examples/Asteroids/Asteroid1_piece1.png
  9. BIN  examples/Asteroids/Asteroid1_piece10.png
  10. BIN  examples/Asteroids/Asteroid1_piece11.png
  11. BIN  examples/Asteroids/Asteroid1_piece12.png
  12. BIN  examples/Asteroids/Asteroid1_piece13.png
  13. BIN  examples/Asteroids/Asteroid1_piece14.png
  14. BIN  examples/Asteroids/Asteroid1_piece15.png
  15. BIN  examples/Asteroids/Asteroid1_piece16.png
  16. BIN  examples/Asteroids/Asteroid1_piece17.png
  17. BIN  examples/Asteroids/Asteroid1_piece2.png
  18. BIN  examples/Asteroids/Asteroid1_piece3.png
  19. BIN  examples/Asteroids/Asteroid1_piece4.png
  20. BIN  examples/Asteroids/Asteroid1_piece5.png
  21. BIN  examples/Asteroids/Asteroid1_piece6.png
  22. BIN  examples/Asteroids/Asteroid1_piece7.png
  23. BIN  examples/Asteroids/Asteroid1_piece8.png
  24. BIN  examples/Asteroids/Asteroid1_pieces.psd
  25. BIN  examples/Asteroids/Asteroid5.png
  26. BIN  examples/Asteroids/Asteroid6.png
  27. +6 −4 examples/Asteroids/AsteroidAnimator.cc
  28. +2 −1  examples/Asteroids/AsteroidAnimator.h
  29. +37 −11 examples/Asteroids/AsteroidsAdapter.cc
  30. +7 −1 examples/Asteroids/AsteroidsAdapter.h
  31. BIN  examples/Asteroids/Test2.png
  32. +62 −27 src/Brick/Animation.cc
  33. +14 −5 src/Brick/Animation.h
  34. +33 −0 src/Brick/Bitmap.cc
  35. +31 −0 src/Brick/Bitmap.h
  36. +8 −22 src/Brick/Body.cc
  37. +2 −7 src/Brick/Body.h
  38. +2 −0  src/Brick/Brick.h
  39. +12 −7 src/Brick/Engine.cc
  40. +8 −5 src/Brick/Engine.h
  41. +24 −6 src/Brick/Entity.cc
  42. +5 −1 src/Brick/Entity.h
  43. +13 −0 src/Brick/Event.h
  44. +52 −0 src/Brick/EventManager.cc
  45. +252 −2 src/Brick/EventManager.h
  46. +6 −14 src/Brick/Eventable.cc
  47. +27 −48 src/Brick/Eventable.h
  48. +3 −3 src/Brick/OpenGL/GLSprite.cc
  49. +2 −2 src/Brick/OpenGL/GLSprite.h
  50. +2 −0  src/Brick/Prefix.pch
  51. +2 −7 src/Brick/ResourceLoader.h
  52. +58 −35 src/Brick/World.cc
  53. +14 −4 src/Brick/World.h
  54. +5 −1 src/Brick/iOS/EAGLView.mm
  55. +2 −4 src/Brick/iOS/IOSResourceLoader.cc
  56. +1 −0  src/Brick/iOS/IOSResourceLoader.h
  57. +2 −0  src/Brick/iOS/ShellAdapter.h
  58. +5 −5 src/Brick/iOS/iOS.h
View
3  .gitignore
@@ -2,7 +2,6 @@
*.sublime-project
*.sublime-workspace
.DS_Store
-build/
*~.nib/
*.pbxuser
*.perspective
@@ -10,3 +9,5 @@ build/
*.xcworkspace/
xcuserdata/
/_trash
+/_history
+/build
View
211 Brick.xcodeproj/project.pbxproj
@@ -7,16 +7,18 @@
objects = {
/* Begin PBXBuildFile section */
+ FA0736A71425103B00259971 /* EventManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA0736A61425103B00259971 /* EventManager.cc */; };
+ FA0736AA142510B300259971 /* Event.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0736A9142510B300259971 /* Event.h */; };
+ FA0736AD142AAC9700259971 /* Asteroid5.png in Resources */ = {isa = PBXBuildFile; fileRef = FA0736AB142AAC9700259971 /* Asteroid5.png */; };
+ FA0736AE142AAC9700259971 /* Asteroid6.png in Resources */ = {isa = PBXBuildFile; fileRef = FA0736AC142AAC9700259971 /* Asteroid6.png */; };
+ FA22FF7F15314A140084EF99 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA22FF7E15314A140084EF99 /* UIKit.framework */; };
+ FA22FF8115314A2F0084EF99 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA22FF8015314A2F0084EF99 /* CoreGraphics.framework */; };
+ FA22FF8315314A3A0084EF99 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA22FF8215314A3A0084EF99 /* OpenGLES.framework */; };
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 */; };
- 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 */; };
FA2B2BC1141C36620021B94F /* Shell.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B6C141C2D560021B94F /* Shell.mm */; };
FA2B2BC3141C36620021B94F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2B4C141C2CEE0021B94F /* AppDelegate.mm */; };
@@ -25,7 +27,6 @@
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 */; };
FA2B2BFC141D47400021B94F /* GLRenderer.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA2B2BF4141D473F0021B94F /* GLRenderer.cc */; };
@@ -61,31 +62,39 @@
FA505F57141F857B0024E371 /* IOSResourceLoader.cc in Sources */ = {isa = PBXBuildFile; fileRef = FA505F55141F857B0024E371 /* IOSResourceLoader.cc */; };
FA505F58141F857B0024E371 /* IOSResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FA505F56141F857B0024E371 /* IOSResourceLoader.h */; };
FA506330141F996D0024E371 /* BulletDynamics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA50632F141F996D0024E371 /* BulletDynamics.framework */; };
- FA506331141F996D0024E371 /* BulletDynamics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA50632F141F996D0024E371 /* BulletDynamics.framework */; };
FA50633C141F99A70024E371 /* BulletCollision.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506332141F99A70024E371 /* BulletCollision.framework */; };
- FA50633D141F99A70024E371 /* BulletCollision.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506332141F99A70024E371 /* BulletCollision.framework */; };
FA506340141F99A70024E371 /* BulletSoftBody.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506334141F99A70024E371 /* BulletSoftBody.framework */; };
- FA506341141F99A70024E371 /* BulletSoftBody.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506334141F99A70024E371 /* BulletSoftBody.framework */; };
FA506342141F99A70024E371 /* BulletSoftBodySolvers_CPU.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506335141F99A70024E371 /* BulletSoftBodySolvers_CPU.framework */; };
- FA506343141F99A70024E371 /* BulletSoftBodySolvers_CPU.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506335141F99A70024E371 /* BulletSoftBodySolvers_CPU.framework */; };
FA506344141F99A70024E371 /* BulletSoftBodySolvers_OpenCL_Mini.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506336141F99A70024E371 /* BulletSoftBodySolvers_OpenCL_Mini.framework */; };
- FA506345141F99A70024E371 /* BulletSoftBodySolvers_OpenCL_Mini.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506336141F99A70024E371 /* BulletSoftBodySolvers_OpenCL_Mini.framework */; };
FA506346141F99A70024E371 /* libBulletMultiThreaded.2.78.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506337141F99A70024E371 /* libBulletMultiThreaded.2.78.dylib */; };
- FA506347141F99A70024E371 /* libBulletMultiThreaded.2.78.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506337141F99A70024E371 /* libBulletMultiThreaded.2.78.dylib */; };
FA506348141F99A70024E371 /* libBulletMultiThreaded.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506338141F99A70024E371 /* libBulletMultiThreaded.dylib */; };
- FA506349141F99A70024E371 /* libBulletMultiThreaded.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506338141F99A70024E371 /* libBulletMultiThreaded.dylib */; };
FA50634A141F99A70024E371 /* libMiniCL.2.78.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506339141F99A70024E371 /* libMiniCL.2.78.dylib */; };
- FA50634B141F99A70024E371 /* libMiniCL.2.78.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA506339141F99A70024E371 /* libMiniCL.2.78.dylib */; };
FA50634C141F99A70024E371 /* libMiniCL.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA50633A141F99A70024E371 /* libMiniCL.dylib */; };
- FA50634D141F99A70024E371 /* libMiniCL.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FA50633A141F99A70024E371 /* libMiniCL.dylib */; };
FA50634E141F99A70024E371 /* LinearMath.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA50633B141F99A70024E371 /* LinearMath.framework */; };
- FA50634F141F99A70024E371 /* LinearMath.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA50633B141F99A70024E371 /* LinearMath.framework */; };
FA6B28AF1417DF4B00D54A65 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA6B28AE1417DF4B00D54A65 /* Foundation.framework */; };
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 */; };
FAB9B26E1419879F00017413 /* Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = FAB9B2571419879F00017413 /* Prefix.pch */; };
+ FAE3A195154CA50B007F33ED /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA22FF8215314A3A0084EF99 /* OpenGLES.framework */; };
+ FAE3A197154CA50C007F33ED /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA22FF7E15314A140084EF99 /* UIKit.framework */; };
+ FAE3A19C154CA51A007F33ED /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA6B28AE1417DF4B00D54A65 /* Foundation.framework */; };
+ FAE3A19D154CA524007F33ED /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA22FF8015314A2F0084EF99 /* CoreGraphics.framework */; };
+ FAE3A19F154CA544007F33ED /* BulletCollision.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A19E154CA544007F33ED /* BulletCollision.framework */; };
+ FAE3A1A1154CA574007F33ED /* BulletDynamics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1A0154CA574007F33ED /* BulletDynamics.framework */; };
+ FAE3A1A3154CA57E007F33ED /* BulletSoftBody.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1A2154CA57E007F33ED /* BulletSoftBody.framework */; };
+ FAE3A1A5154CA58D007F33ED /* LinearMath.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1A4154CA58D007F33ED /* LinearMath.framework */; };
+ FAE3A1A7154CA5B4007F33ED /* BulletSoftBodySolvers_OpenCL_Mini.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1A6154CA5B4007F33ED /* BulletSoftBodySolvers_OpenCL_Mini.framework */; };
+ FAE3A1A9154CA5CC007F33ED /* BulletSoftBodySolvers_CPU.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1A8154CA5CC007F33ED /* BulletSoftBodySolvers_CPU.framework */; };
+ FAE3A1AC154CA603007F33ED /* libBulletMultiThreaded.2.78.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1AA154CA603007F33ED /* libBulletMultiThreaded.2.78.dylib */; };
+ FAE3A1AD154CA603007F33ED /* libBulletMultiThreaded.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1AB154CA603007F33ED /* libBulletMultiThreaded.dylib */; };
+ FAE3A1B0154CA618007F33ED /* libMiniCL.2.78.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1AE154CA618007F33ED /* libMiniCL.2.78.dylib */; };
+ FAE3A1B1154CA618007F33ED /* libMiniCL.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE3A1AF154CA618007F33ED /* libMiniCL.dylib */; };
+ FAE3A1B2154CA9D7007F33ED /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA2B2B85141C35BA0021B94F /* QuartzCore.framework */; };
+ FAE3A1B3154CA9E5007F33ED /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA2B2B85141C35BA0021B94F /* QuartzCore.framework */; };
+ FAE3A1B6154CC179007F33ED /* Bitmap.cc in Sources */ = {isa = PBXBuildFile; fileRef = FAE3A1B4154CC178007F33ED /* Bitmap.cc */; };
+ FAE3A1B7154CC179007F33ED /* Bitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE3A1B5154CC179007F33ED /* Bitmap.h */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -99,6 +108,13 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ FA0736A61425103B00259971 /* EventManager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EventManager.cc; path = src/Brick/EventManager.cc; sourceTree = "<group>"; };
+ FA0736A9142510B300259971 /* Event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Event.h; path = src/Brick/Event.h; sourceTree = "<group>"; };
+ FA0736AB142AAC9700259971 /* Asteroid5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Asteroid5.png; sourceTree = "<group>"; };
+ FA0736AC142AAC9700259971 /* Asteroid6.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Asteroid6.png; sourceTree = "<group>"; };
+ FA22FF7E15314A140084EF99 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+ FA22FF8015314A2F0084EF99 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
+ FA22FF8215314A3A0084EF99 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
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>"; };
@@ -109,10 +125,7 @@
FA2B2B6C141C2D560021B94F /* Shell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Shell.mm; 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>"; };
FA2B2BF4141D473F0021B94F /* GLRenderer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GLRenderer.cc; sourceTree = "<group>"; };
@@ -173,6 +186,20 @@
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>"; };
FAB9B2571419879F00017413 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Prefix.pch; path = src/Brick/Prefix.pch; sourceTree = "<group>"; };
+ FAE3A198154CA50C007F33ED /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
+ FAE3A199154CA50C007F33ED /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; };
+ FAE3A19E154CA544007F33ED /* BulletCollision.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BulletCollision.framework; path = vendor/bullet/src/BulletCollision/BulletCollision.framework; sourceTree = "<group>"; };
+ FAE3A1A0154CA574007F33ED /* BulletDynamics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BulletDynamics.framework; path = vendor/bullet/src/BulletDynamics/BulletDynamics.framework; sourceTree = "<group>"; };
+ FAE3A1A2154CA57E007F33ED /* BulletSoftBody.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BulletSoftBody.framework; path = vendor/bullet/src/BulletSoftBody/BulletSoftBody.framework; sourceTree = "<group>"; };
+ FAE3A1A4154CA58D007F33ED /* LinearMath.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LinearMath.framework; path = vendor/bullet/src/LinearMath/LinearMath.framework; sourceTree = "<group>"; };
+ FAE3A1A6154CA5B4007F33ED /* BulletSoftBodySolvers_OpenCL_Mini.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BulletSoftBodySolvers_OpenCL_Mini.framework; path = vendor/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/BulletSoftBodySolvers_OpenCL_Mini.framework; sourceTree = "<group>"; };
+ FAE3A1A8154CA5CC007F33ED /* BulletSoftBodySolvers_CPU.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = BulletSoftBodySolvers_CPU.framework; path = vendor/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/CPU/BulletSoftBodySolvers_CPU.framework; sourceTree = "<group>"; };
+ FAE3A1AA154CA603007F33ED /* libBulletMultiThreaded.2.78.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libBulletMultiThreaded.2.78.dylib; path = vendor/bullet/src/BulletMultiThreaded/libBulletMultiThreaded.2.78.dylib; sourceTree = "<group>"; };
+ FAE3A1AB154CA603007F33ED /* libBulletMultiThreaded.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libBulletMultiThreaded.dylib; path = vendor/bullet/src/BulletMultiThreaded/libBulletMultiThreaded.dylib; sourceTree = "<group>"; };
+ FAE3A1AE154CA618007F33ED /* libMiniCL.2.78.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMiniCL.2.78.dylib; path = vendor/bullet/src/MiniCL/libMiniCL.2.78.dylib; sourceTree = "<group>"; };
+ FAE3A1AF154CA618007F33ED /* libMiniCL.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libMiniCL.dylib; path = vendor/bullet/src/MiniCL/libMiniCL.dylib; sourceTree = "<group>"; };
+ FAE3A1B4154CC178007F33ED /* Bitmap.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Bitmap.cc; path = src/Brick/Bitmap.cc; sourceTree = "<group>"; };
+ FAE3A1B5154CC179007F33ED /* Bitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bitmap.h; path = src/Brick/Bitmap.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -180,22 +207,22 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ FAE3A1B2154CA9D7007F33ED /* QuartzCore.framework in Frameworks */,
+ FAE3A19C154CA51A007F33ED /* Foundation.framework in Frameworks */,
+ FAE3A19F154CA544007F33ED /* BulletCollision.framework in Frameworks */,
+ FAE3A1A3154CA57E007F33ED /* BulletSoftBody.framework in Frameworks */,
+ FAE3A1A9154CA5CC007F33ED /* BulletSoftBodySolvers_CPU.framework in Frameworks */,
+ FAE3A1A7154CA5B4007F33ED /* BulletSoftBodySolvers_OpenCL_Mini.framework in Frameworks */,
+ FAE3A1A1154CA574007F33ED /* BulletDynamics.framework in Frameworks */,
+ FAE3A1AC154CA603007F33ED /* libBulletMultiThreaded.2.78.dylib in Frameworks */,
+ FAE3A1AD154CA603007F33ED /* libBulletMultiThreaded.dylib in Frameworks */,
+ FAE3A1B0154CA618007F33ED /* libMiniCL.2.78.dylib in Frameworks */,
+ FAE3A1B1154CA618007F33ED /* libMiniCL.dylib in Frameworks */,
+ FAE3A1A5154CA58D007F33ED /* LinearMath.framework in Frameworks */,
+ FAE3A19D154CA524007F33ED /* CoreGraphics.framework in Frameworks */,
+ FAE3A195154CA50B007F33ED /* OpenGLES.framework in Frameworks */,
+ FAE3A197154CA50C007F33ED /* UIKit.framework in Frameworks */,
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 */,
- FA506331141F996D0024E371 /* BulletDynamics.framework in Frameworks */,
- FA50633D141F99A70024E371 /* BulletCollision.framework in Frameworks */,
- FA506341141F99A70024E371 /* BulletSoftBody.framework in Frameworks */,
- FA506343141F99A70024E371 /* BulletSoftBodySolvers_CPU.framework in Frameworks */,
- FA506345141F99A70024E371 /* BulletSoftBodySolvers_OpenCL_Mini.framework in Frameworks */,
- FA506347141F99A70024E371 /* libBulletMultiThreaded.2.78.dylib in Frameworks */,
- FA506349141F99A70024E371 /* libBulletMultiThreaded.dylib in Frameworks */,
- FA50634B141F99A70024E371 /* libMiniCL.2.78.dylib in Frameworks */,
- FA50634D141F99A70024E371 /* libMiniCL.dylib in Frameworks */,
- FA50634F141F99A70024E371 /* LinearMath.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -203,6 +230,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ FAE3A1B3154CA9E5007F33ED /* QuartzCore.framework in Frameworks */,
FA6B28AF1417DF4B00D54A65 /* Foundation.framework in Frameworks */,
FA506330141F996D0024E371 /* BulletDynamics.framework in Frameworks */,
FA50633C141F99A70024E371 /* BulletCollision.framework in Frameworks */,
@@ -214,6 +242,9 @@
FA50634A141F99A70024E371 /* libMiniCL.2.78.dylib in Frameworks */,
FA50634C141F99A70024E371 /* libMiniCL.dylib in Frameworks */,
FA50634E141F99A70024E371 /* LinearMath.framework in Frameworks */,
+ FA22FF7F15314A140084EF99 /* UIKit.framework in Frameworks */,
+ FA22FF8115314A2F0084EF99 /* CoreGraphics.framework in Frameworks */,
+ FA22FF8315314A3A0084EF99 /* OpenGLES.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -263,6 +294,8 @@
FA2B2B6F141C33A20021B94F /* Asteroids */ = {
isa = PBXGroup;
children = (
+ FA0736AB142AAC9700259971 /* Asteroid5.png */,
+ FA0736AC142AAC9700259971 /* Asteroid6.png */,
FA42F1881422D4F4000F17D9 /* Smiley.png */,
FA42F1861422CBDE000F17D9 /* Test2.png */,
FA505F53141EB74E0024E371 /* Test.png */,
@@ -290,6 +323,18 @@
FA6B289C1417D74800D54A65 = {
isa = PBXGroup;
children = (
+ FAE3A1AE154CA618007F33ED /* libMiniCL.2.78.dylib */,
+ FAE3A1AF154CA618007F33ED /* libMiniCL.dylib */,
+ FAE3A1AA154CA603007F33ED /* libBulletMultiThreaded.2.78.dylib */,
+ FAE3A1AB154CA603007F33ED /* libBulletMultiThreaded.dylib */,
+ FAE3A1A8154CA5CC007F33ED /* BulletSoftBodySolvers_CPU.framework */,
+ FAE3A1A6154CA5B4007F33ED /* BulletSoftBodySolvers_OpenCL_Mini.framework */,
+ FAE3A1A4154CA58D007F33ED /* LinearMath.framework */,
+ FAE3A1A2154CA57E007F33ED /* BulletSoftBody.framework */,
+ FAE3A1A0154CA574007F33ED /* BulletDynamics.framework */,
+ FAE3A19E154CA544007F33ED /* BulletCollision.framework */,
+ FAE3A198154CA50C007F33ED /* CoreFoundation.framework */,
+ FAE3A199154CA50C007F33ED /* CoreImage.framework */,
FA2B2B6E141C33A20021B94F /* examples */,
FA6B28A51417D91F00D54A65 /* src */,
FA6B28AD1417DF4B00D54A65 /* Frameworks */,
@@ -329,10 +374,10 @@
FA50633B141F99A70024E371 /* LinearMath.framework */,
FA50632F141F996D0024E371 /* BulletDynamics.framework */,
FA6B28AE1417DF4B00D54A65 /* Foundation.framework */,
- FA2B2B80141C35BA0021B94F /* UIKit.framework */,
- FA2B2B83141C35BA0021B94F /* CoreGraphics.framework */,
+ FA22FF7E15314A140084EF99 /* UIKit.framework */,
+ FA22FF8015314A2F0084EF99 /* CoreGraphics.framework */,
FA2B2B85141C35BA0021B94F /* QuartzCore.framework */,
- FA2B2B87141C35BA0021B94F /* OpenGLES.framework */,
+ FA22FF8215314A3A0084EF99 /* OpenGLES.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -340,6 +385,10 @@
FA6B28BC1417E29C00D54A65 /* Brick */ = {
isa = PBXGroup;
children = (
+ FAE3A1B4154CC178007F33ED /* Bitmap.cc */,
+ FAE3A1B5154CC179007F33ED /* Bitmap.h */,
+ FA0736A9142510B300259971 /* Event.h */,
+ FA0736A61425103B00259971 /* EventManager.cc */,
FA42F18A1423F893000F17D9 /* Animation.cc */,
FA42F18B1423F893000F17D9 /* Animation.h */,
FA2B2B4A141C2CEE0021B94F /* iOS */,
@@ -395,6 +444,8 @@
FA42F18D1423F893000F17D9 /* Animation.h in Headers */,
FA42F1911423F89D000F17D9 /* GLObject.h in Headers */,
FA42F19514240A0E000F17D9 /* GLSprite.h in Headers */,
+ FA0736AA142510B300259971 /* Event.h in Headers */,
+ FAE3A1B7154CC179007F33ED /* Bitmap.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -477,6 +528,8 @@
FA505F54141EB74E0024E371 /* Test.png in Resources */,
FA42F1871422CBDE000F17D9 /* Test2.png in Resources */,
FA42F1891422D4F4000F17D9 /* Smiley.png in Resources */,
+ FA0736AD142AAC9700259971 /* Asteroid5.png in Resources */,
+ FA0736AE142AAC9700259971 /* Asteroid6.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -487,7 +540,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- FA2B2BE2141C38390021B94F /* AppDelegate.mm in Sources */,
FA2B2BA8141C362C0021B94F /* main.mm in Sources */,
FA2B2C09141D7BDD0021B94F /* AsteroidsAdapter.cc in Sources */,
FA2B2C34141E59A70021B94F /* Asteroid.cc in Sources */,
@@ -515,6 +567,8 @@
FA42F18C1423F893000F17D9 /* Animation.cc in Sources */,
FA42F1901423F89D000F17D9 /* GLObject.cc in Sources */,
FA42F19414240A0E000F17D9 /* GLSprite.cc in Sources */,
+ FA0736A71425103B00259971 /* EventManager.cc in Sources */,
+ FAE3A1B6154CC179007F33ED /* Bitmap.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -533,32 +587,26 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletCollision\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletDynamics\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletSoftBody\"",
+ "\"$(SRCROOT)/vendor/bullet/src/LinearMath\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/CPU\"",
);
- 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;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletMultiThreaded\"",
+ "\"$(SRCROOT)/vendor/bullet/src/MiniCL\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
- TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -567,27 +615,26 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletCollision\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletDynamics\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletSoftBody\"",
+ "\"$(SRCROOT)/vendor/bullet/src/LinearMath\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletMultiThreaded/GpuSoftBodySolvers/CPU\"",
);
- 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;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
+ "\"$(SRCROOT)/vendor/bullet/src/BulletMultiThreaded\"",
+ "\"$(SRCROOT)/vendor/bullet/src/MiniCL\"",
);
- OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PRODUCT_NAME = "$(TARGET_NAME)";
- TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Release;
@@ -596,19 +643,24 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- CODE_SIGN_IDENTITY = "iPhone Developer";
- GCC_C_LANGUAGE_STANDARD = c99;
+ CODE_SIGN_IDENTITY = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = src/Brick/Prefix.pch;
- GCC_VERSION = com.apple.compilers.llvmgcc42;
+ "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1";
+ GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
src,
/opt/local/include,
/usr/local/include,
);
- PROVISIONING_PROFILE = "";
+ OTHER_CPLUSPLUSFLAGS = "";
+ OTHER_LDFLAGS = "-ObjC";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -617,19 +669,22 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- CODE_SIGN_IDENTITY = "iPhone Developer";
- GCC_C_LANGUAGE_STANDARD = c99;
- GCC_OPTIMIZATION_LEVEL = 3;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ CODE_SIGN_IDENTITY = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PREFIX_HEADER = src/Brick/Prefix.pch;
- GCC_VERSION = com.apple.compilers.llvmgcc42;
+ GCC_VERSION = "";
HEADER_SEARCH_PATHS = (
src,
/opt/local/include,
/usr/local/include,
);
- PROVISIONING_PROFILE = "";
+ "OTHER_CFLAGS[arch=*]" = "-DNS_BLOCK_ASSERTIONS=1";
+ OTHER_CPLUSPLUSFLAGS = "";
+ OTHER_LDFLAGS = "-ObjC";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
SDKROOT = iphoneos;
+ STRIP_INSTALLED_PRODUCT = NO;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@@ -644,13 +699,9 @@
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
+ "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks\"",
);
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -658,7 +709,6 @@
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
);
- OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
@@ -673,7 +723,9 @@
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
+ "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks\"",
);
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -681,7 +733,6 @@
"$(inherited)",
"\"$(SRCROOT)/../../../Library/Frameworks\"",
);
- OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
View
5 Rakefile
@@ -0,0 +1,5 @@
+# TODO
+cmake . -G "Unix Makefiles" -DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON \
+ -DFRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURES='i386;x86_64' \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/Library/Frameworks \
+ -DCMAKE_INSTALL_NAME_DIR=$HOME/Library/Frameworks -DBUILD_DEMOS:BOOL=OFF
View
85 examples/Asteroids/Asteroid.cc
@@ -1,19 +1,67 @@
#include "Asteroid.h"
-#include <boost/random/uniform_int_distribution.hpp>
+#include <BulletCollision/CollisionShapes/btConvex2dShape.h>
#include <Brick/Engine.h>
namespace Asteroids
{
- Asteroid::Asteroid() :
+ float random_within2(float start, float stop)
+ {
+ return start + (stop - start) * (((float) rand()) / RAND_MAX);
+ }
+
+ Asteroid::Asteroid(float a_size) :
Body()
{
- boost::random::uniform_int_distribution<> range(0, 100);
- //size = range(Engine::get()->get_random_generator()) / 100.0;
- size = 35;
- set_collision_shape(shared_ptr<btCollisionShape>(new btSphereShape(size)));
+ if (a_size != -1) {
+ size = a_size;
+ } else {
+ size = random_within2(0, 100);
+ }
+
+ btVector3 points[] = {
+ btVector3(0, 15, 0),
+ btVector3(7, 5, 0),
+ btVector3(22, 0, 0),
+ btVector3(57, 2, 0),
+ btVector3(66, 7, 0),
+ btVector3(74, 20, 0),
+ btVector3(74, 38, 0),
+ btVector3(66, 47, 0),
+ btVector3(50, 53, 0),
+ btVector3(35, 51, 0),
+ btVector3(15, 41, 0),
+ btVector3(4, 27, 0)
+ };
+ float mid_point_x = 75 / 2.0;
+ float mid_point_y = 55 / 2.0;
+ btConvexHullShape* hull = new btConvexHullShape();
+ for (int i = 0; i < 12; i++) {
+ points[i].setX(points[i].getX() - mid_point_x);
+ points[i].setY(points[i].getY() - mid_point_y);
+ hull->addPoint(points[i]);
+ }
+
+ //btConvex2dShape* shape = new btConvex2dShape(hull);
+ //shape->setMargin(1);
+ btCollisionShape* shape = new btSphereShape(45);
+
+ btScalar mass = 1.0;
+ btVector3 inertia(0, 0, 0);
+ shape->calculateLocalInertia(mass, inertia);
+
+ btDefaultMotionState* motion_state = new btDefaultMotionState();
+
+ btRigidBody::btRigidBodyConstructionInfo rigid_body_info(
+ mass, motion_state, shape, inertia);
+ btRigidBody* rigid_body = new btRigidBody(rigid_body_info);
+ //rigid_body->setDamping(0, 0.3);
+
+ bt_rigid_body = shared_ptr<btRigidBody>(rigid_body);
+
+ n = 100 + 500 * (rand() / RAND_MAX);
}
float Asteroid::get_size()
@@ -24,6 +72,31 @@ namespace Asteroids
void Asteroid::iterate()
{
Body::iterate();
+ n--;
+ if (n <= 0) {
+ split();
+ n = 100 + 100 * (rand() / RAND_MAX);
+ }
+ }
+
+ void Asteroid::split()
+ {
+ shared_ptr<Entity> parent = get_parent();
+ remove();
+
+ int piece_count = random_within2(2, 3);
+ float piece_size = size / piece_count;
+ if (piece_size > 0.1) {
+ printf("split into %d pieces of size %f\n", piece_count, piece_size);
+ while (piece_count > 0) {
+ printf("create 1 piece (%f)\n", piece_size);
+ shared_ptr<Asteroid> piece = shared_ptr<Asteroid>(new Asteroid(piece_size));
+ parent->add_child(piece);
+ piece_count--;
+ }
+ } else {
+ printf("no more pieces\n");
+ }
}
}
View
6 examples/Asteroids/Asteroid.h
@@ -1,6 +1,8 @@
#ifndef _ASTEROIDS_ASTEROID_H
#define _ASTEROIDS_ASTEROID_H
+#include <BulletDynamics/btBulletDynamicsCommon.h>
+
#include "Brick/Body.h"
namespace Asteroids
@@ -11,11 +13,13 @@ namespace Asteroids
class Asteroid : public Body
{
public:
- Asteroid();
+ Asteroid(float a_size = -1);
void iterate();
float get_size();
+ void split();
protected:
float size;
+ int n;
};
}
View
BIN  examples/Asteroids/Asteroid1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece13.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece14.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece15.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece17.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_piece8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid1_pieces.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  examples/Asteroids/Asteroid6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
10 examples/Asteroids/AsteroidAnimator.cc
@@ -8,7 +8,7 @@ namespace Asteroids
AsteroidAnimator::AsteroidAnimator() :
asteroid()
- {
+ {
}
void AsteroidAnimator::map(Animation& animation, shared_ptr<Entity> entity)
@@ -17,8 +17,9 @@ namespace Asteroids
asteroid = shared_ptr<Asteroid>(dynamic_cast<Asteroid*>(&(*entity)));
+ float size = asteroid->get_size();
asteroid_sprite = shared_ptr<GLSprite>(new GLSprite(
- sprite_name_from_size(asteroid->get_size())));
+ sprite_name_from_size(size)));
asteroid_sprite->set_world_transform(asteroid->get_world_transform());
renderer->add_object(asteroid_sprite);
}
@@ -36,10 +37,11 @@ namespace Asteroids
string AsteroidAnimator::sprite_name_from_size(float size)
{
- int num_asteroid_sprites = 4;
+ int num_asteroid_sprites = 6;
std::stringstream buffer;
buffer << "Asteroid";
- buffer << floor(1 + (size / 50 * (num_asteroid_sprites - 1)));
+ buffer << floor(1 + num_asteroid_sprites - (size * (num_asteroid_sprites - 1)));
+ printf("asteroid size %f => %s\n", size, buffer.str().c_str());
return buffer.str();
}
View
3  examples/Asteroids/AsteroidAnimator.h
@@ -35,7 +35,8 @@ namespace Asteroids
private:
shared_ptr<Asteroid> asteroid;
shared_ptr<GLSprite> asteroid_sprite;
-
+ shared_ptr<btCollisionShape> asteroid_shape;
+
string sprite_name_from_size(float size);
};
View
48 examples/Asteroids/AsteroidsAdapter.cc
@@ -15,7 +15,8 @@ namespace Asteroids
}
AsteroidsAdapter::AsteroidsAdapter() :
- engine()
+ engine(),
+ n(0)
{
}
@@ -31,21 +32,46 @@ namespace Asteroids
engine->get_animation()->set_world(engine->get_world());
engine->get_world()->set_gravity(btVector3(0, 0, 0));
+ }
+ void AsteroidsAdapter::on_started()
+ {
Space* space = new Space();
engine->get_world()->set_root(shared_ptr<Entity>(space));
- srand(clock());
- for (int i = 0; i < 30; i++) {
- Asteroid* asteroid = new Asteroid();
- shared_ptr<btDefaultMotionState> motion = shared_ptr<btDefaultMotionState>(
- new btDefaultMotionState(
- btTransform(
- btQuaternion(0, 0, 0, 1),
- btVector3(random_within(-400, 400), random_within(-500, 500), 0))));
- asteroid->set_motion_state(motion);
- space->add_child(shared_ptr<Entity>(asteroid));
+ srand(1234);
+ for (int i = 0; i < 1; i++) {
+ add_asteroid();
+ }
+ }
+
+ void AsteroidsAdapter::on_iterate()
+ {
+ /*
+ n++;
+ if (n > 30) {
+ n = 0;
+ add_asteroid();
}
+ */
+ }
+
+ void AsteroidsAdapter::add_asteroid()
+ {
+ printf("add_asteroid\n");
+
+ Asteroid* asteroid = new Asteroid();
+ shared_ptr<btRigidBody> rigid_body = asteroid->get_bt_rigid_body();
+ /*
+ rigid_body->proceedToTransform(
+ btTransform(
+ btQuaternion(0, 0, 0, 1),
+ btVector3(random_within(-200, 200), random_within(-200, 200), 0)));
+ */
+ rigid_body->applyImpulse(
+ btVector3(random_within(-15, 15), random_within(-15, 15), 0),
+ btVector3(0, 0, 0));
+ Engine::get()->get_world()->get_root()->add_child(shared_ptr<Entity>(asteroid));
}
shared_ptr<Engine> AsteroidsAdapter::get_engine()
View
8 examples/Asteroids/AsteroidsAdapter.h
@@ -15,11 +15,17 @@ namespace Asteroids
{
public:
AsteroidsAdapter();
- void on_startup();
shared_ptr<Engine> get_engine();
+ // From ShellAdapter
+ void on_startup();
+ void on_started();
+ void on_iterate();
+
private:
shared_ptr<Engine> engine;
+ int n;
+ void add_asteroid();
};
}
View
BIN  examples/Asteroids/Test2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
89 src/Brick/Animation.cc
@@ -40,10 +40,11 @@ namespace Brick
// TODO
}
world = a_world;
- if (world && world->get_root()) {
- add_entities_recursively(world->get_root());
- world->get_root()->listen("child_added", this, &Animation::on_child_added);
- world->get_root()->listen("child_removed", this, &Animation::on_child_removed);
+ if (world) {
+ Engine::get()->get_event_manager()->listen(world, "changed", shared_from_this(), &Animation::on_world_changed);
+ if (world->get_root()) {
+ register_entity(world->get_root());
+ }
}
}
@@ -109,31 +110,25 @@ namespace Brick
animator_factories[entity_type] = function;
}
- void Animation::on_child_added(Event* event)
+ void Animation::on_child_added(ChildAddedEvent* event)
{
- printf("animation: on_child_added\n");
- ChildAddedEvent* actual = reinterpret_cast<ChildAddedEvent*>(event);
- if (actual) {
- shared_ptr<Entity> entity = actual->entity;
- add_entities_recursively(entity);
- }
+ register_entity(event->entity);
}
- void Animation::on_child_removed(Event* event)
+ void Animation::on_child_removed(ChildRemovedEvent* event)
{
- // TODO
+ unregister_entity(event->entity);
}
void Animation::on_world_changed(Event* event)
{
- printf("on_world_changed\n");
- add_entities_recursively(world->get_root());
+ register_entity(world->get_root());
}
void Animation::do_start()
{
if (world) {
- add_entities_recursively(world->get_root());
+ register_entity(world->get_root());
}
if (renderer) {
renderer->start();
@@ -147,19 +142,59 @@ namespace Brick
}
}
- void Animation::add_entities_recursively(shared_ptr<Entity> entity)
+ void Animation::register_entity(shared_ptr<Entity> entity)
{
- entity->listen("child_added", this, &Animation::on_child_added);
- entity->listen("child_removed", this, &Animation::on_child_removed);
+ if (entity) {
+ if (known_entities.insert(entity).second) {
+ printf("[animation] register_entity: %s\n", typeid(*entity.get()).name());
- shared_ptr<Animator> animator = get_animator_for_entity(entity);
-
- const vector<shared_ptr<Entity> >& children = entity->get_children();
- vector<shared_ptr<Entity> >::const_iterator i = children.begin();
- vector<shared_ptr<Entity> >::const_iterator end = children.end();
- while (i != end) {
- add_entities_recursively(*i);
- i++;
+ Engine::get()->get_event_manager()->listen(entity, "child_added", shared_from_this(), &Animation::on_child_added);
+ Engine::get()->get_event_manager()->listen(entity, "child_removed", shared_from_this(), &Animation::on_child_removed);
+
+ // Force animator to be created
+ shared_ptr<Animator> animator = get_animator_for_entity(entity);
+
+ const vector<shared_ptr<Entity> >& children = entity->get_children();
+ vector<shared_ptr<Entity> >::const_iterator i = children.begin();
+ vector<shared_ptr<Entity> >::const_iterator end = children.end();
+ while (i != end) {
+ register_entity(*i);
+ i++;
+ }
+ } else {
+ printf("[animation] entity already known: %s\n", typeid(*entity.get()).name());
+ }
+ }
+ }
+
+ void Animation::unregister_entity(shared_ptr<Entity> entity)
+ {
+ if (entity) {
+ if (known_entities.find(entity) != known_entities.end()) {
+ printf("[animation] unregister_entity: %s\n", typeid(*entity.get()).name());
+
+ //Engine::get()->get_event_manager()->listen(entity, "child_added", shared_from_this(), &Animation::on_child_added);
+ //Engine::get()->get_event_manager()->listen(entity, "child_removed", shared_from_this(), &Animation::on_child_removed);
+
+ const vector<shared_ptr<Entity> >& children = entity->get_children();
+ vector<shared_ptr<Entity> >::const_iterator i = children.begin();
+ vector<shared_ptr<Entity> >::const_iterator end = children.end();
+ while (i != end) {
+ unregister_entity(*i);
+ i++;
+ }
+
+ shared_ptr<Animator> animator = entities_to_animators[entity];
+ if (animator) {
+ animator->unmap(*this, entity);
+ }
+ entities_to_animators.erase(entity);
+ known_entities.erase(entity);
+
+ printf("[animation] now has %d entities\n", (int) entities_to_animators.size());
+ } else {
+ printf("[animation] entity not known: %s\n", typeid(*entity.get()).name());
+ }
}
}
View
19 src/Brick/Animation.h
@@ -1,15 +1,18 @@
-#ifndef _BRICK_SCENE_H
-#define _BRICK_SCENE_H
+#ifndef _BRICK_ANIMATION_H
+#define _BRICK_ANIMATION_H
#include <tr1/unordered_map>
+
#include <string>
#include <typeinfo>
+#include <set>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include "Brick/Runnable.h"
#include "Brick/World.h"
+#include "Brick/Event.h"
namespace Brick
{
@@ -18,11 +21,15 @@ namespace Brick
using boost::enable_shared_from_this;
using std::tr1::unordered_map;
using std::type_info;
+ using std::set;
class AnimatorFactory;
class Animator;
class Renderer;
class Entity;
+ class World;
+ class ChildAddedEvent;
+ class ChildRemovedEvent;
/**
* Hash function for shared_ptr<Entity>.
@@ -70,11 +77,12 @@ namespace Brick
AnimatorFactoryFunction function);
protected:
- void on_child_added(Event* event);
- void on_child_removed(Event* event);
+ void on_child_added(ChildAddedEvent* event);
+ void on_child_removed(ChildRemovedEvent* event);
void on_world_changed(Event* event);
- void add_entities_recursively(shared_ptr<Entity> entity);
+ void register_entity(shared_ptr<Entity> entity);
+ void unregister_entity(shared_ptr<Entity> entity);
// Runnable overrides
void do_start();
@@ -83,6 +91,7 @@ namespace Brick
private:
shared_ptr<Renderer> renderer;
shared_ptr<World> world;
+ set<shared_ptr<Entity> > known_entities;
unordered_map<const type_info*, AnimatorFactoryFunction> animator_factories;
unordered_map<shared_ptr<Entity>, shared_ptr<Animator>, EntityKeyHash> entities_to_animators;
};
View
33 src/Brick/Bitmap.cc
@@ -0,0 +1,33 @@
+#include "Brick/Bitmap.h"
+
+namespace Brick
+{
+
+ Bitmap::Bitmap(unsigned a_width, unsigned a_height, void* a_data) :
+ width(a_width),
+ height(a_height),
+ data(a_data)
+ {
+ }
+
+ Bitmap::~Bitmap()
+ {
+ free(data);
+ }
+
+ unsigned Bitmap::get_width() const
+ {
+ return width;
+ }
+
+ unsigned Bitmap::get_height() const
+ {
+ return height;
+ }
+
+ void* Bitmap::get_data() const
+ {
+ return data;
+ }
+
+}
View
31 src/Brick/Bitmap.h
@@ -0,0 +1,31 @@
+#ifndef _BRICK_BITMAP
+#define _BRICK_BITMAP
+
+#include <string>
+#include <boost/shared_ptr.hpp>
+
+namespace Brick
+{
+
+ using std::string;
+ using boost::shared_ptr;
+
+ class Bitmap
+ {
+ public:
+ Bitmap(unsigned a_width, unsigned a_height, void* a_data);
+ virtual ~Bitmap();
+
+ unsigned get_width() const;
+ unsigned get_height() const;
+ void* get_data() const;
+
+ private:
+ unsigned width;
+ unsigned height;
+ void* data;
+ };
+
+}
+
+#endif
View
30 src/Brick/Body.cc
@@ -5,37 +5,23 @@ namespace Brick
{
Body::Body() :
- Entity(),
- motion_state(shared_ptr<btDefaultMotionState>(
- new btDefaultMotionState(
- btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, 0, 0)))))
+ Entity()
{
}
- shared_ptr<btDefaultMotionState> Body::get_motion_state()
+ shared_ptr<btRigidBody> Body::get_bt_rigid_body()
{
- return motion_state;
- }
-
- void Body::set_motion_state(shared_ptr<btDefaultMotionState> a_motion_state)
- {
- motion_state = a_motion_state;
- }
-
- shared_ptr<btCollisionShape> Body::get_collision_shape()
- {
- return collision_shape;
- }
-
- void Body::set_collision_shape(shared_ptr<btCollisionShape> a_collision_shape)
- {
- collision_shape = a_collision_shape;
+ return bt_rigid_body;
}
btTransform Body::get_world_transform()
{
btTransform transform;
- motion_state->getWorldTransform(transform);
+ if (bt_rigid_body) {
+ bt_rigid_body->getMotionState()->getWorldTransform(transform);
+ } else {
+ transform.setIdentity();
+ }
return transform;
}
View
9 src/Brick/Body.h
@@ -15,11 +15,7 @@ namespace Brick
public:
Body();
- shared_ptr<btDefaultMotionState> get_motion_state();
- void set_motion_state(shared_ptr<btDefaultMotionState> a_motion_state);
-
- shared_ptr<btCollisionShape> get_collision_shape();
- void set_collision_shape(shared_ptr<btCollisionShape> a_collision_shape);
+ shared_ptr<btRigidBody> get_bt_rigid_body();
btTransform get_world_transform();
@@ -27,8 +23,7 @@ namespace Brick
void iterate();
protected:
- shared_ptr<btDefaultMotionState> motion_state;
- shared_ptr<btCollisionShape> collision_shape;
+ shared_ptr<btRigidBody> bt_rigid_body;
};
}
View
2  src/Brick/Brick.h
@@ -3,7 +3,9 @@
#include <Brick/Animator.h>
#include "Brick/Animation.h"
#include "Brick/Renderer.h"
+#include "Brick/Event.h"
#include "Brick/Eventable.h"
+#include "Brick/EventManager.h"
#include "Brick/Engine.h"
#include "Brick/Entity.h"
#include "Brick/Body.h"
View
19 src/Brick/Engine.cc
@@ -5,14 +5,16 @@ namespace Brick
shared_ptr<Engine> Engine::current_engine = shared_ptr<Engine>();
- Engine::Engine() :
- random_generator()
+ Engine::Engine()
{
}
void Engine::init()
{
check_not_started();
+
+ //random_generator.seed(static_cast<unsigned int>(std::time(0)));
+
if (!world) {
world = shared_ptr<World>(new World());
world->init();
@@ -22,6 +24,8 @@ namespace Brick
animation = shared_ptr<Animation>(new Animation());
animation->init();
}
+
+ event_manager = shared_ptr<EventManager>(new EventManager());
}
void Engine::teardown()
@@ -54,6 +58,7 @@ namespace Brick
{
check_started();
world->iterate();
+ event_manager->process();
animation->iterate();
}
@@ -63,11 +68,6 @@ namespace Brick
animation->render();
}
- mt19937& Engine::get_random_generator()
- {
- return random_generator;
- }
-
shared_ptr<World> Engine::get_world()
{
return world;
@@ -83,6 +83,11 @@ namespace Brick
return resource_loader;
}
+ shared_ptr<EventManager> Engine::get_event_manager()
+ {
+ return event_manager;
+ }
+
void Engine::set_resource_loader(shared_ptr<ResourceLoader> a_resource_loader)
{
resource_loader = a_resource_loader;
View
13 src/Brick/Engine.h
@@ -2,20 +2,23 @@
#define _BRICK_ENGINE_H
#include <boost/shared_ptr.hpp>
-#include <boost/tr1/random.hpp>
+#include <tr1/random>
#include "Brick/Animation.h"
#include "Brick/Entity.h"
#include "Brick/World.h"
#include "Brick/ResourceLoader.h"
#include "Brick/Runnable.h"
+#include "Brick/EventManager.h"
namespace Brick
{
using boost::shared_ptr;
- using std::tr1::mt19937;
+ class Animation;
+ class EventManager;
+
/**
* An engine ties together everything in one place: screen graph, world model,
* resource management, etc.
@@ -30,8 +33,6 @@ namespace Brick
void render();
void iterate();
- mt19937& get_random_generator();
-
shared_ptr<World> get_world();
shared_ptr<Animation> get_animation();
@@ -39,6 +40,8 @@ namespace Brick
shared_ptr<ResourceLoader> get_resource_loader();
void set_resource_loader(shared_ptr<ResourceLoader> a_resource_loader);
+ shared_ptr<EventManager> get_event_manager();
+
static shared_ptr<Engine> get();
protected:
@@ -46,7 +49,7 @@ namespace Brick
shared_ptr<World> world;
shared_ptr<Animation> animation;
shared_ptr<ResourceLoader> resource_loader;
- mt19937 random_generator;
+ shared_ptr<EventManager> event_manager;
void iterate_entity(shared_ptr<Entity> entity);
View
30 src/Brick/Entity.cc
@@ -8,6 +8,11 @@ namespace Brick
{
}
+ Entity::~Entity()
+ {
+ printf("Entity dtor!\n");
+ }
+
void Entity::iterate()
{
// Does nothing, descendants implement
@@ -32,29 +37,42 @@ namespace Brick
entity->set_parent(this_shared);
children.push_back(entity);
- ChildAddedEvent event(entity);
- trigger("child_added", &event);
+ Engine::get()->get_event_manager()->send(this_shared, "child_added",
+ new ChildAddedEvent(entity));
}
void Entity::remove_child(shared_ptr<Entity> entity)
{
- if (entity.get() == this) {
+ if (entity->get_parent().get() != this) {
throw new InvalidEntityStructure;
}
+ entity->set_parent(shared_ptr<Entity>());
+ Engine::get()->get_event_manager()->send(shared_from_this(), "child_removed",
+ new ChildRemovedEvent(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);
- ChildRemovedEvent event(entity);
- trigger("child_removed", &event);
break;
}
+ }
+ }
+
+ void Entity::remove()
+ {
+ if (parent) {
+ parent->remove_child(shared_from_this());
}
}
+ shared_ptr<Entity> Entity::get_parent()
+ {
+ return parent;
+ }
+
void Entity::set_parent(shared_ptr<Entity> a_parent)
{
- if (parent && parent != a_parent) {
+ if (parent && a_parent && parent != a_parent) {
throw new InvalidEntityStructure;
}
parent = a_parent;
View
6 src/Brick/Entity.h
@@ -7,6 +7,7 @@
#include <boost/enable_shared_from_this.hpp>
#include "Brick/Eventable.h"
+#include "Brick/Engine.h"
namespace Brick
{
@@ -48,16 +49,19 @@ namespace Brick
* model easily. Semantic graph nodes may also be added that modify the
* evaluation and iteration of the world model.
*/
- class Entity : public Eventable, public enable_shared_from_this<Entity>
+ class Entity : public enable_shared_from_this<Entity>
{
public:
Entity();
+ virtual ~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);
+ void remove();
+ shared_ptr<Entity> get_parent();
shared_ptr<World> get_world();
View
13 src/Brick/Event.h
@@ -0,0 +1,13 @@
+#ifndef _BRICK_EVENT_H
+#define _BRICK_EVENT_H
+
+namespace Brick
+{
+
+ struct Event
+ {
+ };
+
+}
+
+#endif
View
52 src/Brick/EventManager.cc
@@ -0,0 +1,52 @@
+#include "Brick/EventManager.h"
+
+#include <algorithm>
+
+namespace Brick
+{
+
+ EventManager::EventManager() :
+ highest_queued_event_id(0),
+ current_entries(),
+ pending_entries(),
+ current_events(new queue<QueuedEvent*>),
+ pending_events(new queue<QueuedEvent*>)
+ {
+ }
+
+ void EventManager::process()
+ {
+ // Move pending entries into current list
+ if (!pending_entries.empty()) {
+ current_entries.merge(pending_entries);
+ pending_entries.clear();
+ }
+
+ // Switch queues by switching the pointer
+ if (pending_events->size() > 0) {
+ queue<QueuedEvent*>* queue = pending_events;
+ pending_events = current_events;
+ current_events = queue;
+
+ while (queue->size() > 0) {
+ QueuedEvent* queued_event = queue->front();
+ if (queued_event) {
+ printf("[eventmgr] queue: processing one event, size now=%d\n", (int) queue->size());
+ queue->pop();
+ list<ListenerEntry*>::const_iterator i = current_entries.begin();
+ list<ListenerEntry*>::const_iterator end = current_entries.end();
+ while (i != end) {
+ ListenerEntry* entry = *i;
+ entry->dispatch(queued_event);
+ i++;
+ }
+ delete queued_event;
+ } else {
+ break;
+ }
+ }
+ printf("[eventmgr] queue done, there are %d future events\n", (int) pending_events->size());
+ }
+ }
+
+}
View
254 src/Brick/EventManager.h
@@ -1,8 +1,258 @@
-#ifndef _BRICK_EVENT_MANAGER
-#define _BRICK_EVENT_MANAGER
+#ifndef _BRICK_EVENT_MANAGER_H
+#define _BRICK_EVENT_MANAGER_H
+
+#include <string>
+#include <list>
+#include <queue>
+
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/ref.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "Brick/Engine.h"
+#include "Brick/Event.h"
namespace Brick
{
+
+ using std::tr1::unordered_map;
+ using std::string;
+ using std::list;
+ using std::queue;
+ using boost::shared_ptr;
+ using boost::function1;
+
+ /**
+ * Hash function for shared_ptr<void*>.
+ */
+ typedef struct
+ {
+ size_t operator()(const shared_ptr<void*>& key) const
+ {
+ return reinterpret_cast<size_t>(key.get());
+ }
+ } VoidKeyHash;
+
+ /**
+ * Abstract base class for queued events.
+ */
+ struct QueuedEvent
+ {
+ virtual ~QueuedEvent()
+ {
+ }
+ };
+
+ /**
+ * Typed queued event.
+ */
+ template <class ProducerClass, class EventClass>
+ struct TypedQueuedEvent : public QueuedEvent
+ {
+ string event_name;
+ shared_ptr<ProducerClass> producer;
+ EventClass* event;
+ unsigned long id;
+
+ TypedQueuedEvent(
+ unsigned long an_id,
+ shared_ptr<ProducerClass> a_producer,
+ string an_event_name,
+ EventClass* an_event
+ ) :
+ id(an_id),
+ producer(a_producer),
+ event_name(an_event_name),
+ event(an_event)
+ {
+ }
+
+ ~TypedQueuedEvent()
+ {
+ delete event;
+ }
+ };
+
+ /**
+ * Abstract base class for listener entries.
+ */
+ struct ListenerEntry
+ {
+ /**
+ * Dispatch an event.
+ */
+ virtual void dispatch(QueuedEvent* event) = 0;
+
+ /**
+ * Compare this entry to another.
+ */
+ virtual bool equals(const ListenerEntry* other) = 0;
+ };
+
+ /**
+ * Typed listener entry used by event manager to register listeners.
+ */
+ template <class ProducerClass, class ListenerClass, class EventClass>
+ struct TypedListenerEntry : public ListenerEntry
+ {
+ string event_name;
+ shared_ptr<ProducerClass> producer;
+ shared_ptr<ListenerClass> listener;
+ void (ListenerClass::*member_function)(EventClass* event);
+
+ /**
+ * Initialize entry.
+ */
+ TypedListenerEntry(
+ shared_ptr<ProducerClass> a_producer,
+ string an_event_name,
+ shared_ptr<ListenerClass> a_listener,
+ void (ListenerClass::*a_member_function)(EventClass* event)
+ ) :
+ producer(a_producer),
+ event_name(an_event_name),
+ listener(a_listener),
+ member_function(a_member_function)
+ {
+ }
+
+ void dispatch(QueuedEvent* queued_event)
+ {
+ TypedQueuedEvent<ProducerClass, EventClass>* typed_queued_event =
+ dynamic_cast<TypedQueuedEvent<ProducerClass, EventClass>*>(queued_event);
+ if (typed_queued_event &&
+ typed_queued_event->producer == producer &&
+ typed_queued_event->event_name == event_name
+ ) {
+ EventClass* event = typed_queued_event->event;
+ printf("[eventmgr] dispatching #%ld <%s> from %s to %s\n",
+ typed_queued_event->id,
+ event_name.c_str(),
+ typeid(*producer.get()).name(),
+ typeid(*listener.get()).name());
+ (listener.get()->*member_function)(event);
+ }
+ }
+
+ bool equals(const ListenerEntry* other)
+ {
+ const TypedListenerEntry* typed_other =
+ dynamic_cast<const TypedListenerEntry*>(other);
+ return typed_other
+ && typed_other->listener.get() == listener.get()
+ && typed_other->member_function == member_function
+ && typed_other->event_name == event_name;
+ }
+ };
+
+ class EventManager
+ {
+ public:
+ EventManager();
+
+ /**
+ * Send an event to all current listeners.
+ */
+ template <class ProducerClass, class EventClass>
+ void send(
+ shared_ptr<ProducerClass> producer,
+ const string& event_name,
+ EventClass* event = 0);
+
+ /**
+ * Listen to an event.
+ */
+ template <class ProducerClass, class ListenerClass, class EventClass>
+ void listen(
+ shared_ptr<ProducerClass> producer,
+ const string& event_name,
+ shared_ptr<ListenerClass> listener,
+ void (ListenerClass::*member_function)(EventClass* event));
+
+ /**
+ * Stop listening to an event.
+ */
+ template <class ProducerClass, class ListenerClass>
+ void unlisten(
+ shared_ptr<ProducerClass> producer,
+ shared_ptr<ListenerClass> listener);
+
+ /**
+ * Process pending events.
+ */
+ void process();
+
+ protected:
+ unsigned long highest_queued_event_id;
+
+ list<ListenerEntry*> current_entries;
+ list<ListenerEntry*> pending_entries;
+
+ queue<QueuedEvent*>* current_events;
+ queue<QueuedEvent*>* pending_events;
+ };
+
+ template <class ProducerClass, class EventClass>
+ void EventManager::send(
+ shared_ptr<ProducerClass> producer,
+ const string& event_name,
+ EventClass* event)
+ {
+ unsigned long id = ++highest_queued_event_id;
+
+ TypedQueuedEvent<ProducerClass, EventClass>* queued_event =
+ new TypedQueuedEvent<ProducerClass, EventClass>(id, producer, event_name, event);
+ pending_events->push(queued_event);
+ printf("[eventmgr] sent <%s> from %s (#%ld, queue now has %d events)\n",
+ event_name.c_str(),
+ typeid(*producer.get()).name(),
+ id,
+ (int) pending_events->size());
+ }
+
+ template <class ProducerClass, class ListenerClass, class EventClass>
+ void EventManager::listen(
+ shared_ptr<ProducerClass> producer,
+ const string& event_name,
+ shared_ptr<ListenerClass> listener,
+ void (ListenerClass::*member_function)(EventClass* event))
+ {
+ printf("[eventmgr] listen for <%s> on %s by %s\n",
+ event_name.c_str(),
+ typeid(*producer.get()).name(),
+ typeid(*listener.get()).name());
+ TypedListenerEntry<ProducerClass, ListenerClass, EventClass>* entry =
+ new TypedListenerEntry<ProducerClass, ListenerClass, EventClass>(
+ producer,
+ event_name,
+ listener,
+ member_function);
+ pending_entries.push_back(entry);
+ }
+
+ template <class ProducerClass, class ListenerClass>
+ void EventManager::unlisten(
+ shared_ptr<ProducerClass> producer,
+ shared_ptr<ListenerClass> listener)
+ {
+ /*
+ unordered_map<string, vector<EventListenerEntry*> > entry_map = listeners[producer];
+
+ unordered_map<string, vector<EventListenerEntry*> >::const_iterator i = listeners.begin();
+ unordered_map<string, vector<EventListenerEntry*> >::const_iterator end = listeners.end();
+ while (i != end) {
+ vector<EventListenerEntry*>& entries = *i;
+ for (vector<EventListenerEntry*>::const_iterator j = entries.begin(); j != entries.end(); j++) {
+ EventListenerEntry* entry = *j;
+ if (entry->listener == listener) {
+ //entries.erase(j);
+ }
+ }
+ i++;
+ }
+ */
+ }
}
View
20 src/Brick/Eventable.cc
@@ -1,27 +1,19 @@
#include "Brick/Eventable.h"
+#include "Brick/Engine.h"
+#include "Brick/EventManager.h"
namespace Brick
{
- Eventable::Eventable() :
- listeners()
+ Eventable::Eventable()
{
}
- void Eventable::trigger(const string& event_name)
- {
- trigger(event_name, 0);
- }
-
+ /*
void Eventable::trigger(const string& event_name, Event* event)
{
- vector<function1<void, Event*> >& handlers = listeners[event_name];
- vector<function1<void, Event*> >::const_iterator i = handlers.begin();
- vector<function1<void, Event*> >::const_iterator end = handlers.end();
- while (i != end) {
- (*i)(event);
- i++;
- }
+ //Engine::get()->get_event_manager()->send(shared_from_this(), event_name, event);
}
+ */
}
View
75 src/Brick/Eventable.h
@@ -4,74 +4,53 @@
#include <string>
#include <vector>
-#include <boost/function.hpp>
-#include <boost/bind.hpp>
-#include <boost/ref.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+#include "Brick/Event.h"
namespace Brick
{
- using std::tr1::unordered_map;
using std::string;
- using std::vector;
- using boost::function1;
-
- struct Event
- {
- };
+ using boost::shared_ptr;
+ using boost::enable_shared_from_this;
class Eventable
{
public:
Eventable();
- /**
- * Triggers an event, calling all current listeners.
- */
- void trigger(const string& event_name);
-
- /**
- * Triggers an event, calling all current listeners.
- */
- void trigger(const string& event_name, Event* event);
+ //void trigger(const string& event_name, Event* event = 0);
- /**
- * Listen to an event on this object. The listener 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 listen(const string& event_name, T* instance, void (T::*handler)(Event* event));
+ /*
+ template <class Listener>
+ void listen(
+ const string& event_name,
+ Listener* instance,
+ void (Listener::*handler)(Event* event));
- template <class T>
- void unlisten(T* instance);
-
- protected:
- unordered_map<string,
- vector<function1<void, Event*> > > listeners;
+ template <class Listener>
+ void unlisten(Listener* instance);
+ */
};
- template <class T>
- void Eventable::listen(const string& event_name, T* instance, void (T::*handler)(Event* event))
+ /*
+ template <class Listener>
+ void Eventable::listen(
+ const string& event_name,
+ Listener* instance,
+ void (Listener::*handler)(Event* event))
{
- // We are so lucky that C++ allows us to put implementation code in header
- // files. Thanks for that, Bjarne.
- function1<void, Event*> function = boost::bind(handler, instance, _1);
- listeners[event_name].push_back(function);
+ Engine::get()->get_event_manager()->listen(this, event_name, instance, handler);
}
- template <class T>
- void Eventable::unlisten(T* instance)
+ template <class Listener>
+ void Eventable::unlisten(Listener* instance)
{
- unordered_map<string, vector<function1<void, Event*> > >::const_iterator i = listeners.begin();
- unordered_map<string, vector<function1<void, Event*> > >::const_iterator end = listeners.end();
- while (i != end) {
- // TODO
- i++;
- }
+ Engine::get()->get_event_manager()->unlisten(this, instance);
}
+ */
}
View
6 src/Brick/OpenGL/GLSprite.cc
@@ -10,9 +10,9 @@ namespace Brick
{
shared_ptr<Bitmap> bitmap = Engine::get()->get_resource_loader()->get_bitmap(name);
- width = bitmap->width;
- height = bitmap->height;
- data = static_cast<GLubyte*>(bitmap->data);
+ width = bitmap->get_width();
+ height = bitmap->get_height();
+ data = static_cast<GLubyte*>(bitmap->get_data());
glGenTextures(1, &texture_id);
glBindTexture(GL_TEXTURE_2D, texture_id);
View
4 src/Brick/OpenGL/GLSprite.h
@@ -1,5 +1,5 @@
-#ifndef _BRICK_OPENGL_SPRITE_SCENE_NODE_H
-#define _BRICK_OPENGL_SPRITE_SCENE_NODE_H
+#ifndef _BRICK_OPENGL_GLSPRITE_H
+#define _BRICK_OPENGL_GLSPRITE_H
#include <string>
View
2  src/Brick/Prefix.pch
@@ -17,6 +17,8 @@
#ifdef __cplusplus
#include <tr1/unordered_map>
#include <string>
+ #include <vector>
+ #include <list>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
View
9 src/Brick/ResourceLoader.h
@@ -4,19 +4,14 @@
#include <string>
#include <boost/shared_ptr.hpp>
+#include "Brick/Bitmap.h"
+
namespace Brick
{
using std::string;
using boost::shared_ptr;
- typedef struct
- {
- unsigned width;
- unsigned height;
- void* data;
- } Bitmap;
-
class ResourceNotFound
{
public:
View
93 src/Brick/World.cc
@@ -4,11 +4,18 @@
#include "Brick/Animator.h"
#include "Brick/Body.h"
+#include <BulletCollision/btBulletCollisionCommon.h>
+#include <BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h>
+#include <BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h>
+#include <BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h>
+#include <BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h>
+
namespace Brick
{
World::World() :
- frame_rate(30)
+ frame_rate(30),
+ object_count(0)
{
}
@@ -25,6 +32,16 @@ namespace Brick
solver.get(),
collision_configuration.get()));
+ btVoronoiSimplexSolver* simplex_solver = new btVoronoiSimplexSolver();
+ btMinkowskiPenetrationDepthSolver* pd_solver = new btMinkowskiPenetrationDepthSolver();
+ btConvex2dConvex2dAlgorithm::CreateFunc* convex_algo_2d =
+ new btConvex2dConvex2dAlgorithm::CreateFunc(simplex_solver, pd_solver);
+ collision_dispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE, CONVEX_2D_SHAPE_PROXYTYPE, convex_algo_2d);
+ collision_dispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE, CONVEX_2D_SHAPE_PROXYTYPE, convex_algo_2d);
+ collision_dispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE, BOX_2D_SHAPE_PROXYTYPE, convex_algo_2d);
+ collision_dispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE, BOX_2D_SHAPE_PROXYTYPE,
+ new btBox2dBox2dCollisionAlgorithm::CreateFunc());
+
{
btCollisionShape* ground_shape = new btStaticPlaneShape(btVector3(0, 1, 0), 1);
btDefaultMotionState* ground_motion_state =
@@ -85,10 +102,8 @@ namespace Brick
}
root = a_root;
if (root) {
- root->listen("child_added", this, &World::on_child_added);
- root->listen("child_removed", this, &World::on_child_removed);
+ register_entity(root);
}
- trigger("changed");
}
void World::set_gravity(const btVector3 a_gravity)
@@ -108,53 +123,61 @@ namespace Brick
void World::iterate()
{
- if (!(started && root)) {
- return;
+ check_started();
+ if (root) {
+ iterate_entity(root);
}
- iterate_entity(root);
+ float clock_start = clock();
dynamics_world->stepSimulation(frame_rate, 10);
+ float secs = (clock() - clock_start) / CLOCKS_PER_SEC;
+ if (secs > 0.050) {
+ printf("Dynamics stepping took %f sec\n", secs);
+ }
}
- void World::on_child_added(Event* event)
+ void World::on_child_added(ChildAddedEvent* event)
{
- printf("on_child_added\n");
- ChildAddedEvent* actual = reinterpret_cast<ChildAddedEvent*>(event);
- if (actual) {
- shared_ptr<Entity> entity = actual->entity;
-
- entity->listen("child_added", this, &World::on_child_added);
- entity->listen("child_removed", this, &World::on_child_removed);
-
- Body* body = dynamic_cast<Body*>(entity.get());
- if (body && body->get_collision_shape()) {
- btScalar mass = 1.0;
- btVector3 inertia(0, 0, 0);
- body->get_collision_shape()->calculateLocalInertia(mass, inertia);
-
- btRigidBody::btRigidBodyConstructionInfo rigid_body_info(
- mass, body->get_motion_state().get(), body->get_collision_shape().get(), inertia);
- btRigidBody* rigid_body = new btRigidBody(rigid_body_info);
- dynamics_world->addRigidBody(rigid_body);
- }
- }
+ register_entity(event->entity);
}
- void World::on_child_removed(Event* event)
+ void World::on_child_removed(ChildRemovedEvent* event)
{
- // TODO
+ printf("on_child_removed");
}
void World::iterate_entity(shared_ptr<Entity> entity)
{
entity->iterate();
-
- const vector<shared_ptr<Entity> >& children = entity->get_children();
+
+ vector<shared_ptr<Entity> > children = entity->get_children();
vector<shared_ptr<Entity> >::const_iterator i = children.begin();
- vector<shared_ptr<Entity> >::const_iterator end = children.end();
- while (i != end) {
- iterate_entity(*i);
+ while (i != children.end()) {
+ shared_ptr<Entity> child = *i;
+ if (child) {
+ iterate_entity(child);
+ }
i++;
}
}
+ void World::register_entity(shared_ptr<Entity> entity)
+ {
+ object_count++;
+ printf("world: entity %s added, %d objs total now\n", typeid(*entity.get()).name(), object_count);
+
+ Engine::get()->get_event_manager()->listen(entity, "child_added", shared_from_this(), &World::on_child_added);
+ Engine::get()->get_event_manager()->listen(entity, "child_removed", shared_from_this(), &World::on_child_removed);
+
+ Body* body = dynamic_cast<Body*>(entity.get());
+ if (body) {
+ shared_ptr<btRigidBody> rigid_body = body->get_bt_rigid_body();
+ if (rigid_body) {
+ printf("adding rigid body\n");
+ dynamics_world->addRigidBody(rigid_body.get());
+ }
+ }
+
+ Engine::get()->get_event_manager()->send(shared_from_this(), "changed", new Event);
+ }
+
}
View
18 src/Brick/World.h
@@ -3,14 +3,22 @@
#include <BulletDynamics/btBulletDynamicsCommon.h>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+#include "Brick/Event.h"
#include "Brick/Eventable.h"
#include "Brick/Runnable.h"
+#include "Brick/Engine.h"
namespace Brick {
using boost::shared_ptr;
+ using boost::enable_shared_from_this;
class Entity;
+ class ChildAddedEvent;
+ class ChildRemovedEvent;
/**
* A world is the non-visual data model behind the visual scene model.
@@ -21,7 +29,7 @@ namespace Brick {
* parents and childen. Iterating the world iterates over the entire graph
* in depth-first order.
*/
- class World : public Eventable, public Runnable
+ class World : public Runnable, public enable_shared_from_this<World>
{
public:
World();
@@ -39,19 +47,21 @@ namespace Brick {
void set_root(shared_ptr<Entity> a_root);
protected:
- void on_child_added(Event* event);
- void on_child_removed(Event* event);
+ void on_child_added(ChildAddedEvent* event);
+ void on_child_removed(ChildRemovedEvent* event);