void changeFullscreenMode() override {
			if(fullscreenMode() == FullScreenMode::FULLSCREEN_EXCLUSIVE) {
				nonfs_width_ = width();
				nonfs_height_ = height();
				if(SDL_SetWindowFullscreen(window_.get(), SDL_WINDOW_FULLSCREEN) != 0) {
					LOG_WARN("Unable to set fullscreen mode at " << width() << " x " << height());
					return;
				}
			} else if(fullscreenMode() == FullScreenMode::FULLSCREEN_WINDOWED) {
				nonfs_width_ = width();
				nonfs_height_ = height();

				if(SDL_SetWindowFullscreen(window_.get(), SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
					LOG_WARN("Unable to set windowed fullscreen mode at " << width() << " x " << height());
					return;
				}
				SDL_SetWindowSize(window_.get(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED);
				SDL_SetWindowPosition(window_.get(), 0, 0);

			} else {
				if(SDL_SetWindowFullscreen(window_.get(), 0) != 0) {
					LOG_WARN("Unable to set windowed mode at " << width() << " x " << height());
					return;
				}
				SDL_SetWindowSize(window_.get(), nonfs_width_, nonfs_height_);
				SDL_SetWindowPosition(window_.get(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
			}
			int w, h;
			SDL_GetWindowSize(window_.get(), &w, &h);
			// update viewport
			setViewPort(0, 0, w, h);
			// update width_ and height_ and notify observers
			updateDimensions(w, h);
		}
Exemple #2
0
PipeLine::PipeLine(FrameBuffer& fbo,int regsN)
    :fbo_(fbo),registers_(regsN),
     uniforms_((Uniforms*)registers_.regs_.data()),
     worldTransform_(),
     viewfrustum_(),
     cam_(viewfrustum_,0.1,0.01)
{

    setCullState(FT_CCW,CT_BACK);
    viewfrustum_.setFrustum(90.0f,fbo.width(),fbo.height(),5,500);

    //viewfrustum_.setFrustum(-400,400,-300,300,50,500);
    setViewPort(fbo.width(),fbo.height(),0,0);
    uniforms_->wpvMatrix_ = viewfrustum_.getProjectionViewMatrix();
    using PT = Mesh::PrimitiveT;

    // FIXME
    //drawFunction_[PT::POLYPOINT] = &PipeLine::drawPolypoint;
    //drawFunction_[PT::POLYSEGMENT_DISJOINT] = &PipeLine::drawPolylineDisjoint;
    //drawFunction_[PT::POLYSEGMENT_CONTIGUOUS] = &PipeLine::drawPolylineContiguous;
    //drawFunction_[PT::TRISTRIP]=

    drawFunction_[PT::TRIMESH] = &PipeLine::drawTriMesh;
    rasterAlgo_[RasAlgo::SCANLINE_ALGO] = &PipeLine::scanlineAlgo;
}
		bool handlePhysicalWindowSizeChange() override {
			if(window_) {
				SDL_SetWindowSize(window_.get(), width(), height());
				setViewPort(0, 0, width(), height());
				return true;
			}
			return false;
		}
Exemple #4
0
void GameLayer::update( float dTime )
{
    //test code
    testCode();
    setViewPort(this, m_Player->getPosition(), cocos2d::Point::ANCHOR_MIDDLE);
    m_BackGround->setPosition(-getPosition() + m_BackGround->getContentSize() / 2);
    m_RoomLayers[m_CurrentRoomNum]->update(dTime);
    m_Player->update(dTime);
    checkIn();
}
// Canvas functions
Canvas::Canvas( int width, int height, const char * windowTitle ) {
	
	// initialize openGL and everything
	glutWin initw(	height, width, 20, 20,
					GLUT_SINGLE | GLUT_RGB,
					windowTitle );
	
	// make sure the frustum is set up properly
	setWindow( 0.0f, (float)width, 0.0f, (float)height );
	setViewPort( 0, width, 0, height );
	
	// set turtle position
	currPos = Point2( 0.0f, 0.0f );
	currDir = 0.0f;

	// set initial colors
	setBackgroundColor( 0.0f, 0.0f, 0.0f );
	setColor( 1.0f, 0.0f, 0.0f );
	
}
Exemple #6
0
void Window::resetViewPort() noexcept
{
    setViewPort( m_wimpl->viewport );
}
Exemple #7
0
void WPainter::setViewPort(double x, double y, double width, double height)
{
    setViewPort(WRectF(x, y, width, height));
}
Exemple #8
0
void AbstractNavigation::resize(const QSize & size)
{
    setViewPort(size.width(), size.height());
}