ui
This commit is contained in:
parent
8477a3a274
commit
e9547d04e0
8 changed files with 171 additions and 15 deletions
BIN
DangerousD/Content/Caveat-Bold.ttf
Normal file
BIN
DangerousD/Content/Caveat-Bold.ttf
Normal file
Binary file not shown.
|
@ -13,6 +13,27 @@
|
|||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin File.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:File.spritefont
|
||||
|
||||
#begin Font_25.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:Font_25.spritefont
|
||||
|
||||
#begin Font_30.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:Font_30.spritefont
|
||||
|
||||
#begin wall.jpg
|
||||
/importer:TextureImporter
|
||||
/processor:TextureProcessor
|
||||
|
@ -24,10 +45,4 @@
|
|||
/processorParam:MakeSquare=False
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:wall.jpg
|
||||
#begin Font.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
/processorParam:PremultiplyAlpha=True
|
||||
/processorParam:TextureFormat=Compressed
|
||||
/build:Font.spritefont
|
||||
|
||||
|
|
60
DangerousD/Content/File.spritefont
Normal file
60
DangerousD/Content/File.spritefont
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file contains an xml description of a font, and will be read by the XNA
|
||||
Framework Content Pipeline. Follow the comments to customize the appearance
|
||||
of the font in your game, and to change the characters which are available to draw
|
||||
with.
|
||||
-->
|
||||
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||
<Asset Type="Graphics:FontDescription">
|
||||
|
||||
<!--
|
||||
Modify this string to change the font that will be imported.
|
||||
-->
|
||||
<FontName>Handjet-ExtraLight.ttf</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>70</Size>
|
||||
|
||||
<!--
|
||||
Spacing is a float value, measured in pixels. Modify this value to change
|
||||
the amount of spacing in between characters.
|
||||
-->
|
||||
<Spacing>0</Spacing>
|
||||
|
||||
<!--
|
||||
UseKerning controls the layout of the font. If this value is true, kerning information
|
||||
will be used when placing characters.
|
||||
-->
|
||||
<UseKerning>true</UseKerning>
|
||||
|
||||
<!--
|
||||
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
|
||||
and "Bold, Italic", and are case sensitive.
|
||||
-->
|
||||
<Style>Regular</Style>
|
||||
|
||||
<!--
|
||||
If you uncomment this line, the default character will be substituted if you draw
|
||||
or measure text that contains characters which were not included in the font.
|
||||
-->
|
||||
<!-- <DefaultCharacter>*</DefaultCharacter> -->
|
||||
|
||||
<!--
|
||||
CharacterRegions control what letters are available in the font. Every
|
||||
character from Start to End will be built and made available for drawing. The
|
||||
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
|
||||
character set. The characters are ordered according to the Unicode standard.
|
||||
See the documentation for more information.
|
||||
-->
|
||||
<CharacterRegions>
|
||||
<CharacterRegion>
|
||||
<Start> </Start>
|
||||
<End>~</End>
|
||||
</CharacterRegion>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
|
@ -17,7 +17,7 @@ with.
|
|||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>12</Size>
|
||||
<Size>25</Size>
|
||||
|
||||
<!--
|
||||
Spacing is a float value, measured in pixels. Modify this value to change
|
64
DangerousD/Content/Font_30.spritefont
Normal file
64
DangerousD/Content/Font_30.spritefont
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file contains an xml description of a font, and will be read by the XNA
|
||||
Framework Content Pipeline. Follow the comments to customize the appearance
|
||||
of the font in your game, and to change the characters which are available to draw
|
||||
with.
|
||||
-->
|
||||
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||
<Asset Type="Graphics:FontDescription">
|
||||
|
||||
<!--
|
||||
Modify this string to change the font that will be imported.
|
||||
-->
|
||||
<FontName>Arial</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>30</Size>
|
||||
|
||||
<!--
|
||||
Spacing is a float value, measured in pixels. Modify this value to change
|
||||
the amount of spacing in between characters.
|
||||
-->
|
||||
<Spacing>0</Spacing>
|
||||
|
||||
<!--
|
||||
UseKerning controls the layout of the font. If this value is true, kerning information
|
||||
will be used when placing characters.
|
||||
-->
|
||||
<UseKerning>true</UseKerning>
|
||||
|
||||
<!--
|
||||
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
|
||||
and "Bold, Italic", and are case sensitive.
|
||||
-->
|
||||
<Style>Regular</Style>
|
||||
|
||||
<!--
|
||||
If you uncomment this line, the default character will be substituted if you draw
|
||||
or measure text that contains characters which were not included in the font.
|
||||
-->
|
||||
<!-- <DefaultCharacter>*</DefaultCharacter> -->
|
||||
|
||||
<!--
|
||||
CharacterRegions control what letters are available in the font. Every
|
||||
character from Start to End will be built and made available for drawing. The
|
||||
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
|
||||
character set. The characters are ordered according to the Unicode standard.
|
||||
See the documentation for more information.
|
||||
-->
|
||||
<CharacterRegions>
|
||||
<CharacterRegion>
|
||||
<Start> </Start>
|
||||
<End>~</End>
|
||||
</CharacterRegion>
|
||||
<CharacterRegion>
|
||||
<Start>а</Start>
|
||||
<End>я</End>
|
||||
</CharacterRegion>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
BIN
DangerousD/Content/Handjet-ExtraLight.ttf
Normal file
BIN
DangerousD/Content/Handjet-ExtraLight.ttf
Normal file
Binary file not shown.
|
@ -8,14 +8,31 @@ internal class MenuGUI : AbstractGui
|
|||
{
|
||||
protected override void CreateUI()
|
||||
{
|
||||
Elements.Add(new CheckBox(Manager) { rectangle = new Rectangle(10, 10, 50, 50) });
|
||||
var but = new Button(Manager) { rectangle = new Rectangle(100, 10, 80, 50) };
|
||||
Elements.Add(but);
|
||||
but.LeftButtonPressed += () =>
|
||||
int wigth = AppManager.Instance.Window.ClientBounds.Width;
|
||||
int height = AppManager.Instance.Window.ClientBounds.Height;
|
||||
var butSingle = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 130, 300, 50), text = "Singleplayer", fontName = "File" };
|
||||
Elements.Add(butSingle);
|
||||
butSingle.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.ChangeGameState(GameState.Game);
|
||||
};
|
||||
Elements.Add(new Button(Manager) { rectangle = new Rectangle(0, 10, 50, 50) });
|
||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle(100, 10, 50, 50), text = "DA" });
|
||||
var butMulti = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "File" };
|
||||
Elements.Add(butMulti);
|
||||
butMulti.LeftButtonPressed += () =>
|
||||
{
|
||||
// открытие мультиплеера
|
||||
};
|
||||
var butOption = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 250, 300, 50), text = "Option", fontName = "File" };
|
||||
Elements.Add(butOption);
|
||||
butOption.LeftButtonPressed += () =>
|
||||
{
|
||||
// открытие настроек
|
||||
};
|
||||
var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" };
|
||||
Elements.Add(butExit);
|
||||
butExit.LeftButtonPressed += () =>
|
||||
{
|
||||
AppManager.Instance.Exit();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ namespace MonogameLibrary.UI.Base
|
|||
public class DrawableTextedUiElement : DrawableUIElement
|
||||
{
|
||||
protected SpriteFont spriteFont;
|
||||
protected string fontName;
|
||||
public string fontName;
|
||||
public string text = "";
|
||||
public float scale = 0.5f;
|
||||
public Color fontColor = Color.Black;
|
||||
|
|
Loading…
Add table
Reference in a new issue