本文整理汇总了C++中CCEGLView::moveWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ CCEGLView::moveWindow方法的具体用法?C++ CCEGLView::moveWindow怎么用?C++ CCEGLView::moveWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCEGLView
的用法示例。
在下文中一共展示了CCEGLView::moveWindow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
int UiPlayer::run(void)
{
const char *QUICK_COCOS2DX_ROOT = getenv("QUICK_COCOS2DX_ROOT");
SimulatorConfig::sharedDefaults()->setQuickCocos2dxRootPath(QUICK_COCOS2DX_ROOT);
loadProjectConfig();
HWND hwndConsole = NULL;
if (m_project.isShowConsole())
{
AllocConsole();
freopen("CONOUT$", "wt", stdout);
freopen("CONOUT$", "wt", stderr);
// disable close console
hwndConsole = GetConsoleWindow();
if (hwndConsole != NULL)
{
HMENU hMenu = GetSystemMenu(hwndConsole, FALSE);
if (hMenu != NULL) DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
ShowWindow(hwndConsole, SW_SHOW);
BringWindowToTop(hwndConsole);
}
}
if (m_project.isWriteDebugLogToFile())
{
const string debugLogFilePath = m_project.getDebugLogFilePath();
m_writeDebugLogFile = fopen(debugLogFilePath.c_str(), "w");
if (!m_writeDebugLogFile)
{
CCLOG("Cannot create debug log file %s", debugLogFilePath.c_str());
}
}
do
{
m_exit = TRUE;
// create the application instance
m_app = new AppDelegate();
m_app->setProjectConfig(m_project);
// set environments
SetCurrentDirectoryA(m_project.getProjectDir().c_str());
CCFileUtils::sharedFileUtils()->setSearchRootPath(m_project.getProjectDir().c_str());
CCFileUtils::sharedFileUtils()->setWritablePath(m_project.getWritableRealPath().c_str());
// create opengl view
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setMenuResource(MAKEINTRESOURCE(IDC_LUAHOSTWIN32));
eglView->setWndProc(WindowProc);
eglView->setFrameSize(m_project.getFrameSize().width, m_project.getFrameSize().height);
eglView->setFrameZoomFactor(m_project.getFrameScale());
// make window actived
m_hwnd = eglView->getHWnd();
BringWindowToTop(m_hwnd);
SetWindowTextA(m_hwnd, "ui-player");
// restore window position
const CCPoint windowOffset = m_project.getWindowOffset();
if (windowOffset.x != 0 || windowOffset.y != 0)
{
eglView->moveWindow(windowOffset.x, windowOffset.y);
}
// set icon
HICON icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_LUAHOSTWIN32));
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon);
if (hwndConsole)
{
SendMessage(hwndConsole, WM_SETICON, ICON_BIG, (LPARAM)icon);
}
// update menu
createViewMenu();
updateMenu();
// run game
CCLuaStack *stack = CCLuaEngine::defaultEngine()->getLuaStack();
const vector<string> arr = m_project.getPackagePathArray();
for (vector<string>::const_iterator it = arr.begin(); it != arr.end(); ++it)
{
stack->addSearchPath(it->c_str());
}
m_app->run();
// cleanup
CCScriptEngineManager::sharedManager()->removeScriptEngine();
CCScriptEngineManager::purgeSharedManager();
CocosDenshion::SimpleAudioEngine::end();
delete m_app;
m_app = NULL;
} while (!m_exit);
//.........这里部分代码省略.........
示例2: loadProjectConfig
int LuaHostWin32::run(void)
{
loadProjectConfig();
AllocConsole();
freopen("CONOUT$", "wt", stdout);
freopen("CONOUT$", "wt", stderr);
// disable close console
HWND hwndConsole = GetConsoleWindow();
if (hwndConsole != NULL)
{
HMENU hMenu = GetSystemMenu(hwndConsole, FALSE);
if (hMenu != NULL) DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
}
do
{
m_exit = TRUE;
if (m_project.isShowConsole())
{
ShowWindow(hwndConsole, SW_SHOW);
BringWindowToTop(hwndConsole);
}
else
{
ShowWindow(hwndConsole, SW_HIDE);
}
// create the application instance
m_app = new AppDelegate();
m_app->setStartupScriptFilename(m_project.getScriptFilePath());
// set environments
SetCurrentDirectoryA(m_project.getProjectDir().c_str());
vector<string> searchPaths;
searchPaths.push_back(m_project.getProjectDir());
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
// create opengl view
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
eglView->setMenuResource(MAKEINTRESOURCE(IDC_LUAHOSTWIN32));
eglView->setWndProc(WindowProc);
eglView->setFrameSize(m_project.getFrameSize().width, m_project.getFrameSize().height);
eglView->setFrameZoomFactor(m_project.getFrameScale());
// make window actived
m_hwnd = eglView->getHWnd();
BringWindowToTop(m_hwnd);
// restore window position
const CCPoint windowOffset = m_project.getWindowOffset();
if (windowOffset.x >= 0 || windowOffset.y >= 0)
{
eglView->moveWindow(windowOffset.x, windowOffset.y);
}
// set icon
HICON icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_LUAHOSTWIN32));
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon);
SendMessage(hwndConsole, WM_SETICON, ICON_BIG, (LPARAM)icon);
// run game
CCLuaStack *stack = CCLuaEngine::defaultEngine()->getLuaStack();
const vector<string> arr = m_project.getPackagePathArray();
for (vector<string>::const_iterator it = arr.begin(); it != arr.end(); ++it)
{
stack->addSearchPath(it->c_str());
}
m_app->run();
// cleanup
CCScriptEngineManager::sharedManager()->removeScriptEngine();
CCScriptEngineManager::purgeSharedManager();
CocosDenshion::SimpleAudioEngine::end();
delete m_app;
m_app = NULL;
} while (!m_exit);
FreeConsole();
return 0;
}