本文整理汇总了C++中IRect类的典型用法代码示例。如果您正苦于以下问题:C++ IRect类的具体用法?C++ IRect怎么用?C++ IRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BltBitmap
bool SylVNC::BltBitmap(SrvBitmap *pcDstBitmap, SrvBitmap *pcSrcBitmap,
IRect cSrcRect, IPoint cDstPos, int nMode)
{
if((!pcDstBitmap->m_bVideoMem) && (!pcSrcBitmap->m_bVideoMem))
{
// Off-screen to off-screen
return DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect,
cDstPos, nMode);
}
int srcX1 = cSrcRect.left;
int srcY1 = cSrcRect.top;
int srcX2 = cSrcRect.right;
int srcY2 = cSrcRect.bottom;
int dstX1 = cDstPos.x;
int dstY1 = cDstPos.y;
int dstX2 = cDstPos.x + cSrcRect.Width();
int dstY2 = cDstPos.y + cSrcRect.Height();
if((pcDstBitmap->m_bVideoMem) && (pcSrcBitmap->m_bVideoMem))
{
if(nMode == DM_COPY)
// dbprintf("SylVNC::BltBitmap() - Screen to screen DM_COPY\n");
;
else if(nMode == DM_OVER)
dbprintf("SylVNC::BltBitmap() - Screen to screen DM_OVER\n");
else if(nMode == DM_BLEND)
dbprintf("SylVNC::BltBitmap() - Screen to screen DM_BLEND\n");
else
dbprintf("SylVNC::BltBitmap() - Unknown nMode = %d\n", nMode);
}
DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect, cDstPos, nMode);
if(pcDstBitmap->m_bVideoMem)
{
// ACQUIRE RFB lock
m_cRFBLock.Lock();
rfbMarkRectAsModified( rfbScreen, dstX1, dstY1, dstX2 + 1, dstY2 + 1);
// RELEASE RFB lock
m_cRFBLock.Unlock();
}
if(pcSrcBitmap->m_bVideoMem)
{
// ACQUIRE RFB lock
m_cRFBLock.Lock();
rfbMarkRectAsModified( rfbScreen, srcX1, srcY1, srcX2 + 1, srcY2 + 1);
// RELEASE RFB lock
m_cRFBLock.Unlock();
}
resume_thread( rfbEventThread );
// rfbProcessEvents(rfbScreen, 0);
return true;
}
示例2: r
int ChangeEnergySpeed::Editor_CaptureGadget(const IPoint& mouse_pos, int x, int y)
{
// Преобразовываем координаты к координатам на поле
int mx = mouse_pos.x + GameSettings::FieldCoordMouse().x;
int my = mouse_pos.y + GameSettings::FieldCoordMouse().y;
IRect r (mx - (GameSettings::SQUARE_SIDE / 2), my - (GameSettings::SQUARE_SIDE / 2), 0, 0);
r.Inflate((GameSettings::SQUARE_SIDE / 2));
_sliderRect = IRect(_snapPoint.x * GameSettings::SQUARE_SIDE,_snapPoint.y * GameSettings::SQUARE_SIDE - 30,200,30);
if (r.Contains(_snapPoint * GameSettings::SQUARE_SIDE))
{
return (-2);
}
else if (_sliderRect.Contains(IPoint(mx,my)))
{
return (-3);
}
else
{
return (-1);
}
}
示例3: IRect
void ChipSelecter::Draw()
{
Render::device.SetTexturing(false);
Render::BeginColor(Color(100, 100, 100, 180));
Render::DrawRect(IRect(200, 150, 400, 300));
Render::EndColor();
Render::device.SetTexturing(true);
//IRect rect = Game::ChipColor::DRAW_RECT;
//Тут должно быть 44х44!
IRect rect = IRect(0,0,44,44);
for (int i = 0; i <= 6; i++)
{
int x = _chipXLeft + 50*(i%7);
int y = _chipYDown + 50*(3 - i/7);
FRect uv = Game::GetChipRect(i, false, false, false);
_chipsTex->Draw(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)), uv);
}
for (size_t i = 0; i < _chipColors.size(); i++)
{
int color = _chipColors[i];
int x = _chipXLeft + 50*(color%7);
int y = _chipYDown + 50*(3 - color/7);
Render::BeginColor(Color(100, 255, 255, 255));
for (int q = -1; q<=1; q++)
{
for (int w = -1; w<=1; w++)
{
DrawRamka(x+q, y+w);
}
}
Render::EndColor();
FRect uv = Game::GetChipRect(color, false, false, false);
Render::device.SetAlpha(static_cast<int>(150+80*sinf(_timer*6 + x - y/3)));
Render::device.SetBlendMode(Render::ADD);
_chipsTex->Draw(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)), uv);
Render::device.SetBlendMode(Render::ALPHA);
}
if (_underMouseChip >= 0)
{
int color = _underMouseChip;
int x = _chipXLeft + 50*(color%7);
int y = _chipYDown + 50*(3 - color/7);
Render::BeginColor(Color(0, 255, 0, 255));
DrawRamka(x, y);
Render::EndColor();
}
Render::BindFont("debug");
Render::PrintString(IPoint(370, 170), utils::lexical_cast(static_cast<int>(_chipColors.size())) + " colors", 1.f, CenterAlign);
}
示例4: clipToScreen
KDE_NO_EXPORT void Surface::repaint (const SRect &rect) {
Matrix matrix;
IRect clip;
clipToScreen (this, matrix, clip);
IRect scr = matrix.toScreen (rect);
clip = clip.intersect (scr);
if (!clip.isEmpty ())
view_widget->scheduleRepaint (clip);
}
示例5: BltBitmap
bool VMware::BltBitmap(SrvBitmap *pcDstBitmap, SrvBitmap *pcSrcBitmap,
IRect cSrcRect, IRect cDstRect, int nMode, int nAlpha)
{
if(((!pcDstBitmap->m_bVideoMem) && (!pcSrcBitmap->m_bVideoMem)) || nMode != DM_COPY || cSrcRect.Size() != cDstRect.Size())
{
// Off-screen to off-screen
return DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect,
cDstRect, nMode, nAlpha);
}
IPoint cDstPos = cDstRect.LeftTop();
int srcX = cSrcRect.left;
int srcY = cSrcRect.top;
int dstX = cDstPos.x;
int dstY = cDstPos.y;
int width = cSrcRect.Width() + 1;
int height = cSrcRect.Height() + 1;
bool accelDmCopy = false;
if((pcDstBitmap->m_bVideoMem) && (pcSrcBitmap->m_bVideoMem))
{
if(nMode == DM_COPY)
accelDmCopy = m_regCapabilities & SVGA_CAP_RECT_COPY;
else if(nMode == DM_OVER)
dbprintf("VMware::BltBitmap() - Screen to screen DM_OVER\n");
else if(nMode == DM_BLEND)
dbprintf("VMware::BltBitmap() - Screen to screen DM_BLEND\n");
else
dbprintf("VMware::BltBitmap() - Unknown nMode = %d\n", nMode);
}
// ACQUIRE lock
m_cGELock.Lock();
if(accelDmCopy)
{
// Accelerated screen to screen DM_COPY
Fifo_RectCopy(srcX, srcY, dstX, dstY, width, height);
m_bFifoCmds = true;
}
else
{
if(m_bFifoCmds)
FifoSync();
DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect,
cDstRect, nMode, nAlpha);
if(pcDstBitmap->m_bVideoMem)
Fifo_UpdateRect(dstX, dstY, width, height);
}
// RELEASE lock
m_cGELock.Unlock();
return true;
}
示例6: Editor_CutToClipboard
void LockBarriers::Editor_CutToClipboard(IRect part)
{
_clipboard.clear();
for(Barriers::iterator itr = _barriers.begin(); itr != _barriers.end(); )
{
if( part.Contains((*itr)->GetPos()) ) {
(*itr)->SetPos( (*itr)->GetPos() - part.LeftBottom() );
_clipboard.push_back(*itr);
itr = _barriers.erase(itr);
} else {
++itr;
}
}
}
示例7: Draw
void CoreDelegateImpl::Draw()
{
static float x = 50;
static float y = 600;
auto p_renderer = Core::GetRenderer();
IRect rect = p_renderer->GetTargetRectangle();
p_renderer->SetMatrix(MatrixMode::Projection, Matrix4f::CreateOrtho(0, rect.Width(), 0, rect.Height()));
std::wstring message = L"FPS: " + std::to_wstring(Core::GetApplication()->GetCurrentFPS());
auto en_font = Core::GetGlobalObject<Resources::ResourceManager>()->GetHandleToResource<Render::Font>("Arial_en");
auto arial_font = Core::GetGlobalObject<Resources::ResourceManager>()->GetHandleToResource<Render::Font>("Arial");
Core::GetGlobalObject<Render::FontManager>()->Render({ x, y }, 1.f, message, arial_font);
Core::GetGlobalObject<Render::FontManager>()->Render({ x, y - 50 }, 1.f, message_num_0, en_font);
Core::GetGlobalObject<Render::FontManager>()->Render({ x, y - 100 }, 1.f, L"Мама мыла раму!", arial_font);
}
示例8: if
void View::update(const InputState &state) {
if(state.isKeyDown('g')) {
if(m_is_visible) {
if(m_cell_size == 3)
m_cell_size = 6;
else if(m_cell_size == 6)
m_cell_size = 9;
else {
m_cell_size = 1;
m_is_visible = false;
}
}
else {
m_cell_size = 3;
m_is_visible = true;
}
}
int height_change = state.mouseWheelMove() +
(state.isKeyDownAuto(InputKey::pagedown)? -1 : 0) +
(state.isKeyDownAuto(InputKey::pageup)? 1 : 0);
if(height_change)
m_height = clamp(m_height + height_change, 0, (int)Grid::max_height);
{
int actions[TileGroup::Group::side_count] = {
InputKey::kp_1,
InputKey::kp_2,
InputKey::kp_3,
InputKey::kp_6,
InputKey::kp_9,
InputKey::kp_8,
InputKey::kp_7,
InputKey::kp_4
};
for(int n = 0; n < arraySize(actions); n++)
if(state.isKeyDownAuto(actions[n]))
m_view_pos += worldToScreen(TileGroup::Group::s_side_offsets[n] * m_cell_size);
}
if((state.isKeyPressed(InputKey::lctrl) && state.isMouseButtonPressed(InputButton::left)) ||
state.isMouseButtonPressed(InputButton::middle))
m_view_pos -= state.mouseMove();
IRect rect = worldToScreen(IBox(int3(0, 0, 0), asXZY(m_tile_map.dimensions(), 256)));
m_view_pos = vclamp(m_view_pos, rect.min(), rect.max() - m_view_size);
}
示例9: m_editor
GroupPad::GroupPad(const IRect &rect, PGroupEditor editor, TileGroup *group)
:Window(rect), m_editor(editor), m_group(group) {
m_filter_box = make_shared<ComboBox>(IRect(0, 0, rect.width(), 22), 200,
"Filter: ", TileFilter::strings(), TileFilter::count);
attach(m_filter_box);
m_filter_box->selectEntry(editor->tileFilter());
}
示例10: draw
void ChangeEnergySpeed::Draw()
{
Render::device.SetTexturing(false);
// Точка центрирования (краcная)
Render::device.SetTexturing(false);
IRect draw (_snapPoint.x * GameSettings::SQUARE_SIDE + (GameSettings::SQUARE_SIDE / 2), _snapPoint.y * GameSettings::SQUARE_SIDE + (GameSettings::SQUARE_SIDE / 2), 0, 0);
draw.Inflate(GameSettings::SQUARE_SIDE / 2);
if (_selected)
{
Render::BeginColor(Color(50,255,50,128));
}
else
{
Render::BeginColor(Color(20,80,20,128));
}
Render::DrawRect(draw);
Render::DrawFrame(draw);
Render::EndColor();
/*
Render::BeginColor(Color(255,80,20,128));
Render::DrawRect(_sliderRect);
//Render::DrawFrame(sliderRect);
Render::EndColor();
*/
Render::device.SetTexturing(true);
Render::BeginColor(Color(255,255,255,255));
Render::FreeType::BindFont("debug");
Render::PrintString(draw.x + 2, draw.y + 35, "Energy", 1.0f, LeftAlign, BaseLineAlign);
Render::PrintString(draw.x + 2, draw.y + 25, "speed:", 1.0f, LeftAlign, BaseLineAlign);
Render::PrintString(draw.x + 2, draw.y + 5, Float::ToStringF(_energyTimeScale), 1.0f, LeftAlign, BaseLineAlign);
Render::EndColor();
if (_selected)
{
_sliderTime.Draw();
}
}
示例11: DASSERT
void Window::setRect(const IRect &rect) {
DASSERT(!m_dragging_mode);
DASSERT(!rect.empty());
m_rect = rect;
setInnerRect(IRect({0, 0}, m_rect.size()));
updateRects();
}
示例12: FillRect
bool VMware::FillRect(SrvBitmap *pcBitmap, const IRect& cRect,
const Color32_s& sColor, int nMode)
{
if(!pcBitmap->m_bVideoMem || nMode != DM_COPY)
{
/* Off-screen */
return DisplayDriver::FillRect(pcBitmap, cRect, sColor, nMode);
}
int dstX = cRect.left;
int dstY = cRect.top;
int width = cRect.Width() + 1;
int height = cRect.Height() + 1;
int nColor;
if (pcBitmap->m_eColorSpc == CS_RGB32)
nColor = COL_TO_RGB32(sColor);
else
nColor = COL_TO_RGB16(sColor);
bool accelOp = false;
// accelOp = m_regCapabilities & SVGA_CAP_RECT_FILL;
// ACQUIRE lock
m_cGELock.Lock();
if(accelOp)
{
/* Accelerated on-screen RectFill */
Fifo_RectFill(dstX, dstY, width, height, nColor);
m_bFifoCmds = true;
}
else
{
if(m_bFifoCmds)
FifoSync();
DisplayDriver::FillRect(pcBitmap, cRect, sColor, nMode);
Fifo_UpdateRect(dstX, dstY, width, height);
}
// RELEASE lock
m_cGELock.Unlock();
return true;
}
示例13: Editor_DrawIndicators
void EnergyReceiver::Editor_DrawIndicators(bool selected)
{
// подложка под приемником
Render::device.SetBlendMode(Render::ADD);
if (selected)
Render::BeginColor(Color(128, 255, 200, 48));
else
Render::BeginColor(Color(255, 100, 200, 48));
Render::device.SetTexturing(false);
IRect draw = GameSettings::CELL_RECT.Inflated(-2);
draw.MoveTo(GetIndex()*GameSettings::SQUARE_SIDE);
Render::DrawRect(draw);
Render::EndColor();
Render::device.SetBlendMode(Render::ALPHA);
}
示例14: Editor_CopyToClipboard
void SquareNewInfo::Editor_CopyToClipboard(IRect part)
{
Game::FieldAddress offset(part.x, part.y);
_clipboard.clear();
for(std::map<Game::FieldAddress, InfoSquare>::iterator itr = _info.begin(); itr != _info.end(); ++itr)
{
if( part.Contains(itr->first.ToPoint()) )
_clipboard.insert( std::make_pair(itr->first - offset, itr->second) );
}
}
示例15: Editor_ClearFieldPart
void SquareNewInfo::Editor_ClearFieldPart(IRect part)
{
for(std::map<Game::FieldAddress, InfoSquare>::iterator itr = _info.begin(); itr != _info.end(); )
{
if( part.Contains(itr->first.ToPoint()) ) {
itr = _info.erase(itr);
} else {
++itr;
}
}
}