The C++ side of the Minimap consists of the following files (located in Apps\Kits\HUD):
The minimap view interface declares the following types:
The following code is the PlayerIcon::Update() method (FxMinimapView.cpp; line 116). It shows the logic used to update the player icons in the view using the Direct Access API. The MovieClip member contains a reference to the icon MovieClip on stage. The SetDisplayInfo method directly modifies the MovieClip’s display properties (the display matrix, visibility flag or alpha value) instead of going through the slower SetMember() method. Note that GFx::Value::SetMember is still faster than GFx::Movie::SetVariable:
virtual voidUpdate(FxMinimapView* pview, FxMinimapEntity* pentity, float distSquared) { SF_UNUSED(distSquared); bool hasIcon = (pentity->GetIconRef() != NULL); PointF pt = pentity->GetPhysicalPosition(); bool showDir = pview->IsShowingPlayerDir(); // If entity did not have an icon attached before, then wait for the // next update to set the state data. picon is most probably not initialized // (the movie needs to advance after creation) if (hasIcon && (State != (int)showDir)) { // state 0: no arrow, state 1: show arrow Value frame(Double(showDir ? 2.0 : 1.0)); MovieClip.Invoke("gotoAndStop", NULL, &frame, 1); State = (SInt)showDir; } pt = pview->GetIconTransform().Transform(pt); Value::DisplayInfo info; if (State) { info.SetRotation(pview->IsCompassLocked() ? (pentity->GetDirection() + 90) : (pentity->GetDirection() – pview->GetPlayerDirection())); } info.SetPosition(pt.x, pt.y); MovieClip.SetDisplayInfo(info); }