2
* This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
3
* For full copyright and license information please refer to doc/license.txt.
9
* This class demonstrates a basic stage layout.
11
class Layout1 extends ui.StageLayout
20
* _resize will be called whenever the stage size changes.
21
* Overriding this function allows you to handle those
23
* In our case we are simple going to draw a few objects
24
* on the screen (to demonstrate different principles)
26
override function _resize( w : Float, h : Float )
28
//if you are used to the Flash API you'll notice that we are
29
//using "gfx" here rather than "graphics" directly. This
30
//is covered in the drawing tutorials
33
//draw a blue square, which is *always* square, based on the
34
//width -- it never distorts based on the size
35
gfx.use( draw.Brush.solid( draw.Color.rgb( 0, 0, 1 ) ) );
36
gfx.drawRect( w/10, h/10, w/10, w/10 );
38
//draw red rectangle which is proportional to the width
39
//and the height of the stage
40
gfx.use( draw.Brush.solid( draw.Color.rgb( 1, 0, 0 ) ) );
41
gfx.drawRect( w/10, 8*h/10, w/10, h/10 );
45
* The following main function must always be defined if
46
* you wish to use a class as the main layout class. There
47
* is unfortunately no simple way to have this automatically
50
static public function main()
52
ui.StageLayout.setup( Layout1 );