本文整理汇总了C++中rect::isPointInside方法的典型用法代码示例。如果您正苦于以下问题:C++ rect::isPointInside方法的具体用法?C++ rect::isPointInside怎么用?C++ rect::isPointInside使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rect
的用法示例。
在下文中一共展示了rect::isPointInside方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viewportTick
void Editor::viewportTick(Viewport viewport, rect<s32> rect,
bool mousehit, bool middlehit)
{
// Init
IVideoDriver *driver = device->getVideoDriver();
ISceneManager *smgr = device->getSceneManager();
IGUIEnvironment *guienv = device->getGUIEnvironment();
ViewportType type = state->getViewportType(viewport);
// Draw camera
smgr->setActiveCamera(camera[(int)viewport]);
driver->setViewPort(rect);
if (type == VIEWT_BOTTOM)
plane->setVisible(false);
smgr->drawAll();
if (type == VIEWT_BOTTOM)
plane->setVisible(true);
// Callbacks
if (state->Mode())
state->Mode()->viewportTick(viewport, driver, rect);
if (viewport_drag == viewport) {
vector2di delta = state->mouse_position;
delta -= viewport_drag_last;
viewport_drag_last = state->mouse_position;
viewport_offset[(int)viewport].X -= (f32)delta.X * 0.01f;
viewport_offset[(int)viewport].Y += (f32)delta.Y * 0.01f;
if (viewport_offset[(int)viewport].X > 0.5)
viewport_offset[(int)viewport].X = 0.5;
if (viewport_offset[(int)viewport].X < -0.5)
viewport_offset[(int)viewport].X = -0.5;
if (viewport_offset[(int)viewport].Y > 0.5)
viewport_offset[(int)viewport].Y = 0.5;
if (viewport_offset[(int)viewport].Y < -0.5)
viewport_offset[(int)viewport].Y = -0.5;
applyCameraOffsets(viewport);
}
if (middlehit && rect.isPointInside(state->mouse_position)
&& type != VIEWT_PERS) {
viewport_drag = viewport;
viewport_drag_last = state->mouse_position;
}
// Draw text
driver->setViewPort(rects32(0, 0, driver->getScreenSize().Width,
driver->getScreenSize().Height));
{
static const wchar_t* labels[7] = {L"Perspective", L"Front", L"Left",
L"Top", L"Back", L"Right", L"Bottom"};
// Handle clicking
position2d<s32> labelpos(rect.LowerRightCorner.X - 86,
rect.UpperLeftCorner.Y + ((rect.UpperLeftCorner.Y < 50)?30:10));
rects32 backgroundrect(rect.LowerRightCorner.X - 96,
rect.UpperLeftCorner.Y + ((rect.UpperLeftCorner.Y < 50)?25:5),
rect.LowerRightCorner.X - 5,
rect.UpperLeftCorner.Y + ((rect.UpperLeftCorner.Y < 50)?185:165));
bool context_is_open = (viewport_contextmenu == viewport);
if (mousehit && !state->menu->dialog) {
if ((rects32(labelpos.X, labelpos.Y, labelpos.X + 90,
labelpos.Y + 25)).isPointInside(state->mouse_position)) {
viewport_contextmenu = viewport;
} else if (context_is_open) {
context_is_open = false;
viewport_contextmenu = VIEW_NONE;
if (backgroundrect.isPointInside(state->mouse_position)) {
int y = 0;
for (int i = 0; i < 7; i++) {
if (i != (int)type) {
int ty = rect.UpperLeftCorner.Y +
((rect.UpperLeftCorner.Y < 50)?56:36)
+ y * 20;
rects32 trect(rect.LowerRightCorner.X - 96,
ty,
rect.LowerRightCorner.X - 5, ty + 20);
y++;
if (trect.isPointInside(state->mouse_position)) {
viewport_offset[(int)viewport] = vector3df(0, 0, 0);
state->settings->set(viewportToSetting(viewport),
viewportTypeToSetting((ViewportType)i));
recreateCameras();
break;
}
}
}
}
}
}
// Context menu
if (context_is_open) {
// Context menu background
driver->draw2DRectangle(SColor(100, 32, 32, 32), backgroundrect);
s32 y2 = rect.UpperLeftCorner.Y + ((rect.UpperLeftCorner.Y < 50)?52:32);
driver->draw2DLine(position2d<s32>(rect.LowerRightCorner.X - 96, y2),
position2d<s32>(rect.LowerRightCorner.X - 5, y2),
SColor(100, 255, 255, 255));
// Draw options
//.........这里部分代码省略.........