Skip to content

Instantly share code, notes, and snippets.

/**
* Created by Thomas Zenkner on 11.08.2016.
*/
package ui.components {
import feathers.events.FeathersEventType;
import feathers.layout.ILayoutData;
import feathers.layout.ILayoutDisplayObject;
import starling.display.Image;
protected function initialize(): void {
_textFormatCache = new Dictionary();
getStyleProviderForClass(Label).defaultStyleFunction = setLabelStyles;
}
protected function setLabelStyles(label: Label): void {
label.textRendererProperties.textFormat = getTextFormat(label.styleNameList);
}
private function getTextFormat(style: TokenList): TextFormat {
@tzenkner
tzenkner / PieFillImage.as
Last active August 10, 2016 20:44
Starling Displayobject that shows a texture with a circular mask and pie chart like filling set by a percentage
package application.popup.view{
import com.adobe.utils.AGALMiniAssembler;
import flash.display3D.*;
import flash.geom.*;
import starling.core.RenderSupport;
import starling.core.Starling;
import starling.display.DisplayObject;
package application.popup.view{
import com.adobe.utils.AGALMiniAssembler;
import flash.display3D.*;
import flash.geom.*;
import starling.core.RenderSupport;
import starling.core.Starling;
import starling.display.DisplayObject;
package{
import flash.geom.PerspectiveProjection;
import starling.animation.Tween;
import starling.core.Starling;
/**
* less code for setting up starling.animation.Tween instances
* it's working but not finished yet
* @author Thomas Zenkner
package{
import org.osflash.signals.Signal;
import starling.animation.DelayedCall;
import starling.animation.IAnimatable;
import starling.animation.Tween;
import starling.core.Starling;
/**
* basic timeline implementation to handle tweens and functions
package{
import starling.animation.Tween;
import starling.core.Starling;
/**
* less code for setting up starling.animation.Tween instances
* it's working but not finished yet
* @author Thomas Zenkner
*/
public class LazyTween extends Tween{
package{
import feathers.controls.Button;
import feathers.controls.Label;
import feathers.controls.text.BitmapFontTextRenderer;
import feathers.core.ITextRenderer;
import feathers.display.Scale3Image;
import feathers.display.Scale9Image;
import feathers.text.BitmapFontTextFormat;
import feathers.textures.Scale3Textures;
@tzenkner
tzenkner / ThresholdTestState.as
Last active December 16, 2015 11:59
Simple state which constantly "fires" box2d circles and render them to a Texture. They are stored in a Vector to delete the oldest ones when a specific amount is reached
package levels {
import Box2D.Common.Math.b2Vec2;
import Box2D.Dynamics.Contacts.b2Contact;
import citrus.core.CitrusEngine;
import citrus.core.starling.StarlingState;
import citrus.objects.Box2DPhysicsObject;
import citrus.objects.CitrusSprite;
import citrus.objects.platformer.box2d.Platform;
package
{
import Box2D.Common.Math.b2Vec2;
import citrus.objects.CitrusSprite;
import citrus.view.starlingview.StarlingCamera;
import citrus.view.starlingview.StarlingView;
import starling.core.Starling;
import starling.extensions.lighting.core.LightBase;