#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;
}
cocos2d-x加入控制台程序代码
最新推荐文章于 2019-03-04 09:32:16 发布