cocos2d-x增加控制台程序代码

#include "main.h"
#include "AppDelegate.h"
#include "CCEGLView.h" USING_NS_CC;
#define USE_WIN32_CONSOLE //这里是控制台开关。是否打开控制台 int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine); #ifdef USE_WIN32_CONSOLE
AllocConsole(); //创建一个控制台
freopen("CONIN$","r",stdin); //将标准输入输出流定位到这个控制台
freopen("CONOUT$","w",stdout);
freopen("CONOUT$","w",stderr);
#endif
// create the application instance
AppDelegate app;
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setViewName("NetWorkTest");
eglView->setFrameSize(480, 320);
int ret=CCApplication::sharedApplication()->run(); #ifdef USE_WIN32_CONSOLE
FreeConsole(); //删除控制台
#endif return ret;
}
上一篇:javascriptdocument load 和document ready的区别


下一篇:详述Linux配置静态IP、设置DNS和主机名(一)