本文整理匯總了C++中GetPos函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetPos函數的具體用法?C++ GetPos怎麽用?C++ GetPos使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetPos函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Action
bool Shot_net::Action(Game_Manager* gm_)
{
if(valid)
{
if(gm_)
{
for(list<Unit*>::iterator it = gm_->unit_list.begin();it != gm_->unit_list.end();it++)
{
if((*it)->isLive() && !(*it)->isNonTarget() && (*it)->GetTeam() != GetTeam() && (*it)->isCollution())
{
if((*it)->collution(GetPos(), 5.0f))
{
(*it)->SetNet(net_time);
(*it)->StateApply("그물",net_time);
valid = false;
}
}
}
}
if(collution(3))
{
valid = false;
}
else
Move();
distance -= const_speed;
if(distance<0)
valid = false;
}
if(!valid)
{
return true;
}
return false;
}
示例2: GetAngleToTarget
float Bazooka::Shot(Game_Manager* gm_, Unit* User_, int team_, const coord_def& start_, const coord_def& pos_, float focus_)
{
float angle_ = GetAngleToTarget(start_, pos_);
if(UseBullet(1))
{
for(int i = 0;i<bunch;i++)
{
float focus2_ = rand_float(-focus_, focus_, "Bazooka::Shot focus");
float speed2_ = shot_speed*GetShotSpeedApply();
float damage_ = damage*GetDamegeApply()*(User_?User_->GetAtkApply():1.0f);
gm_->shot_list.push_back(new Shot_missile(&tex_missile, User_, damage_, GetPower(), GetMaxPower(), range, team_, start_, angle_+focus2_, speed2_, guided_range, guided_power, GetDistance()));
}
if (gm_->isPlayerCanHear(GetPos()))
{
PlaySE(se_rocket, false);
}
gm_->Noise(team_,start_,GetNoise() * User_->GetSilencer());
return burst_speed*(1.0f/(GetBurstSpeedApply()*(User_?User_->GetAtkSpdApply():1.0f)));
}
return -1;
}
示例3: menu_DrawQuad
void TopMenuItem::Render(const Camera& curCamera)
{
menu_DrawQuad(0.f, 0.f, m_w, m_h, 1.f);
float x = kHSpace;
float y = m_h - kVSpace;
for(int i = 0, c = GetChildren().size(); i < c; ++i)
{
auto child = GetChildren()[i];
float titlew,titleh;
child->GetTitleDims(titlew, titleh);
const Color* col = (GetPos() == i) ? &kTextSelColor : &kTextColor;
if(child->HasFlag(MENUSTATE_Active)) col = &kTextActiveColor;
child->DrawTitle(x, y, *col);
x += 2.f * kHSpace + titlew;
}
for(auto child: GetChildren())
if(child->HasFlag(MENUSTATE_Active))
child->Render(curCamera);
}
示例4: GetPos
bool FuelCell::Load(File*)
{
Vec3f p = GetPos();
float s = 5.0f; // TODO CONFIG
m_aabb.Set(p.x - s, p.x + s, p.y - s, p.y + s, p.z - s, p.z + s);
FuelNode* sm = new FuelNode;
sm->SetAABB(m_aabb);
SetSceneNode(sm);
Billboard* bb = new Billboard;
Texture* tex = (Texture*)TheResourceManager::Instance()->GetRes("flare.png");
bb->SetTexture(tex);
bb->SetSize(30.0f); // TODO CONFIG
bb->SetAABB(m_aabb);
sm->AddChild(bb);
return true;
}
示例5: GetPos
GoalMapTarget::~GoalMapTarget()
{
sint32 index;
if (what_goal != GOAL_TYPE_WANDER)
{
GetPos(*m_pos);
m_ai->m_planner->the_strategic_map->
SetAreaGoal(*m_pos, what_goal, NULL);
}
else
{
index = m_ai->m_wanderGoalTargets->Find(this);
Assert(index >= 0);
if (index >= 0)
m_ai->m_wanderGoalTargets->DelIndexFlat(index);
}
}
示例6: GetPos
bool COggFile::Sync(HANDLE hBreak)
{
__int64 start = GetPos();
DWORD dw;
for(__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
i < j && S_OK == ByteRead((BYTE*)&dw, sizeof(dw))
&& ((i&0xffff) || !hBreak || WaitForSingleObject(hBreak, 0) != WAIT_OBJECT_0);
i++, Seek(start + i))
{
if(dw == 'SggO')
{
Seek(start + i);
return(true);
}
}
Seek(start);
return(false);
}
示例7: GetVe1SceneGraph
void Player::OnLocationEntry()
{
Ve1ObjectChar::OnLocationEntry();
SceneNode* root = GetVe1SceneGraph()->GetRootNode(SceneGraph::AMJU_OPAQUE);
if (root)
{
root->AddChild(m_arrow.GetPtr());
SetArrowVis(false);
}
m_nameTag = new PlayerNameNode(this);
if (m_sceneNode)
{
if (m_nameTag)
{
m_sceneNode->AddChild(m_nameTag.GetPtr());
}
if (m_effect)
{
m_sceneNode->AddChild(m_effect.GetPtr());
}
}
// TODO Portal should have a heading which you should face when you appear at the destination
m_isMoving = false;
SetVel(Vec3f(0, 0, 0)); // TODO walk out of doorway ?
// TODO Set m_newPos ??
// Set appearance
SetLoggedIn(IsLoggedIn());
// If we are carrying something, change its location too
if (m_carrying)
{
TheObjectUpdater::Instance()->SendChangeLocationReq(m_carrying->GetId(), GetPos(), GetLocation());
}
}
示例8: AfxGetCurrentSettings
void CVolumeCtrl::IncreaseVolume()
{
AppSettings& s = AfxGetCurrentSettings();
if(GetPos() > 99 && !s.fAudioNormalize){
SetPosInternal(GetPos() + 1);
/*
DWORD plVolume;
int WaveOutVol = 100;
// if(MMSYSERR_NOERROR == waveOutGetVolume(0, (DWORD*)plVolume) ){
// WaveOutVol = (HIWORD(plVolume) + LOWORD(plVolume)) * 100 / 2 / 0xFFFF;
// }
if( WaveOutVol > 90){
int iBVol = (int)(50.0f*log10(s.AudioBoost));
iBVol = min(iBVol + 8, 100);
s.AudioBoost = pow(10.0f, (float)iBVol/50);
if( s.AudioBoost > 100)
s.AudioBoost = 100;
}else{
//increaseWaveOut
//plVolume = (min( (HIWORD(plVolume) + 0x0FFF), 0xFFFF) << 16) | min( (LOWORD(plVolume) + 0x0FFF), 0xFFFF) ;
//waveOutSetVolume(0, plVolume);
}*/
}else{
if (GetPos() > 95 ){
SetPosInternal(100);
}else if (GetPos() > 25 ){
SetPosInternal(GetPos() + GetPageSize());
}else if (GetPos() > 15 ){
SetPosInternal(GetPos() + 3);
}else{
SetPosInternal(GetPos() + 1);
}
}
}
示例9: DrawGraphInCamera
void UnitBase::DrawUnit( bool is_walk , bool is_attack)
{
DrawGraphInCamera(
Vector2(
( GetPos().x - mImageSize.x / 2 ),
( GetPos().y - GetHeight() - mImageSize.y )
),
mImageSize,
mAnimIndex + (is_walk ? 2 : 0) + (is_attack ? 4 : 0),
mImageType,
TRUE,
( mDir.x < 0.0f ) );
//HP
DrawBox(
static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x - 25),
static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y ),
static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x + 25 ),
static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y + 4 ),
GetColor(255,0,0) , TRUE);
DrawBox(
static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x - 25),
static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y ),
static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x - 25 + (50 * mHP / mHPMax) ),
static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y + 4 ),
GetColor(0,255,0) , TRUE);
if( IsVisibleCollision() ){
// コリジョン
DrawBox(
static_cast<int>( GetPos().x - GetSize().x / 2 + gCamera2D().GetDrawOffset().x ),
static_cast<int>( GetPos().y - GetSize().y / 2 + gCamera2D().GetDrawOffset().y ),
static_cast<int>( GetPos().x + GetSize().x / 2 + gCamera2D().GetDrawOffset().x ),
static_cast<int>( GetPos().y + GetSize().y / 2 + gCamera2D().GetDrawOffset().y ),
ColorOf(255,0,0),
FALSE
);
}
if( IsDamaged() ){
SetFontSize(32);
DrawFormatString(
static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x + 32),
static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y + ( - 150 + mDamageFrame ) / 2 ),
GetColor(255,255,0) , "%d", mDamage );
}
}
示例10: GetSize
void MY_UI::Controls::Resizable::Resizing(cWidgetBase* widget){
unsigned int t = widget->GetId();
Utilities::Point size = GetSize();
Utilities::Point pos = GetPos();
int deltax = New_MousePosx - Old_MousePosx;
int deltay = New_MousePosy - Old_MousePosy;
switch(t){
case(Utilities::Tr_to_Bl):// this is top right to bottom left
if(widget == Internal_Resizable.BottomLeft){// this means the bottom control is being draggged!!!
SetPos(pos.x+ deltax, pos.y);
SetSize(size.x - deltax, size.y + deltay);
} else {
SetPos(pos.x, pos.y + deltay);
SetSize(size.x + deltax, size.y - deltay);// otherwise, its the top right .. which doesnt need a new pos
}
break;
case(Utilities::U_to_D):// this is top to bottom
if(widget == Internal_Resizable.Top){// this means the top control is being draggged!!!
SetPos(pos.x, pos.y + deltay);
SetSize(size.x, size.y - deltay);
} else SetSize(size.x, size.y + deltay);// otherwise, its the bottom .. which doesnt need a new pos
break;
case(Utilities::Tl_to_Br):// this is top left to bottom right
if(widget == Internal_Resizable.TopLeft){// this means the top left control is being draggged!!!
SetPos(pos.x + deltax, pos.y + deltay);
SetSize(size.x - deltax, size.y - deltay);
} else SetSize(size.x + deltax, size.y + deltay);// otherwise, its the bottom right.. which doesnt need a new pos
break;
case(Utilities::L_to_R):// this is left to right
if(widget == Internal_Resizable.Left){// this means the left control is being draggged!!!
SetPos(pos.x + deltax, pos.y);
SetSize(size.x - deltax, size.y);
} else SetSize(size.x + deltax, size.y);// otherwise, its the bottom .. which doesnt need a new pos
break;
};
}
示例11: GetPos
void g2Controller::GetGlobalPos(int* x, int* y)
{
// Get this controller's global position
// Which is the summation of all parent offsets
int gX, gY, tX, tY; // Global, temp holders
GetPos(&gX, &gY);
g2Controller* Parent = GetParent();
while(Parent != NULL)
{
Parent->GetPos(&tX, &tY);
gX += tX;
gY += tY;
Parent = Parent->GetParent();
}
// Post results
if(x != NULL)
*x = gX;
if(y != NULL)
*y = gY;
}
示例12: Pos
void CLED::OnDraw(const SRect &rUpdate)
{
if( !IsVisible() )
return;
tfloat fDrawSize = (miCurrent - miMin) / (float)(miMax - miMin);
int iPixelsToDraw = (int)(GetSize().iCY * fDrawSize);
// Possion to draw from
SPos Pos(GetPos() + SPos(0, GetSize().iCY - iPixelsToDraw));
// Size to draw
SSize Size(GetSize().iCX, iPixelsToDraw);
// Set rect to draw
SRect Rect(Pos, Size);
// Draw
mpPrimitives->DrawRect(rUpdate, Rect, mColor);
}
示例13: Melee
bool Monster::Melee(Game_Manager* gm_)
{
if(!GetDamage())
return false;
bool ok_ = false;
if(GetStop())
return false;
for(list<Unit*>::iterator it = gm_->unit_list.begin();it != gm_->unit_list.end();it++)
{
if((*it)->isLive() && !(*it)->isNonTarget() && GetTeam() != (*it)->GetTeam())
{
if(GetSize()+(*it)->GetSize()+5.0f > distan_coord(GetPos(), (*it)->GetPos()))
{
//if(각도가 맞으면)
MeleeDamage(gm_,(*it));
SetDelay(30.0f);
ok_ = true;
}
}
}
return ok_;
}
示例14: GetPos
bool CMissile::PointInObject (CVector vPos)
// PointInObject
//
// Returns TRUE if the given point is inside the object
{
if (m_fDestroyed)
return false;
// Figure out the coordinates of vPos relative to the center of the
// object, in pixels.
CVector vOffset = vPos - GetPos();
int x = (int)((vOffset.GetX() / g_KlicksPerPixel) + 0.5);
int y = -(int)((vOffset.GetY() / g_KlicksPerPixel) + 0.5);
if (m_pPainter)
return m_pPainter->PointInImage(x, y, m_iTick, (m_pDesc->m_bDirectional ? Angle2Direction(m_iRotation) : 0));
else
return m_pDesc->m_Image.PointInImage(x, y, m_iTick, (m_pDesc->m_bDirectional ? Angle2Direction(m_iRotation) : 0));
}
示例15: focusOnItem
bool DIALOG_DRC_CONTROL::focusOnItem( const DRC_ITEM* aItem )
{
if( !aItem )
return false;
auto toolmgr = m_brdEditor->GetToolManager();
auto pos = aItem->GetPointA();
auto marker = static_cast<MARKER_PCB*>( aItem->GetParent() );
if( marker )
{
pos = marker->GetPos();
toolmgr->RunAction( PCB_ACTIONS::selectionClear, true );
toolmgr->RunAction( PCB_ACTIONS::selectItem, true, marker );
}
toolmgr->GetView()->SetCenter( pos );
m_brdEditor->GetCanvas()->Refresh();
return true;
}