void CMapEditor10View::OnMouseMove(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 switch(GCurOperState) { case OPERSTATE_ZOOM_IN: //设置操作状态为放大 ZoomInMM(point); break; case OPERSTATE_MOV_PNT: //移动点 MovePoint(point); break; case OPERSTATE_CREAT_REG: CreatRegMM(point); break; case OPERSTATE_MOVE_REG: //设置操作状态为移动区 MoveRegMM(point); break; case OPERSTATE_WINDOW_MOVE: //设置操作状态为窗口移动 WindowMoveMM(point); break; case OPERSTATE_MOVE_LIN: //移动线 if(nFlags==MK_LBUTTON) MoveLin(point); break; case OPERSTATE_INPUT_LIN: //设置操作状态为造线 CreateLinMM(point); break; default: break; } CView::OnMouseMove(nFlags, point); }
void __fastcall TOpenGLFootBall::Timer1Timer(TObject *Sender) { // move the ball... MovePoint(Ball,DeltaBall,W,D); // move the players... for (int t=0; t<5; t++) { if (random(100)<5) // stop it { DeltaPlayers[t].x = 0; DeltaPlayers[t].y = 0; } else // move it { if (DeltaPlayers[t].x == 0) { if (random(100)<10) DeltaPlayers[t].x = 2; else if (random(100)<10) DeltaPlayers[t].x = -2; } if (DeltaPlayers[t].y == 0) { if (random(100)<10) DeltaPlayers[t].y = 2; else if (random(100)<10) DeltaPlayers[t].y = -2; } MovePoint(Players[t],DeltaPlayers[t], W, D); } } // rotate the field... if (CheckBox1->Checked) { TView3DOptions *opt = Draw3D1->View3DOptions; opt->Rotation += 1; opt->Zoom += DeltaZoom; if (opt->Zoom<60 || opt->Zoom>500) DeltaZoom = -DeltaZoom; } // show changes... Draw3D1->Repaint(); }
int main() { char s[100]; struct point point={0,0}; struct point *p; while(fgets(s,100,stdin)!=NULL) { if(s[strlen(s)-1]=='\n') s[strlen(s)-1]='\0'; p=MovePoint(s,&point); printf("%d,%d\n",p->x,p->y); } }
void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance) { float distanceToTravel = _owner->GetExactDist2d(target) - distance; if (distanceToTravel > 0.0f) { float angle = _owner->GetAbsoluteAngle(target); float destx = _owner->GetPositionX() + distanceToTravel * std::cos(angle); float desty = _owner->GetPositionY() + distanceToTravel * std::sin(angle); MovePoint(id, destx, desty, target->GetPositionZ()); } else { // we are already close enough. We just need to turn toward the target without changing position. Movement::MoveSplineInit init(_owner); init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); init.SetFacing(target); Mutate(new GenericMovementGenerator(std::move(init), EFFECT_MOTION_TYPE, id), MOTION_SLOT_ACTIVE); } }
void Unit_Dig::Update(void) { if( m_Life <= 0) { TaskSet_DeadCalc( m_x, m_y, this ); m_Exist = false; } SetStatus(); BadStatusUpdate(); switch(m_MoveStatus) { case UnitBase::MovePoint: MovePoint(); break; case UnitBase::Free: FreeMove(); break; case UnitBase::Enemy: EnemyMove(); default: break; } }
void MotionMaster::MovePoint(uint32 id, Position const& pos, bool generatePath/* = true*/, Optional<float> finalOrient/* = {}*/) { MovePoint(id, pos.m_positionX, pos.m_positionY, pos.m_positionZ, generatePath, finalOrient); }
int main() { InitGraphics(); packet_table[0].packet_count = GIF_PACKET_MAX; packet_table[0].packet = &packets[0][0]; packet_table[1].packet_count = GIF_PACKET_MAX; packet_table[1].packet = &packets[1][0]; /* // change Background color draw_env[0].bg_color.b = 255; draw_env[0].bg_color.r = 255; draw_env[0].bg_color.g = 255; draw_env[1].bg_color.b = 255; draw_env[1].bg_color.r = 255; draw_env[1].bg_color.g = 255; */ while(1) { active_buffer = GsDbGetDrawBuffer(); GsGifPacketsClear(&packet_table[active_buffer]); // clear the area that we are going to put the sprites/triangles/.... MovePoint(); DrawTriangles(&packet_table[active_buffer], active_buffer); //add stuff to the packet area GsDrawSync(0); //wait for the previous buffer to finish drawing GsVSync(0); //display the previous drawn buffer SelectDisplayContext( GsDbGetDisplayBuffer() ); //tell CRTC which context we want to see on our tv // clear the draw environment before we draw stuff on it ClearDrawingContext(active_buffer); GsGifPacketsExecute(&packet_table[active_buffer], 0); // '0' we dont have to wait because we have 2 buffers (GsDrawSync(0) will do the wait) GsDbSwapBuffer(); } return 0; }