void ReymentaHapPlayerApp::setup() { g_Width = 640; g_Height = 480; // parameters mParameterBag = ParameterBag::create(); // utils mBatchass = Batchass::create(mParameterBag); // if AutoLayout, try to position the window on the 2nd screen if (mParameterBag->mAutoLayout) { mBatchass->getWindowsResolution(); } setWindowSize(mParameterBag->mRenderWidth, mParameterBag->mRenderHeight); setWindowPos(ivec2(mParameterBag->mRenderX, mParameterBag->mRenderY)); setFullScreen(false); //enableHighDensityDisplay(); setFrameRate(60); mBatchass->setup(); mLoopVideo = false; // -------- SPOUT ------------- // Set up the texture we will use to send out // We grab the screen so it has to be the same size bInitialized = false; }
BOOL LLWindowMacOSX::setPosition(const LLCoordScreen position) { if(mWindow) { float pos[2] = {position.mX, position.mY}; setWindowPos(mWindow, pos); } return TRUE; }
void SDLManager::setWIndowPosY(int y){ setWindowPos(-1,y); }
void SDLManager::setWindowPosX(int x){ setWindowPos(x); }
/** * \brief Show window event handler * * Given virtual function is called by the parent class whenever the window is * being shown, hidden or closed. * * When the window is being shown with an enabled effect function, a timer is * created that takes care of the window slide-in animation. * If the window is being hidden or closed with an enabled effect function, * another timer is created that takes care of the window slide-out animation. * * \return Retuns true if the window is being shown or effects are disabled, * returns false if the window is being closed or hidden and effects are * enabled. */ bool GuiEffectWindow::onShowWindow(SHOW_WINDOW_TYPE type, int extCode) { s_thread_mutex_lock(effectMutex); showWindowType = type; closeRetCode = extCode; if(type == SHOW_WINDOW) { originalPos = windowPos; switch(openEffectType) { case OPEN_EFFECT_NONE: s_thread_mutex_unlock(effectMutex); return true; case OPEN_EFFECT_SLIDE_BOTTOM: windowPos.y = -windowPos.h; refreshRealSurface = false; break; case OPEN_EFFECT_SLIDE_TOP: windowPos.y = wndHandle->surface->height; refreshRealSurface = false; break; case OPEN_EFFECT_SLIDE_LEFT: windowPos.x = wndHandle->surface->width; refreshRealSurface = false; break; case OPEN_EFFECT_SLIDE_RIGHT: windowPos.x = -windowPos.w; refreshRealSurface = false; break; } setWindowPos(windowPos); effectTimer = startTimer(30, openEffectType, NULL); #ifdef DEBUG printf("GuiEffectWindow::onShowWindow: started timer %x\n", effectTimer); #endif s_thread_mutex_unlock(effectMutex); return true; } else { originalPos = windowPos; if(effectTimer) { #ifdef DEBUG printf("GuiEffectWindow::onShowWindow: stopping timer %x\n", effectTimer); #endif stopTimer(effectTimer); effectTimer = NULL; } if(closeEffectType == CLOSE_EFFECT_NONE) { #ifdef DEBUG printf("GuiEffectWindow::onShowWindow: no effect\n"); #endif s_thread_mutex_unlock(effectMutex); return true; } #ifdef DEBUG printf("GuiEffectWindow::onShowWindow: starting timer...\n"); #endif effectTimer = startTimer(30, closeEffectType, NULL); refreshRealSurface = false; s_thread_mutex_unlock(effectMutex); #ifdef DEBUG printf("%x done\n", effectTimer); #endif return false; } }
/** * \brief Timer event handler * * Given virtual function is called by the parent window whenever a timer is * fired. In the context of effect-enabled windows, the timer is used to * implement window slide-in and slide-out animations. * * \param idTimer Specifies the timer identifier */ void GuiEffectWindow::onTimer(int idTimer) { s_thread_mutex_lock(effectMutex); // check if we have a stale timer event if(effectTimer == NULL) { #ifdef DEBUG printf("stale timer %d\n", idTimer); #endif s_thread_mutex_unlock(effectMutex); return; } #ifdef DEBUG printf("GuiEffectWindow::onTimer: %d locked\n", idTimer); #endif switch(idTimer) { case OPEN_EFFECT_SLIDE_BOTTOM: if(windowPos.y >= originalPos.y) { stopTimer(effectTimer); effectTimer = NULL; break; } windowPos.y += originalPos.y - windowPos.y < effectVertSpeed ? originalPos.y - windowPos.y : effectVertSpeed; if(windowPos.y >= originalPos.y) refreshRealSurface = true; setWindowPos(windowPos); break; case OPEN_EFFECT_SLIDE_RIGHT: if(windowPos.x >= originalPos.x) { stopTimer(effectTimer); effectTimer = NULL; break; } windowPos.x += originalPos.x - windowPos.x < effectHorzSpeed ? originalPos.x - windowPos.x : effectHorzSpeed; if(windowPos.x >= originalPos.x) refreshRealSurface = true; #ifdef DEBUG printf("GuiEffectWindow::onTimer: open %d %d %d %d\n", windowPos.x, windowPos.y, windowPos.w, windowPos.h); #endif setWindowPos(windowPos); break; case OPEN_EFFECT_SLIDE_TOP: if(windowPos.y <= originalPos.y) { stopTimer(effectTimer); effectTimer = NULL; break; } windowPos.y -= windowPos.y - originalPos.y < effectVertSpeed ? windowPos.y - originalPos.y : effectVertSpeed; if(windowPos.y <= originalPos.y) refreshRealSurface = true; setWindowPos(windowPos); break; case OPEN_EFFECT_SLIDE_LEFT: if(windowPos.x <= originalPos.x) { stopTimer(effectTimer); effectTimer = NULL; break; } windowPos.x -= windowPos.x - originalPos.x < effectHorzSpeed ? windowPos.x - originalPos.x : effectHorzSpeed; if(windowPos.x <= originalPos.x) refreshRealSurface = true; setWindowPos(windowPos); break; case CLOSE_EFFECT_SLIDE_BOTTOM: if(windowPos.y >= wndHandle->surface->height) { stopTimer(effectTimer); effectTimer = NULL; if(showWindowType == HIDE_WINDOW) { s_window_hide(wndHandle); } else if(showWindowType == CLOSE_WINDOW) { returnCode = closeRetCode; isShuttingDown = true; s_window_quit(wndHandle); } break; } windowPos.y += effectVertSpeed; setWindowPos(windowPos); break; case CLOSE_EFFECT_SLIDE_RIGHT: if(windowPos.x >= wndHandle->surface->width) { stopTimer(effectTimer); effectTimer = NULL; if(showWindowType == HIDE_WINDOW) { s_window_hide(wndHandle); } else if(showWindowType == CLOSE_WINDOW) { returnCode = closeRetCode; isShuttingDown = true; s_window_quit(wndHandle); } break; } windowPos.x += effectHorzSpeed; #ifdef DEBUG printf("GuiEffectWindow::onTimer: close %d %d %d %d\n", windowPos.x, windowPos.y, windowPos.w, windowPos.h); #endif setWindowPos(windowPos); break; case CLOSE_EFFECT_SLIDE_TOP: if(windowPos.y + windowPos.h <= 0) { stopTimer(effectTimer); effectTimer = NULL; if(showWindowType == HIDE_WINDOW) { s_window_hide(wndHandle); } else if(showWindowType == CLOSE_WINDOW) { returnCode = closeRetCode; isShuttingDown = true; s_window_quit(wndHandle); } break; } windowPos.y -= effectVertSpeed; setWindowPos(windowPos); break; case CLOSE_EFFECT_SLIDE_LEFT: if(windowPos.x + windowPos.w <= 0) { stopTimer(effectTimer); effectTimer = NULL; if(showWindowType == HIDE_WINDOW) { s_window_hide(wndHandle); } else if(showWindowType == CLOSE_WINDOW) { returnCode = closeRetCode; isShuttingDown = true; s_window_quit(wndHandle); } break; } windowPos.x -= effectHorzSpeed; setWindowPos(windowPos); break; } s_thread_mutex_unlock(effectMutex); #ifdef DEBUG printf("GuiEffectWindow::onTimer: %d unlocked\n", idTimer); #endif }
void ReymentaServerApp::setup() { // parameters mParameterBag = ParameterBag::create(); mParameterBag->mLiveCode = true; mParameterBag->mRenderThumbs = false; loadShader(getAssetPath("default.fs")); // utils mBatchass = Batchass::create(mParameterBag); CI_LOG_V("reymenta setup"); mFirstLaunch = true; setWindowSize(mParameterBag->mMainWindowWidth, mParameterBag->mMainWindowHeight); // 12 fps is enough for a router setFrameRate(120.0f); setWindowPos(ivec2(0, 40)); // setup shaders and textures mBatchass->setup(); mParameterBag->mMode = MODE_WARP; mParameterBag->iResolution.x = mParameterBag->mRenderWidth; mParameterBag->iResolution.y = mParameterBag->mRenderHeight; mParameterBag->mRenderResolution = ivec2(mParameterBag->mRenderWidth, mParameterBag->mRenderHeight); CI_LOG_V("createRenderWindow, resolution:" + toString(mParameterBag->iResolution.x) + "x" + toString(mParameterBag->iResolution.y)); mParameterBag->mRenderResoXY = vec2(mParameterBag->mRenderWidth, mParameterBag->mRenderHeight); mParameterBag->mRenderPosXY = ivec2(mParameterBag->mRenderX, mParameterBag->mRenderY); // instanciate the console class mConsole = AppConsole::create(mParameterBag, mBatchass); // imgui margin = 3; inBetween = 3; // mPreviewFboWidth 80 mPreviewFboHeight 60 margin 10 inBetween 15 mPreviewWidth = 160;mPreviewHeight = 120; w = mParameterBag->mPreviewFboWidth + margin; h = mParameterBag->mPreviewFboHeight * 2.3; largeW = (mParameterBag->mPreviewFboWidth + margin) * 4; largeH = (mParameterBag->mPreviewFboHeight + margin) * 5; largePreviewW = mParameterBag->mPreviewWidth + margin; largePreviewH = (mParameterBag->mPreviewHeight + margin) * 2.4; displayHeight = mParameterBag->mMainDisplayHeight - 50; mouseGlobal = false; showConsole = showGlobal = showTextures = showAudio = showMidi = showChannels = showShaders = true; showTest = showTheme = showOSC = showFbos = false; /* set ui window and io events callbacks with autorender == false, we have to use NewFrame and Render but we have access to DrawData to send to remoteImGui void Renderer::initFontTexture() { unsigned char* pixels; int width, height; ImGui::GetIO().Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); mFontTexture = gl::Texture::create( pixels, GL_RGBA, width, height, gl::Texture::Format().magFilter(GL_LINEAR).minFilter(GL_LINEAR) ); ImGui::GetIO().Fonts->ClearTexData(); ImGui::GetIO().Fonts->TexID = (void *)(intptr_t) mFontTexture->getId(); } ui::initialize(ui::Options().autoRender(false).fonts({ { getAssetPath("KontrapunktBob-Light.ttf"), 12 }, { getAssetPath("KontrapunktBob-Bold.ttf"), 20 }, { getAssetPath("DroidSans.ttf"), 12 } }) .fontGlyphRanges("DroidSans", { 0xf000, 0xf06e, 0 })); */ ui::initialize(ui::Options().autoRender(false)); // warping mUseBeginEnd = false; updateWindowTitle(); disableFrameRate(); // initialize warps mSettings = getAssetPath("") / "warps.xml"; if (fs::exists(mSettings)) { // load warp settings from file if one exists mWarps = Warp::readSettings(loadFile(mSettings)); } else { // otherwise create a warp from scratch mWarps.push_back(WarpBilinear::create()); mWarps.push_back(WarpPerspective::create()); mWarps.push_back(WarpPerspectiveBilinear::create()); } // load test image try { mImage = gl::Texture::create(loadImage(loadAsset("help.jpg")), gl::Texture2d::Format().loadTopDown().mipmap(true).minFilter(GL_LINEAR_MIPMAP_LINEAR)); //mSrcArea = mImage->getBounds(); // adjust the content size of the warps Warp::setSize(mWarps, mImage->getSize()); } catch (const std::exception &e) { console() << e.what() << std::endl; } mSrcArea = Area(0, 0, mParameterBag->mFboWidth*4, mParameterBag->mFboHeight*4); mMesh = gl::VboMesh::create(geom::Rect()); }