|   版权声明:本文为博主原创文章,未经博主允许不得转载。(笔者才疏学浅,如有错误,请多多指教)

  一般像游戏关于的这种界面中,主要显示的是游戏的玩法等。

GameAbout.h

#ifndef _GAME_ABOUT_H_
#define _GAME_ABOUT_H_ //////////////////////////////////////////////////////////
//////// 此文件主要描述关于界面 #include "cocos2d.h"
USING_NS_CC; class GameAbout : public cocos2d::Layer
{
private:
cocos2d::MenuItemImage* awayItem;
cocos2d::Sprite* background;
public:
static cocos2d::Scene* createScene();
virtual bool init();
void aboutInterface();
void goMainInterface(cocos2d::Ref*);
CREATE_FUNC(GameAbout);
};
#endif // _GAME_ABOUT_H_

GameAbout.cpp

#include "GameAbout.h"
#include "GameUnit.h"
#include "MainMenu.h" unit u1; cocos2d::Scene* GameAbout::createScene()
{
auto scene = Scene::create();
auto layer = GameAbout::create();
scene->addChild(layer);
return scene;
} bool GameAbout::init()
{
if (!Layer::init())
{
return false;
} this->aboutInterface(); //best->setColor(Color3B(0, 0, 0));
//best->setString(__String::createWithFormat("%d", Score - 1)->getCString()); return true;
} void GameAbout::aboutInterface()
{
background = Sprite::create("background/about.png");
background->setPosition(Vec2(u1.winOrigin().x + u1.winSize().width / 2,
u1.winOrigin().y + u1.winSize().height / 2));
background->setScale(u1.scaleX(background, u1.winSize()),
u1.scaleY(background, u1.winSize()));
this->addChild(background, 0); awayItem = MenuItemImage::create(
"button/away.png",
"button/buttom.png",
CC_CALLBACK_1(GameAbout::goMainInterface, this));
awayItem->setPosition(Vec2(u1.winOrigin().x + awayItem->getContentSize().width / 2,
u1.winOrigin().y + awayItem->getContentSize().height / 2));
auto m = Menu::create(awayItem, NULL);
m->setPosition(Vec2::ZERO);
this->addChild(m, 2);
} void GameAbout::goMainInterface(cocos2d::Ref* pSender)
{
Director::getInstance()->replaceScene(TransitionFadeBL::create(1,
MainMenu::createScene()));
}

  

函数的功能介绍详见:http://lipei95.blog.163.com/blog/static/257578646201671924726318/

效果图:

最新文章

  1. [python] 安装numpy+scipy+matlotlib+scikit-learn及问题解决
  2. AngularJS 模块
  3. 控件(弹出类): FlyoutBase, Flyout, MenuFlyout
  4. Codeforces Round #373 (Div. 2) B
  5. golang操作文件的四种方法
  6. WPF:行列显示
  7. photoshop,用切片工具等分图片
  8. rfid门禁系统笔记
  9. web相关
  10. easyui datagrid pagesize设置无效
  11. 【HDOJ】1438 钥匙计数之一
  12. SVN仓库迁移到Git遇到的两个问题和解决办法
  13. 003_JS基础_面向对象基础
  14. Spring Data与elasticsearch版本对应关系
  15. SQL Server数据库————模糊查询和聚合函数
  16. ionic3 百度地图插件定位 问题
  17. css 样式表的书写顺序
  18. linux下的初始化系统systemd简科普
  19. 软件测试中Bug的生命周期以及Bug的严重等级
  20. 使用MyEclipse开发Java EE应用:用XDoclet创建EJB 2 Session Bean项目(一)

热门文章

  1. Server Tomcat v8.5 Server at localhost failed to start.
  2. CodeChef Sereja and LCM(矩阵快速幂)
  3. 70.Trapping Rain Water(容水量)
  4. C# 使用Silverlight打印图片
  5. Linux笔记1-简介
  6. Windows 下 MySQL 备份脚本
  7. Vue-native绑定原生事件
  8. Java调用MySql数据库函数
  9. sd卡无法启动及zc706更改主频后可以进入uboot无法启动kernel的坑
  10. python-字符串的处理