std::vector<IMenu*> LayoutManager::findAllMenus(IWindow& window, const char* path) { // create a collection of all menus associated with this window. auto& windowMenus = window.menus(); std::vector<IMenu*> menus(windowMenus.size() + dynamicMenus_.size()); // copy all the menus owned by the window auto it = std::transform(windowMenus.begin(), windowMenus.end(), menus.begin(), [](const std::unique_ptr<IMenu>& menu) { return menu.get(); }); // copy all the menus dynamically registered for this window auto windowId = safe_str(window.id()); it = std::copy_if(dynamicMenus_.begin(), dynamicMenus_.end(), it, [&](IMenu* menu) { auto menuWindowId = safe_str(menu->windowId()); return strcmp(windowId, menuWindowId) == 0; }); // resize the collection to the actual number of menus that were collected menus.erase(it, menus.end()); for (auto it = menus.begin(); it != menus.end();) { if (matchMenu(**it, path)) { ++it; continue; } it = menus.erase(it); } return menus; }
bool CPointOutput::Run() { if(m_bIsRun) return false; IWindow* pWindow = ALCHEMY_PLATFORM_MANAGER.GetWindow(1); if(pWindow) { UINT uType; if( ALCHEMY_GET_EVENT_TYPE(uType, POINT_MOVE, IWindow) ) pWindow->AddEventListener(uType, m_Move); if( ALCHEMY_GET_EVENT_TYPE(uType, POINT_ON, IWindow) ) pWindow->AddEventListener(uType, m_On); if( ALCHEMY_GET_EVENT_TYPE(uType, POINT_OUT, IWindow) ) pWindow->AddEventListener(uType, m_Out); m_bIsRun = true; return true; } return false; }
void Camera::SetWindow(IWindow& window){ this->window.RemoveCamera(*this); this->window = window; window.AddCamera(*this); Rect<unsigned int> windowRect = Rect<unsigned int>(0,0,window.GetResolution().Get(0),window.GetResolution().Get(1)); rect = rect.Intersect(windowRect); if (!renderer->IsContextSupported(window.GetContext())) { Debug::LogWarning("Windows context not supported by renderer. Switching to default renderer."); renderer = window.DefaultRenderer(); } }
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nShowCmd ) { WSIZE wSize = { 100, 100, 350, 320 }; IWindow *WndInterface = GetInterface(); if(WndInterface) { WndInterface->CreateWnd(L"Test Title", wSize ); WndInterface->Run(); WndInterface->Release(); UnregisterClass(L"Main_ClAsS", hInstance); } return TRUE; }
void CNullRenderer::draw(const IScene& scene, const ICamera& camera, const IWindow& window, const IGraphicsResourceManager& manager) { window.setActive(); // Set clear color glClearColor(0.f, 0.f, 0.f, 1.f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); return; }
void LinksPlayer::run() { IWindow* parent; ::usleep(1000000); if (surface != NULL) { parent = (IWindow*)(surface->getParent()); if (parent != NULL) { parent->renderFrom(surface); browserSetFlipWindow(mBrowser, parent->getContent()); } } if (notifyContentUpdate) { while (status == PLAY || status == PAUSE) { notifyListeners( PL_NOTIFY_UPDATECONTENT, "", TYPE_PASSIVEDEVICE); this->usleep(65); } } }
// Entry point into the application int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int nCmdShow) { g_app_instance = hInstance; //use the factory to create our objects. IGame * game = get_game(); IWindow * window = get_game_window( game ); g_input = get_game_input(); window->Run(); // Run the application // Cleanup our objects. release_game_input(&g_input); release_game_window( &window ); release_game( &game ); return 0; }
int Application::Create(IWindow &window, IScene &scene) { assert( !MainWindow || MainWindow == &window ); MainWindow = &window; // Create window - assume that window has been precreated if (! window.Create() ) { Destroy(); return WINDOW_ERROR; } // Call event bool res = true; OnApplicationCreate(res); if (!res) { Destroy(); return EVENT_ERROR; } // Init window events SceneCur = &scene; window.OnCreate.Set(this, ::MainWindow_OnCreate); window.OnResize.Set(this, ::MainWindow_OnResize); // Create scene if (! SceneCur->Create(0, 0, window.Width_Get(), window.Height_Get()) ) { Destroy(); return SCENE_ERROR; } SceneCur->Enter(); return SUCCESS; }
void LayoutManager::removeWindow(IWindow& window) { auto windowId = safe_str(window.id()); auto windowIt = windows_.find(windowId); if (windowIt == windows_.end()) { return; } removeActions(window); removeViews(window); windows_.erase(windowId); }
void LayoutManager::addWindow(IWindow& window) { auto windowId = safe_str(window.id()); auto windowIt = windows_.find(windowId); if (windowIt != windows_.end()) { // error? return; } windows_[windowId] = &window; // after adding a window we need to reevaluate all the actions and views that we registered // against this window as they now all need to be added to the UI refreshActions(window); refreshViews(window); }
int main() { IWindow* w; ISurface* s; ILocalDeviceManager* dm; IPlayer* player; IPlayer* img; #if HAVE_COMPSUPPORT IComponentManager* cm = IComponentManager::getCMInstance(); dm = ((LocalDeviceManagerCreator*)(cm->getObject("LocalDeviceManager")))(); #else dm = LocalDeviceManager::getInstance(); #endif dm->createDevice("systemScreen(0)"); #if HAVE_COMPSUPPORT w = ((WindowCreator*)(cm->getObject("Window")))(10, 10, 100, 100); #else w = new DFBWindow(10, 10, 100, 100); #endif w->setCaps(w->getCap("ALPHACHANNEL")); w->draw(); w->show(); player = new Player("teste"); img = new ImagePlayer("/root/bg_initializing.png"); s = img->getSurface(); w->renderFrom(s); //TODO: tests cout << "Player test has shown image. press enter to continue" << endl; getchar(); dm->clearWidgetPools(); cout << "Player test has released widgets. press enter to continue" << endl; getchar(); return 0; }
// // I_SetVideoMode // // Main function to set the video mode at the hardware level. // void I_SetVideoMode(int width, int height, int surface_bpp, bool fullscreen, bool vsync) { // ensure the requested mode is valid IVideoMode desired_mode(width, height, surface_bpp, fullscreen); IVideoMode mode = I_ValidateVideoMode(&desired_mode); assert(mode.isValid()); IWindow* window = I_GetWindow(); window->setMode(mode.getWidth(), mode.getHeight(), mode.getBitsPerPixel(), mode.isFullScreen(), vsync); I_ForceUpdateGrab(); // [SL] 2011-11-30 - Prevent the player's view angle from moving I_FlushInput(); // Set up the primary and emulated surfaces primary_surface = window->getPrimarySurface(); int surface_width = primary_surface->getWidth(), surface_height = primary_surface->getHeight(); I_FreeSurface(converted_surface); converted_surface = NULL; I_FreeSurface(matted_surface); matted_surface = NULL; I_FreeSurface(emulated_surface); emulated_surface = NULL; // Handle a requested 8bpp surface when the video capabilities only support 32bpp if (surface_bpp != mode.getBitsPerPixel()) { const PixelFormat* format = surface_bpp == 8 ? I_Get8bppPixelFormat() : I_Get32bppPixelFormat(); converted_surface = new IWindowSurface(surface_width, surface_height, format); primary_surface = converted_surface; } // clear window's surface to all black; primary_surface->lock(); primary_surface->clear(); primary_surface->unlock(); // [SL] Determine the size of the matted surface. // A matted surface will be used if pillar-boxing or letter-boxing are used, or // if vid_320x200/vid_640x400 are being used in a wide-screen video mode, or // if vid_overscan is used to create a matte around the entire screen. // // Only vid_overscan creates a matted surface if the video mode is 320x200 or 640x400. // if (vid_overscan < 1.0f) { surface_width *= vid_overscan; surface_height *= vid_overscan; } if (!I_IsProtectedResolution(I_GetVideoWidth(), I_GetVideoHeight())) { if (vid_320x200 || vid_640x400) surface_width = surface_height * 4 / 3; else if (V_UsePillarBox()) surface_width = surface_height * 4 / 3; else if (V_UseLetterBox()) surface_height = surface_width * 9 / 16; } // Ensure matted surface dimensions are sane and sanitized. surface_width = clamp<uint16_t>(surface_width, 320, MAXWIDTH); surface_height = clamp<uint16_t>(surface_height, 200, MAXHEIGHT); // Anything wider than 16:9 starts to look more distorted and provides even more advantage, so for now // if the monitor aspect ratio is wider than 16:9, clamp it to that (TODO: Aspect ratio selection) if (surface_width / surface_height > 16 / 9) surface_width = (surface_height * 16) / 9; // Is matting being used? Create matted_surface based on the primary_surface. if (surface_width != primary_surface->getWidth() || surface_height != primary_surface->getHeight()) { matted_surface = new IWindowSurface(primary_surface, surface_width, surface_height); primary_surface = matted_surface; } // Create emulated_surface for emulating low resolution modes. if (vid_320x200) { emulated_surface = new IWindowSurface(320, 200, primary_surface->getPixelFormat()); emulated_surface->clear(); } else if (vid_640x400) { emulated_surface = new IWindowSurface(640, 400, primary_surface->getPixelFormat()); emulated_surface->clear(); } screen = primary_surface->getDefaultCanvas(); assert(I_VideoInitialized()); if (*window->getVideoMode() != desired_mode) DPrintf("I_SetVideoMode: could not set video mode to %s. Using %s instead.\n", I_GetVideoModeString(&desired_mode).c_str(), I_GetVideoModeString(window->getVideoMode()).c_str()); else DPrintf("I_SetVideoMode: set video mode to %s\n", I_GetVideoModeString(window->getVideoMode()).c_str()); const argb_t* palette = V_GetGamePalette()->colors; if (matted_surface) matted_surface->setPalette(palette); if (emulated_surface) emulated_surface->setPalette(palette); if (converted_surface) converted_surface->setPalette(palette); // handle the -noblit parameter when playing a LMP demo if (noblit) window->disableRefresh(); else window->enableRefresh(); }
void GingaNclGfx::show(int l, int t, int w, int h) { int size, compRollerW, compRollerH, initX, initY; double rate; vector<int> x; vector<int> y; AnimePlayer* p; IWindow* win; ISurface* s; vector<string>* mrls, *mrlsAux; IComponentManager* cm = IComponentManager::getCMInstance(); release(); GingaNclGfx::w = w; GingaNclGfx::h = h; rate = 0.2; initX = (w/2) - ((550 * rate)/2); initY = (h/2) - ((530 * rate)/2); x.push_back(initX + (130 * rate)); x.push_back(initX + (240 * rate)); x.push_back(initX + (340 * rate)); x.push_back(initX + (400 * rate)); x.push_back(initX + (340 * rate)); x.push_back(initX + (240 * rate)); x.push_back(initX + (130 * rate)); x.push_back(initX + (60 * rate)); y.push_back(initY + (90 * rate)); y.push_back(initY + (50 * rate)); y.push_back(initY + (90 * rate)); y.push_back(initY + (190 * rate)); y.push_back(initY + (330 * rate)); y.push_back(initY + (380 * rate)); y.push_back(initY + (330 * rate)); y.push_back(initY + (190 * rate)); compRollerW = 115 * rate; compRollerH = 113 * rate; mrls = new vector<string>; mrls->push_back("/usr/local/lib/ginga/files/img/roller/b1.png"); mrls->push_back("/usr/local/lib/ginga/files/img/roller/b2.png"); mrls->push_back("/usr/local/lib/ginga/files/img/roller/b3.png"); mrls->push_back("/usr/local/lib/ginga/files/img/roller/b4.png"); mrls->push_back("/usr/local/lib/ginga/files/img/roller/b5.png"); mrls->push_back("/usr/local/lib/ginga/files/img/roller/b6.png"); mrls->push_back("/usr/local/lib/ginga/files/img/roller/b7.png"); mrls->push_back("/usr/local/lib/ginga/files/img/roller/b8.png"); animes = new vector<AnimePlayer*>; bg = ((WindowCreator*)(cm->getObject("Window")))(l, t, w, h); s = ((ImageRenderer*)(cm->getObject("ImageRenderer")))( (char*)("/usr/local/lib/ginga/files/img/roller/loading.png")); bg->setCaps(bg->getCap("ALPHACHANNEL")); bg->draw(); bg->show(); bg->raiseToTop(); bg->renderFrom(s); delete s; s = NULL; bottom = ((WindowCreator*)(cm->getObject("Window")))( 5, h - 30, w / 2, 30); bottom->setCaps(bottom->getCap("ALPHACHANNEL")); bottom->draw(); bottom->setBackgroundColor(0, 0, 0, 0); bottom->show(); bottom->raiseToTop(); top = ((WindowCreator*)(cm->getObject("Window")))(5, 5, w / 2, 30); top->setCaps(top->getCap("ALPHACHANNEL")); top->draw(); top->setBackgroundColor(0, 0, 0, 0); top->show(); top->raiseToTop(); size = mrls->size(); for (unsigned int i = 0; i < size; i++) { mrlsAux = new vector<string>(*mrls); p = createAnimePlayer(mrlsAux); win = ((WindowCreator*)(cm->getObject("Window")))( x[i], y[i], compRollerW, compRollerH); win->setCaps(win->getCap("ALPHACHANNEL")); win->draw(); win->show(); win->raiseToTop(); p->setVoutWindow(win); animes->push_back(p); roll(mrls); } delete mrls; mrls = NULL; for (unsigned int i = 0; i < size; i++) { ((*animes)[i])->play(); } }
void GingaNclGfx::show(int l, int t, int w, int h) { int compRollerW, compRollerH, initX, initY; unsigned int i, size; double rate; vector<int> x; vector<int> y; AnimePlayer* p; IWindow* win; ISurface* s; vector<string>* mrls, *mrlsAux; release(); GingaNclGfx::w = w; GingaNclGfx::h = h; rate = 0.2; initX = (w/2) - ((550 * rate)/2); initY = (h/2) - ((530 * rate)/2); x.push_back(initX + (130 * rate)); x.push_back(initX + (240 * rate)); x.push_back(initX + (340 * rate)); x.push_back(initX + (400 * rate)); x.push_back(initX + (340 * rate)); x.push_back(initX + (240 * rate)); x.push_back(initX + (130 * rate)); x.push_back(initX + (60 * rate)); y.push_back(initY + (90 * rate)); y.push_back(initY + (50 * rate)); y.push_back(initY + (90 * rate)); y.push_back(initY + (190 * rate)); y.push_back(initY + (330 * rate)); y.push_back(initY + (380 * rate)); y.push_back(initY + (330 * rate)); y.push_back(initY + (190 * rate)); compRollerW = 115 * rate; compRollerH = 113 * rate; mrls = new vector<string>; mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b1.png"); mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b2.png"); mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b3.png"); mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b4.png"); mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b5.png"); mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b6.png"); mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b7.png"); mrls->push_back(DATA_PREFIX_PATH "/share/ginga/img/roller/b8.png"); animes = new vector<AnimePlayer*>; #if HAVE_COMPSUPPORT bg = ((WindowCreator*)(cm->getObject("Window")))(l, t, w, h); s = ((ImageRenderer*)(cm->getObject("ImageRenderer")))( (char*)(DATA_PREFIX_PATH "/share/ginga/img/roller/loading.png")); #else bg = new DFBWindow(l, t, w, h); s = ImagePlayer::renderImage( DATA_PREFIX_PATH "/share/ginga/img/roller/loading.png"); #endif bg->setCaps(bg->getCap("ALPHACHANNEL")); bg->draw(); bg->show(); bg->raiseToTop(); bg->renderFrom(s); delete s; s = NULL; #if HAVE_COMPSUPPORT bottom = ((WindowCreator*)(cm->getObject("Window")))( 5, h - 30, w / 2, 30); #else bottom = new DFBWindow( 5, h - 30, w / 2, 30); #endif bottom->setCaps(bottom->getCap("ALPHACHANNEL")); bottom->draw(); bottom->setBackgroundColor(0, 0, 0, 0); bottom->show(); bottom->raiseToTop(); #if HAVE_COMPSUPPORT top = ((WindowCreator*)(cm->getObject("Window")))(5, 5, w / 2, 30); #else top = new DFBWindow(5, 5, w / 2, 30); #endif top->setCaps(top->getCap("ALPHACHANNEL")); top->draw(); top->setBackgroundColor(0, 0, 0, 0); top->show(); top->raiseToTop(); size = mrls->size(); for (i = 0; i < size; i++) { mrlsAux = new vector<string>(*mrls); p = createAnimePlayer(mrlsAux); #if HAVE_COMPSUPPORT win = ((WindowCreator*)(cm->getObject("Window")))( x[i], y[i], compRollerW, compRollerH); #else win = new DFBWindow( x[i], y[i], compRollerW, compRollerH); #endif win->setCaps(win->getCap("ALPHACHANNEL")); win->draw(); win->show(); win->raiseToTop(); p->setVoutWindow(win); animes->push_back(p); roll(mrls); } delete mrls; mrls = NULL; for (unsigned int i = 0; i < size; i++) { ((*animes)[i])->play(); } }
void CommonCoreManager::startPresentation() { int aPid, vPid; #if HAVE_TUNER && HAVE_TSPARSER && HAVE_DSMCC NclPlayerData* data = NULL; StcWrapper* sw = NULL; INetworkInterface* ni = NULL; ITSFilter* mavFilter = NULL; IWindow* wmv = NULL; ISurface* s = NULL; ISurface* smv = NULL; //IPlayer* ma = NULL; IPlayer* mv = NULL; string mrlv = "sbtvd-ts://dvr0.ts"; //string mrla = "sbtvd-ts://dvr1.ts"; data = pem->createNclPlayerData(); if (fileExists(PREFIX_PATH "/tuner/tuning.png")) { #if HAVE_COMPSUPPORT tuningWindow = ((WindowCreator*)(cm->getObject("Window")))( data->x, data->y, data->w, data->h); s = ((ImageRenderer*)(cm->getObject("ImageRenderer")))( (char*)(PREFIX_PATH "/tuner/tuning.png")); #else tuningWindow = new DFBWindow(data->x, data->y, data->w, data->h); s = ImagePlayer::renderImage( PREFIX_PATH "/tuner/tuning.png"); #endif ((IWindow*)tuningWindow)->setCaps( ((IWindow*)tuningWindow)->getCap("ALPHACHANNEL")); ((IWindow*)tuningWindow)->draw(); ((IWindow*)tuningWindow)->show(); ((IWindow*)tuningWindow)->lowerToBottom(); ((IWindow*)tuningWindow)->renderFrom(s); delete s; s = NULL; } #if HAVE_COMPSUPPORT wmv = ((WindowCreator*)(cm->getObject("Window")))( data->x, data->y, data->w, data->h); #else wmv = new DFBWindow(data->x, data->y, data->w, data->h); #endif wmv->draw(); delete data; ((ITuner*)tuner)->tune(); ((IDemuxer*)demuxer)->waitProgramInformation(); if (ocDelay == 0) { ((IDataProcessor*)dataProcessor)-> createStreamTypeSectionFilter( STREAM_TYPE_DSMCC_TYPE_B, (IDemuxer*)demuxer); } pem->setCurrentPrivateBaseId(((IDemuxer*)demuxer)->getTSId()); if (ocDelay > 0) { ((IDataProcessor*)dataProcessor)-> createStreamTypeSectionFilter( STREAM_TYPE_DSMCC_TYPE_B, (IDemuxer*)demuxer); ::usleep((int)(ocDelay * 1000)); } #if HAVE_COMPSUPPORT mavFilter = ((filterCreator*)(cm->getObject("PipeFilter")))(0); #else mavFilter = new PipeFilter(0); #endif //mavFilter->addDestination(1); ((IDemuxer*)demuxer)->addPesFilter(PFT_DEFAULTTS, mavFilter); // Create Main AV cout << "lssm-ccm::sp creating av player" << endl; #if HAVE_COMPSUPPORT mv = ((PlayerCreator*)(cm->getObject("AVPlayer")))( mrlv.c_str(), true); //ma = ((PlayerCreator*)(cm->getObject("AVPlayer")))( // mrla.c_str(), false); #else mv = new AVPlayer(mrlv.c_str(), true); //ma = new AVPlayer(mrla.c_str(), true); #endif //ma->setOutWindow(NULL); mv->setOutWindow(wmv); cout << "lssm-ccp::sp create av ok" << endl; vPid = ((IDemuxer*)demuxer)->getDefaultMainVideoPid(); aPid = ((IDemuxer*)demuxer)->getDefaultMainAudioPid(); ((IDemuxer*)demuxer)->waitBuffers(); while (smv == NULL) { smv = mv->getSurface(); ::usleep(100000); } ni = ((ITuner*)tuner)->getCurrentInterface(); if (ni != NULL && ni->getCaps() & DPC_CAN_DECODESTC) { cout << "lssm-ccp::sp using stc hardware!" << endl; ((IDataProcessor*)dataProcessor)->setSTCProvider(ni); } else { cout << "lssm-ccp::sp using stc wrapper!" << endl; sw = new StcWrapper(mv); ((IDataProcessor*)dataProcessor)->setSTCProvider(sw); } nptProvider = ((IDataProcessor*)dataProcessor)->getNPTProvider(); if (nptProvider != NULL) { pem->setTimeBaseProvider((ITimeBaseProvider*)nptProvider); } /*((IDataProcessor*)dataProcessor)-> createStreamTypeSectionFilter( STREAM_TYPE_DSMCC_TYPE_C, (IDemuxer*)demuxer);*/ ((IDataProcessor*)dataProcessor)-> createStreamTypeSectionFilter( STREAM_TYPE_DSMCC_TYPE_D, (IDemuxer*)demuxer); /*((IDataProcessor*)dataProcessor)-> createPidSectionFilter( SDT_PID, (IDemuxer*)demuxer); //SDT ((IDataProcessor*)dataProcessor)-> createPidSectionFilter( EIT_PID, (IDemuxer*)demuxer); //EIT ((IDataProcessor*)dataProcessor)-> createPidSectionFilter( CDT_PID, (IDemuxer*)demuxer); //CDT*/ wmv->show(); if (tuningWindow != NULL) { ((IWindow*)tuningWindow)->clearContent(); ((IWindow*)tuningWindow)->hide(); delete ((IWindow*)tuningWindow); tuningWindow = NULL; } pthread_mutex_t mutex; pthread_cond_t condition; cout << "lssm ccm::sp cond_wait" << endl; pthread_mutex_init(&mutex, NULL); pthread_cond_init(&condition, NULL); pthread_mutex_lock(&mutex); pthread_cond_wait(&condition, &mutex); pthread_mutex_unlock(&mutex); pthread_mutex_destroy(&mutex); pthread_cond_destroy(&condition); cout << "lssm ccm::sp all done!" << endl; #endif //TUNER... // Activate PEM Connector //pem->startConnector(); }