/********************************************************************* * * MainTask */ void MainTask(void) { FRAMEWIN_Handle hWinVideo; BUTTON_Handle hBut; GUI_Init(); WM_SetCallback(WM_HBKWIN, _cbBkWin); /* Create buttons */ hBut = BUTTON_CreateEx(240, 5, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0); BUTTON_SetText(hBut, "Create win"); hBut = BUTTON_CreateEx(240, 25, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON1); BUTTON_SetText(hBut, "Delete win"); hBut = BUTTON_CreateEx(240, 45, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON2); BUTTON_SetText(hBut, "Show win"); hBut = BUTTON_CreateEx(240, 65, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON3); BUTTON_SetText(hBut, "Hide win"); /* Create framewin video */ hWinVideo = FRAMEWIN_CreateEx(5, 5, 170, 120, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Video window", _cbFrameWinVideo); FRAMEWIN_SetClientColor(hWinVideo, GUI_INVALID_COLOR); /* Create test windows */ _CreateWindow(); _CreateWindow(); _CreateWindow(); while (1) { GUI_Delay(1000); } }
/********************************************************************* * * _cbBkWin */ static void _cbBkWin(WM_MESSAGE* pMsg) { switch (pMsg->MsgId) { case WM_PAINT: GUI_SetBkColor(GUI_BLACK); GUI_Clear(); break; case WM_NOTIFY_PARENT: if (pMsg->Data.v == WM_NOTIFICATION_RELEASED) { int Id = WM_GetId(pMsg->hWinSrc); switch (Id) { case GUI_ID_BUTTON0: /* Create window */ _CreateWindow(); break; case GUI_ID_BUTTON1: /* Delete window */ _DeleteWindow(); break; case GUI_ID_BUTTON2: /* Show window */ _ShowWindow(); break; case GUI_ID_BUTTON3: /* Hide window */ _HideWindow(); break; } } break; default: WM_DefaultProc(pMsg); } }
bool Application::Initialize(const std::string& configDataPath, OPTIONAL HINSTANCE appInstanceHandler) { this->_SetResourcesPath(); this->_configDataPath = configDataPath; auto logger = Logger::Create(); if (false == Deserialize(ExtendString::Format("%s\\%s", _resourcesPath.c_str(), _configDataPath.c_str()).c_str())) { LOG_ERROR("Failed to deserialize a Application"); return false; } _isReplaceData = true; if (false == _CreateWindow((nullptr == appInstanceHandler) ? GetModuleHandle(nullptr) : appInstanceHandler)) { LOG_ERROR("Failed to create a WinAPI"); return false; } auto director = Director::Create(); if (false == director->Initialize(_winHandler)) { LOG_ERROR("Failed to initialize a Director"); director->Destroy(); return false; } return _OnInitialize(); }
Ogre::SceneManager* DisplayManager::GetSceneManager(const std::string& scene) { if(mSceneManagers.count(scene) == 0) { _CreateWindow(); // TODO check if window already present Logger::Get().Info("Creating a scene manager for scene " + scene + "."); Ogre::SceneManager* mgr = mOgreRoot->createSceneManager("DefaultSceneManager"); mgr->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5)); mSceneManagers[scene] = mgr; } return mSceneManagers[scene]; }
bool MkBaseWindow::SetUpByWindowCreation (HINSTANCE hInstance, WNDPROC wndProc, HWND hParent, const MkStr& title, eSystemWindowProperty sysWinProp, const MkInt2& position, const MkInt2& clientSize, bool fullScreen, bool hide) { // 윈도우 스타일 m_WindowModeStyle = (hide) ? 0 : WS_VISIBLE; m_WindowModeStyle |= (WS_OVERLAPPED | WS_CAPTION); if (MK_FLAG_EXIST(sysWinProp, eSWP_Minimize)) { m_WindowModeStyle |= WS_MINIMIZEBOX; } if (MK_FLAG_EXIST(sysWinProp, eSWP_Maximize)) { m_WindowModeStyle |= WS_MAXIMIZEBOX; } if (MK_FLAG_EXIST(sysWinProp, eSWP_Close)) { m_WindowModeStyle |= WS_SYSMENU; } m_CurrentWindowStyle = (fullScreen) ? FullModeStyle : m_WindowModeStyle; // 윈도우 위치 및 크기 재설정 MkInt2 windowPos = position; MkInt2 windowSize = clientSize; if (fullScreen) { if ((windowSize.x <= 0) || (windowSize.y <= 0)) { windowSize = MK_SYS_ENV.GetBackgroundResolution(); } windowPos = MkInt2::Zero; } else { if ((windowSize.x <= 0) || (windowSize.y <= 0)) { windowSize = GetWorkspaceSize(); if (windowSize == MkInt2::Zero) return false; windowPos = MkInt2::Zero; } else { windowSize = ConvertClientToWindowSize(clientSize); } } // 윈도우 생성 return _CreateWindow(hInstance, wndProc, hParent, title, windowPos, windowSize, fullScreen); }
int vxl::Stoat() { int result = _CreateWindow(); if (result != 0) return result; _Init(); while (!glfwWindowShouldClose(m_window)) { // clear both depth and color each frame glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); _Update(); _Render(); glfwSwapBuffers(m_window); glfwPollEvents(); } return 0; }
/********************************************************************* * * MainTask */ void MainTask(void) { FRAMEWIN_Handle hWinVideo; BUTTON_Handle hBut; WM_HWIN hText; GUI_Init(); WM_SetCallback(WM_HBKWIN, _cbBkWin); hText = TEXT_CreateEx(240, 85, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT0, "The client\nwindow is"); TEXT_SetTextColor(hText, GUI_WHITE); hText = TEXT_CreateEx(240, 111, 80, 26, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_TEXT1, NULL); TEXT_SetTextColor(hText, GUI_WHITE); // // Create buttons // hBut = BUTTON_CreateEx(240, 5, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON0); BUTTON_SetText(hBut, "Create win"); hBut = BUTTON_CreateEx(240, 25, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON1); BUTTON_SetText(hBut, "Delete win"); hBut = BUTTON_CreateEx(240, 45, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON2); BUTTON_SetText(hBut, "Show win"); hBut = BUTTON_CreateEx(240, 65, 75, 18, WM_HBKWIN, WM_CF_SHOW, 0, GUI_ID_BUTTON3); BUTTON_SetText(hBut, "Hide win"); // // Create framewin video // hWinVideo = FRAMEWIN_CreateEx(5, 5, 170, 120, 0, WM_CF_SHOW, FRAMEWIN_CF_MOVEABLE, 0, "Video window", _cbFrameWinVideo); FRAMEWIN_SetClientColor(hWinVideo, GUI_INVALID_COLOR); // // Create test windows // _CreateWindow(); _CreateWindow(); _CreateWindow(); while (1) { GUI_Delay(1000); } }
bool NNWindowsApplication::Init( wchar_t* title, int width, int height, bool isFullscreen, RendererStatus rendererStatus ) { mTitle = title; mScreenWidth = width; mScreenHeight = height; mIsFullscreen = isFullscreen; mRendererStatus = rendererStatus; if ( _CreateWindow( title, width, height, rendererStatus ) == false ) return false; if ( _CreateRenderer( isFullscreen, rendererStatus ) == false ) return false; return true; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int cmdShow) { static TCHAR szAppName[] = TEXT("SampleSRS"); if (!_RegisterClass(szAppName)) { return 1; } if (!_CreateWindow(szAppName, cmdShow)) { return 1; } init_log(); return MessageLoop(); }
bool NNApplication::Init( wchar_t* const title, int width, int height, RendererStatus renderStatus ) { m_hInstance = GetModuleHandle(0); m_Title = title; m_ScreenWidth = width; m_ScreenHeight = height; m_RendererStatus = renderStatus; _CreateWindow( m_Title, m_ScreenWidth, m_ScreenHeight ); _CreateRenderer( renderStatus ); m_pSceneDirector = NNSceneDirector::GetInstance(); m_Renderer->Init(); m_pSceneDirector->Init(); return true; }
bool DisplayManager::RegisterCamera(CameraComponent* camera_component) { std::string name = camera_component->GetName(); // Do not add if a CameraComponent of the same name already exists. if(mCameras.count(name) != 0) return false; int start_size = mCameras.size(); // Create the render window if this is the first CameraComponent. if(mCameras.size() == 0 && (mOgreRoot == nullptr || !mOgreRoot->isInitialised())) _CreateWindow(); mCameras[name] = camera_component; if(start_size == 0) { AddViewport("main", name, true); } return true; }
bool NNApplication::Init( wchar_t* title, int width, int height, RendererStatus renderStatus ) { mhInstance = GetModuleHandle(0); mTitle = title; mScreenWidth = width; mScreenHeight = height; mRendererStatus = renderStatus; _CreateWindow( mTitle, mScreenWidth, mScreenHeight ); _CreateRenderer( renderStatus ); mpSceneDirector = NNSceneDirector::GetInstance(); mRenderer->Init(); mpSceneDirector->Init(); srand( (unsigned int)time(NULL) ) ; return true; }
bool Initialize( HINSTANCE i_hInstance, int i_CmdShow, const char * i_pWindowName, int i_IconID, unsigned int i_WindowWidth, unsigned int i_WindowHeight ) { g_hInstance = i_hInstance; #ifdef UNICODE const size_t lenWindowName = 128; wchar_t WindowName[lenWindowName]; MultiByteToWideChar( CP_ACP, 0, ( i_pWindowName ) ? i_pWindowName : "GLib Render", -1, WindowName, lenWindowName ); LPCTSTR pWindowName = WindowName; #else LPCTSTR pWindowName = ( i_pWindowName ) ? i_pWindowName : "GLib Render"; #endif // UNICODE g_hWnd = _CreateWindow( WndProc, g_hInstance, i_IconID, pWindowName, i_WindowWidth, i_WindowHeight ); if( g_hWnd == nullptr ) { DEBUG_PRINT( "_CreateWindow() failed.\n" ); return NULL; } HRESULT hResult = CreateDevice( g_hWnd ); if( !Succeeded( hResult ) ) { DEBUG_PRINT( "_CreateDevice() failed. HRESULT = %d.\n", hResult ); return false; } ShowWindow( g_hWnd, i_CmdShow ); Input::Initialize(); Sprites::Initialize(); return true; }
void DisplayManager::CreateOgreRoot() { if(mOgreRoot == nullptr) { _CreateWindow(); Root::get_mutable_instance().GetInputManager()->Initialize(mOgreRenderWindow); } }