| 185 | } |
| 186 | |
| 187 | shared_ptr<Island> SceneController::makeIsland() |
| 188 | { |
| 189 | const float baseHeight = randFloat( 70, 110 ); |
| 190 | const float topHeight = randFloat( 70, 90 ); |
| 191 | const float baseWidth = 140; |
| 192 | const float topWidth = 8; |
| 193 | |
| 194 | auto island = make_shared<Island>( mAudio ); |
| 195 | island->mOuterVerts = calcNextOuterBumperVerts( baseHeight, topHeight, baseWidth, topWidth ); |
| 196 | island->mInnerVerts = calcInnerBumperVerts( baseHeight, topHeight, baseWidth ); |
| 197 | island->setupGeometry(); |
| 198 | |
| 199 | vector<b2Vec2> vertsBox2d; |
| 200 | |
| 201 | for( size_t i = 0; i < island->mOuterVerts.size(); i++ ) |
| 202 | vertsBox2d.emplace_back( pointsToMeters( island->mOuterVerts[i].x ), pointsToMeters( island->mOuterVerts[i].y ) ); |
| 203 | |
| 204 | b2PolygonShape polygon; |
| 205 | polygon.Set( vertsBox2d.data(), vertsBox2d.size() ); |
| 206 | |
| 207 | b2BodyDef islandBodyDef; |
| 208 | islandBodyDef.type = b2_kinematicBody; |
| 209 | |
| 210 | island->mBody = box2d::makeBodyShared( mWorld.get(), islandBodyDef ); |
| 211 | island->mBody->CreateFixture( &polygon, 0.0f ); |
| 212 | island->mBody->SetUserData( island.get() ); |
| 213 | |
| 214 | return island; |
| 215 | } |
| 216 | |
| 217 | void SceneController::addGear( const vec2 &pos ) |
| 218 | { |
nothing calls this directly
no test coverage detected