mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-11-02 02:26:55 -05:00
More fixes for default.png, fix 'okay' widget not being properly closed when clicking on 'use font'.
This commit is contained in:
parent
7d1e716eb4
commit
ef34766b2b
@ -16,7 +16,7 @@ namespace ClassicalSharp.Gui {
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
messageFont = new Font( game.FontName, 14, FontStyle.Regular );
|
||||
messageFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
}
|
||||
|
||||
public override void Render( double delta ) {
|
||||
|
||||
@ -22,7 +22,8 @@ namespace ClassicalSharp.Gui {
|
||||
textFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
arrowFont = new Font( game.FontName, 18, FontStyle.Bold );
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
title = TextWidget.Create( game, 0, -130, titleText, Anchor.Centre, Anchor.Centre, titleFont );
|
||||
title = ChatTextWidget.Create( game, 0, -130, titleText,
|
||||
Anchor.Centre, Anchor.Centre, titleFont );
|
||||
|
||||
buttons = new ButtonWidget[] {
|
||||
MakeText( 0, -80, Get( 0 ) ),
|
||||
|
||||
@ -77,7 +77,7 @@ namespace ClassicalSharp.Gui {
|
||||
base.Init();
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
arrowFont = new Font( game.FontName, 18, FontStyle.Bold );
|
||||
textFont = new Font( game.FontName, 14, FontStyle.Bold );
|
||||
textFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
|
||||
widgets = new [] {
|
||||
MakeHotkey( 0, -180, 0 ),
|
||||
|
||||
@ -84,7 +84,7 @@ namespace ClassicalSharp.Gui {
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
playerFont = new Font( game.FontName, 14 );
|
||||
playerFont = new Font( game.FontName, 16 );
|
||||
chat = new ChatScreen( game );
|
||||
chat.Init();
|
||||
hotbar = new BlockHotbarWidget( game );
|
||||
|
||||
@ -9,7 +9,7 @@ namespace ClassicalSharp.Gui {
|
||||
public partial class InventoryScreen : Screen {
|
||||
|
||||
public InventoryScreen( Game game ) : base( game ) {
|
||||
font = new Font( game.FontName, 13 );
|
||||
font = new Font( game.FontName, 16 );
|
||||
}
|
||||
|
||||
Block[] blocksTable;
|
||||
|
||||
@ -16,7 +16,6 @@ namespace ClassicalSharp.Gui {
|
||||
TextWidget[] labels;
|
||||
MenuInputWidget[] inputs;
|
||||
MenuInputWidget selectedWidget;
|
||||
Font labelFont;
|
||||
|
||||
public override void Render( double delta ) {
|
||||
RenderMenuBounds();
|
||||
@ -56,20 +55,20 @@ namespace ClassicalSharp.Gui {
|
||||
public override void Init() {
|
||||
game.Keyboard.KeyRepeat = true;
|
||||
base.Init();
|
||||
labelFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
|
||||
inputs = new [] {
|
||||
MakeInput( -80, false, game.World.Width.ToString() ),
|
||||
inputs = new [] {
|
||||
MakeInput( -80, false, game.World.Width.ToString() ),
|
||||
MakeInput( -40, false, game.World.Height.ToString() ),
|
||||
MakeInput( 0, false, game.World.Length.ToString() ),
|
||||
MakeInput( 40, true, "" )
|
||||
};
|
||||
labels = new [] {
|
||||
labels = new [] {
|
||||
MakeLabel( -150, -80, "Width:" ), MakeLabel( -150, -40, "Height:" ),
|
||||
MakeLabel( -150, 0, "Length:" ), MakeLabel( -140, 40, "Seed:" ),
|
||||
TextWidget.Create( game, 0, -130, "Generate new level", Anchor.Centre, Anchor.Centre, titleFont ),
|
||||
ChatTextWidget.Create( game, 0, -130, "Generate new level",
|
||||
Anchor.Centre, Anchor.Centre, regularFont ),
|
||||
};
|
||||
widgets = new [] {
|
||||
ButtonWidget.Create( game, -120, 100, 201, 40, "Flatgrass", Anchor.Centre,
|
||||
@ -93,7 +92,7 @@ namespace ClassicalSharp.Gui {
|
||||
|
||||
TextWidget MakeLabel( int x, int y, string text ) {
|
||||
TextWidget widget = ChatTextWidget.Create( game, x, y, text,
|
||||
Anchor.Centre, Anchor.Centre, labelFont );
|
||||
Anchor.Centre, Anchor.Centre, regularFont );
|
||||
int start = game.Width / 2 - 110;
|
||||
widget.MoveTo( start - widget.Width, widget.Y );
|
||||
widget.Colour = new FastColour( 224, 224, 224 );
|
||||
@ -114,7 +113,6 @@ namespace ClassicalSharp.Gui {
|
||||
inputs[i].Dispose();
|
||||
for( int i = 0; i < labels.Length; i++ )
|
||||
labels[i].Dispose();
|
||||
labelFont.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
@ -128,7 +126,7 @@ namespace ClassicalSharp.Gui {
|
||||
}
|
||||
|
||||
void GenFlatgrassClick( Game game, Widget widget, MouseButton mouseBtn ) {
|
||||
if( mouseBtn != MouseButton.Left ) return;
|
||||
if( mouseBtn != MouseButton.Left ) return;
|
||||
GenerateMap( new FlatGrassGenerator() );
|
||||
}
|
||||
|
||||
|
||||
@ -74,10 +74,13 @@ namespace ClassicalSharp.Gui {
|
||||
}
|
||||
|
||||
void HandleFontChange() {
|
||||
int selIndex = Array.IndexOf<Widget>( widgets, selectedWidget );
|
||||
game.Events.RaiseChatFontChanged();
|
||||
base.Dispose();
|
||||
base.Init();
|
||||
game.RefreshHud();
|
||||
if( selIndex >= 0 )
|
||||
selectedWidget = (ButtonWidget)widgets[selIndex];
|
||||
|
||||
for( int i = 0; i < widgets.Length; i++) {
|
||||
if( widgets[i] == null || !(widgets[i] is ButtonWidget)) {
|
||||
|
||||
@ -28,7 +28,7 @@ namespace ClassicalSharp.Gui {
|
||||
base.Init();
|
||||
if( keyNames == null )
|
||||
keyNames = Enum.GetNames( typeof( Key ) );
|
||||
keyFont = new Font( game.FontName, 15, FontStyle.Bold );
|
||||
keyFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Italic );
|
||||
statusWidget = ChatTextWidget.Create( game, 0, 130, "",
|
||||
Anchor.Centre, Anchor.Centre, regularFont );
|
||||
|
||||
@ -40,7 +40,7 @@ namespace ClassicalSharp.Gui {
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
extendedHelpFont = new Font( game.FontName, 13, FontStyle.Regular );
|
||||
extendedHelpFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
game.Keyboard.KeyRepeat = true;
|
||||
}
|
||||
|
||||
@ -78,11 +78,7 @@ namespace ClassicalSharp.Gui {
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
if( inputWidget != null ) {
|
||||
inputWidget.Dispose();
|
||||
inputWidget = null;
|
||||
}
|
||||
|
||||
DisposeWidgets();
|
||||
game.Keyboard.KeyRepeat = false;
|
||||
extendedHelpFont.Dispose();
|
||||
DisposeExtendedHelp();
|
||||
@ -260,18 +256,23 @@ namespace ClassicalSharp.Gui {
|
||||
string text = inputWidget.GetText();
|
||||
if( inputWidget.Validator.IsValidValue( text ) )
|
||||
targetWidget.SetValue( game, text );
|
||||
|
||||
DisposeWidgets();
|
||||
UpdateDescription( targetWidget );
|
||||
targetWidget = null;
|
||||
InputClosed();
|
||||
}
|
||||
|
||||
void DisposeWidgets() {
|
||||
if( inputWidget != null )
|
||||
inputWidget.Dispose();
|
||||
widgets[widgets.Length - 2] = null;
|
||||
inputWidget = null;
|
||||
UpdateDescription( targetWidget );
|
||||
targetWidget = null;
|
||||
|
||||
int okayIndex = widgets.Length - 1;
|
||||
if( widgets[okayIndex] != null )
|
||||
widgets[okayIndex].Dispose();
|
||||
widgets[okayIndex] = null;
|
||||
InputClosed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ namespace ClassicalSharp.Gui {
|
||||
|
||||
public ExtPlayerListWidget( Game game, Font font ) : base( game, font ) {
|
||||
textures = new Texture[512];
|
||||
titleFont = new Font( game.FontName, 12, FontStyle.Underline );
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Underline );
|
||||
}
|
||||
|
||||
PlayerInfo[] info = new PlayerInfo[512];
|
||||
|
||||
@ -44,7 +44,7 @@ namespace ClassicalSharp.Entities {
|
||||
}
|
||||
|
||||
protected void InitRenderingData() {
|
||||
using( Font font = new Font( game.FontName, 20 ) ) {
|
||||
using( Font font = new Font( game.FontName, 24 ) ) {
|
||||
DrawTextArgs args = new DrawTextArgs( DisplayName, font, true );
|
||||
nameTex = game.Drawer2D.MakeBitmappedTextTexture( ref args, 0, 0 );
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ namespace ClassicalSharp.Model {
|
||||
|
||||
public override bool Bobbing { get { return true; } }
|
||||
|
||||
public override float NameYOffset { get { return 2.1375f; } }
|
||||
public override float NameYOffset { get { return 32/16f + 0.5f/16f; } }
|
||||
|
||||
public override float GetEyeY( Entity entity ) { return 26/16f; }
|
||||
|
||||
|
||||
@ -941,4 +941,3 @@ namespace OpenTK.Platform.MacOS.Carbon
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user