dcsext.ui.DrawObject

DrawObject - base class for a drawable object.

Contents

  1. Description
  2. Metamethods
    1. drawobject:__init(scope)
    2. drawobject:__draw()
  3. Methods
    1. drawobject:isDrawn()
    2. drawobject:draw()
    3. drawobject:remove()
    4. drawobject:update(key, new, old)

Description

This class must be inherited by a concrete class that needs to draw objects in DCS.

Metamethods

drawobject:__init(scope)

Constructor. Initializes the drawable with the properties listed below. Every property can be reassigned later; while the object is drawn the change is pushed to DCS immediately.

  • color - outline color, a Color instance (default black)
  • colorfill - fill color, a Color instance (default black)
  • linetype - line style from enum.MARKUP.LINETYPE (default SOLID)
  • text - label text (default empty string)
  • fontsize - font size in points (default 12)
  • radius - radius in meters, used by circles (default 100)
  • readonly - whether the mark can be edited by players (default true)

Parameters

scope
dcsext.enum.coalition, which coalition can see the drawn object; defaults to all coalitions.

drawobject:__draw()

Pure abstract method. Inheriting objects must override this method to draw the object.

Methods

drawobject:isDrawn()

Tests if this object has been drawn to the screen.

Returns

  • true if the object is currently drawn, false otherwise.

drawobject:draw()

Public method to draw the object. Allocates a mark id and calls the abstract __draw method once; further calls are ignored until the object is removed again.

drawobject:remove()

Remove the drawn object from DCS. Does nothing when the object is not currently drawn.

drawobject:update(key, new, old)

Updates an attribute of the object when its associated class property is updated. Live-updates the corresponding attribute of the drawn mark in DCS; has no effect while the object is not drawn.

Parameters

key
name of the updated property.
new
the new property value.
old
the previous property value.