Skip to content

OGDrawHelper

Jeppe Zapp edited this page Feb 14, 2014 · 14 revisions

Helper class for drawing sprites and glyphs

Variables

Variable Type
texSize Vector2 The size of the currently drawn atlas

Methods

Method Return type
SetPass ( mat : Material ) void Define atlas to be drawn
DrawLabel ( rect : Rect, string : string, style : OGTextStyle, intSize : int, alignment : TextAnchor, depth : float, alpha : float, clipping : OGWidget ) void Draw a label
DrawSprite ( rect : Rect, style OGStyle:, depth : float, alpha : float, clipping : OGWidget ) void Draw a simple sprite
DrawTiledSprite ( rect : Rect, style : OGStyle, depth : float, alpha : float, tileX : int, tileY : int, clipping : OGWidget ) void Draw a tiled sprite
DrawSlicedSprite ( rect : Rect, style : OGStyle, depth : float, alpha : float, clipping : OGWidget ) void Draw a sliced sprite

Example

The draw helper is exclusively used by widgets

public class MyWidget extends OGWidget {
   override function DrawSkin () {
      OGDrawHelper.DrawSlicedSprite ( drawRct, styles.basic, drawDepth, alpha, null );
   }

   override function DrawText () {
      OGDrawHelper.DrawLabel ( drawRct, "Hello!", styles.basic.text, 12, TextAnchor.UpperLeft, drawDepth, alpha, null );
   }
}