使用cocos2d-x编程debug记录

Debug Records

1.      Error when read data from xmlfile?

Trace it I find:

In file CCSAXParser.cpp

         intresultxmlSAXUserParseMemory( &saxHandlerthispBuffersize);

         if ( result != 0 )

         {

                   returnfalse;

         }

In this code it the result!=0 and returnedfrom here.

 

But the other little game program doesn’treturn from here.

 

So I think the error is in the xml filesand find:

<?xml version="1.0"encoding="UTF_8"?>

 

The UTF_8 is wrong

 

Should be:

<?xml version="1.0"encoding="UTF-8"?>

 

2.      Error when add a button to thelayer.

It cannot receive the touch event.

Reason: Forgot to add the button to Menu,then add the Menu to the layer.

 

3.      File open error!!!

Fogget to trim the return after the filename in SqlLite database.

 

4.      Coordinate Error!!

Somegthing is wrong with the coordinate ofthe data of the rectangle read from the TMX files.

 

Little Summary:

Most of the bugs result from data errors orcarelessness when coding,

So,

Make sure the data is right next time andbe more careful when coding,

What’s else learn more techniques.

 

5.      Cannot use the class whose headfile I have included?

We can just see we cannot directly use it,but we can use it indirectly.

Add the namespace!!! Like CocosDenshion::SimpleAudioEngine.

Or and usingnamespace CocosDenshion at the beginning of the file.

Bug like this kind should be avoid at thebeginning.

 

6.      When use the schedule(schedule_selector(CategoryLogic::playWinSound),0.5f);

The callback function cannot be const and musthave a parameter with the type ccTime.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值