代码下载链接

http://download.csdn.net/detail/yincheng01/6864893

解压密码:c.itcast.cn

main函数内容

#include "main.h"
#include "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("CrazyMario");
eglView->setFrameSize(480, 320);
return CCApplication::sharedApplication()->run();
}

本文以win32的main函数为模板,该部分代码是win32平台特有,不可移植。

_tWinMain是win32程序的主函数,四个参数与cocos2dx关系不大,忽略。

1)定义app对象 AppDelegate app;

AppDelegate是CCApplication的子类,定义的app对象的地址,最后将被保存到CCApplication的静态变量中

可以使用静态函数CCApplication::shareApplication()获取该app的指针。
CCApplication详细信息参见这里

2)创建窗口 CCEGLView* eglView = CCEGLView::sharedOpenGLView();

这句代码创建窗口,代码运行到这里只是创建了一个窗口罢了

eglView->setViewName("CrazyMario");是设置窗口的名字

eglView->setFrameSize(480, 320);是设置窗口的大小。对于不同的设备分辨率不同,窗口大小也不同,会导致很多问题,解决方法见这里

对于CCEGLView类的学习参见这里

3)运行程序CCApplication::shareApplication()->run();进入程序循环

这个代码要注意以下几点:

a.CCApplication::sharedApplication()返回的指针,就是app的地址,因为app是单例,所以一旦定义了一个对象,就不会再建立其他对象。

b.进入消息处理死循环之前,会先调用applicationDidFinishLaunching虚函数,该虚函数在AppDelegate中进行了重载,所以在进入消息处理之前,AppDelegate的applicationDidFinishLaunching函数会先被调用

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdcAAAFzCAIAAADja9RuAAAelElEQVR4nO2dvc7kuJVA9YJ+BOcOHPoBKjAcGfMATjZaGwYWcLK9cDBBpxPswJgFOphgAEdOZ4JuT6YNalrNj7z38vJfUp2DDx8oiry8UpVOsVQq1fbx48ePHz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tt0b7eEjSToD7U9HtvjES7WJZDmANDO2S0cHWlz7BaOUjfidS2c7vCh8YsIDRg+QI5BsTCclwtb2HClOJs7FtNC38jiVLoopbClOC01otW113a4M4hWNnZC6Z5JJ8JR4fPi4/gLK4//YSFsHzXW2keZIGVo54YW9nuhPZoncveUtP1T1Hf0QM74/j2T+i5q/7mg+tTWq7EWC8NQbmthbc4lxhdHydYbkSvSLmqZTaNow5db2JOGPRf2WPgoeCyc/tcyAWjkthbOhgorjVGyEcT6oRZuFF/7Nna3sCcNzcJJGQvDxbi/hSvs7GzplKk/1YoN7GXhor03zsJGzraFg46WhZ9l28JGOc0EI0M7Z7fwrrz7tlcZlVp8u6Y0sp2qs2NWXlFAZ3u7srG+KJmiPbMrV6qFcfZCCx+LkWoNC0c5YGFo5wIWfmKY8YRhYQRnUB4Whu5cxsJ7MvfpGLNjQBjKWuuhYBjBlSwMAHA/sDAAwEqwMADASrAwAMBKsDAAwEqwMADASrAwAMBK/h+stI+tlJAJ5QAAAABJRU5ErkJggg==" alt="" />

applicationDidFinishLaunching函数将在下一篇博文中详细描述。

