#pragma once

#include "cocos2d.h"
#include "ui/CocosGUI.h"

class First : public cocos2d::Layer,public cocos2d::TextFieldDelegate
{
public:
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();  

    // there's no 'id' in cpp, so we recommend returning the class instance pointer
    static cocos2d::Scene* scene();
	cocos2d::TextFieldTTF* _nameTextField;
	cocos2d::ui::CheckBox* _players;
	cocos2d::ui::CheckBox* _friendly;
	cocos2d::ui::CheckBox* _endless;
    
    // a selector callback
    void menuCloseCallback(cocos2d::Ref* pSender);
	void menuStartCallback(cocos2d::Ref* pSender);
	void menuScoreCallback(cocos2d::Ref* pSender);
	void menuTutorialCallback(cocos2d::Ref* pSender);
    
	virtual bool onTextFieldAttachWithIME(cocos2d::TextFieldTTF * pSender);
    virtual bool onTextFieldDetachWithIME(cocos2d::TextFieldTTF * pSender);
    virtual bool onTextFieldInsertText(cocos2d::TextFieldTTF * pSender, const char * text, int nLen);
    virtual bool onTextFieldDeleteBackward(cocos2d::TextFieldTTF * pSender, const char * delText, int nLen);
    virtual bool onDraw(cocos2d::TextFieldTTF * pSender);

	virtual bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event);
	//virtual void onTouchMoved(cocos2d::Touch* touch, cocos2d::Event* event);
	virtual void onTouchEnded(cocos2d::Touch* touch, cocos2d::Event* event);

    // implement the "static node()" method manually
    CREATE_FUNC(First);
};


