Map Panning

Registered by Russ Adams

Summary

When a CharacterMapObject approaches the border of a Map, the Map must pan to reveal more so that the user can make decisions about movement.

Panning the Map

Map Panning itself is already well handled by Map::setFocusPoint(). This method will move all drawables associated with loaded Map Objects by a certain offset which is computed as the difference between the new focus point and the
old focus point.

When panning the map, a new focus point will be selected by attempting to place the CharacterMapObject in the center of the screen.

User Defined Events

The event generated when the CharacterMapObject exceeds the threshold at the borders of the visible screen will be an SDL User Generated Event [1]. By using SDL's event queue, we can avoid implementing one of our own. Asgard's controller already reads SDL events from the SDL event queue.

Asgard will maintain an enumerated list of user defined event codes. One of which will be this Map Pan event.

An event handling thread, hosted by the Map component, will handle the Map Pan event.

Threshold

Map will specify a threshold in terms of a percentage.

  ThresholdTop = ScreenTop + 0 + (ScreenHeight * ThresholdPercentage)
  ThresholdBottom = ScreenTop + ScreenHeight - (ScreenHeight * ThresholdPercentage)
  ThresholdLeft = ScreenLeft + 0 + (ScreenWidth * ThresholdPercentage)
  ThresholdRight = ScreenLeft + ScreenWidth - (ScreenWidth * ThresholdPercentage)

If the CharacterMapObject's World Coordinate x or y exceeds any of these points, the the Map Pan event will fire.

Special Case: CharacterMapObject Movement During Panning

What about map panning while a CharacterMapObject is moving into the 'threshold'? The answer:
  1. Do not allow there to be more than one map panning thread at a time.
  2. All mouse clicks during a Map Pan event must queue or overwrite each other and be handled by the single Map Pan event handling thread.
  3. The velocity of the map panning should always be faster than the velocity of the moving CharacterMapObject,

[1] http://sdl.beuc.net/sdl.wiki/SDL_UserEvent.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
Russ Adams
Definition:
Approved
Series goal:
Accepted for thegrandmap
Implementation:
Implemented
Milestone target:
milestone icon 0.3.8
Started by
Russ Adams
Completed by
Russ Adams

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.