# HeadsUpDisplay HUD Copyright (c) 2007 Doug Hammer. # Modified 2008 by Jacob Schrum. # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. @define VIEW_HEIGHT 1500. @define VIEW_DISTANCE 5. @use Camera. Camera : HUD { + variables: target (object). location (vector). direction (vector). viewdistance (double). + to init: self set-size with-width 400 with-height 50. self set-position with-x 10 with-y 10. viewdistance = -5.0. location=(.1,.1,.1). direction = location * viewdistance. + to set-fov with-width w (int) with-height h (int) at-orgin-x x (int) at-orgin-y y (int) at-distance d (double): self set-size with-width w with-height h. self set-position with-x x with-y y. viewdistance = - |d|. + to set-target object-ptr ptr (object): target = ptr. location = ptr get-location. #direction = location * viewdistance. + to set-location to loc (vector): location = loc. + to track-object from pos = (0.1,-0.1,10) (vector): #if (target) : location = target get-location. #direction = location * viewdistance. direction = pos * viewdistance. self look at location from direction. + to set-viewdistance to v (double): viewdistance = v. }