void Graphics::RefreshSceneRect() { // GFade is drawn after the scene buffer, so this is in window space UpdateScreenSize(windowWidth(), windowHeight()); /* Calculates the rectangle within the back buffer that the scene will be drawn in. This accounts for "fit to width/height" scenarios where the back buffer has a different aspect ratio. */ float w = static_cast<float>(windowWidth()); float h = static_cast<float>(windowHeight()); float wFactor = (float)w / config.renderWidth; float hFactor = (float)h / config.renderHeight; mSceneScale = std::min(wFactor, hFactor); int screenW = (int)round(mSceneScale * config.renderWidth); int screenH = (int)round(mSceneScale * config.renderHeight); // Center on screen RECT rect; rect.left = (mWindowWidth - screenW) / 2; rect.top = (mWindowHeight - screenH) / 2; rect.right = rect.left + screenW; rect.bottom = rect.top + screenH; mSceneRect = rect; }
// MainWnd HWND CustomWindow::Criar(HINSTANCE hInst, LPCTSTR wndName) { this->_hWnd = CreateWindowEx(0L, _WndClsEx.lpszClassName, wndName, WS_OVERLAPPEDWINDOW, windowX(), windowY(), windowWidth(), windowHeight(), (HWND)HWND_DESKTOP, NULL, hInst, this); // Se a janela não foi criada if (this->_hWnd != NULL) { SetWindowLongPtr(this->_hWnd, GWLP_USERDATA, (long)this); this->hInst = hInst; return _hWnd; } return NULL; }
// creation du contexte openGL et d'une fenetre TP( ):gk::App() { // specifie le type de contexte openGL a creer : gk::AppSettings settings; settings.setGLVersion(3,3); // version 3.3 settings.setGLCoreProfile(); // core profile settings.setGLDebugContext(); // version debug pour obtenir les messages d'erreur en cas de probleme width=512; height=512; // cree le contexte et une fenetre if(createWindow(width,height, settings) < 0) closeWindow(); m_widgets.init(); m_widgets.reshape(windowWidth(), windowHeight()); }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: attachSexyAPI(); break; case 1: { QStringList _r = exec((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< QStringList*>(_a[0]) = _r; } break; case 2: { QStringList _r = exec((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QStringList*>(_a[0]) = _r; } break; case 3: alert((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 4: quit(); break; case 5: windowMinimize(); break; case 6: windowMaximize(); break; case 7: windowResize((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 8: { int _r = windowWidth(); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 9: { int _r = windowHeight(); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 10: { QStringList _r = getOpenFileName((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< QStringList*>(_a[0]) = _r; } break; case 11: { QStringList _r = getOpenFileName((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QStringList*>(_a[0]) = _r; } break; case 12: { QStringList _r = getOpenFileName(); if (_a[0]) *reinterpret_cast< QStringList*>(_a[0]) = _r; } break; case 13: { QString _r = getSaveFileName((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< const QString(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 14: { QString _r = getSaveFileName((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 15: { QString _r = getSaveFileName(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 16: { QString _r = getDirectory((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 17: { QString _r = getDirectory(); if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; } break; case 18: { QStringList _r = getArgs(); if (_a[0]) *reinterpret_cast< QStringList*>(_a[0]) = _r; } break; default: ; } _id -= 19; } return _id; }
int draw( ) { keys(); // glViewport(0, 0, windowWidth(), windowHeight()); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // mesurer le temps d'execution m_time->start(); // dessiner quelquechose /*glUseProgram(m_program->name); // parametrer le shader m_program->uniform("mvpMatrix")= T.matrix(); // transformation model view projection m_program->uniform("diffuse_color")= gk::VecColor(1, 1, 0); // couleur des fragments // selectionner un ensemble de buffers et d'attributs de sommets glBindVertexArray(m_vao->name); // dessiner un maillage indexe glDrawElements(GL_TRIANGLES, m_indices_size, GL_UNSIGNED_INT, 0);*/ // nettoyage glUseProgram(0); glBindVertexArray(0); // mesurer le temps d'execution m_time->stop(); // afficher le temps d'execution { m_widgets.begin(); m_widgets.beginGroup(nv::GroupFlags_GrowDownFromLeft); m_widgets.doLabel(nv::Rect(), m_time->summary("draw").c_str()); m_widgets.endGroup(); m_widgets.end(); } // afficher le dessin present(); // continuer return 1; }
int Kore::System::desktopHeight() { return windowHeight(0); }
void Controller::setWindowWidth(int width) { engine.getRoomsManager()->setRoomSize(width, windowHeight()); emit windowWidthChanged(); }