当前位置: 首页>>代码示例>>C++>>正文


C++ Rect::width方法代码示例

本文整理汇总了C++中common::Rect::width方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::width方法的具体用法?C++ Rect::width怎么用?C++ Rect::width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common::Rect的用法示例。


在下文中一共展示了Rect::width方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: allocateSurface

void Surface::allocateSurface(const Common::Rect &bounds) {
	deallocateSurface();

	if (bounds.isEmpty())
		return;

	_bounds = bounds;
	_surface = new Graphics::Surface();
	_surface->create(bounds.width(), bounds.height(), g_system->getScreenFormat());
	_ownsSurface = true;
}
开发者ID:AlbanBedel,项目名称:scummvm,代码行数:11,代码来源:surface.cpp

示例2: setBounds

void PanoramaScroll::setBounds(const Common::Rect &r) {
	Animation::setBounds(r);

	_boundsWidth = r.width();

	Common::Rect r2;
	_panorama.getViewBounds(r2);
	r2.right = r2.left + _boundsWidth;
	r2.bottom = r2.top + r.height();
	_panorama.setViewBounds(r2);
}
开发者ID:86400,项目名称:scummvm,代码行数:11,代码来源:panoramascroll.cpp

示例3: scrollCopyOldToScreen

void GfxTransitions::scrollCopyOldToScreen(Common::Rect screenRect, int16 x, int16 y) {
	byte *oldScreenPtr = _oldScreen;
	int16 screenWidth = _screen->getDisplayWidth();
	if (_screen->getUpscaledHires()) {
		_screen->adjustToUpscaledCoordinates(screenRect.top, screenRect.left);
		_screen->adjustToUpscaledCoordinates(screenRect.bottom, screenRect.right);
		_screen->adjustToUpscaledCoordinates(y, x);
	}
	oldScreenPtr += screenRect.left + screenRect.top * screenWidth;
	g_system->copyRectToScreen(oldScreenPtr, screenWidth, x, y, screenRect.width(), screenRect.height());
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:11,代码来源:transitions.cpp

示例4: copyToScreen

void RenderManager::copyToScreen(const Graphics::Surface &surface, Common::Rect &rect, int16 srcLeft, int16 srcTop) {
	// Convert the surface to RGB565, if needed
	Graphics::Surface *outSurface = surface.convertTo(_engine->_screenPixelFormat);
	_system->copyRectToScreen(outSurface->getBasePtr(srcLeft, srcTop),
		                        outSurface->pitch,
		                        rect.left,
		                        rect.top,
		                        rect.width(),
		                        rect.height());
	outSurface->free();
	delete outSurface;
}
开发者ID:superg,项目名称:scummvm,代码行数:12,代码来源:render_manager.cpp

示例5: flushImage

void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal) {
	Common::Point newPos(newBounds.left, newBounds.top);
	Common::Point newSize(newBounds.width(), newBounds.height());

	if (scaleVal == SCALE_THRESHOLD)
		flushImage(frame, pt, &newPos.x, &newPos.y, &newSize.x, &newSize.y);
	else
		flushScaleImage(frame, pt, &newPos.x, &newPos.y, &newSize.x, &newSize.y, scaleVal);

	// Transfer the pos and size amounts into a single bounds rect
	newBounds = Common::Rect(newPos.x, newPos.y, newPos.x + newSize.x, newPos.y + newSize.y);
}
开发者ID:Tkachov,项目名称:scummvm,代码行数:12,代码来源:screen.cpp

示例6: setupCameraPerspective

void OpenGLRenderer::setupCameraPerspective(float pitch, float heading, float fov) {
	BaseRenderer::setupCameraPerspective(pitch, heading, fov);

	Common::Rect frame = frameViewport();
	glViewport(frame.left, frame.top, frame.width(), frame.height());

	glMatrixMode(GL_PROJECTION);
	glLoadMatrixf(_projectionMatrix.getData());

	glMatrixMode(GL_MODELVIEW);
	glLoadMatrixf(_modelViewMatrix.getData());
}
开发者ID:ComputeLinux,项目名称:residualvm,代码行数:12,代码来源:gfx_opengl.cpp

示例7: add

