Skip to content

Commit

Permalink
update demo project
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhengh committed Apr 13, 2016
1 parent edb1481 commit 0feecea
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
Binary file added demo/assets/textures/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions demo/src/starlingbuilder/demo/EmbeddedAssets.as
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ package starlingbuilder.demo
[Embed(source="../../../assets/textures/ui.xml", mimeType="application/octet-stream")]
public static const ui_xml:Class;

[Embed(source="../../../assets/textures/background.jpg")]
public static const background:Class;

//fonts
[Embed(source="../../../assets/textures/fonts/GrilledCheeseBTN_Size18_ColorFFFFFF_StrokeA8364B.png")]
Expand Down
9 changes: 6 additions & 3 deletions demo/src/starlingbuilder/demo/HUD.as
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
package starlingbuilder.demo {
import starling.core.Starling;
import starling.display.Button;
import starling.display.Quad;
import starling.display.Image;
import starling.display.Sprite;
import starling.display.Stage;
import starling.events.Touch;
import starling.events.TouchEvent;
import starling.events.TouchPhase;

import starlingbuilder.engine.util.StageUtil;

public class HUD extends Sprite
{
private var _sprite:Sprite;
Expand All @@ -30,8 +32,9 @@ package starlingbuilder.demo {

var stage:Stage = Starling.current.stage;

var quad:Quad = new Quad(stage.stageWidth, stage.stageHeight);
addChild(quad);
var background:Image = new Image(UIBuilderDemo.assetManager.getTexture("background"));
StageUtil.fitBackground(background);
addChild(background);

_sprite = UIBuilderDemo.uiBuilder.create(ParsedLayouts.hud, false, this) as Sprite;
addChild(_sprite);
Expand Down
12 changes: 6 additions & 6 deletions demo/src/starlingbuilder/demo/UIBuilderDemo.as
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ package starlingbuilder.demo {
{
public static const linkers:Array = [AnchorLayout, FlowLayout, HorizontalLayout, VerticalLayout, TiledRowsLayout, BlurFilter];

private var _assetManager:AssetManager;
private var _assetMediator:starlingbuilder.demo.AssetMediator;

public static var uiBuilder:IUIBuilder;
public static var assetManager:AssetManager;

public function UIBuilderDemo()
{
_assetManager = new AssetManager();
_assetMediator = new starlingbuilder.demo.AssetMediator(_assetManager);
assetManager = new AssetManager();
_assetMediator = new starlingbuilder.demo.AssetMediator(assetManager);

var localization:ILocalization = new DefaultLocalization(JSON.parse(new EmbeddedAssets.strings), "en_US");
uiBuilder = new UIBuilder(_assetMediator, false, null, localization, new DefaultTweenBuilder());
Expand All @@ -49,9 +49,9 @@ package starlingbuilder.demo {

var loader:LayoutLoader = new LayoutLoader(starlingbuilder.demo.EmbeddedLayouts, ParsedLayouts);

_assetManager.enqueue(EmbeddedAssets);
//_assetManager.enqueue(File.applicationDirectory.resolvePath("textures"));
_assetManager.loadQueue(function(ratio:Number):void{
assetManager.enqueue(EmbeddedAssets);
//assetManager.enqueue(File.applicationDirectory.resolvePath("textures"));
assetManager.loadQueue(function(ratio:Number):void{
if (ratio == 1)
{
createButtons();
Expand Down

0 comments on commit 0feecea

Please sign in to comment.