//------------------------------------------------------------------------ void spline_ctrl_impl::point(unsigned idx, double x, double y) { if(idx < m_num_pnt) { set_xp(idx, x); set_yp(idx, y); } }
void MsgNeighbor::MergeFrom(const MsgNeighbor& from) { GOOGLE_CHECK_NE(&from, this); neighbor_.MergeFrom(from.neighbor_); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from._has_bit(0)) { set_platform(from.platform()); } if (from._has_bit(1)) { set_accountid(from.accountid()); } if (from._has_bit(2)) { set_score(from.score()); } if (from._has_bit(3)) { set_xp(from.xp()); } if (from._has_bit(4)) { set_extid(from.extid()); } if (from._has_bit(5)) { set_url(from.url()); } if (from._has_bit(6)) { set_name(from.name()); } if (from._has_bit(7)) { set_isneighbor(from.isneighbor()); } } if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { if (from._has_bit(8)) { set_levelbasedonscore(from.levelbasedonscore()); } if (from._has_bit(9)) { set_wishlist(from.wishlist()); } if (from._has_bit(10)) { set_damageprotectiontimeleft(from.damageprotectiontimeleft()); } if (from._has_bit(11)) { set_tutorialcompleted(from.tutorialcompleted()); } } mutable_unknown_fields()->MergeFrom(from.unknown_fields()); }
//------------------------------------------------------------------------ bool spline_ctrl_impl::on_mouse_move(double x, double y, bool button_flag) { inverse_transform_xy(&x, &y); if(!button_flag) { return on_mouse_button_up(x, y); } if(m_move_pnt >= 0) { double xp = x + m_pdx; double yp = y + m_pdy; set_xp(m_move_pnt, (xp - m_xs1) / (m_xs2 - m_xs1)); set_yp(m_move_pnt, (yp - m_ys1) / (m_ys2 - m_ys1)); update_spline(); return true; } return false; }
//------------------------------------------------------------------------ bool spline_ctrl_impl::on_arrow_keys(bool left, bool right, bool down, bool up) { double kx = 0.0; double ky = 0.0; bool ret = false; if(m_active_pnt >= 0) { kx = m_xp[m_active_pnt]; ky = m_yp[m_active_pnt]; if(left) { kx -= 0.001; ret = true; } if(right) { kx += 0.001; ret = true; } if(down) { ky -= 0.001; ret = true; } if(up) { ky += 0.001; ret = true; } } if(ret) { set_xp(m_active_pnt, kx); set_yp(m_active_pnt, ky); update_spline(); } return ret; }