Game Development Reference
In-Depth Information
void onDraw();
CustomCommand _customCommand;
};
7. Then add this
include
statement at the top:
#include "GLES-Render.h"
8. Then, in the
HelloWorldScene.cpp
implementation file, replace the lines
between the
using namespace CocosDenshion
and
Hel-
loWorld::scene
methods with these:
#define PTM_RATIO 32
HelloWorld::HelloWorld()
{
this->initPhysics();
scheduleUpdate();
}
HelloWorld::~HelloWorld()
{
delete world;
world = nullptr;
delete _debugDraw;
_debugDraw = nullptr;
}
void HelloWorld::initPhysics() {
b2Vec2 gravity;
gravity.Set(0.0f, -10.0f);
world = new b2World(gravity);
// Do we want to let bodies sleep?
world->SetAllowSleeping(true);
world->SetContinuousPhysics(true);
_debugDraw = new (std::nothrow) GLESDebugDraw(