fenaren/cs420-game — pull request #43 by fenaren (2014-11-07 04:19:26+00:00)
Title: Map window data

Adds some functionality to the human game view to make it easy to translate from map to window coordinates, and from window to map coordinates. The calculateMapWindowData() function runs each frame and calculates where the top-left corner of the map should be placed in window coordinates, and stores this in a new 'map_tl_wcoords' vector. It also calculates how big map tiles should be drawn.

Two helper functions, mapToWindow() and windowToMap(), were also added. mapToWindow accepts a vector position on the map (in map coordinates) and returns where that position is in the window (in window coordinates). windowToMap() accepts a vector position in the window (in window coordinates) and returns where that position would be on the map (in map coordinates).