I have create a button action with cocos2d-x but i dont know how it duplicate my action when button clicked
Here is my code for .h
#include "cocos2d.h"
#include "cocos-ext.h"
#include "CocosGUI.h"
USING_NS_CC;
USING_NS_CC_EXT;
using namespace ui;
class LoginScene : public Scene
{
public:
LoginScene(bool pPortrait=false);
~LoginScene();
virtual void onEnter();
virtual void onExit();
virtual void onLogin();
virtual void onRegister();
protected:
Layout* m_pLayout;
Layer* m_pUILayer;
};
and .cpp
#include "LoginScene.h"
#include "cocostudio/CCSSceneReader.h"
#include "cocostudio/CCSGUIReader.h"
#include "cocostudio/CCActionManagerEx.h"
#include <sqlite3.h>
#include "MainScene.h"
LoginScene::LoginScene(bool pPortrait):m_pLayout(NULL),m_pUILayer(NULL)
{
Scene::init();
}
LoginScene::~LoginScene()
{
}
void LoginScene::onEnter()
{
Scene::onEnter();
m_pUILayer=Layer::create();
m_pUILayer->scheduleUpdate();
addChild(m_pUILayer);
//register root from json
m_pLayout=dynamic_cast<Layout*>(cocostudio::GUIReader::getInstance()->widgetFromJsonFile("LoginScene/LoginScene.json"));
m_pUILayer->addChild(m_pLayout);
//button initialize
Button* btnLogin=static_cast<Button*>(Helper::seekWidgetByName(m_pLayout, "btnLogin"));
btnLogin->addTouchEventListener(CC_CALLBACK_0(LoginScene::onLogin,this));
Button* btnRegister=static_cast<Button*>(Helper::seekWidgetByName(m_pLayout, "btnRegister"));
btnRegister->addTouchEventListener(CC_CALLBACK_0(LoginScene::onRegister, this));
}
void LoginScene::onRegister()
{
CCLOG("checking");
}
void LoginScene::onExit()
{
m_pUILayer->removeFromParent();
cocostudio::GUIReader::destroyInstance();
cocostudio::ActionManagerEx::destroyInstance();
cocostudio::SceneReader::destroyInstance();
Scene::onExit();
}
void LoginScene::onLogin()
{
}
And the AppDelegate.cpp
#include "AppDelegate.h"
#include "LoginScene.h"
USING_NS_CC;
AppDelegate::AppDelegate() {
}
AppDelegate::~AppDelegate()
{
}
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("My Game");
director->setOpenGLView(glview);
}
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
//design Size
auto screenSize=glview->getFrameSize();
auto designSize=Size(960,640);
glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::EXACT_FIT);
// create a scene. it's an autorelease object
auto scene = new LoginScene;
scene->autorelease();
// run
director->runWithScene(scene);
return true;
}
Can anyone tell me my mistake :( now it duplicates the log :(
tks all
Related
I'm trying to make a simple software with Gtkmm3.
I want to have a window with a grid inside. At a click on a button inside that grid, a method of the window should be triggered to delete the current grid and replace it with another one.
I'm able to use a method of the grid like this :
button.signal_clicked().connect(sigc::mem_fun(*this, &MyGrid::someMethod));
"this" being MyGrid.
I would like to do something like this :
button.signal_clicked().connect(sigc::mem_fun(*this->get_parent(), &MyWindow::someMethod));
where this->get_parent() would be an instance of MyWindow
My .h:
#ifndef MINIPROJECT_GUI_H
#define MINIPROJECT_GUI_H
#include <gtkmm/button.h>
#include <gtkmm/window.h>
#include <gtkmm/grid.h>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <gtkmm/label.h>
class WelcomeGrid: public Gtk::Grid
{
Gtk::Label message;
Gtk::Button nextButton; // This button should be connected to Fenetre::infoView()
public:
WelcomeGrid();
void display();
};
class InfoGrid : public Gtk::Grid
{
Gtk::Button button2;// This button should be connected to Fenetre::welcomeView()
Gtk::Label label2;
public:
InfoGrid();
void display();
};
class Fenetre : public Gtk::Window
{
public:
Fenetre();
virtual ~Fenetre(); // Setup window
void welcomeView();
protected:
//Member widgets:
WelcomeGrid welcome;
InfoGrid info;
void infoView(); // Remove the current grid from the window and replace it by infoGrid
void welcomeView(); // Remove the current grid from the window and replace it by WelcomeGrid
};
#endif //MINIPROJECT_GUI_H
My .cpp :
#include "GUI.h"
Fenetre::Fenetre()
{
// Sets the border width of the window.
set_border_width(10);
this->add(welcome);
}
Fenetre::~Fenetre()
{
}
void Fenetre::welcomeView() {
this->remove();
this->add(welcome);
}
void Fenetre::infoView() {
this->remove();
this->add(info);
}
InfoGrid::InfoGrid() {
button2.set_label("Hello.");
button2.signal_clicked().connect(sigc::mem_fun(*this,
&InfoGrid::display));
label2.set_label("Welcome on the Vampire creation interface.");
this->attach(label2, 0, 0, 1, 1);
this->attach(button2,1,1,1,1);
button2.show();
this->show_all();
}
WelcomeGrid::WelcomeGrid() {
nextButton.set_label("Create new character.");
auto a = this->get_parent();
nextButton.signal_clicked().connect(sigc::mem_fun(*this,
&WelcomeGrid::display));
message.set_label("Welcome on the Vampire creation interface.");
this->attach(message, 0, 0, 1, 1);
this->attach(nextButton,1,1,1,1);
// This packs the button into the Window (a container);
this->show_all();
}
void WelcomeGrid::display() {
auto a = this->get_parent();
std::cout << typeid(a).name();
}
void InfoGrid::display() {
std::cout << "coucou";
}
Without any code, it is hard to know what exactly you are looking for. Here is how I would do it: I would keep a reference to the parent Window inside the grid. For example:
#include <iostream>
#include <memory>
#include <sstream>
#include <gtkmm.h>
class MyWindow : public Gtk::Window
{
public:
MyWindow()
: m_grid{std::make_unique<MyGrid>(*this, m_count)}
{
add(*m_grid);
}
// This is called when the grid's button is pressed:
void ReplaceGrid()
{
++m_count;
// Remove the grid from the window:
remove();
// Destroy current grid:
m_grid = nullptr;
// Create a new grid:
m_grid = std::make_unique<MyGrid>(*this, m_count);
// Add it to the window:
add(*m_grid);
show_all();
}
private:
class MyGrid : public Gtk::Grid
{
public:
MyGrid(MyWindow& p_parent, int p_count)
: m_parent{p_parent}
{
// Create button:
std::ostringstream ss;
ss << "Replace me #" << p_count;
m_replaceButton = Gtk::Button(ss.str());
// Attach it to the grid:
attach(m_replaceButton, 0, 0, 1, 1);
// Connect replacement signal, using the parent window:
m_replaceButton.signal_clicked().connect([this]()
{
// Call the parent (the window):
m_parent.ReplaceGrid();
});
}
~MyGrid()
{
std::cout << "Grid destroyed" << std::endl;
}
private:
Gtk::Button m_replaceButton;
// Keep a reference to the parent window in the grid:
MyWindow& m_parent;
};
int m_count = 0;
std::unique_ptr<MyGrid> m_grid;
};
int main(int argc, char *argv[])
{
auto app = Gtk::Application::create(argc, argv, "so.question.q64594709");
MyWindow w;
w.show_all();
return app->run(w);
}
If you run this code, you will see a window with a grid containing one button. Whenever you click the button, the window:
updates a counter
destroys the current grid
creates a new grid with the updated counter value
You will see the counter value updated on the new grid's button label. In the terminal, the grids destructor will print a message, proving grids have really been switched.
Notice I have used lambdas here to clean up the syntax. I would suggest you do so as well. If you really want to use sigc::men_fun, you can encapsulate the lambda's content into the MyGrid::someMethod method that you mentioned in your question.
Notice also that the grid is a private nested class of the window (no one else needs to know...).
Compiled with GCC:
g++ main.cpp -o example.out `pkg-config gtkmm-3.0 --cflags --libs`
I am trying to make my own reusable button class in SFML. This would allow me to create a button and add a callback function to it in order to make the creation of buttons much easier.
Here is my hpp file:
#ifndef Button_hpp
#define Button_hpp
#include <stdio.h>
#include <SFML/Graphics.hpp>
#include "View.hpp"
#include "State.hpp"
#include "Window.hpp"
namespace kge {
class Button: public View{
private:
sf::RectangleShape* _buttonOutline;
sf::RenderWindow* _window;
sf::Clock _clock;
std::string _textString;
sf::Text* _text;
public:
Button(Window*, std::string);
~Button();
virtual void update(float td);
std::function<void(void)> callback;
void setPosition(float x, float y);
};
}
#endif /* Button_hpp */
And here is where I generate the buttons:
_restartButton = new kge::Button(_window, "Restart");
_restartButton->setPosition(getCenterOfScreen().x-((11*fontSize)/2), 300);
_restartButton->callback = ([this](){
State::instance().currentView = new GameView(this->_window);
this->_window->setView(State::instance().currentView);
});
_exitButton = new kge::Button(_window, "Quit");
_exitButton->setPosition(getCenterOfScreen().x-((11*fontSize)/2), 500);
_exitButton->callback = ([this](){
this->_window->close();
});
Finally, I tell the button to update and do it's checks in my window update, button->update(td)
All my buttons seem to all do the action of the last set callback. In this case, my restart button executes my exit code.
Why is this happening and how would I fix it?
Edit
Here is my generation code:
#ifndef GameOver_hpp
#define GameOver_hpp
#include <stdio.h>
#include "View.hpp"
#include "Button.hpp"
#include "GameView.hpp"
#include "State.hpp"
namespace kge{
class View;
};
class GameOver: public kge::View{
private:
sf::Text* _text;
kge::Button* _restartButton;
kge::Button* _exitButton;
void restartFunction(void){
}
public:
GameOver(kge::Window* screen) : View(screen){
int fontSize = 50;
_text = new sf::Text();
_text->setFont(kge::AssetManager::mainBundle().getFontNamed("mainfont"));
_text->setString("Game Over");
_text->setCharacterSize(fontSize);
_text->setPosition(getCenterOfScreen().x-((9*fontSize)/2), 100);
_text->setFillColor(sf::Color(255,0,0));
_restartButton = new kge::Button(_window, "Restart");
_restartButton->setPosition(getCenterOfScreen().x-((11*fontSize)/2), 300);
_exitButton = new kge::Button(_window, "Quit");
_exitButton->setPosition(getCenterOfScreen().x-((11*fontSize)/2), 500);
_restartButton->callback = ([this](){
// State::instance().currentView = new GameView(this->_window);
// this->_window->setView(State::instance().currentView);
puts("Restart");
});
_exitButton->callback = ([this](){
// this->_window->close();
puts("Restart");
});
this->addItemToView(_text);
this->addItemToView(_restartButton);
this->addItemToView(_exitButton);
}
void update(float td){
_restartButton->update(td);
_exitButton->update(td);
}
~GameOver(){
delete _text;
delete _restartButton;
}
};
#endif /* GameOver_hpp */
Note, kge::View is just a custom sf::Drawable class (how I create my own "views")
Edit 2
Button update function:
void Button::update(float td){
if(_clock.getElapsedTime().asMilliseconds() < 400) return;
if(!sf::Mouse::isButtonPressed(sf::Mouse::Left)) return;
if(mouseIsIn(*_buttonOutline, _window)){
callback();
_clock.restart();
}
}
Please note: _clock is an sf::Clock that is stored privately in the button class.
The issue was resolved in chat. To summarize, the mouseIsIn function that #iProgram posted did not check collision correctly, leading to multiple buttons triggering at the same time.
The original function:
bool mouseIsIn(sf::RectangleShape shape, sf::RenderWindow* window){
sf::FloatRect shapeBounds = shape.getGlobalBounds();
sf::Vector2i mousePos = sf::Mouse::getPosition(*window);
sf::FloatRect mouseRect = sf::FloatRect(mousePos.x, mousePos.y, mousePos.x+shapeBounds.width, mousePos.y+shapeBounds.height);
return mouseRect.intersects(shapeBounds);
}
The fixed function:
bool mouseIsIn(sf::RectangleShape shape, sf::RenderWindow* window){
sf::FloatRect shapeBounds = shape.getGlobalBounds();
sf::Vector2i mousePos = sf::Mouse::getPosition(*window);
return shapeBounds.contains(mousePos.x, mousePos.y);
}
I would like to arrange many layers in HelloWorldScene.cpp by making each layers to cpp file. But I have no idea how to start to code header files and how to include them in HelloWorld.cpp eventhough I searched around few days on Google & StakOverflow.. To explain what I want to do, I made a simple sample below. I added here only 2 Layers, but there will be over 20 layers on this 1 scene, so I want to make each of them as a file.
HelloWorldScene.h
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
class HelloWorld : public cocos2d::Layer
{
public:
static cocos2d::Scene* createScene();
virtual bool init();
CREATE_FUNC(HelloWorld);
cocos2d::Layer* layer01;
cocos2d::Layer* layer02;
int GrossiniPops;
cocos2d::Sprite* pMan;
virtual void getTouched01();
virtual void closingLayer();
};
#endif // __HELLOWORLD_SCENE_H__
HelloWorldScene.cpp
#include "HelloWorldScene.h"
#include "ui/CocosGUI.h"
USING_NS_CC;
Scene* HelloWorld::createScene()
{
auto scene = Scene::create();
auto layer = HelloWorld::create();
scene->addChild(layer);
return scene;
}
bool HelloWorld::init()
{
if ( !Layer::init() )
{
return false;
}
layer01 = Layer::create();
this->addChild(layer01);
layer02 = LayerColor::create(Color4B::WHITE);
this->addChild(layer02);
layer02->setVisible(false);
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
auto btn01 = cocos2d::ui::Button::create();
btn01->loadTextures("images/moveBar.png","","");
btn01->addTouchEventListener(CC_CALLBACK_0(HelloWorld::getTouched01, this));
btn01->setPosition(Point(275,250));
layer01->addChild(btn01);
auto btn02 = cocos2d::ui::Button::create();
btn02->loadTextures("images/moveBar.png", "", "");
btn02->addClickEventListener(CC_CALLBACK_0(HelloWorld::closingLayer, this));
btn02->setPosition(Point(375, 250));
this->addChild(btn02, 3);
GrossiniPops = 0;
pMan = Sprite::create("images/grossini.png");
pMan->setPosition(Point(325, 150));
layer01->addChild(pMan);
pMan->setVisible(false);
return true;
}
void HelloWorld::getTouched01()
{
GrossiniPops++;
if (GrossiniPops%4==2) {
pMan->setVisible(true);
}
else { pMan->setVisible(false); }
}
void HelloWorld::closingLayer()
{
log("Layer Change");
if (layer01->isVisible()==true)
{
layer01->setVisible(false);
layer02->setVisible(true);
}
else {
layer02->setVisible(false);
layer01->setVisible(true);
}
}
You need to include the "HelloWorld.h" file in your "HelloWorld.cpp" file if you wish to use it. Put this line at the top of your "HelloWorld.cpp" file:
#include "HelloWorld.h"
That should solve it.
Here's a good reference if you'd like to read more on includes and source files in C++:
http://www.cplusplus.com/forum/articles/10627/
OS : Win10
Language : c++
Cocos2d-x Ver : 3.8.1
Tool : Visual Studio 2013
//MainMenuScene.h
#ifndef ProjectV_MainMenuScene_h
#define ProjectV_MainMenuScene_h
#include "cocos2d.h"
class MainMenuScene :public cocos2d::CCLayerColor
{
public:
virtual bool init();
static cocos2d::CCScene *createScene();
CREATE_FUNC(MainMenuScene);
cocos2d::Label *PlayLabel;
void goPlayScene(cocos2d::Ref *pSender);
};
#endif
//MainMenuScene.cpp
#include "MainMenuScene.h"
#include "PlayScene.h"
USING_NS_CC;
CCScene *MainMenuScene::createScene()
{
CCScene *scene = CCScene::create();
MainMenuScene *layer = MainMenuScene::create();
scene->addChild(layer);
return scene;
}
bool MainMenuScene::init()
{
if (!CCLayerColor::initWithColor(Color4B(255, 255, 255, 255)))
{
return false;
}
PlayLabel = Label::createWithTTF("Play", "fonts/consola.ttf", 18);
PlayLabel->setColor(Color3B::BLACK);
auto PlayBtn = MenuItemLabel::create(
PlayLabel,
CC_CALLBACK_1(MainMenuScene::goPlayScene, this));
// i thought CC_CALLBACK_1(MainMenuScene::goPlayScene,this) mean call goPlayScene(Ref* pSender) when click or touch the label
PlayBtn->setPosition(Vec2(240, 100));
auto pMenu = Menu::create(PlayBtn, NULL);
pMenu->setPosition(Vec2::ZERO);
this->addChild(pMenu);
return true;
}
void MainMenuScene::goPlayScene(Ref* pSender)
{
CCScene *pScene = PlayScene::createScene();
TransitionScene *pTransScene = TransitionFade::create(1.0f, pScene, Color3B::WHITE);
Director::getInstance()->replaceScene(pTransScene);
}
i don't know why function don't call when i clicked the label
You is not passed an argument in the calling function
CC_CALLBACK_1(MainMenuScene::goPlayScene, this)
You need either remove the Ref* pSender from void MainMenuScene::goPlayScene() or add an your sender in CC_CALLBACK_1(MainMenuScene::goPlayScene, this) after this.
can't change the color of a background i have this simple class :
here is the c++ file :
#include "HelloWorldScene.h"
USING_NS_CC;
HelloWorld::HelloWorld()
{
;
}
Scene* HelloWorld::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !LayerColor::initWithColor(Color4B(20,0,0,255)) )
{
return false;
}
winSize = Director::getInstance()->getWinSize();
visibleSize = Director::getInstance()->getVisibleSize();
origin = Director::getInstance()->getVisibleOrigin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
auto closeItem = MenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
closeItem->setPosition(Point(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
origin.y + closeItem->getContentSize().height/2));
// create menu, it's an autorelease object
auto menu = Menu::create(closeItem, NULL);
menu->setPosition(Point::ZERO);
this->addChild(menu, 1);
schedule( schedule_selector(HelloWorld::tick) );
return true;
}
void HelloWorld::onExit()
{
LayerColor::onExit();
}
void HelloWorld::onEnter()
{
LayerColor::onEnter();
auto cache = SpriteFrameCache::getInstance();
cache->addSpriteFramesWithFile("interface/sprites.plist", "interface/sprites.png");
SpriteBatchNode* batch = SpriteBatchNode::create("interface/sprites.png");
this->addChild(batch,BATCH_Z);
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesBegan = CC_CALLBACK_2(HelloWorld::onTouchesBegan, this);
listener->onTouchesMoved = CC_CALLBACK_2(HelloWorld::onTouchesMoved, this);
listener->onTouchesEnded = CC_CALLBACK_2(HelloWorld::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
}
void HelloWorld::onTouchesBegan(const std::vector<Touch*>& touches, Event *event)
{
for( auto& touch : touches)
{
}
}
void HelloWorld::onTouchesMoved(const std::vector<Touch*>& touches, Event *event)
{
for( auto& touch : touches)
{
}
}
void HelloWorld::onTouchesEnded(const std::vector<Touch*>& touches, Event *event)
{
for( auto& touch : touches)
{
startAnim = true;
};
}
void HelloWorld::tick(float dt)
{
if(startAnim)
{
}
}
void HelloWorld::draw()
{
LayerColor::draw();
}
HelloWorld::~HelloWorld()
{
// Removes Touch Event Listener
_eventDispatcher->removeEventListener(_touchListener);
}
void HelloWorld::menuCloseCallback(Object* pSender)
{
Director::getInstance()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}
and the h file :
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
class GameObj;
class ReelGameObj;
class HelloWorld : public cocos2d::LayerColor
{
public:
HelloWorld();
~HelloWorld();
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// a selector callback
void menuCloseCallback(Object* pSender);
// implement the "static create()" method manually
CREATE_FUNC(HelloWorld);
void tick(float dt);
virtual void draw();
virtual void onEnter();
virtual void onExit();
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
protected:
cocos2d::CustomCommand _customCommand;
void onDraw();
private:
cocos2d::EventListenerTouchOneByOne* _touchListener;
cocos2d::Size winSize;
cocos2d::Size visibleSize;
cocos2d::Point origin;
GameObj* pMainWindowObjCenter;
ReelGameObj* pReelGameObj;
bool startAnim;
};
#endif // __HELLOWORLD_SCENE_H__
and nothing no color in the background , why ?
im working on windows with VC 2012
I think your color is too dark. Try changing the values to (255,25,255,255) and check the result.
I created a sample project (in Beta 2), and only changed these lines:
.h:
class HelloWorld : public cocos2d::LayerColor
.cpp:
if( !LayerColor::initWithColor(Color4B(255,255,255,255)) )
The result is a white background.
I cleaned up and updated your code (I use cocos2dx 2.2.1) and I could change the layer's color to red.
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
class HelloWorld : public cocos2d::CCLayerColor
{
public:
HelloWorld();
~HelloWorld();
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::CCScene* createScene();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// a selector callback
void menuCloseCallback(CCObject* pSender);
// implement the "static create()" method manually
CREATE_FUNC(HelloWorld);
virtual void onEnter();
void draw();
private:
cocos2d::CCSize winSize;
cocos2d::CCSize visibleSize;
cocos2d::CCPoint origin;
bool startAnim;
};
#endif // __HELLOWORLD_SCENE_H__
The cpp file
#include "HelloWorldScene.h"
USING_NS_CC;
HelloWorld::HelloWorld()
{}
HelloWorld::~HelloWorld()
{}
CCScene* HelloWorld::createScene()
{
// 'scene' is an autorelease object
auto scene = CCScene::create();
// 'layer' is an autorelease object
auto layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
ccColor4B c = ccc4(255,0,0,255);
if ( !CCLayerColor::initWithColor(c) )
{
return false;
}
return true;
}
void HelloWorld::onEnter()
{
CCLayerColor::onEnter();
}
void HelloWorld::draw()
{
CCLayerColor::draw();
}