本文整理汇总了C++中IRect::MovedBy方法的典型用法代码示例。如果您正苦于以下问题:C++ IRect::MovedBy方法的具体用法?C++ IRect::MovedBy怎么用?C++ IRect::MovedBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRect
的用法示例。
在下文中一共展示了IRect::MovedBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
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);
}
示例2: DrawRamka
void ChipSelecter::DrawRamka(int x, int y)
{
//Тут должно быть 44х44!
IRect rect = IRect(0,0,44,44);
Render::device.SetTexturing(false);
Render::DrawFrame(rect.MovedBy(IPoint(x - rect.width/2, y - rect.height/2)));
Render::device.SetTexturing(true);
}