Here is my code:
Ironing.h file:
#pragma once
#include “cocos2d.h”
using namespace cocos2d;
class Ironing : CCLayer
{
private:
CCSize winsize;
CCSprite* iron;
bool ironing;
bool movingIron;
public:
virtual bool init();
static CCScene* scene();
CREATE_FUNC(Ironing);
void ccTouchesBegan(CCSet* touch, CCEvent* event);
void ccTouchesEnded(CCSet* touch, CCEvent* event);
void ccTouchesMoved(CCSet* touch, CCEvent* event);
};
Ironing.cpp:
#include “Ironing.h”
#include “HelloWorldScene.h”
#include
using namespace cocos2d;
using namespace std;
CCScene* Ironing::scene(){
CCScene* scene=NULL;
do {
scene=CCScene::create();
CC_BREAK_IF(!scene);
Ironing* layer=Ironing::create();
CC_BREAK_IF(!layer);
scene->addChild(layer);
}while (0);
return scene;
}
bool Ironing::init(){
bool ret=false;
do {
CC_BREAK_IF(! CCLayer::init());
winsize = CCDirector::sharedDirector()>getWinSize;>setTouchEnabled(true);
HelloWorld::addSprite;
HelloWorld::addSprite;
iron=HelloWorld::addSprite;
ironing=false;
movingIron=false;
ret=true;
} while ;
this
return ret;
}
void Ironing::ccTouchesBegan(CCSet* touch, CCEvent* event){
}
void Ironing::ccTouchesEnded(CCSet* touch, CCEvent* event){
}
void Ironing::ccTouchesMoved(CCSet* touch, CCEvent* event){
}
I am getting the following exception:
First-chance exception at 0x5e7b121b (libcocos2d.dll) in Designers.win32.exe: 0xC0000005: Access violation reading location 0x0000000c.
Unhandled exception at 0x5e7b121b (libcocos2d.dll) in Designers.win32.exe: 0xC0000005: Access violation reading location 0x0000000c.
The exception occurs at the retain function in CCObject.cpp
@
void CCObject::retain(void)
{
CCAssert(m_uReference > 0, “reference count should greater than 0”);
++m_uReference;
}
@