geObject2D

From GriffinEngine
Jump to: navigation, search

geObject2D is a base class for all geHUD elements.

Usage

This class itself has an empty Draw() method, but its virtual fields and methods are used in derived classes.


Inheritance

Base classes

Derived classes


Reference

Alignment Options

Alignment options are used with
Align()
method to make it easy to position objects. Alignment specifies which point of the object should be used as the "attachment point" of an object. Default alignment for newly created objects is GE_ALIGN_TL (top left).

The same constants are used to specify axis alignment in an object, i.e. whether object revolves around the center, top-left corner, etc. Default axis alignment for new objects is GE_ALIGN_CENTER (middle of an object).

GE_ALIGN_TL

top left

GE_ALIGN_TC

top center

GE_ALIGN_TR

top right

GE_ALIGN_CL

center left

GE_ALIGN_CENTER

center

GE_ALIGN_CR

center right

GE_ALIGN_BL

bottom left

GE_ALIGN_BC

bottom center

GE_ALIGN_BR

bottom right

GE_ALIGN_CUSTOM

specify x and y offsets in pixels, relative to the object's top-left corner

Axis Options

Fields

Note: All coordinates are in pixels, relative to top-left corner of the window. All angles are in degrees.

  • double x; // x coordinate (px)
  • double y; // y coordinate (px)
  • double r; // rotation (degrees) - around axis point
  • double s; // scale (1.0 = 100%) - around axis point
  • double w; // width (px)
  • double h; // height (px)
  • double alignX; // horizontal alignment offset (px) - use Align() to set these
  • double alignY; // vertical alignment offset (px)
  • double axisX; // horizontal axis offset (px) - use SetAxis() to set these
  • double axisY; // vertical axis offset (px)
  • bool active; // indicates whether object should be active/visible

Methods

  • virtual void Align( int alignment = GE_ALIGN_TL, double _alignX = 0, double _alignY = 0 );
Specify alignment option for an object. The last 2 parameters are only required if alignment=GE_ALIGN_CUSTOM, in which case they specify the relative offset (in pixels) from the top-left corner of the object.
  • virtual void SetAxis( int axis = GE_ALIGN_CENTER, double _axisX = 0, double _axisY = 0 );
Specify axis alignment option for an object. same as above, the last 2 parameters are only required if alignment=GE_ALIGN_CUSTOM.