本文整理汇总了C++中Coordinates::GetY方法的典型用法代码示例。如果您正苦于以下问题:C++ Coordinates::GetY方法的具体用法?C++ Coordinates::GetY怎么用?C++ Coordinates::GetY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coordinates
的用法示例。
在下文中一共展示了Coordinates::GetY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShotsAtPosition
// Check if shots were fired on the given set of coordinates
bool CliGridRenderer::ShotsAtPosition(std::vector<Coordinates> *shots, Coordinates pos)
{
bool fired = false;
for (int i = 0; i < shots->size(); i++)
{
if (shots->at(i).GetX() == pos.GetX() && shots->at(i).GetY() == pos.GetY())
{
// Only return true if both x and y values match
fired = true;
}
}
return fired;
}
示例2: DrawDot
bool FieldView::DrawDot(const Coordinates& coords){
window=get_window(); //get pointer to parent window
//we draw only if parent window exists and if dot is colored
if(window && field->GetColor(coords)!=NONE){
//getting coords of point
const double xc = (coords.GetX() + 1) * CELL_SIZE * GetScaleX();
const double yc = (coords.GetY() + 1) * CELL_SIZE * GetScaleY();
//preparing context
cr = window->create_cairo_context();
if(cr){//if pointer to contest is not NULL
allocation = get_allocation();
double awidth = allocation.get_width();
double aheight = allocation.get_height();
cr->rectangle(0.0, 0.0, awidth, aheight);
cr->clip();
//choose color
switch(field->GetColor(coords)){
case RED:
cr->set_source_rgb(1.0, 0.0, 0.0);
break;
case BLUE:
cr->set_source_rgb(0.0, 0.0, 1.0);
break;
default:
return false;
}
//setting line width and draw circle
cr->set_line_width(GetScaleX() * 2.5);
//this will draw a circle, but we've got to fat lines and this circle will be like a big fat dot
cr->arc(xc, yc, GetScaleX(), 0.0, 2 * M_PI);
cr->stroke();
return true;
}
}
return false;
}
示例3:
bool Coordinates::operator==(const Coordinates& other) {
if (this->GetX() == other.GetX() && this->GetY() == other.GetY()) {
return true;
}
return false;
}
示例4: return
bool Coordinates::operator !=(const Coordinates& coords2) const{
return ( (GetX() != coords2.GetX()) || (GetY() != coords2.GetY()) );
}