本文整理汇总了C++中Rect2D::height方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect2D::height方法的具体用法?C++ Rect2D::height怎么用?C++ Rect2D::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect2D
的用法示例。
在下文中一共展示了Rect2D::height方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pack
void GuiScrollPane::pack() {
float scrollBarWidth = theme()->scrollBarWidth();
m_viewPane->setPosition(0,0);
m_viewPane->pack();
Rect2D viewRect = m_viewPane->rect();
if (verticalEnabled) {
if (viewRect.width() > MIN_WINDOW_SIZE) {
setWidth(viewRect.width() + scrollBarWidth);
}
}
if (horizontalEnabled) {
if(viewRect.height() < m_rect.height() && viewRect.height() > MIN_WINDOW_SIZE) {
setHeight(viewRect.height() + scrollBarWidth);
}
}
}
示例2: showMenu
void GuiDropDownList::showMenu() {
// Show the menu
Rect2D clickRect = theme()->dropDownListToClickBounds(rect(), m_captionWidth);
Vector2 clickOffset = clickRect.x0y0() - rect().x0y0();
Vector2 menuOffset(10, clickRect.height() + 10);
menu()->show(m_gui->manager(), window(), this, toOSWindowCoords(clickOffset + menuOffset), false, m_actionCallback);
}
示例3: setRect
void CameraControlWindow::setRect(const Rect2D& r) {
GuiWindow::setRect(r);
if (drawerButtonPane) {
float s = 12;
const Rect2D& r = clientRect();
drawerButtonPane->setPosition((r.width() - s) / 2.0f, r.height() - s);
}
}
示例4: onGraphics
void FontViewer::onGraphics(RenderDevice* rd, App* app, const shared_ptr<LocalLightingEnvironment>& lighting, Array<shared_ptr<Surface> >& surfaceArray) {
app->colorClear = Color3::white();
rd->push2D();
Rect2D windowBounds = rd->viewport();
rd->setLineWidth(0.5f);
rd->setColor(Color3::black());
rd->setObjectToWorldMatrix(Vector3(0.375, 0.375, 0));
rd->beginPrimitive(PrimitiveType::LINES);
for (int i = 0; i <= 16; ++i) {
// Horizontal line
float y = i * windowBounds.height() / 16;
rd->sendVertex(Vector2(0, y));
rd->sendVertex(Vector2(windowBounds.width(), y));
// Vertical line
float x = i * windowBounds.width() / 16;
rd->sendVertex(Vector2(x, 0));
rd->sendVertex(Vector2(x, windowBounds.height()));
}
rd->endPrimitive();
double size = windowBounds.height()/16.0 /2.0 ;
const Color4 color = Color3::black();
const Color4 outline = Color4::clear();
for (int y = 0; y < 16; ++y ) {
for (int x = 0; x < 16; ++x ) {
int i = x + y*16;
std::string s = "";
s += (char)i;
// Character in the current font
m_font->draw2D( rd, s, Vector2( x* windowBounds.width()/16.0f + windowBounds.width()/32.0f,
y*windowBounds.height()/16.0f + windowBounds.height()/32.0f),
(float)size, color, outline, GFont::XALIGN_CENTER, GFont::YALIGN_CENTER );
// Character in the normal font
m_basefont->draw2D( rd, s, Vector2( x* windowBounds.width()/16.0f + windowBounds.width()/64.0f,
y* windowBounds.height()/16.0f + windowBounds.height()/20.0f),
(float)size/2.0f, color, outline, GFont::XALIGN_CENTER, GFont::YALIGN_CENTER );
// Character number
m_basefont->draw2D( rd, format("\\x%x", i), Vector2( x* windowBounds.width()/16.0f + windowBounds.width()/20.0f-(float)size * 0.5f,
y* windowBounds.height()/16.0f + windowBounds.height()/20.0f),
(float)size/2.0f, color, outline, GFont::XALIGN_CENTER, GFont::YALIGN_CENTER );
}
}
rd->pop2D();
}
示例5: setRect
void GuiCheckBox::setRect(const Rect2D& rect) {
if (m_style == GuiTheme::NORMAL_CHECK_BOX_STYLE) {
// TODO: use the actual font size etc. to compute bounds
// Prevent the checkbox from stealing clicks very far away
m_rect = rect;
m_clickRect = Rect2D::xywh(rect.x0y0(), Vector2(min(rect.width(), 30.0f), rect.height()));
} else {
GuiControl::setRect(rect);
}
}
示例6: allocateTextures
void allocateTextures(const Rect2D& screenRect) {
if (depth.isNull() ||
(depth->vector2Bounds() != screenRect.wh())) {
/*
Texture::Parameters depthParameters;
depthParameters.autoMipMap = false;
depthParameters.maxAnisotropy = 1;
depthParameters.wrapMode = Texture::CLAMP;
depthParameters.interpolateMode = Texture::NO_INTERPOLATION;
*/
depth = Texture::createEmpty("Depth Buffer", screenRect.width(), screenRect.height(),
TextureFormat::depth(), Texture::DIM_2D_NPOT, Texture::Parameters::video());
color = Texture::createEmpty("Color Buffer", screenRect.width(), screenRect.height(),
TextureFormat::RGB8, Texture::DIM_2D_NPOT, Texture::Parameters::video());
shader->args.set("depth", depth);
shader->args.set("color", color);
}
}
示例7: setDimensions
void SDLWindow::setDimensions(const Rect2D& dims) {
#ifdef G3D_WIN32
int W = screenWidth();
int H = screenHeight();
int x = iClamp((int)dims.x0(), 0, W);
int y = iClamp((int)dims.y0(), 0, H);
int w = iClamp((int)dims.width(), 1, W);
int h = iClamp((int)dims.height(), 1, H);
SetWindowPos(_Win32HWND, NULL, x, y, w, h, SWP_NOZORDER);
// Do not update settings-- wait for an event to notify us
#endif
#ifdef G3D_LINUX
//TODO: Linux
#endif
// TODO: OS X
}
示例8: addPane
GuiPane* GuiPane::addPane(const GuiText& text, GuiTheme::PaneStyle style) {
Rect2D minRect = theme()->clientToPaneBounds(Rect2D::xywh(0,0,0,0), text, style);
Vector2 pos = nextControlPos();
// Back up by the border size
pos -= minRect.x0y0();
// Ensure the width isn't negative due to a very small m_clientRect
// which would push the position off the parent panel
float newRectWidth = max(m_clientRect.width() - pos.x * 2, 0.0f);
Rect2D newRect = Rect2D::xywh(pos, Vector2(newRectWidth, minRect.height()));
GuiPane* p = new GuiPane(this, text, newRect, style);
containerArray.append(p);
increaseBounds(p->rect().x1y1());
return p;
}
示例9: convertFromUnitToNormal
Vector3 Camera::convertFromUnitToNormal(const Vector3& in, const Rect2D& viewport) const{
return (in + Vector3(1.0f, 1.0f, 1.0f)) * 0.5f * Vector3(viewport.width(), viewport.height(), 1.0f) +
Vector3(viewport.x0(), viewport.y0(), 0.0f);
}
示例10: intersect
shared_ptr<Entity> Scene::intersectEyeRay(const shared_ptr<Camera>& camera, const Vector2& pixel, const Rect2D& viewport, const Vector2int16 guardBandThickness, bool hitMarkers, const Array<shared_ptr<Entity> >& exclude, Model::HitInfo& selectionInfo) const {
const Ray& ray = camera->worldRay(pixel.x + guardBandThickness.x, pixel.y + guardBandThickness.y, Rect2D(Vector2(viewport.width() + 2 * guardBandThickness.x, viewport.height() + 2 * guardBandThickness.y)));
// clear old selection info
selectionInfo.clear();
float distance = finf();
return intersect(ray, distance, hitMarkers, exclude, selectionInfo);
}
示例11: setDimensions
void GlutWindow::setDimensions(const Rect2D& dims) {
setPosition((int)dims.x0(), (int)dims.x1());
glutReshapeWindow((int)dims.width(), (int)dims.height());
}
示例12: onEvent
bool GuiScrollBar::onEvent(const GEvent& event) {
if (! m_visible) {
return false;
}
float m = maxValue();
Rect2D topB;
Rect2D bottomB;
Rect2D barBounds;
Rect2D thumbBounds;
getAllBounds(topB, bottomB, barBounds, thumbBounds);
if (event.type == GEventType::MOUSE_BUTTON_DOWN) {
const Vector2& mouse = Vector2(event.button.x, event.button.y);
if(bottomB.contains(mouse)) {
*m_value = min<float>( m * m_extent, *m_value + m_extent * BUTTON_PRESS_SCROLL);
m_state = ARROW_DOWN_SCROLLING;
GEvent response;
response.gui.type = GEventType::GUI_CHANGE;
response.gui.control = m_eventSource;
m_gui->fireEvent(response);
fireEvent(GEventType::GUI_ACTION);
return true;
} else if (topB.contains(mouse)) {
*m_value = max<float>( 0.0f, *m_value - m_extent*BUTTON_PRESS_SCROLL);
m_state = ARROW_UP_SCROLLING;
GEvent response;
response.gui.type = GEventType::GUI_CHANGE;
response.gui.control = m_eventSource;
m_gui->fireEvent(response);
fireEvent(GEventType::GUI_ACTION);
return true;
} else if (thumbBounds.contains(mouse)) {
m_state = IN_DRAG;
m_dragStart = mouse;
m_dragStartValue = floatValue();
GEvent response;
response.gui.type = GEventType::GUI_DOWN;
response.gui.control = m_eventSource;
m_gui->fireEvent(response);
response.gui.type = GEventType::GUI_CHANGE;
response.gui.control = m_eventSource;
m_gui->fireEvent(response);
return true;
} else if (barBounds.contains(mouse)) {
// Jump to this position
float p;
if(m_vertical) {
p = ( mouse.y - (float)barBounds.y0() ) / ((float)barBounds.height()/(m + 1)) - .5f;
} else {
p = ( mouse.x - (float)barBounds.x0() ) / ((float)barBounds.width()/(m + 1)) - .5f;
}
p = max<float>(0, p);
p = min<float>(p, m);
setFloatValue(p);
m_state = NONE;
GEvent response;
response.gui.type = GEventType::GUI_CHANGE;
response.gui.control = m_eventSource;
m_gui->fireEvent(response);
fireEvent(GEventType::GUI_ACTION);
return true;
}
return false;
} else if (event.type == GEventType::MOUSE_BUTTON_UP) {
m_state = NONE;
fireEvent(GEventType::GUI_ACTION);
if (m_state == IN_DRAG) {
// End the drag
fireEvent(GEventType::GUI_DOWN);
fireEvent(GEventType::GUI_ACTION);
return true;
}
} else if (event.type == GEventType::MOUSE_MOTION) {
// We'll only receive these events if we have the keyFocus, but we can't
// help receiving the key focus if the user clicked on the control!
//.........这里部分代码省略.........
示例13: setDimensions
void wxGWindow::setDimensions (const Rect2D &dims) {
window->SetSize(dims.x0(), dims.y0(), dims.width(), dims.height());
}
示例14: setRect
void GuiTabPane::setRect(const Rect2D& rect) {
m_rect = rect;
float y = m_tabButtonPane->rect().height() - OVERLAP;
m_viewPane->setRect(Rect2D::xywh(0, y, rect.width(), rect.height() - y));
m_clientRect = m_rect;//m_viewPane->rect() + rect.x0y0();
}