本文整理汇总了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;
}
示例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);
}
示例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());
}
示例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;
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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();
}
示例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;
}
}
}
示例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;
}
示例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;
}