void UISlots::add(const Common::Rect &bounds) {
	assert(size() < 50);

	UISlot ie;
	ie._flags = IMG_OVERPRINT;
	ie._segmentId = IMG_TEXT_UPDATE;
	ie._position = Common::Point(bounds.left, bounds.top);
	ie._width = bounds.width();
	ie._height = bounds.height();

	push_back(ie);
}
开发者ID:CobaltBlues,项目名称:scummvm,代码行数:12,代码来源:user_interface.cpp

示例8: glBlendFunc

void ShaderRenderer::drawTexturedRect2D(const Common::Rect &screenRect, const Common::Rect &textureRect,
    Texture *texture, float transparency) {

  OpenGLTexture *glTexture = static_cast<OpenGLTexture *>(texture);

  const float tLeft = textureRect.left / (float) glTexture->internalWidth;
  const float tWidth = textureRect.width() / (float) glTexture->internalWidth;
  const float tTop = textureRect.top / (float) glTexture->internalHeight;
  const float tHeight = textureRect.height() / (float) glTexture->internalHeight;

  const float sLeft = screenRect.left;
  const float sTop = screenRect.top;
  const float sWidth = screenRect.width();
  const float sHeight = screenRect.height();

  if (transparency >= 0.0) {
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_BLEND);
  } else {
    transparency = 1.0;
  }

  _box_shader->use();
  _box_shader->setUniform("textured", true);
  _box_shader->setUniform("color", Math::Vector4d(1.0f, 1.0f, 1.0f, transparency));
  _box_shader->setUniform("verOffsetXY", scaled(sLeft, sTop));
  _box_shader->setUniform("verSizeWH", scaled(sWidth, sHeight));
  _box_shader->setUniform("texOffsetXY", Math::Vector2d(tLeft, tTop));
  _box_shader->setUniform("texSizeWH", Math::Vector2d(tWidth, tHeight));

  glEnable(GL_TEXTURE_2D);
  glDepthMask(GL_FALSE);

  glBindTexture(GL_TEXTURE_2D, glTexture->id);

  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

  glDisable(GL_BLEND);
  glDepthMask(GL_TRUE);
}
开发者ID:ZydrateJunkie,项目名称:grim_mouse,代码行数:40,代码来源:gfx_opengl_shaders.cpp

示例9: drawExtrasImage

void RivenGraphics::drawExtrasImage(uint16 id, Common::Rect dstRect) {
	MohawkSurface *mhkSurface = _bitmapDecoder->decodeImage(_vm->getExtrasResource(ID_TBMP, id));
	mhkSurface->convertToTrueColor();
	Graphics::Surface *surface = mhkSurface->getSurface();

	assert(dstRect.width() == surface->w);

	for (uint16 i = 0; i < surface->h; i++)
		memcpy(_mainScreen->getBasePtr(dstRect.left, i + dstRect.top), surface->getBasePtr(0, i), surface->pitch);

	delete mhkSurface;
	_dirtyScreen = true;
}
开发者ID:hchen1014,项目名称:scummvm,代码行数:13,代码来源:riven_graphics.cpp

示例10: getSourceCharacterWidth

int BitmapFont::getSourceCharacterWidth(uint charIndex, const Graphics::Surface &src,
		const Common::Rect &charBounds) {
	if (charIndex == 0)
		// The space character is treated as half the width of bounding area
		return charBounds.width() / 2;

	// Scan through the rows to find the right most pixel, getting the width from that
	int maxWidth = 0, rowX;
	for (int y = charBounds.top; y < charBounds.bottom; ++y) {
		rowX = 0;
		const byte *srcP = (const byte *)src.getBasePtr(charBounds.left, y);

		for (int x = 0; x < charBounds.width(); ++x, ++srcP) {
			if (!*srcP)
				rowX = x;
		}

		maxWidth = MAX(maxWidth, MIN(rowX + 2, (int)charBounds.width()));
	}

	return maxWidth;
}
开发者ID:dreammaster,项目名称:scummvm,代码行数:22,代码来源:bitmap_font.cpp

示例11: copyToCurrentPort