cocos2d-x游戏开发系列教程-超级玛丽03-main函数的更多相关文章

  1. cocos2d-x游戏开发系列教程-超级玛丽04-AppDelegate

    代码下载链接 http://download.csdn.net/detail/yincheng01/6864893 解压密码:c.itcast.cn 背景 上一篇博文提到在CCApplication: ...

  2. cocos2d-x游戏开发系列教程-超级玛丽10-怪物与马里奥冲突检测

    在超级玛丽游戏中,马里奥在移动,怪物也在移动,当他们遇见时,需要判断是马里奥身亡还是怪物身亡. 这个判断的代码在怪物类的检测函数实现中. 比如蘑菇怪的冲突检测函数: bool CMMonsterMus ...

  3. cocos2d-x游戏开发系列教程-超级玛丽07-CMGameMap

    背景 在上一篇博客中,我们提到CMGameScene,但是CMGameScene只是个框架,实际担任游戏逻辑的是CMGameMap类,这个博文就来了解下CMGameMap 头文件 class CMGa ...

  4. cocos2d-x游戏开发系列教程-超级玛丽06-CMGameScene

    背景 在CMMenuScene中,当用户点击开始游戏时,导演让场景进入到CMGameScene 头文件 class CMGameScene : public cocos2d::CCLayer,publ ...

  5. cocos2d-x游戏开发系列教程-超级玛丽08-消息机制

    在超级玛丽游戏里,地图类CMGameMap负责所有的程序逻辑,它包含了背景地图,包含了游戏元素精灵,当游戏中的精灵之间发生碰撞时,比如马里奥撞上砖头这种事情发生时,马里奥对象本身不知道怎么处理这个逻辑 ...

  6. cocos2d-x游戏开发系列教程-超级玛丽05-CMMenuScene

    代码下载链接 http://download.csdn.net/detail/yincheng01/6864893 解压密码:c.itcast.cn 背景 上一篇博文提到appDelegate,在该类 ...

  7. cocos2d-x游戏开发系列教程-超级玛丽09-怪物激活与移动

    在游戏中,很多怪物本身是会移动的,这里主要有蘑菇怪,乌龟等. 说起怪物的移动,首先在游戏里先要考虑怪物的抽象和设计. 在CMMonster.h中,有个类CMMonsterBasic,这个类抽象了所有的 ...

  8. cocos2d-x游戏开发系列教程-超级玛丽07-CMGameMap(五)-地图卷动

    马里奥在平移的过程中,涉及到地图的卷动问题. 在这个游戏里,地图比窗口大,窗口只是显示了地图的一部分,因此马里奥在移动的时候,移动到一定位置之后要卷动地图,否则马里奥移动到窗口右边之后......那结 ...

  9. cocos2d-x游戏开发系列教程-超级玛丽07-CMGameMap(三)-按键处理

    在地图初始化好了之后,就开始移动马里奥吧,我在windows下,是使用键盘来移动马里奥的 w是跳,d是前进,a是后退,那么在程序里是怎么来获取这个按键的呢? 普通的windows程序,在按键之后,会有 ...

  10. cocos2d-x游戏开发系列教程-超级玛丽02-代码结构

    代码下载链接 http://download.csdn.net/detail/yincheng01/6864893 解压密码:c.itcast.cn 前景回顾 上一篇博文提到超级马里奥的游戏效果,大家 ...

随机推荐

  1. android UI进阶之用ViewPager实现欢迎引导页面[转]

    ViewPager需要android-support-v4.jar这个包的支持,来自google提供的一个附加包.大家搜下即可. ViewPager主要用来组织一组数据,并且通过左右滑动的方式来展示. ...

  2. jQuery的hover()方法(笔记)

    因为mouseover和mouseout经常一起写,所以出现了hover() hover(function(){},function(){});第一个参数为鼠标移入运行的函数,第二个为鼠标离开运行的函 ...

  3. superMap Object 属性查看的一点代码

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  4. PKU POJ 1006 Biorhythms (中国剩余定理)

    中国剩余定理 x = ai (mod mi)  ai和mi是一组数,mi两两互质,求x 令Mi = m1*m2*~mk     其中,mi不包含在内. 因为mi两两互质,所以存在x和y, st   M ...

  5. USACO Section 5.4 TeleCowmunication(最小割)

    挺裸的一道最小割.把每台电脑拆成一条容量为1的边,然后就跑最大流.从小到大枚举每台电脑,假如去掉后 最大流=之前最大流+1,那这台电脑就是answer之一了. -------------------- ...

  6. Linux 中 java 访问 windows共享目录

    有两个方案: 1.将windows共享目录,挂载到linux系统下,通过使用本地目录访问windows共享目录 2.通过samba的java实现包,不过需要开个windows共享目录的账户  http ...

  7. Latex调整行距

    修改行间距的方法: \usepackage{setspace}%使用间距宏包 \begin{document} \begin{spacing}{2.0}%%行间距变为double-space 双倍行距 ...

  8. 【转】android windowSoftInputMode

    android:windowSoftInputMode activity主窗口与软键盘的交互模式,可以用来避免输入法面板遮挡问题,Android1.5后的一个新特性. 这个属性能影响两件事情: [一] ...

  9. 电感耦合非接触IC卡系统的EMI问题

    射频识别(RFID)技术近年来发展迅速,并获得了广泛应用.但作为一种无线射频技术,其电磁兼容(EMC)性能也越来越受到人们的关注.RFID涉及的频率范围甚广,包括低于135kHz.13.56MHz.4 ...

  10. 从51跳新唐cortex-m0学习1——思想转变

    Cortex-M0学习第一帖 序言:这里先说一下,大家在看帖子时候,可能看见字数比较多的,可能只是先大概浏览一下,之后从中挑几段大概瞅瞅,但是我要说,如果你碰到一个适合的帖子,请仔细品读,这是我在论坛 ...