protected override void InitializeService() { TextureGL patch6 = materialManager.Texture("res/images/ninepatch6.png", false); TextureGL patch7 = materialManager.Texture("res/images/ninepatch7.png", false); Vector2 padding = new Vector2(6.0f, 6.0f); Vector2 innerPadding = new Vector2(2.0f, 2.0f); NinePatchStyle ninePatchStyle = new NinePatchStyle(patch6); NinePatchStyle foreNinePatchStyle = new NinePatchStyle(patch7); Style.NullPadding = new Style( new Vector2(0.0f, 0.0f), new Vector2(0.0f, 0.0f), null, null, null ); Style.Background = new Style( padding, innerPadding, (textRenderer != null) ? textRenderer.FontStyle : null, ninePatchStyle, renderer.Programs["Ninepatch"] ); Style.Foreground = new Style( padding, innerPadding, (textRenderer != null) ? textRenderer.FontStyle : null, foreNinePatchStyle, renderer.Programs["Font"] ); Style.Default = Style.Background; }
private Area Menu() { Material material = new Material("menu", renderer.Programs["Textured"], MeshMode.PolygonFill); FontStyle fontStyle = new FontStyle("res/fonts/large.fnt"); Vector2 padding = new Vector2(6.0f, 6.0f); Vector2 innerPadding = new Vector2(2.0f, 2.0f); NinePatchStyle ninePatchStyle = new NinePatchStyle("ninepatch8.png"); menuStyle = new Style( padding, innerPadding, fontStyle, ninePatchStyle, material ); Dock dock = new Dock(Orientation.Vertical); dock.OffsetFreeSizeRelative = new Vector2(0.5f, 0.5f); dock.OffsetSelfSizeRelative = new Vector2(-0.5f, -0.5f); var b1 = new Button(renderer, "New Game", menuStyle); var b2 = new Button(renderer, "Load", menuStyle); var b3 = new Button(renderer, "Options", menuStyle); var b4 = new Button(renderer, "Quit", menuStyle); b1.OffsetFreeSizeRelative = new Vector2(0.5f, 0.0f); b2.OffsetFreeSizeRelative = new Vector2(0.5f, 0.0f); b3.OffsetFreeSizeRelative = new Vector2(0.5f, 0.0f); b4.OffsetFreeSizeRelative = new Vector2(0.5f, 0.0f); b1.OffsetSelfSizeRelative = new Vector2(-0.5f, 0.0f); b2.OffsetSelfSizeRelative = new Vector2(-0.5f, 0.0f); b3.OffsetSelfSizeRelative = new Vector2(-0.5f, 0.0f); b4.OffsetSelfSizeRelative = new Vector2(-0.5f, 0.0f); dock.Add(b1); dock.Add(b2); dock.Add(b3); dock.Add(b4); return(dock); }
private void InitializeStyles() { FontStyle fontStyle = new FontStyle("res/fonts/small.fnt"); Vector2 padding = new Vector2(6.0f, 6.0f); Vector2 innerPadding = new Vector2(2.0f, 2.0f); NinePatchStyle ninePatchStyle = new NinePatchStyle("ninepatch6.png"); NinePatchStyle foreNinePatchStyle = new NinePatchStyle("ninepatch7.png"); Style.Background = new Style( padding, innerPadding, fontStyle, ninePatchStyle, material ); Style.Foreground = new Style( padding, innerPadding, fontStyle, foreNinePatchStyle, material ); Style.Default = Style.Background; }