AppDelegate.h

#ifndef  _APP_DELEGATE_H_
#define _APP_DELEGATE_H_ #include "cocos2d.h" USING_NS_CC; /**
@brief The cocos2d Application. The reason for implement as private inheritance is to hide some interface call by CCDirector.
*/
class AppDelegate : private cocos2d::CCApplication
{
public:
AppDelegate();
virtual ~AppDelegate(); /**
@brief Implement CCDirector and CCScene init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/
virtual bool applicationDidFinishLaunching(); /**
@brief The function be called when the application enter background
@param the pointer of the application
*/
virtual void applicationDidEnterBackground(); /**
@brief The function be called when the application enter foreground
@param the pointer of the application
*/
virtual void applicationWillEnterForeground();
}; #endif // _APP_DELEGATE_H_

  

AppDelegate.cpp

#include "AppDelegate.h"  

#include <vector>
#include <string> #include "PlayingScene.h"
#include "AppMacros.h" USING_NS_CC;
using namespace std; #define DESIGN_WIDTH 420
#define DESIGN_HEIGHT 720 AppDelegate::AppDelegate() { } AppDelegate::~AppDelegate()
{
} bool AppDelegate::applicationDidFinishLaunching() { CCDirector* pDirector = CCDirector::sharedDirector();
CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView);
pEGLView->setDesignResolutionSize(DESIGN_WIDTH, DESIGN_HEIGHT, kResolutionShowAll); pDirector->setAnimationInterval(1.0 / 60);
CCScene *pScene = PlayingScene::scene();
pDirector->runWithScene(pScene); return true;
} void AppDelegate::applicationDidEnterBackground() {
CCDirector::sharedDirector()->stopAnimation();
} void AppDelegate::applicationWillEnterForeground() {
CCDirector::sharedDirector()->startAnimation();
} main.cpp
#include "main.h"
#include "../Classes/AppDelegate.h"
#include "CCEGLView.h" USING_NS_CC; int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine); // create the application instance
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setViewName("HelloCpp");
//eglView->setFrameSize(384,640);
eglView->setFrameSize(240,400);
eglView->setFrameZoomFactor(1.0f);
return CCApplication::sharedApplication()->run();
}

  

  

cocos2dx 的基本框架的更多相关文章

  1. 基于cocos2d-x的游戏框架设计——李成

    视频:http://v.youku.com/v_show/id_XMzc5ODUyMTI4.html?f=17330006 网易科技讯 3月31日,第四届CocoaChina开发者大会暨Cocos2d ...

  2. Cocos2d-x之引擎框架简介

    |   版权声明:本文为博主原创文章,未经博主允许不得转载. 1.cocos2d-x的设计思想 cocos2d-x分为导演,场景,图层,精灵,节点: (1).导演(Director):控制整个游戏的场 ...

  3. [原创]cocos2d-x研习录-第二阶 基本框架

    了解完Cocos2D-x的基本概念和概念类之后,是不是有一种蠢蠢欲动的冲动,想要探究Cocos2D-x是如何完成这一切的.接着我将通过对Cocos2D-x自代的HelloCpp项目进行分析,初步了解C ...

  4. Cocos2d-x学习笔记(两)Cocos2d-x总体框架

    原创文章.转载请注明出处:http://blog.csdn.net/sfh366958228/article/details/38680123 前言 上一节我们简单分析了HelloWorldproje ...

  5. cocos2dx游戏开发——微信打飞机学习笔记(一)——开发准备

    一.环境的搭建 1.Windows开发准备: (1)软件下载及安装 •下载Cocos2d-x 最新版本:http://www.cocos2d-x.org/download 或者从Cocos2d-x G ...

  6. [原创]cocos2d-x研习录-第二阶 概念类之节点类(CCNode)

    节点类CCNode在基本概念中并不存在,它是为了建立基本概念之间的关联关系而抽象出来的中间辅助类.这个类在Cocos2D-x中极为重要,它为概念类之间搭建了一座宏伟的桥梁.它的继承关系图如下:     ...

  7. [原创]cocos2d-x研习录-第二阶 基本概念

    在Cocos2D-x引擎中,有几个非常重要的概念:导演(CCDirector).摄像机(CCCamera).场景(CCSecen).布景(CCLayer).精灵(CCSPrite)和动作(CCActi ...

  8. 初识cocos2d-x-从环境配置到整体框架

    前言 ACM生涯在带着些许遗憾中结束了.春招的时候找了一份游戏开发的工作,现在学习cocos2dx中. 从ACM竞赛到实际项目开发的学习,第一感觉就是不适应,虽然感觉实际项目的确要比ACM简单的多.最 ...

  9. win7 vs2010 安装cocos2d-x

    http://blog.csdn.net/leoncoder/article/details/12523727 新安装搭建cocos2d-X的跳过这里,看以下红色開始: cocos2d-x删除vs20 ...

随机推荐

  1. 这些年,我收集的JavaScript代码

    这些年,我收集的JavaScript代码(一) http://www.cnblogs.com/jscode/archive/2012/07/25/2605395.html 这些年,我收集的JavaSc ...

  2. nodejs fs 模块的用途

    /*** New node filefs 操作*/var fs = require(“fs”); /*创建文件 var fileName = “anps_hsj”;fs.mkdir(fileName, ...

  3. PHP前端$.ajax传递数据到后台

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  4. Regex.Match 方法

    Regex.Match 方法 在输入字符串中搜索正则表达式的匹配项,并将精确结果作为单个 Match 对象返回. 重载列表      (1) 在指定的输入字符串中搜索 Regex 构造函数中指定的正则 ...

  5. shell script 的追踪与 debug

    shell script 的追踪与 debug scripts 在运行之前,最怕的就是出现语法错误的问题了!那么我们如何 debug 呢?有没有办法不需要透过直接运行该 scripts 就可以来判断是 ...

  6. 得到当前活动的controller

    UIWindow+PazLabs.h (header file) #import <UIKit/UIKit.h> @interface UIWindow (PazLabs) - (UIVi ...

  7. C#序列化与反序列化(Serialize,Deserialize)实例详解

    这篇文章主要介绍了C#序列化与反序列化(Serialize,Deserialize)的方法,实例分析了C#序列化与反序列化的常见技巧,需要的朋友可以参考下 本文实例讲述了C#序列化与反序列化(Seri ...

  8. 20160730noip模拟赛zld

    codeforces394E 如果没有在凸多边形内一点的限制,答案肯定是 如果不在凸多边形内,那么目标点肯定在凸多边形边上,我们枚举每条边,在每条边上求出距离平方和最小的点,在这些点中求出最小的 我们 ...

  9. Unity3D研究院之脚本批量打包渠道包研究

    原地址:http://www.xuanyusong.com/archives/2418#comments 最近在研究Unity3D脚本批量打包,比如在Android平台下各种不同分辨率和不同内存大小的 ...

  10. 【redis】05Redis的常用命令及高级应用

    Redis常用命令     Redis提供了非常丰富的命令,对数据库和个中数据类型进行操作, 这些命令呢,可以在Linux终端使用. 分为两大类的命令,一种是键值相关的命令,一种是服务器相关的命令, ...