本文整理汇总了C++中Coord函数的典型用法代码示例。如果您正苦于以下问题:C++ Coord函数的具体用法?C++ Coord怎么用?C++ Coord使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Coord函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Sprite
DrawableSprite::DrawableSprite() : Sprite ( Coord(), Coord ( 1, 1 ), 0, 1 )
{
//ctor
}
示例2: while
void Menubar::_render( GfxDevice * pDevice, const Rect& _canvas, const Rect& _window, const Rect& _clip )
{
Widget::_render(pDevice,_canvas,_window,_clip);
// Take backgrounds content borders into account
Rect window;
Rect clip;
if( m_pSkin )
{
window = m_pSkin->contentRect( _canvas, m_state );
clip.intersection( window, _clip );
}
else
{
window = _canvas;
clip = _clip;
}
// Go throught the MenuBarItems and print their text and render their rectangles.
MenuBarItem * pI = m_items.first();
uint32_t posX = window.x;
Pen pen;
TextAttr attr;
TextTool::addPropAttributes( attr, Base::getDefaultTextprop(), StateEnum::Normal);
TextTool::addPropAttributes( attr, m_pTextProp, StateEnum::Normal);
pen.setAttributes( attr );
pen.setClipRect( clip );
pen.setDevice( pDevice );
uint32_t printPosY = window.y + ( window.h - pen.getLineHeight() )/2 + pen.getBaseline();
uint32_t itemNb = 1;
while( pI )
{
if( pI->isVisible() )
{
State state = StateEnum::Disabled;
if( m_state.isEnabled() && pI->m_bEnabled )
{
state = StateEnum::Normal;
if( itemNb == m_selectedItem )
state = StateEnum::Pressed;
else if( itemNb == m_markedItem )
state = StateEnum::Hovered;
}
Border b = _getEntryBorder();
// ColorsetPtr pTextColors;
// if( m_pSkin )
// pTextColors = m_pSkin->TextColors();
if( m_pEntrySkin )
{
Rect dest( posX, window.y, pI->m_width + b.width(), window.h );
m_pEntrySkin->render( pDevice, dest, state, clip );
// pTextColors = m_pEntrySkin->TextColors();
}
pen.setPos( Coord(posX + b.left, printPosY) );
TextAttr attr;
TextTool::addPropAttributes( attr, Base::getDefaultTextprop(), state );
// TextTool::setAttrColor( attr, pTextColors, mode );
TextTool::addPropAttributes( attr, m_pTextProp, state );
pen.setAttributes( attr );
pDevice->printLine( pen, attr, pI->m_pText );
posX += pI->m_width + b.width();
}
itemNb++;
pI = pI->next();
}
}
示例3: Coord
/**
* Applique l'opérateur modulo sur les deux coordonnées.
*/
Coord Coord::operator%(const int n) const
{
return Coord(this->x % n, this->y % n);
}
示例4: item
/**
This function returns the size of the specified item.
\param ItemID the id of the item (e.g. Structure_HeavyFactory)
\return a Coord containg the size (e.g. (3,2) ). Returns (0,0) on error.
*/
Coord getStructureSize(int itemID) {
switch(itemID) {
case Structure_Barracks: return Coord(2,2); break;
case Structure_ConstructionYard: return Coord(2,2); break;
case Structure_GunTurret: return Coord(1,1); break;
case Structure_HeavyFactory: return Coord(3,2); break;
case Structure_HighTechFactory: return Coord(3,2); break;
case Structure_IX: return Coord(2,2); break;
case Structure_LightFactory: return Coord(2,2); break;
case Structure_Palace: return Coord(3,3); break;
case Structure_Radar: return Coord(2,2); break;
case Structure_Refinery: return Coord(3,2); break;
case Structure_RepairYard: return Coord(3,2); break;
case Structure_RocketTurret: return Coord(1,1); break;
case Structure_Silo: return Coord(2,2); break;
case Structure_StarPort: return Coord(3,3); break;
case Structure_Slab1: return Coord(1,1); break;
case Structure_Slab4: return Coord(2,2); break;
case Structure_Wall: return Coord(1,1); break;
case Structure_WindTrap: return Coord(2,2); break;
case Structure_WOR: return Coord(2,2); break;
default: return Coord(0,0); break;
}
return Coord(0,0);
}
示例5: Coord
Coord operator-(Coord coord1,Coord coord2){
return Coord(coord1.x()-coord2.x(),coord1.y()-coord2.y(),coord1.z()-coord2.z(),coord1.ex()-coord2.ex(),coord1.ey()-coord2.ey(),coord1.ez()-coord2.ez());
}
示例6: Apple
Apple() {
_value = 10;
_type = NORMAL_APPLE;
_pos = Coord(0, 0);
}
示例7: glPushMatrix
void GlAxisBoxPlot::draw(float lod,Camera* camera) {
float rotationAngle = axis->getRotationAngle();
if (rotationAngle != 0) {
glPushMatrix();
glRotatef(rotationAngle, 0.0f, 0.0f, 1.0f);
}
bottomOutlierCoord = axis->getBottomOutlierCoord();
firstQuartileCoord = axis->getFirstQuartileCoord();
medianCoord = axis->getMedianCoord();
thirdQuartileCoord = axis->getThirdQuartileCoord();
topOutlierCoord = axis->getTopOutlierCoord();
Coord interQuartileRangeBoxCoords[4];
if (axis->hasAscendingOrder()) {
boundingBox.expand(Coord(bottomOutlierCoord.getX() - boxWidth / 2.0f, bottomOutlierCoord.getY(), 0.0f));
boundingBox.expand(Coord(topOutlierCoord.getX() + boxWidth / 2.0f, topOutlierCoord.getY(), 0.0f));
interQuartileRangeBoxCoords[0] = Coord(thirdQuartileCoord.getX() - boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f);
interQuartileRangeBoxCoords[1] = Coord(thirdQuartileCoord.getX() + boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f);
interQuartileRangeBoxCoords[2] = Coord(firstQuartileCoord.getX() + boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f);
interQuartileRangeBoxCoords[3] = Coord(firstQuartileCoord.getX() - boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f);
}
else {
boundingBox.expand(Coord(topOutlierCoord.getX() - boxWidth / 2.0f, topOutlierCoord.getY(), 0.0f));
boundingBox.expand(Coord(bottomOutlierCoord.getX() + boxWidth / 2.0f, bottomOutlierCoord.getY(), 0.0f));
interQuartileRangeBoxCoords[0] = Coord(firstQuartileCoord.getX() - boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f);
interQuartileRangeBoxCoords[1] = Coord(firstQuartileCoord.getX() + boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f);
interQuartileRangeBoxCoords[2] = Coord(thirdQuartileCoord.getX() + boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f);
interQuartileRangeBoxCoords[3] = Coord(thirdQuartileCoord.getX() - boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f);
}
GlQuad interQuartileRangeBox(interQuartileRangeBoxCoords[0], interQuartileRangeBoxCoords[1],
interQuartileRangeBoxCoords[2], interQuartileRangeBoxCoords[3], fillColor);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_SRC_COLOR);
glEnable(GL_LIGHTING);
interQuartileRangeBox.draw(lod, camera);
glDisable(GL_BLEND);
glDisable(GL_LIGHTING);
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GlLines::glDrawLine(interQuartileRangeBoxCoords[0], interQuartileRangeBoxCoords[1], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor);
GlLines::glDrawLine(interQuartileRangeBoxCoords[1], interQuartileRangeBoxCoords[2], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor);
GlLines::glDrawLine(interQuartileRangeBoxCoords[2], interQuartileRangeBoxCoords[3], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor);
GlLines::glDrawLine(interQuartileRangeBoxCoords[3], interQuartileRangeBoxCoords[0], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor);
GlLines::glDrawLine(bottomOutlierCoord + Coord(-(boxWidth / 2.0f), 0.0f, 0.0f), bottomOutlierCoord + Coord(boxWidth / 2.0f, 0.0f, 0.0f), 2, GlLines::TLP_PLAIN, outlineColor, outlineColor);
GlLines::glDrawLine(medianCoord + Coord(-(boxWidth / 2.0f), 0.0f, 0.0f), medianCoord + Coord(boxWidth / 2.0f, 0.0f, 0.0f), 2, GlLines::TLP_PLAIN, outlineColor, outlineColor);
GlLines::glDrawLine(topOutlierCoord + Coord(-(boxWidth / 2.0f), 0.0f, 0.0f), topOutlierCoord + Coord(boxWidth / 2.0f, 0.0f, 0.0f), 2, GlLines::TLP_PLAIN, outlineColor, outlineColor);
GlLines::glDrawLine(bottomOutlierCoord, firstQuartileCoord, 2, GlLines::TLP_DASHED, outlineColor, outlineColor);
GlLines::glDrawLine(thirdQuartileCoord, topOutlierCoord, 2, GlLines::TLP_DASHED, outlineColor, outlineColor);
glDisable(GL_BLEND);
drawLabel(bottomOutlierCoord, axis->getBottomOutlierStringValue(),camera);
drawLabel(firstQuartileCoord, axis->getFirstQuartileStringValue(),camera);
drawLabel(medianCoord, axis->getMedianStringValue(),camera);
drawLabel(thirdQuartileCoord, axis->getThirdQuartileStringValue(),camera);
drawLabel(topOutlierCoord, axis->getTopOutlierStringValue(),camera);
if (highlightRangeLowBound != NULL && highlightRangeHighBound != NULL) {
Coord highlightBoxCoords[4] = { Coord(highlightRangeHighBound->getX() - boxWidth / 2.0f, highlightRangeHighBound->getY(), 0.0f),
Coord(highlightRangeHighBound->getX() + boxWidth / 2.0f, highlightRangeHighBound->getY(), 0.0f),
Coord(highlightRangeLowBound->getX() + boxWidth / 2.0f, highlightRangeLowBound->getY(), 0.0f),
Coord(highlightRangeLowBound->getX() - boxWidth / 2.0f, highlightRangeLowBound->getY(), 0.0f)
};
Color outlineColorTranslucent(outlineColor);
outlineColorTranslucent.setA(10);
GlQuad highlightBox(highlightBoxCoords[0], highlightBoxCoords[1], highlightBoxCoords[2], highlightBoxCoords[3], outlineColorTranslucent);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_SRC_COLOR);
glEnable(GL_LIGHTING);
highlightBox.draw(lod, camera);
glDisable(GL_BLEND);
glDisable(GL_LIGHTING);
highlightRangeLowBound = NULL;
highlightRangeHighBound = NULL;
}
if (rotationAngle != 0.0f) {
glPopMatrix();
}
}
示例8: __compute_up
static inline
Coord __compute_up(unit_t NX, unit_t NY)
{
return Coord(NX,__half_NY(NY)-1);
}
示例9: __compute_lo
static inline
Coord __compute_lo(unit_t NY)
{
return Coord(0,-__half_NY(NY) );
}
示例10: latlonInverse
inline Coord latlonInverse(const QPointF& point) const
{
return Coord(point.x()/*/EQUATORIALMETERPERDEGREE*/, point.y()/*/EQUATORIALMETERPERDEGREE*/);
}
示例11: SetUp
virtual void SetUp() {
ModuleNodePointer module = Utility::getPointer(new RectangularModuleFactory("module1"));
module->addShape(Utility::getPointer(new RectangularShape("0", Coord(1, 1, 1))));
module->addShape(Utility::getPointer(new RectangularShape("1", Coord(1, 1, 2))));
graph->add(module);
}
示例12: Coord
Coord Coord::operator+( const Coord& src ) const
{
return Coord( this->x + src.x, this->y + src.y, this->z + src.z, this->map );
}
示例13: getDBPC
// かならず、listCharacterが先に呼ばれてロードされていることが前提。
// load失敗していたらNOTLOADエラー返す
void KServer::recv_login( const char *characterName )
{
if( !m_authenticationSuccess )return;
m_lastFunction = FUNCTION_LOGIN;
m_usingPCName = std::string( characterName );
db_proto::PlayerCharacter *dbpc = getDBPC();
if(!dbpc){
send_loginResult( FAIL,0);
std::cerr << "character not found:" << characterName << std::endl;
return;
}
Floor *f = World::getFloor( dbpc->floorID );
if(!f || Coord( dbpc->x, dbpc->y ).insideFloor() == false ){
send_loginResult( FAIL,0);
std::cerr << "invalid location:" << dbpc->floorID << "," << dbpc->x << "," << dbpc->y << std::endl;
return;
}
// このサーバの担当領域か?
Coord logoutCoord = Coord(dbpc->x,dbpc->y);
if( !Zone::inThisZone( dbpc->floorID, logoutCoord) ){
// 領域外でも、1タイル分だけ外れているなら、位置を修正してログインさせる。
// 厳密に1タイルではなくもうちょっとマージンが広くても良い。
Coord c0 = logoutCoord.translate(1,0);
Coord c1 = logoutCoord.translate(0,1);
Coord c2 = logoutCoord.translate(0,-1);
Coord c3 = logoutCoord.translate(-1,0);
bool b0 = Zone::inThisZone( dbpc->floorID, c0 );
bool b1 = Zone::inThisZone( dbpc->floorID, c1 );
bool b2 = Zone::inThisZone( dbpc->floorID, c2 );
bool b3 = Zone::inThisZone( dbpc->floorID, c3 );
if( b0 ){ dbpc->x = c0.x; dbpc->y = c0.y; }
if( b1 ){ dbpc->x = c1.x; dbpc->y = c1.y; }
if( b2 ){ dbpc->x = c2.x; dbpc->y = c2.y; }
if( b3 ){ dbpc->x = c3.x; dbpc->y = c3.y; }
bool resolved = b0 || b1 || b2 || b3;
if( !resolved ){
send_loginResult( FAIL, 0 );
std::cerr << "location is not in this zone." << std::endl;
return;
}
}
// キャラクターを生成して存在するようにする
m_pc = World::allocPlayerCharacter( World::getFloor(dbpc->floorID),
Coord( dbpc->x, dbpc->y ),
this );
assert(m_pc);
m_pc->stat = CharStat( dbpc->hp, dbpc->maxhp, dbpc->level, dbpc->exp );
// 最終的に結果送信
send_loginResult( SUCCESS, m_pc->id );
m_loginSuccess = true;
m_pc->notify( k_proto::FUNCTION_MOVENOTIFY );
// アイテム、スキル、クエストをロードする(遅延して後で読み込まれる)
g_dbcli->send_get_CharacterItem_by_characterID( uID, dbpc->id );
g_dbcli->send_get_CharacterSkill_by_characterID( uID, dbpc->id );
// DEBUG: 敵つくる
if( dbpc->exp == 0 ){
int cnt =0 ;
while(true){
if( World::allocEnemy( m_pc->floor,
m_pc->coord.translate( -5 + ( random() %11 ),
-5 + ( random() %11 ) ),
MOVABLE_GOBLIN ) ){
cnt++;
if(cnt==10)break;
}
}
}
return;
}
示例14: FindCharacterIndex
int StateLobby::OnSelectCharacter (IPacket &packet)
{
std::string name = packet.Read();
if (!packet.EndOfStream())
return MSG_ERROR_SIZE;
World *world = m_server->GetWorld();
player_iterator i = FindCharacterIndex(name);
if ( i != m_player_list.end() )
{
boost::shared_ptr<Player> player = *i;
if (!player)
return MSG_ERROR;
DB::MASTERY::Select mselect;
MasteryTree tree = mselect(m_server->DBConnection(),player->ID(),player->level(),player->race());
player->set_mastery_tree(tree);
DB::SKILL::Select sselect;
std::set<uint32_t> skill_list = sselect(m_server->DBConnection(),player->ID());
player->set_skill_list(skill_list);
boost::shared_ptr<Storage> ml = player->get_storage(STORAGE_MAIN);
DB::ITEM::Select iobj;
std::vector<Item::extended_type> item_list = iobj(m_server->DBConnection(),player->ID(),STORAGE_MAIN);
for (std::vector<Item::extended_type>::const_iterator i = item_list.begin(); i != item_list.end(); ++i)
{
try
{
ml->InsertItem(world->GetItemFactory()->Create(i->id,*i));
}
catch (Exception::InvalidItemID &error)
{
syslog(LOG_INFO,"Lobby::LoadCharacters() - Error while cloning item with ID = %i",i->id);
}
}
DB::JOB::Select jb_sl_query;
Job job = jb_sl_query(m_server->DBConnection(),player->ID());
player->set_job(job);
boost::shared_ptr<OPacket> pkt(new OPacket);
srv_pkt::RequestIngame(pkt);
m_connection->Send(pkt);
DB::PLAYER::State st_query;
st_query(m_server->DBConnection(),player->ID(),true);
pkt.reset(new OPacket);
srv_pkt::InitScreen(pkt);
m_connection->Send(pkt);
DB::HOTKEY::Select hotkey_query;
player->m_Hotkeys = hotkey_query(m_server->DBConnection(),player->ID());
DB::BLOCK::Select block_query;
player->m_BlockList = block_query(m_server->DBConnection(),player->ID());
DB::PLAYER::Autopot autopot_query;
player->m_Autopot = autopot_query(m_server->DBConnection(),player->ID());
if (player->IsDead())
{
player->resurrect(false,false,0,false);
Teleport tlp = m_server->GetWorld()->FindTeleport(player->get_return_point());
if (!tlp.ID)
{
syslog(LOG_INFO,"Invalid Return Point - %i",player->get_return_point());
return MSG_ERROR;
}
player->set_position(Coord(tlp.x,tlp.y,tlp.z,tlp.Zone));
}
pkt.reset(new OPacket);
srv_pkt::PlayerInfo(pkt,player,static_cast<srv::Connection*>(m_connection)->AccountID());
m_connection->Send(pkt);
pkt.reset(new OPacket);
srv_pkt::EndScreen(pkt);
m_connection->Send(pkt);
pkt.reset(new OPacket);
srv_pkt::PlayerID(pkt,player);
m_connection->Send(pkt);
//.........这里部分代码省略.........
示例15: removeButton
void WelcomeScreen::removeButton(int x, int y)
{
Button* button = m_buttons.take(Coord(x, y));
delete button;
update();
}