| Class THexMap (unit Hexmap) |
TGraphicControl
Used in the Convertcoords function
| Constructors |
constructor Create(AOwner: TComponent);| Functions |
function ConvertCoords(point:Tpoint; { pair to be converted }
pointtype:Tpointtype) { Type to be converted }
:Tpoint;
destructor destroy;
function LoadHexMap(MapFileName : String):Boolean;
procedure PaintAHex(HexColorWanted : Tcolor;
HexPatternWanted: TBrushStyle;
MapLocation:TPoint);****************************************************************************} { This function paints an individual hex whatever color is wanted
function RangeInHexes(Bpoint:Tpoint;
Epoint:TPoint)
:Integer;****************************************************************************} {This function will return the range in hexes between a starting hex point and a ending hex point for a using application that calls it
procedure SaveHexMap(MapFileName : String);
procedure Paint;****************************************************************************} { This Function Draws the map
procedure DrawHexOutline(Target:TCanvas; { Canvas to draw hex on }
Linestyle : TPenStyle; { Wwhat kind of lines }
LineColor : Tcolor; { What color for lines }
x,y,radius: integer; { Position and size of Hex }
button : boolean);****************************************************************************} {Hexagon Outline drawing function
procedure DrawSolidHex(Target:TCanvas; { Canvas to draw hex on }
Fillstyle : TBrushStyle; { How to fill the hex }
Fillcolor : TColor; { Color to fill it }
Linestyle : TPenStyle; { Wwhat kind of lines }
LineColor : Tcolor; { What color for lines }
x,y,radius: integer; { Position and size of Hex }
button : boolean);
function findrange(Bpoint:Tpoint;Epoint:TPoint):Integer;Converts Row/Col to X/Y
procedure MakeBackMap;
procedure MakeSolidMap;
procedure SetBackColor(Value: TColor);
procedure SetBackGroundMap(Value: String);
procedure SetHex3d(Value:Boolean);
procedure SetHexColor(Value: TColor);
procedure SetHexColumns(Value: Integer);
procedure SetHexGrid(Value: Boolean);
procedure SetHexRadius(Value: Integer);
procedure SetHexRows(Value: Integer);
procedure SetHexShowLabels(Value:Boolean);
procedure SetLineColor(Value: TColor);
procedure SetSavedImage(Value:Boolean);
procedure SetSolidHexMap(Value:Boolean);| Properties |
property Align :
property BackColor : TColor
property DragCursor :
property DragMode :
property Enabled :
property Font :
property Hex3d : Boolean
property HexColor : TColor
property HexColumns : Integer
property HexRadius : Integer
property HexRows : Integer
property HexShowLabels : Boolean
property LineColor : TColor
property MapGridOn : Boolean
property MapImageName : String
property NoMapImage : Boolean
property PopupMenu :
property UseSavedMap : Boolean
property Visible : | Events |
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp : | Variables |
BitMap1 : TBitMap;
FBackColor : TColor;
FDrawSolidMap : Boolean;
FHex3d : Boolean;
FHexColor : TColor;
FHexColumns : Integer;
FHexMapName : String;
FHexMapOn : Boolean;
FHexRadius : Integer;
FHexRows : Integer;
FHexShowLabels : Boolean;
FLineColor : Tcolor;
FSavedImage : Boolean;
Rise : integer;
TempMap : TBitMap;| Constructors |
constructor Create(AOwner: TComponent);| Functions |
function ConvertCoords(point:Tpoint; { pair to be converted }
pointtype:Tpointtype) { Type to be converted }
:Tpoint;****************************************************************************} { This function will return the Row / Col pair based on a given X/Y for a using application that calls it
destructor destroy;****************************************************************************} { Free any resources allocated to component
function LoadHexMap(MapFileName : String):Boolean;****************************************************************************} { This function loads a previously created hex map. This will allow you to work with saved images already possessing a hexgrid instead of dynamically creating them each time.
procedure PaintAHex(HexColorWanted : Tcolor;
HexPatternWanted: TBrushStyle;
MapLocation:TPoint);result of conversion
****************************************************************************} { This function paints an individual hex whatever color is wanted
function RangeInHexes(Bpoint:Tpoint;
Epoint:TPoint)
:Integer;returns the range in hexes from Bpoint to EPoint
****************************************************************************} {This function will return the range in hexes between a starting hex point and a ending hex point for a using application that calls it
procedure SaveHexMap(MapFileName : String);****************************************************************************} { This function saves a created hex map and creates an INI file called HexMap.Ini to store the information on the saved HexMap Important Note: Since these bitmaps are not DIBs be sure to change your screen resolution to 256 color or lower prior to editing a grid map and saving it or the image file size will be way to large!
procedure Paint;Make hexes look like buttons?
****************************************************************************} { This Function Draws the map
procedure DrawHexOutline(Target:TCanvas; { Canvas to draw hex on }
Linestyle : TPenStyle; { Wwhat kind of lines }
LineColor : Tcolor; { What color for lines }
x,y,radius: integer; { Position and size of Hex }
button : boolean);Make hexes look like buttons?
****************************************************************************} {Hexagon Outline drawing function
procedure DrawSolidHex(Target:TCanvas; { Canvas to draw hex on }
Fillstyle : TBrushStyle; { How to fill the hex }
Fillcolor : TColor; { Color to fill it }
Linestyle : TPenStyle; { Wwhat kind of lines }
LineColor : Tcolor; { What color for lines }
x,y,radius: integer; { Position and size of Hex }
button : boolean);****************************************************************************} {Solid Hexagon drawing function
function findrange(Bpoint:Tpoint;Epoint:TPoint):Integer;Distance from center to top of hex, need to compute each} {Time the radius changes
Converts Row/Col to X/Y
procedure MakeBackMap;****************************************************************************} { This function constructs the hex grid map with background
procedure MakeSolidMap;****************************************************************************} { This function constructs the grid
procedure SetBackColor(Value: TColor);*}
procedure SetBackGroundMap(Value: String);*}
procedure SetHex3d(Value:Boolean);*}
procedure SetHexColor(Value: TColor);*}
procedure SetHexColumns(Value: Integer);
procedure SetHexGrid(Value: Boolean);*}
procedure SetHexRadius(Value: Integer);*}
procedure SetHexRows(Value: Integer);*}
procedure SetHexShowLabels(Value:Boolean);*}
procedure SetLineColor(Value: TColor);*}
procedure SetSavedImage(Value:Boolean);*}
procedure SetSolidHexMap(Value:Boolean);****************************************************************************} { Hexmap Field Implementations } {
| Properties |
property Align : Inherited properties
property BackColor : TColor
property DragCursor :
property DragMode :
property Enabled :
property Font :
property Hex3d : Boolean
property HexColor : TColor
property HexColumns : Integer
property HexRadius : Integer
property HexRows : Integer
property HexShowLabels : Boolean
property LineColor : TColor
property MapGridOn : Boolean
property MapImageName : String
property NoMapImage : Boolean
property PopupMenu :
property UseSavedMap : Boolean
property Visible : | Events |
event OnClick :
event OnDblClick :
event OnDragDrop :
event OnDragOver :
event OnEndDrag :
event OnMouseDown :
event OnMouseMove :
event OnMouseUp : | Variables |
BitMap1 : TBitMap;Used as a drawing surface, then copied to control
FBackColor : TColor;Color of a Hexagon
FDrawSolidMap : Boolean;Name of background map for canvas
FHex3d : Boolean;Do we want the hex grid shown on the map?
FHexColor : TColor;If true, hexes are shaded like buttons
FHexColumns : Integer;Are we using a previously saved image
FHexMapName : String;Color of lines used to draw a hexagon
FHexMapOn : Boolean;If True, lables are displayed in a hex
FHexRadius : Integer;Number of rows in the map
FHexRows : Integer;Number of Columns in the map
FHexShowLabels : Boolean;The radius of one hexagon
FLineColor : Tcolor;Backround color of bitmap
FSavedImage : Boolean;
Rise : integer;Used to store a background image
TempMap : TBitMap;Make a solid color map