void Surface::copyToCurrentPort(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
	Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
	byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top);
	byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top);

	int lineSize = srcRect.width() * _surface->format.bytesPerPixel;

	for (int y = 0; y < srcRect.height(); y++) {
		memcpy(dst, src, lineSize);
		src += _surface->pitch;
		dst += screen->pitch;
	}
}
开发者ID:AlbanBedel,项目名称:scummvm,代码行数:13,代码来源:surface.cpp

示例12: drawRect

void CSTimeGraphics::drawRect(Common::Rect rect, byte color) {
	rect.clip(Common::Rect(640, 480));

	// Useful with debugging. Shows where hotspots are on the screen and whether or not they're active.
	if (!rect.isValidRect() || rect.width() == 0 || rect.height() == 0)
		return;

	Graphics::Surface *screen = _vm->_system->lockScreen();

	screen->frameRect(rect, color);

	_vm->_system->unlockScreen();
}
开发者ID:Bundesdrucker,项目名称:scummvm,代码行数:13,代码来源:cstime_graphics.cpp

示例13: getNewFrameWipe

/**
 * Copies a section of the game frame in a circle bounded by the specified rectangle
 */
void RMWindow::getNewFrameWipe(byte *lpBuf, Common::Rect &rcBoundEllipse) {
	// Clear the screen
	g_system->fillScreen(0);

	if (!rcBoundEllipse.isValidRect())
		return;

	Common::Point center(rcBoundEllipse.left + rcBoundEllipse.width() / 2,
	                     rcBoundEllipse.top + rcBoundEllipse.height() / 2);

	// The rectangle technically defines the area inside the ellipse, with the corners touching
	// the ellipse boundary. Since we're currently simulating the ellipse using a plain circle,
	// we need to calculate a necessary width using the hypotenuse of X/2 & Y/2
	int x2y2 = (rcBoundEllipse.width() / 2) * (rcBoundEllipse.width() / 2) +
	           (rcBoundEllipse.height() / 2) * (rcBoundEllipse.height() / 2);
	int radius = 0;
	while ((radius * radius) < x2y2)
		++radius;

	// Proceed copying a circular area of the frame with the calculated radius onto the screen
	int error = -radius;
	int x = radius;
	int y = 0;

	while (x >= y) {
		plotSplices(lpBuf, center, x, y);

		error += y;
		++y;
		error += y;

		if (error >= 0) {
			error -= x;
			--x;
			error -= x;
		}
	}
}
开发者ID:murgo,项目名称:scummvm,代码行数:41,代码来源:window.cpp

示例14: viewport

Graphics::Surface *ShaderRenderer::getScreenshot() {
	Common::Rect screen = viewport();

	Graphics::Surface *s = new Graphics::Surface();
	s->create(screen.width(), screen.height(), Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));

#if defined(USE_GLES2)
	GLenum format = GL_UNSIGNED_BYTE;
#else
	GLenum format = GL_UNSIGNED_INT_8_8_8_8_REV;
#endif

	glReadPixels(screen.left, screen.top, screen.width(), screen.height(), GL_RGBA, format, s->getPixels());

#if defined(USE_GLES2) && defined(SCUMM_BIG_ENDIAN)
	// OpenGL ES does not support the GL_UNSIGNED_INT_8_8_8_8_REV texture format, we need to byteswap the surface
	OpenGLTexture::byteswapSurface(s);
#endif

	flipVertical(s);

	return s;
}
开发者ID:aquadran,项目名称:residualvm,代码行数:23,代码来源:gfx_opengl_shaders.cpp

示例15:

Graphics::Surface *RenderManager::getBkgRect(Common::Rect &rect) {
	Common::Rect dst = rect;
	dst.clip(_backgroundWidth, _backgroundHeight);

	if (dst.isEmpty() || !dst.isValidRect())
		return NULL;

	Graphics::Surface *srf = new Graphics::Surface;
	srf->create(dst.width(), dst.height(), _currentBackgroundImage.format);

	srf->copyRectToSurface(_currentBackgroundImage, 0, 0, Common::Rect(dst));

	return srf;
}
开发者ID:superg,项目名称:scummvm,代码行数:14,代码来源:render_manager.cpp


注:本文中的common::Rect::width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。