player-03 / advanced-layout Goto Github PK
View Code? Open in Web Editor NEWAn easy way to create fluid layouts.
License: MIT License
An easy way to create fluid layouts.
License: MIT License
(If this is the wrong place to post this, I'm happy to go where I'm supposed to)
I have the following:
Source/Main.hx
:
package;
import openfl.display.Sprite;
import openfl.Assets;
import openfl.text.TextField;
import openfl.text.TextFormat;
import openfl.system.System;
import openfl.system.Capabilities;
import layout.Layout;
using layout.LayoutCreator;
class Main extends Sprite {
// private var _conn:Connection = null;
public function new() {
super();
// Scale
trace('stage.window.scale ${stage.window.scale}');
trace('Capabilities.screenDPI ${Capabilities.screenDPI}');
Layout.stageLayout.scale.screenDPI(Std.int(Capabilities.screenDPI));
// Load fonts
var bold14Font = new TextFormat("assets/fonts/Lato-Bold", 14, 0xffffff);
// Components
var navbarBackground = new Sprite();
addChild(navbarBackground);
navbarBackground.graphics.beginFill(0x2c3e50);
navbarBackground.graphics.drawRect(0, 0, 10, 10);
var text1 = new TextField();
text1.defaultTextFormat = bold14Font;
text1.text = 'Hello';
addChild(text1);
// Scale components
navbarBackground.simpleScale();
navbarBackground.fillHeight();
navbarBackground.alignTopLeft();
navbarBackground.exactWidth(100);
}
}
project.xml
:
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta title="Test" package="com.example.test" version="0.1.0" company="Test" />
<app main="Main" path="Export" file="Test" />
<source path="Source" />
<haxelib name="openfl" />
<haxelib name="advanced-layout" />
<assets path="Assets" rename="assets" />
<window allow-high-dpi="true" />
</project>
Which renders the textfield and blue bar too small:
If I remove <window allow-high-dpi="true" />
from project.xml
it looks like this:
This is the size "in inches" that I want for the blue bar and text, but with blurry text.
To make the text sharp, I can add <window allow-high-dpi="true" />
back in and then add this code.
text1.scaleX = 2;
text1.scaleY = 2;
but that doesn't scale the blue bar the same as the text.
Changing Layout.stageLayout.scale.screenDPI(...)
doesn't do anything as far as I can tell.
Is there a way to make the blue bar an "inch" wide on all screens and the text smooth using Advanced Layout?
Hi,
i am using .preserveChildren();
to preserve the Movieclip which i am loading from the library
but unfortunately i am not getting the exact size it looks like it is scaling twice the size of the container.
I am using it like this:
view = new LanguageScreenBase();
addChild(view);
view.preserveChildren();
Result:
The green line is the border of the container coming from Flash
or i am missing something !
thanks and happy new year
I get this error with last openfl
/usr/lib/haxe/lib/advanced-layout/git/layout/item/TextSize.hx:42: characters 2-38 : Float should be Null<Int>
/usr/lib/haxe/lib/advanced-layout/git/layout/item/TextSize.hx:42: characters 2-38 : Float should be Int
The readme starts like this:
An easy way to create fluid layouts in Flash and OpenFL.
But then later goes on to mention that other things like HaxeUI are supported too, so perhaps the phrasing could be improved a bit?
I think some of the breaking changes related to static extensions in Haxe 4 are preventing this from working now. https://github.com/HaxeFoundation/haxe/wiki/Breaking-changes-in-Haxe-4.0.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.