这篇教程C++ GetX函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetX函数的典型用法代码示例。如果您正苦于以下问题:C++ GetX函数的具体用法?C++ GetX怎么用?C++ GetX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetX函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SetPositionvoid Line::SetY(double y) { SetPosition(GetX(), y); }
开发者ID:cugone,项目名称:Abrams2010,代码行数:1,
示例2: GET_PLAYER/// Recalculate when each unit will arrive at the current army position, whatever that isvoid CvArmyAI::UpdateCheckpointTurnsAndRemoveBadUnits(){ CvAIOperation* pOperation = GET_PLAYER(GetOwner()).getAIOperation(GetOperationID()); //should be updated before calling this ... CvPlot* pCurrentArmyPlot = GC.getMap().plot(GetX(), GetY()); //kick out damaged units, but if we're defending or escorting, no point in running away if (pOperation->IsOffensive()) { for (unsigned int iI = 0; iI < m_FormationEntries.size(); iI++) { if (!m_FormationEntries[iI].IsUsed()) continue; CvUnit* pUnit = GET_PLAYER(m_eOwner).getUnit(m_FormationEntries[iI].m_iUnitID); if (pUnit == NULL) continue; //failsafe - make sure the army ID is set if (pUnit->getArmyID() != GetID()) pUnit->setArmyID(GetID()); //let tactical AI handle those if (pUnit->GetCurrHitPoints() < pUnit->GetMaxHitPoints() / 3) RemoveUnit(m_FormationEntries[iI].GetUnitID()); } } //update for all units in this army. ignore the ones still being built int iGatherTolerance = pOperation->GetGatherTolerance(this, pCurrentArmyPlot); for(unsigned int iI = 0; iI < m_FormationEntries.size(); iI++) { if (!m_FormationEntries[iI].IsUsed()) continue; CvUnit* pUnit = GET_PLAYER(m_eOwner).getUnit(m_FormationEntries[iI].GetUnitID()); if(pUnit && pCurrentArmyPlot) { if(plotDistance(*pUnit->plot(),*pCurrentArmyPlot)<iGatherTolerance) { m_FormationEntries[iI].SetTurnsToCheckpoint(0); } else { //be generous with the flags here, for some ops the muster point may be far away and intermittendly occupied by foreign units ... int iFlags = CvUnit::MOVEFLAG_APPROX_TARGET_RING2 | CvUnit::MOVEFLAG_IGNORE_STACKING | CvUnit::MOVEFLAG_IGNORE_ZOC; int iTurnsToReachCheckpoint = pUnit->TurnsToReachTarget(pCurrentArmyPlot, iFlags, pOperation->GetMaximumRecruitTurns()); //if we're already moving to target, the current army plot is moving, so we cannot check progress against ... if ( iTurnsToReachCheckpoint==INT_MAX || (GetArmyAIState()==ARMYAISTATE_WAITING_FOR_UNITS_TO_CATCH_UP && !m_FormationEntries[iI].IsMakingProgressTowardsCheckpoint(iTurnsToReachCheckpoint)) ) { CvString strMsg; strMsg.Format("Removing %s %d from army %d because no progress to checkpoint (%d:%d). ETA %d, previously %d.", pUnit->getName().c_str(), m_FormationEntries[iI].GetUnitID(), GetID(), pCurrentArmyPlot->getX(), pCurrentArmyPlot->getY(), iTurnsToReachCheckpoint, m_FormationEntries[iI].m_iPrevEstimatedTurnsToCheckpoint); pOperation->LogOperationSpecialMessage(strMsg); RemoveUnit(m_FormationEntries[iI].GetUnitID()); } else m_FormationEntries[iI].SetTurnsToCheckpoint(iTurnsToReachCheckpoint); } } }}
开发者ID:LoneGazebo,项目名称:Community-Patch-DLL,代码行数:66,
示例3: GetXvoid Sprite::ScaleToClipped( float fWidth, float fHeight ){ m_fRememberedClipWidth = fWidth; m_fRememberedClipHeight = fHeight; if( !m_pTexture ) return; int iSourceWidth = m_pTexture->GetSourceWidth(); int iSourceHeight = m_pTexture->GetSourceHeight(); // save the original X&Y. We're going to resore them later. float fOriginalX = GetX(); float fOriginalY = GetY(); if( IsDiagonalBanner(iSourceWidth, iSourceHeight) ) // this is a SSR/DWI CroppedSprite { float fCustomImageCoords[8] = { 0.02f, 0.78f, // top left 0.22f, 0.98f, // bottom left 0.98f, 0.22f, // bottom right 0.78f, 0.02f, // top right }; Sprite::SetCustomImageCoords( fCustomImageCoords ); if( fWidth != -1 && fHeight != -1) m_size = RageVector2( fWidth, fHeight ); else { /* If no crop size is set, then we're only being used to crop diagonal * banners so they look like regular ones. We don't actually care about * the size of the image, only that it has an aspect ratio of 4:1. */ m_size = RageVector2(256, 64); } SetZoom( 1 ); } else if( m_pTexture->GetID().filename.find( "(was rotated)" ) != m_pTexture->GetID().filename.npos && fWidth != -1 && fHeight != -1 ) { /* Dumb hack. Normally, we crop all sprites except for diagonal banners, * which are stretched. Low-res versions of banners need to do the same * thing as their full resolution counterpart, so the crossfade looks right. * However, low-res diagonal banners are un-rotated, to save space. BannerCache * drops the above text into the "filename" (which is otherwise unused for * these banners) to tell us this. */ Sprite::StopUsingCustomCoords(); m_size = RageVector2( fWidth, fHeight ); SetZoom( 1 ); } else if( fWidth != -1 && fHeight != -1 ) { // this is probably a background graphic or something not intended to be a CroppedSprite Sprite::StopUsingCustomCoords(); // first find the correct zoom Sprite::ScaleToCover( RectF(0,0,fWidth,fHeight) ); // find which dimension is larger bool bXDimNeedsToBeCropped = GetZoomedWidth() > fWidth+0.01; if( bXDimNeedsToBeCropped ) // crop X { float fPercentageToCutOff = (this->GetZoomedWidth() - fWidth) / this->GetZoomedWidth(); float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; // generate a rectangle with new texture coordinates RectF fCustomImageRect( fPercentageToCutOffEachSide, 0, 1 - fPercentageToCutOffEachSide, 1 ); SetCustomImageRect( fCustomImageRect ); } else // crop Y { float fPercentageToCutOff = (this->GetZoomedHeight() - fHeight) / this->GetZoomedHeight(); float fPercentageToCutOffEachSide = fPercentageToCutOff / 2; // generate a rectangle with new texture coordinates RectF fCustomImageRect( 0, fPercentageToCutOffEachSide, 1, 1 - fPercentageToCutOffEachSide ); SetCustomImageRect( fCustomImageRect ); } m_size = RageVector2( fWidth, fHeight ); SetZoom( 1 ); } // restore original XY SetXY( fOriginalX, fOriginalY );}
开发者ID:Braunson,项目名称:openitg,代码行数:93,
示例4: AnimateText/************************************************************************ Function: void AnimateText(BYTE mov) Overview: Routine to move or animate the text. Input: mov - number of pixels the text will be moved Output: none************************************************************************/void AnimateText(BYTE mov){ static SHORT xPos = STXXPOS, yPos = STXYPOS; static SHORT x, y; SHORT width; SHORT height; SHORT newX, newY, oldX, oldY; XCHAR NewChar, *pString; // set the clipping region SetClip(CLIP_ENABLE); SetClipRgn(STXXPOS + 2, STXYPOS + 2, STXXPOS + STXWIDTH - 2, STXYPOS + STXHEIGHT - 2); // set the font SetFont(pHWData->pHWFont); // calculate string width & height width = GetTextWidth((XCHAR *)pHWData->pHWStr, pHWData->pHWFont); height = GetTextHeight(pHWData->pHWFont); //----------------------------------------------------------------- // interlace the erasing and printing of characters // check first if we need to move in the positive or negative direction if((xPos + width) >= (STXXPOS + STXWIDTH)) x = -(mov); if(xPos <= (STXXPOS)) x = (mov); if((yPos + height) >= (STXYPOS + STXHEIGHT)) y = -(mov); if(yPos <= (STXYPOS)) y = (mov); pString = pHWData->pHWStr; oldX = xPos; oldY = yPos; newX = xPos + x; newY = yPos + y; while((XCHAR)15 < (XCHAR)(NewChar = *pString++)) { // remove the old position of the character SetColor(FontScheme2->CommonBkColor); MoveTo(oldX, oldY); WAIT_UNTIL_FINISH(OutChar(NewChar)); oldX = GetX(); oldY = GetY(); // display the character in the new position SetColor(BRIGHTBLUE); MoveTo(newX, newY); WAIT_UNTIL_FINISH(OutChar(NewChar)); newX = GetX(); newY = GetY(); } xPos += x; yPos += y; // disable the clipping SetClip(CLIP_DISABLE);}
开发者ID:Athuli7,项目名称:Microchip,代码行数:72,
示例5: remove_timer// solar: if lifetime is 0 this is a permanent beacon.. not sure if that'll be// useful for anythingBeacon::Beacon(Mob *at_mob, int lifetime):Mob( nullptr, nullptr, 0, 0, 0, INVISIBLE_MAN, 0, BT_NoTarget, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), remove_timer(lifetime), spell_timer(0){ remove_timer.Disable(); spell_timer.Disable(); remove_me = false; spell_id = 0xFFFF; resist_adjust = 0; spell_iterations = 0; caster_id = 0; // copy location x_pos = at_mob->GetX(); y_pos = at_mob->GetY(); z_pos = at_mob->GetZ(); heading = at_mob->GetHeading(); if(lifetime) { remove_timer.Start(); }#ifdef SOLAR entity_list.Message(0, 0, "Beacon being created at %0.2f %0.2f %0.2f heading %0.2f lifetime %d", GetX(), GetY(), GetZ(), GetHeading(), lifetime);#endif}
开发者ID:fizzgig16,项目名称:Server,代码行数:33,
示例6: main/***************************************** *int main (void) *****************************************/int main (void){ InitializeHardware(); HardwareButtonInit(); InitAllLEDs(); #ifdef USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH GFX_DRIVER_AutoUpdPart(); // Turn on widget auto update, partial update for less flashing#endif InitTick(); GOLInit(); SetColor(WHITE); ClearDevice(); // Set proper display rotation#if(DISP_ORIENTATION == 90) GFX_DRIVER_InitRotmode(ROTATE_90);#else#error "This PICTail display orientation must be 90."#endif // make sure that the correct hex file is loaded CheckExternalFlashHex(); // Create cursor in GFX_CURSOR_LAYER with Alpha Color = 0xA GFX_DRIVER_CreateLayer( GFX_CURSOR_LAYER, GFX_LAYER_TRANS_EN | 0xA, GetX(), GetY(), GetX() + 31, GetY() + 31 ); GFX_DRIVER_ActivateLayer( GFX_CURSOR_LAYER ); PutImage(0, 0, (void *)&mouse_cursor_icon_270, IMAGE_NORMAL); GFX_DRIVER_ActivateLayer( GFX_MAIN_LAYER ); // Start demo screen demoScreens = DEMO_INTRO_SCREEN_CREATE; while(1) { GOLDraw();#ifndef USE_BISTABLE_DISPLAY_GOL_AUTO_REFRESH #if defined( ONE_CYCLE_DRAWING ) // The screen drawing starts and completes during one while(1) cycle loop in main(). // This Demo is one cycle drawing application. if ( GFX_DRIVER_IsUpdateRequested() || (g_UPDATE_FLAGS == GFX_UPDATE_AS_IT_DRAWS) ) { GFX_DRIVER_UpdateEpd( g_UPDATE_FLAGS, 0, 0, GetMaxX(), GetMaxY() ); g_UPDATE_FLAGS = GFX_UPDATE_NO_FLASH | GFX_WAIT_IMAGE_DISPLAYED; } #else // This way can be used when drawing may take few or more cycles of while(1) loop in main(). // See "tick.c" file for details. if ( g_UpdateNow || (g_UPDATE_FLAGS == GFX_UPDATE_AS_IT_DRAWS) ) { g_UpdateNow = 0; GFX_DRIVER_UpdateEpd( g_UPDATE_FLAGS, 0, 0, GetMaxX(), GetMaxY() ); g_UPDATE_FLAGS = GFX_UPDATE_NO_FLASH | GFX_WAIT_IMAGE_DISPLAYED; } #endif#endif } return (-1);}
开发者ID:Athuli7,项目名称:Microchip,代码行数:65,
示例7: GetX/**/brief Slider mouse down call back. */bool Slider::MouseLUp( int xi, int yi ){ this->SetVal(this->PixelToVal(xi - GetX())); Widget::MouseLDown( xi, yi );; if(OPTION(int, "options/sound/buttons")) UI::beep->Play(); return true;}
开发者ID:cthielen,项目名称:epiar,代码行数:8,
示例8: SetupBlendingFunctionvoid CGSH_Direct3D9::SetRenderingContext(uint64 primReg){ auto prim = make_convertible<PRMODE>(primReg); unsigned int context = prim.nContext; uint64 testReg = m_nReg[GS_REG_TEST_1 + context]; uint64 frameReg = m_nReg[GS_REG_FRAME_1 + context]; uint64 alphaReg = m_nReg[GS_REG_ALPHA_1 + context]; uint64 zbufReg = m_nReg[GS_REG_ZBUF_1 + context]; uint64 tex0Reg = m_nReg[GS_REG_TEX0_1 + context]; uint64 tex1Reg = m_nReg[GS_REG_TEX1_1 + context]; uint64 clampReg = m_nReg[GS_REG_CLAMP_1 + context]; uint64 scissorReg = m_nReg[GS_REG_SCISSOR_1 + context]; if(!m_renderState.isValid || (m_renderState.primReg != primReg)) { m_device->SetRenderState(D3DRS_ALPHABLENDENABLE, ((prim.nAlpha != 0) && m_alphaBlendingEnabled) ? TRUE : FALSE); } if(!m_renderState.isValid || (m_renderState.alphaReg != alphaReg)) { SetupBlendingFunction(alphaReg); } if(!m_renderState.isValid || (m_renderState.testReg != testReg)) { SetupTestFunctions(testReg); } if(!m_renderState.isValid || (m_renderState.zbufReg != zbufReg) || (m_renderState.frameReg != frameReg)) { SetupDepthBuffer(zbufReg, frameReg); } if(!m_renderState.isValid || (m_renderState.frameReg != frameReg) || (m_renderState.scissorReg != scissorReg)) { SetupFramebuffer(frameReg, scissorReg); } if(!m_renderState.isValid || (m_renderState.tex0Reg != tex0Reg) || (m_renderState.tex1Reg != tex1Reg) || (m_renderState.clampReg != clampReg)) { SetupTexture(tex0Reg, tex1Reg, clampReg); } m_renderState.isValid = true; m_renderState.primReg = primReg; m_renderState.alphaReg = alphaReg; m_renderState.testReg = testReg; m_renderState.zbufReg = zbufReg; m_renderState.frameReg = frameReg; m_renderState.tex0Reg = tex0Reg; m_renderState.tex1Reg = tex1Reg; m_renderState.clampReg = clampReg; m_renderState.scissorReg = scissorReg; auto offset = make_convertible<XYOFFSET>(m_nReg[GS_REG_XYOFFSET_1 + context]); m_nPrimOfsX = offset.GetX(); m_nPrimOfsY = offset.GetY(); if(GetCrtIsInterlaced() && GetCrtIsFrameMode()) { if(m_nCSR & CSR_FIELD) { m_nPrimOfsY += 0.5; } }}
开发者ID:AbandonedCart,项目名称:Play-,代码行数:78,
示例9: PointPoint Tile::GetPoint() const{ return Point(GetX(), GetY());}
开发者ID:stuzeakd,项目名称:NEXT-study-CPP-BattleShip,代码行数:4,
示例10: GetAquariumvoid CFish::BreedingUpdate(double elapsed){ CAquarium *aquarium = GetAquarium(); //fish logic for breeding if (mCanBreed == true && mAge >= MaxAge) { if (mInterestTime >= InterestTimePreBreed) { mIsInterested = true; } else if (mIsGestating == false) mInterestTime++; if (mIsGestating == true) mGestatingTime++; if (mIsInterested == true) { CBreedVisitor visitor(mIsMale, GetType()); aquarium->Accept(&visitor); if (visitor.IsInterested()) { // Compute a vector from (x1,y1) to (x2,y2) double dx = visitor.GetX() - GetX(); double dy = visitor.GetY() - GetY(); // How long is that vector? double len = sqrt(dx * dx + dy * dy); if (len > 0) { // Normalize the vector dx /= len; dy /= len; } // Update the location if (GetType() == "beta") { mSpeedX = dx * (MaxSpeedX - BetaSpeed) * BreedMultuplier * elapsed; mSpeedY = dy * (MaxSpeedY - BetaSpeed) * BreedMultuplier * elapsed; } if (GetType() == "bubbles") { mSpeedX = dx * (MaxSpeedX - BubblesSpeed) * BreedMultuplier * elapsed; mSpeedY = dy * (MaxSpeedY - BubblesSpeed) * BreedMultuplier * elapsed; } if (GetType() == "dory") { mSpeedX = dx * (DorySpeed - MaxSpeedX) * BreedMultuplier * elapsed; mSpeedY = dy * (DorySpeed - MaxSpeedY) * BreedMultuplier * elapsed; } // check if the visited fish overlaps this one if (OverlapTest(visitor.GetX(), visitor.GetY())) { if (mIsMale == 0) { mIsGestating = true; } else { visitor.SetGestating(); } mIsInterested = false; mInterestTime = 0; visitor.SetUninterested(); if (GetType() == "beta") { mSpeedX = ((double)rand() / RAND_MAX) * (MaxSpeedX - BetaSpeed); mSpeedY = ((double)rand() / RAND_MAX) * (MaxSpeedY - BetaSpeed); } else if (GetType() == "bubbles") { mSpeedX = ((double)rand() / RAND_MAX) * (MaxSpeedX - BubblesSpeed); mSpeedY = ((double)rand() / RAND_MAX) * (MaxSpeedY - BubblesSpeed); } else if (GetType() == "dory") { mSpeedX = ((double)rand() / RAND_MAX) * (DorySpeed- MaxSpeedX); mSpeedY = ((double)rand() / RAND_MAX) * (DorySpeed- MaxSpeedY); } } } } if (mGestatingTime >= GestatingTime) { mIsGestating = false; mGestatingTime = 0;//.........这里部分代码省略.........
开发者ID:Hutecker,项目名称:Aquarium-Project,代码行数:101,
示例11: returnbool Player::IsPointWithin(int x, int y){ return (x > (GetX()) && GetX() + GetWidth() > x) && (y > GetY() && GetY() + GetWidth() > y);}
开发者ID:copyzerov3,项目名称:Pacman,代码行数:4,
示例12: SetXvoid Sprite::MoveLeft(Dim x) { if(GetX() > x) SetX(GetX() - x);}
开发者ID:Christos-Papoulas,项目名称:hy454_game,代码行数:4,
示例13: rpwxRealPoint ExplainShape::GetEndPoint(int kidNo){ wxRealPoint rp(GetX() - GetBitmap().GetWidth() / 2.0 - ARROWMARGIN, GetY() - (GetHeight()-GetBitmap().GetHeight()) / 2. + (kidCount>1 ? GetBitmap().GetHeight() * 2. /3. * kidNo / (2*kidCount-2) : 0 )); return rp;}
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:5,
示例14: PacketWorldPacket Creature::PackData(){ WorldPacket Packet((uint16)MSG_ADD_OBJECT); Packet << ObjID << pTemplate->Tileset << pTemplate->Name << GetX() << GetY() << pTemplate->tx << pTemplate->ty; return Packet;}
开发者ID:calkut,项目名称:Warrior-of-Dreamworld,代码行数:6,
示例15: Calculatestruct Cluster* Calculate(struct Points* Field, int Height, int Width, int* Num, int NumOfPoints){ struct Cluster *Clusters; int i,j,k,NumOfClusters; int n; double Min; /*int Min_x; int Min_y; int Max_x; int Max_y;*/ double New_Cluster_X; double New_Cluster_Y; int Min_cluster; double Distance; double Point_X, Point_Y; int Flag = 1; int New_Flag; printf("Enter number of clusters: "); scanf("%d",&NumOfClusters); Clusters = (struct Cluster*)malloc(NumOfClusters * sizeof(struct Cluster)); Init_Clusters(Clusters, NumOfClusters); srand(time(NULL)); for(i = 0; i< NumOfClusters; i++) { Clusters[i].x = (double)(rand()%Width); Clusters[i].y = (double)(rand()%Height); } #pragma omp parallel for private(i, Min) for(i = 0;i<NumOfPoints;i++) { Min = (double)(Height + Width); for(k = 0; k<NumOfClusters; k++) { Distance = Dist(Field[i].x,Field[i].y,Clusters[k].x,Clusters[k].y); if(Distance < Min) { Min = Distance; Min_cluster = k; } } Field[i].cluster = Min_cluster; Clusters[Min_cluster] = AddIndex(Clusters[Min_cluster], i); } while(Flag == 1) { Flag = 0; #pragma omp parallel for private(k) for(k=0; k<NumOfClusters; k++) { n = GetClusterNumOfPoints(Clusters[k]); New_Cluster_X = 0; New_Cluster_Y = 0; /*for(i = 0; i < n; i++) { Point_X = GetX(Field, Clusters[k],i); Point_Y = GetY(Field, Clusters[k],i); New_Cluster_X = (i*New_Cluster_X + Point_X)/(i+1);//vot on obhod perepolneniya New_Cluster_Y = (i*New_Cluster_Y + Point_Y)/(i+1); }*/ #pragma omp parallel for private(i) reduction(+:New_Cluster_X, New_Cluster_Y) for(i = 0; i < n; i++) { New_Cluster_X += GetX(Field, Clusters[k],i)/n; New_Cluster_Y += GetY(Field, Clusters[k],i)/n; } Clusters[k].x = New_Cluster_X; Clusters[k].y = New_Cluster_Y; } Clear_Points(Clusters, NumOfClusters); #pragma omp parallel for private(i, Min) for(i = 0;i<NumOfPoints;i++) { Min = (double)(Height + Width); for(k = 0; k<NumOfClusters; k++) { Distance = Dist(Field[i].x,Field[i].y,Clusters[k].x,Clusters[k].y); if(Distance < Min) { Min = Distance; Min_cluster = k; } } if(Field[i].cluster != Min_cluster) Flag = 1; Field[i].cluster = Min_cluster; Clusters[Min_cluster] = AddIndex(Clusters[Min_cluster], i); } } *Num = NumOfClusters; return Clusters;}
开发者ID:StaVorosh,项目名称:K-Means-method,代码行数:99,
示例16: SuggestMovevoid ribi::con3::ConnectThreeWidget::DoComputerMove() noexcept{ const auto move = SuggestMove(); assert(CanDoMove(move.GetX(),move.GetY())); DoMove(move.GetX(),move.GetY());}
开发者ID:richelbilderbeek,项目名称:ConnectThree,代码行数:6,
示例17: AI_SetRoamboxvoid NPC::AI_SetRoambox(float iDist, float iRoamDist, uint32 iDelay, uint32 iMinDelay) { AI_SetRoambox(iDist, GetX()+iRoamDist, GetX()-iRoamDist, GetY()+iRoamDist, GetY()-iRoamDist, iDelay, iMinDelay);}
开发者ID:UnityEQ,项目名称:UnityEQServer,代码行数:3,
示例18: Choosefunc Choose(){ aTrans[GetLength(aTrans)] = FindObject2(Find_ID(ASTE),Find_Distance(100,GetX(User)-GetX(),GetY(User)-GetY()),Sort_Distance()); CallMessageBoard(0,false,"Bitte geben Sie eine passende Beschreibung ein:",GetOwner(User));}
开发者ID:maxmitti,项目名称:SGGP,代码行数:5,
示例19: GetXint Api::_GetX(Object* target){ return GetX(target);}
开发者ID:RKX1209,项目名称:Dnscript,代码行数:3,
示例20: GetIDBeacon::~Beacon(){#ifdef SOLAR entity_list.Message(0, 0, "Beacon %d being removed at %0.2f %0.2f %0.2f heading %0.2f", GetID(), GetX(), GetY(), GetZ(), GetHeading());#endif}
开发者ID:fizzgig16,项目名称:Server,代码行数:6,
示例21: GetXvoid wxTabControl::OnDraw(wxDC& dc, bool lastInRow){ // Old, but in some ways better (drawing opaque tabs)#ifndef wxUSE_NEW_METHOD if (!m_view) return; // Top-left of tab view area int viewX = m_view->GetViewRect().x; int viewY = m_view->GetViewRect().y; // Top-left of tab control int tabX = GetX() + viewX; int tabY = GetY() + viewY; int tabHeightInc = 0; if (m_isSelected) { tabHeightInc = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight()); tabY -= tabHeightInc; } dc.SetPen(*wxTRANSPARENT_PEN); // Draw grey background if (m_view->GetTabStyle() & wxTAB_STYLE_COLOUR_INTERIOR) { if(m_view->GetBackgroundBrush()) dc.SetBrush(*m_view->GetBackgroundBrush()); // Add 1 because the pen is transparent. Under Motif, may be different.#ifdef __WXMOTIF__ dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + tabHeightInc));#else dc.DrawRectangle(tabX, tabY, (GetWidth()+1), (GetHeight() + 1 + tabHeightInc));#endif } // Draw highlight and shadow dc.SetPen(*m_view->GetHighlightPen()); // Calculate the top of the tab beneath. It's the height of the tab, MINUS // a bit if the tab below happens to be selected. Check. wxTabControl *tabBeneath = NULL; int subtractThis = 0; if (GetColPosition() > 0) tabBeneath = m_view->FindTabControlForPosition(GetColPosition() - 1, GetRowPosition()); if (tabBeneath && tabBeneath->IsSelected()) subtractThis = (m_view->GetTabSelectionHeight() - m_view->GetTabHeight()); // Vertical highlight: if first tab, draw to bottom of view if (tabX == m_view->GetViewRect().x && (m_view->GetTabStyle() & wxTAB_STYLE_DRAW_BOX)) dc.DrawLine(tabX, tabY, tabX, (m_view->GetViewRect().y + m_view->GetViewRect().height)); else if (tabX == m_view->GetViewRect().x) // Not box drawing, just to top of view. dc.DrawLine(tabX, tabY, tabX, (m_view->GetViewRect().y)); else dc.DrawLine(tabX, tabY, tabX, (tabY + GetHeight() + tabHeightInc - subtractThis)); dc.DrawLine(tabX, tabY, (tabX + GetWidth()), tabY); dc.SetPen(*m_view->GetShadowPen()); // Test if we're outside the right-hand edge of the view area if (((tabX + GetWidth()) >= m_view->GetViewRect().x + m_view->GetViewRect().width) && (m_view->GetTabStyle() & wxTAB_STYLE_DRAW_BOX)) { int bottomY = m_view->GetViewRect().y + m_view->GetViewRect().height + GetY() + m_view->GetTabHeight() + m_view->GetTopMargin(); // Add a tab height since we wish to draw to the bottom of the view. dc.DrawLine((tabX + GetWidth()), tabY, (tabX + GetWidth()), bottomY); // Calculate the far-right of the view, since we don't wish to // draw inside that int rightOfView = m_view->GetViewRect().x + m_view->GetViewRect().width + 1; // Draw the horizontal bit to connect to the view rectangle dc.DrawLine((wxMax((tabX + GetWidth() - m_view->GetHorizontalTabOffset()), rightOfView)), (bottomY-1), (tabX + GetWidth()), (bottomY-1)); // Draw black line to emphasize shadow dc.SetPen(*wxBLACK_PEN); dc.DrawLine((tabX + GetWidth() + 1), (tabY+1), (tabX + GetWidth() + 1), bottomY); // Draw the horizontal bit to connect to the view rectangle dc.DrawLine((wxMax((tabX + GetWidth() - m_view->GetHorizontalTabOffset()), rightOfView)), (bottomY), (tabX + GetWidth() + 1), (bottomY)); } else { if (lastInRow) { // 25/5/97 UNLESS it's less than the max number of positions in this row int topY = m_view->GetViewRect().y - m_view->GetTopMargin(); int maxPositions = ((wxTabLayer *)m_view->GetLayers().Item(0)->GetData())->GetCount(); // Only down to the bottom of the tab, not to the top of the view if ( GetRowPosition() < (maxPositions - 1) ) topY = tabY + GetHeight() + tabHeightInc;//.........这里部分代码省略.........
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:101,
示例22: Explosionvoid Polecat::Refresh(){ if (m_energy == 0) { Explosion(); return; } int tmp = GetMSSinceTimeoutStart(); if (cfg.timeout && tmp > 1000 * (GetTotalTimeout())) { if (!last_fart_time) { std::string txt = Format(_("%s has done something for the environment, he has not ordered the polecat to fart."), ActiveCharacter().GetName().c_str()); Weapon::Message(txt); } SignalTimeout(); } Double norm, angle; if (last_fart_time && last_fart_time + TIME_BETWEEN_FART < GameTime::GetInstance()->Read()) { Fart(); } //When we hit the ground, jump ! if(!IsMoving() && !FootsInVacuum()) { // Limiting number of rebound to avoid desync if(last_rebound_time + TIME_BETWEEN_REBOUND > GameTime::GetInstance()->Read()) { image->SetRotation_rad(0.0); return; } last_rebound_time = GameTime::GetInstance()->Read(); MSG_DEBUG("weapon.polecat", "Jump ! (time = %d)", last_rebound_time); //If the GNU is stuck in ground -> change direction int x = GetX(); int y = GetY(); if(x == save_x && y == save_y) m_sens = -m_sens; save_x = x; save_y = y; //Do the jump norm = RandomSync().GetDouble(1.0, 2.0); PutOutOfGround(); SetSpeedXY(Point2d(m_sens * norm , -norm * THREE)); } //Due to a bug in the physic engine //sometimes, angle==infinite (according to gdb) ?? GetSpeed(norm, angle); angle = RestrictAngle(angle) * ONE_HALF; bool flipped = m_sens == -1; if (flipped) { if (angle > 0) angle -= HALF_PI; else angle += HALF_PI; } image->SetRotation_rad(angle); image->SetFlipped(flipped); image->Scale(ONE, ONE); image->Update();}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:61,
示例23: SetWhitespaceHandlingvoidnsSVGTextFrame::UpdateGlyphPositioning(PRBool aForceGlobalTransform){ if (mMetricsState == suspended || !mPositioningDirty) return; SetWhitespaceHandling(); nsISVGGlyphFragmentNode* node = GetFirstGlyphFragmentChildNode(); if (!node) return; mPositioningDirty = PR_FALSE; nsISVGGlyphFragmentLeaf *fragment, *firstFragment; firstFragment = node->GetFirstGlyphFragment(); if (!firstFragment) { return; } float x = 0, y = 0; { nsCOMPtr<nsIDOMSVGLengthList> list = GetX(); GetSingleValue(list, &x); } { nsCOMPtr<nsIDOMSVGLengthList> list = GetY(); GetSingleValue(list, &y); } // loop over chunks while (firstFragment) { { nsCOMPtr<nsIDOMSVGLengthList> list = firstFragment->GetX(); GetSingleValue(list, &x); } { nsCOMPtr<nsIDOMSVGLengthList> list = firstFragment->GetY(); GetSingleValue(list, &y); } // check for startOffset on textPath nsSVGTextPathFrame *textPath = firstFragment->FindTextPathParent(); if (textPath) { if (!textPath->GetPathFrame()) { // invalid text path, give up return; } x = textPath->GetStartOffset(); } // determine x offset based on text_anchor: PRUint8 anchor = firstFragment->GetTextAnchor(); float chunkLength = 0.0f; if (anchor != NS_STYLE_TEXT_ANCHOR_START) { // need to get the total chunk length fragment = firstFragment; while (fragment) { float dx = 0.0f; nsCOMPtr<nsIDOMSVGLengthList> list = fragment->GetDx(); GetSingleValue(list, &dx); chunkLength += dx + fragment->GetAdvance(aForceGlobalTransform); fragment = fragment->GetNextGlyphFragment(); if (fragment && fragment->IsAbsolutelyPositioned()) break; } } if (anchor == NS_STYLE_TEXT_ANCHOR_MIDDLE) x -= chunkLength/2.0f; else if (anchor == NS_STYLE_TEXT_ANCHOR_END) x -= chunkLength; // set position of each fragment in this chunk: fragment = firstFragment; while (fragment) { float dx = 0.0f, dy = 0.0f; { nsCOMPtr<nsIDOMSVGLengthList> list = fragment->GetDx(); GetSingleValue(list, &dx); } { nsCOMPtr<nsIDOMSVGLengthList> list = fragment->GetDy(); GetSingleValue(list, &dy); } fragment->SetGlyphPosition(x + dx, y + dy, aForceGlobalTransform); x += dx + fragment->GetAdvance(aForceGlobalTransform); y += dy; fragment = fragment->GetNextGlyphFragment(); if (fragment && fragment->IsAbsolutelyPositioned()) break; }//.........这里部分代码省略.........
开发者ID:amyvmiwei,项目名称:firefox,代码行数:101,
示例24: GetFPSvoid Sprite::Update(double elapsed, const Map* map) { // Informacion inicial de colision colSprite = NULL; collided = false; // Actualizar animacion this->currentFrame += GetFPS() * elapsed; if (this->currentFrame > this->lastFrame) { this->currentFrame -= (this->lastFrame - this->firstFrame); } else if (this->currentFrame < this->firstFrame) { this->currentFrame += (this->lastFrame - this->firstFrame); } // Actualizar rotacion animada if (IsRotating()) { double rot = elapsed * this->rotatingSpeed; if (rot < this->degreesToRotate) { SetAngle(this->angle + rot); this->degreesToRotate -= rot; } else { SetAngle(this->toAngle); } } // Actualizar movimiento animado if (IsMoving()) { prevX = GetX(); prevY = GetY(); double despX = this->x + elapsed * this->movingSpeedX; double despY = this->y + elapsed * this->movingSpeedY; // x if(this->x - this->toX != 0){ if (this->x < this->toX) { // Right if (despX > this->toX) despX = this->toX; } else if (this->x > this->toX) { // Left if (despX < this->toX) despX = this->toX; } SetX(despX); UpdateCollisionBox(); if (CheckCollision(map)) { SetX(prevX); } } // y if (this->y - this->toY != 0) { if (this->y < this->toY) { // Down if (despY > this->toY) { despY = this->toY; } } else if (this->y > this->toY) { // Up if (despY < this->toY){ despY = this->toY; } } SetY(despY); UpdateCollisionBox(); if (CheckCollision(map)) { SetY(prevY); } } //SetPosition(despX, despY); if (this->x - this->toX == 0 && this->y - this->toY == 0) this->moving = false; } // Informacion final de colision UpdateCollisionBox();}
开发者ID:LibelulaV,项目名称:U-gine,代码行数:75,
注:本文中的GetX函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetX509CRL函数代码示例 C++ GetWorldTransform函数代码示例 |