header, main panel addition
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package view;
|
||||
|
||||
import feathers.layout.HorizontalLayout;
|
||||
import feathers.layout.AnchorLayoutData;
|
||||
import feathers.text.TextFormat;
|
||||
import openfl.Assets;
|
||||
import openfl.text.Font;
|
||||
import feathers.layout.VerticalAlign;
|
||||
import feathers.controls.Label;
|
||||
import feathers.layout.AnchorLayout;
|
||||
import components.NekoRectangle;
|
||||
import feathers.controls.LayoutGroup;
|
||||
import feathers.controls.Panel;
|
||||
import feathers.events.FeathersEvent;
|
||||
import model.Constants;
|
||||
import t9.util.ColorTraces.*;
|
||||
|
||||
class MainHeader extends LayoutGroup {
|
||||
|
||||
private var lb1:Label;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
|
||||
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
super.initialize();
|
||||
|
||||
final sw:Int = stage.stageWidth;
|
||||
final sh:Int = stage.stageHeight;
|
||||
final headerWidth = Std.int(sw * Constants.MAIN_HEADER_WIDTH_RATIO);
|
||||
final headerHeight = Std.int(sh * Constants.MAIN_HEADER_HEIGHT_RATIO);
|
||||
|
||||
autoSizeMode = CONTENT;
|
||||
backgroundSkin = new NekoRectangle( Constants.HERO_COLOR,
|
||||
0,
|
||||
0,
|
||||
headerWidth,
|
||||
headerHeight);
|
||||
variant = LayoutGroup.VARIANT_TOOL_BAR;
|
||||
|
||||
// Layout settings
|
||||
var l:HorizontalLayout = new HorizontalLayout();
|
||||
l.paddingLeft = l.paddingRight = Std.int(headerHeight * .3);
|
||||
l.paddingTop = l.paddingBottom = Std.int(headerHeight * .2);
|
||||
layout = l;
|
||||
|
||||
// Title label
|
||||
lb1 = new Label();
|
||||
//lb1.backgroundSkin = new NekoRectangle(Constants.ACCENT_COLOR2);
|
||||
|
||||
//lb1.verticalAlign = VerticalAlign.TOP;
|
||||
lb1.text = "Cavalier·e·s";
|
||||
lb1.embedFonts = true;
|
||||
var fnt:Font = Assets.getFont(Constants.MONTSERRAT_MEDIUM_500);
|
||||
|
||||
var tf:TextFormat = new TextFormat(fnt.fontName, Std.int(headerHeight * .4), Constants.MAIN_COLOR3);
|
||||
lb1.textFormat = tf;
|
||||
|
||||
lb1.layoutData = AnchorLayoutData.middleLeft();
|
||||
addChild(lb1);
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user