本文整理汇总了C++中MoveTo函数的典型用法代码示例。如果您正苦于以下问题:C++ MoveTo函数的具体用法?C++ MoveTo怎么用?C++ MoveTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MoveTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CorrectDragRect
void CPolySelection::OnDraw( CImage* pImage, COLORREF color )
{
/*CRect tmpSelection = m_rect;
CorrectDragRect( &tmpSelection );
BoundRect( pImage, &tmpSelection );*/
auto hDC = pImage->GetDC();
auto memoryDC = CDC::FromHandle( hDC );
CPen pen( PS_SOLID, 1, color );
CPen* pOldPen = memoryDC->SelectObject( &pen );
//auto origColor = memoryDC->SetDCPenColor( color );
if( m_verts.size() <= 0 )
{
return;
}
memoryDC->MoveTo( m_verts[0] );
for( int i=1; i<(int)m_verts.size(); i++ )
{
auto p = m_verts[i];
memoryDC->LineTo( p );
}
if( !m_bIsFinished )
{
memoryDC->LineTo( m_nextPoint );
}
else
{
memoryDC->LineTo( m_verts[0] );
}
pImage->ReleaseDC();
}
示例2: BWindow
DataTranslationsWindow::DataTranslationsWindow()
:
BWindow(BRect(0.0f, 0.0f, 597.0f, 368.0f),
B_TRANSLATE_SYSTEM_NAME("DataTranslations"),
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE
| B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fRelease(NULL)
{
MoveTo(DataTranslationsSettings::Instance()->WindowCorner());
_SetupViews();
// Make sure that the window isn't positioned off screen
BScreen screen;
BRect screenFrame = screen.Frame();
if (!screenFrame.Contains(Frame()))
CenterOnScreen();
BTranslatorRoster* roster = BTranslatorRoster::Default();
roster->StartWatching(this);
Show();
}
示例3: MoveTo
bool GameDisplayDlg::ProcUserCmd(const POINT& _mp)
{
int nShowX = _mp.x;
int nShowY = _mp.y;
int nClientWidth = m_rcClient.right - m_rcClient.left;
int nClientHeight = m_rcClient.bottom - m_rcClient.top;
nShowX += 5;
nShowY += 5;
if(nShowX + nClientWidth > m_nScreenWidth)
{
int nOffset = nShowX + nClientWidth - m_nScreenWidth;
nShowX -= nOffset;
}
if(nShowY + nClientHeight > m_nScreenHeight)
{
int nOffset = nShowY + nClientHeight - m_nScreenHeight;
nShowY -= nOffset;
}
MoveTo(nShowX, nShowY);
return true;
}
示例4: updatemainwindow
static void updatemainwindow (void) {
Rect r;
Str255 s;
r = (*mainwindow).portRect;
EraseRect (&r);
setfontsizestyle (helvetica, 12, 0);
centerstring (r, windowmessage);
NumToString (FreeMem () / 1024, s);
MoveTo (r.left + 3, r.bottom - 3);
setfontsizestyle (geneva, 9, 0);
DrawString (s);
DrawString ("\pK");
} /*updatemainwindow*/
示例5: MoveTo
/*------------------------------------------------------------------------------*\
( )
-
\*------------------------------------------------------------------------------*/
BRect BmTextControl::layout(BRect frame) {
if (frame == Frame())
return frame;
MoveTo(frame.LeftTop());
ResizeTo(frame.Width(),frame.Height());
#ifdef __HAIKU__
float occupiedSpace = 3 + Divider();
float top = mTextView->Frame().top;
float height = mTextView->Frame().Height();
if (mLabelIsMenu) {
top = mMenuField->MenuBar()->Frame().top;
height = mMenuField->MenuBar()->Frame().Height();
}
mTextView->MoveTo( occupiedSpace, top);
mTextView->ResizeTo( frame.Width()-occupiedSpace-4, height);
#else
float occupiedSpace = 3 + Divider();
mTextView->MoveTo( occupiedSpace, 5);
mTextView->ResizeTo( frame.Width()-occupiedSpace-4,
mTextView->Frame().Height());
#endif // __HAIKU__
return frame;
}
示例6: SetViewColor
void CalendarControl::AttachedToWindow(void)
{
BControl::AttachedToWindow();
pb->SetTarget(this);
if(Parent()!=NULL) view_color=Parent()->ViewColor();
else
view_color.red=view_color.green=view_color.blue=view_color.alpha=255;
SetViewColor(view_color); // function of CalendarControl class
#ifdef __UNIVERSAL_INTERFACE
if(interface==CC_BEOS_INTERFACE)
#endif
#ifdef __BEOS_INTERFACE
MakeButton(); // for BeOS interface is called only from here,
// for Zeta interface if color is changed also (in SetViewColor)
#endif
MoveTo(LT);
}
示例7: lock
status_t
InspectorWindow::LoadSettings(const GuiTeamUiSettings& settings)
{
AutoLocker<BLooper> lock(this);
if (!lock.IsLocked())
return B_ERROR;
BMessage inspectorSettings;
if (settings.Settings("inspectorWindow", inspectorSettings) != B_OK)
return B_OK;
BRect frameRect;
if (inspectorSettings.FindRect("frame", &frameRect) == B_OK) {
ResizeTo(frameRect.Width(), frameRect.Height());
MoveTo(frameRect.left, frameRect.top);
}
_LoadMenuFieldMode(fHexMode, "Hex", inspectorSettings);
_LoadMenuFieldMode(fEndianMode, "Endian", inspectorSettings);
_LoadMenuFieldMode(fTextMode, "Text", inspectorSettings);
return B_OK;
}
示例8: InitializeAABB
/**
* @fn void CShoot::Init (void)
* Used when all the values are initialized by default
* when reading the global initialization game file.
*/
void CShoot::Init (void)
{
SubType = CSH_DEFAULT;
Type = CHARS_MISSIL;
Active = Alive = false; ///The very first time, when created at the beginning of the game, this device is not available
//Space position and AABB
Size.v[XDIM] = .05f; ///Update by default the AABB relative to local coordinates
Size.v[YDIM] = 0.3f;
Size.v[ZDIM] = 0.0f;
RenderMode = CHAR_2D;
visible = true;
#ifdef CHAR_USE_AABB
InitializeAABB();
#endif
MoveTo(0.0f, 0.0f, 0.05f);
Speed.v[YDIM] = CSH_DEFAULT_SPEED;
Health=100;
msgUpd = new RTDESK_CMsg;
msgUpd->Type = RTDESKMSG_BASIC_TYPE;
msgUpd->Propietary = true;
}
示例9: while
//-----------------------------------------------------------------------------
//Summary:
// person move process in traffic system
//-----------------------------------------------------------------------------
void CFreeMovingLogic::ProcessMove( const ElapsedTime& time )
{
ElapsedTime eTime = time;
while(!m_routePath.empty())
{
LandsideTrafficGraphVertex& vertex = m_routePath.back();
if (vertex.GetTrafficObjectType() == CLandsideWalkTrafficObjectInSim::CrossWalk_Type)
return GenerateConflictEvent(eTime);
else if(vertex.GetTrafficObjectType() == CLandsideWalkTrafficObjectInSim::Walkway_Type)
{
CWalkwayInSim* pWalkwayInSim = (CWalkwayInSim*)vertex.GetTrafficInSim();
pWalkwayInSim->stepIt(m_pPaxLandsideBehavior,vertex,this,eTime);
}
else
{
//eTime += m_pPaxLandsideBehavior->moveTime();
MoveTo(eTime,vertex.GetPoint());
m_routePath.pop_back();
}
}
m_pLandsideTrafficSys->LeaveTrafficSystem(m_pPaxLandsideBehavior,m_emEndState,eTime);
}
示例10: clock
// called when a enemy is on sight
bool CMonster::OnEnemyOnSight( CPlayer* Enemy )
{
clock_t etime = clock() - lastSighCheck;
if(etime<5000) return true;
if(!IsOnBattle( ))
{
if(thisnpc->aggresive>1)
{
UINT aggro = GServer->RandNumber(2,15);
if(thisnpc->aggresive>=aggro && !IsGhostSeed( ))
{
Enemy->ClearObject( this->clientid );
SpawnMonster(Enemy, this );
StartAction( (CCharacter*) Enemy, NORMAL_ATTACK, 0 );
}
else
if(IsGhostSeed( ) || thisnpc->aggresive>5)
MoveTo( Enemy->Position->current, true );
}
lastSighCheck = clock();
}
return true;
}
示例11: calculate_lineto
static void calculate_lineto(void)
{
RECT rect;
HPEN hOldPen;
WINT temp;
do {
rect.left = get_rand(0, xMax);
rect.top = get_rand(0, yMax);
rect.right = get_rand(0, xMax);
rect.bottom = get_rand(0, yMax);
hOldPen = SelectObject(hMemDC, create_pen());
SetROP2(hMemDC, get_rand(1,17));
MoveTo(hMemDC, rect.left, rect.top);
LineTo(hMemDC, rect.right, rect.bottom);
DeleteObject(SelectObject(hMemDC, hOldPen));
if (TestSemaphore(&PainterRequired) < 0)
{
if (rect.left > rect.right)
{
temp = rect.left;
rect.left = rect.right;
rect.right = temp;
}
if (rect.top > rect.bottom)
{
temp = rect.top;
rect.top = rect.bottom;
rect.bottom = temp;
}
InvalidateRect(hWnd, &rect, FALSE);
UpdateWindow(hWnd);
}
} while ((TestSemaphore(&DemoRun)) && (!TestSemaphore(&SingleRun)));
if (!TestSemaphore(&SingleRun));
Signal(&Done);
}
示例12: BWindow
VirtualKeyboardWindow::VirtualKeyboardWindow(BInputServerDevice* dev)
:
BWindow(BRect(0,0,0,0),"Virtual Keyboard",
B_NO_BORDER_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL,
B_WILL_ACCEPT_FIRST_CLICK | B_AVOID_FOCUS),
fDevice(dev)
{
BScreen screen;
BRect screenRect(screen.Frame());
ResizeTo(screenRect.Width(), screenRect.Height() / 3);
MoveTo(0,screenRect.Height() - screenRect.Height() / 3);
SetLayout(new BGroupLayout(B_VERTICAL));
//Add to an options window later, use as list for now
fMapListView = new BListView("Maps");
fFontMenu = new BMenu("Font");
fLayoutMenu = new BMenu("Layout");
_LoadMaps();
_LoadLayouts(fLayoutMenu);
_LoadFonts();
KeymapListItem* current =
static_cast<KeymapListItem*>(fMapListView->LastItem());
fCurrentKeymap.Load(current->EntryRef());
fKeyboardView = new KeyboardLayoutView("Keyboard",fDevice);
fKeyboardView->GetKeyboardLayout()->SetDefault();
fKeyboardView->SetEditable(false);
fKeyboardView->SetKeymap(&fCurrentKeymap);
AddChild(BGroupLayoutBuilder(B_VERTICAL)
.Add(fKeyboardView));
}
示例13: real_position
void MoveSplineInit::Stop()
{
MoveSpline& move_spline = *unit.movespline;
// No need to stop if we are not moving
if (move_spline.Finalized())
return;
Location real_position(unit.GetPositionX(), unit.GetPositionY(), unit.GetPositionZ(), unit.GetOrientation());
// there is a big chance that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
if (!move_spline.Finalized())
real_position = move_spline.ComputePosition();
if (args.path.empty())
{
// should i do the things that user should do?
MoveTo(real_position);
}
// current first vertex
args.path[0] = real_position;
args.flags = MoveSplineFlag::Done;
unit.m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_SPLINE_ENABLED));
move_spline.Initialize(args);
WorldPacket data(SMSG_MONSTER_MOVE, 64);
data << unit.GetPackGUID();
data << real_position.x << real_position.y << real_position.z;
data << move_spline.GetId();
data << uint8(MonsterMoveStop);
unit.SendMessageToSet(&data, true);
}
示例14: MoveToCommand
void MoveToCommand (void)
{
char *command;
int32_t targets[6];
do {
if (!(command = GetArgument ())) {
break;
}
targets[0] = decatoi (command);
if (!(command = GetArgument ())) {
break;
}
targets[1] = decatoi (command);
if (!(command = GetArgument ())) {
break;
}
targets[2] = decatoi (command);
if (!(command = GetArgument ())) {
break;
}
targets[3] = decatoi (command);
if (!(command = GetArgument ())) {
break;
}
targets[4] = decatoi (command);
if (!(command = GetArgument ())) {
break;
}
targets[5] = decatoi (command);
MoveTo (targets[0], targets[1], targets[2], targets[3], targets[4], targets[5]);
} while (0);
}
示例15: if
void Game_Player::PerformTeleport() {
if (!teleporting) return;
teleporting = false;
// Finish (un)boarding process
if (location.boarding) {
location.boarding = false;
location.aboard = true;
} else if (location.unboarding) {
location.unboarding = false;
location.aboard = false;
}
// Reset sprite if it was changed by a move
// Even when target is the same map
Refresh();
if (Game_Map::GetMapId() != new_map_id) {
pattern = RPG::EventPage::Frame_middle;
Game_Map::Setup(new_map_id);
last_pan_x = 0;
last_pan_y = 0;
}
SetOpacity(255);
MoveTo(new_x, new_y);
if (new_direction >= 0) {
SetDirection(new_direction);
SetSpriteDirection(new_direction);
}
if (InVehicle())
GetVehicle()->MoveTo(new_x, new_y);
}