mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
Use default.png for chat, can toggle on or off with an option.
This commit is contained in:
parent
57d4a937c8
commit
f069a32222
@ -35,7 +35,8 @@ namespace ClassicalSharp {
|
||||
|
||||
MakeKeys( 0, 11, -140 );
|
||||
MakeKeys( 11, 11, 140 );
|
||||
buttons[index] = Make( 0, 5, "Back to menu", Anchor.BottomOrRight, (g, w) => g.SetNewScreen( new OptionsScreen( g ) ) );
|
||||
buttons[index] = Make( 0, 5, "Back to menu", Anchor.BottomOrRight,
|
||||
(g, w) => g.SetNewScreen( new PauseScreen( g ) ) );
|
||||
statusWidget = TextWidget.Create( game, 0, 150, "", Anchor.Centre, Anchor.Centre, regularFont );
|
||||
}
|
||||
|
||||
|
@ -33,28 +33,33 @@ namespace ClassicalSharp {
|
||||
g => g.ViewDistance.ToString(),
|
||||
(g, v) => g.SetViewDistance( Int32.Parse( v ) ) ),
|
||||
// Column 2
|
||||
Make( 140, -100, "Chat font size", Anchor.Centre, OnWidgetClick,
|
||||
g => g.Chat.FontSize.ToString(),
|
||||
(g, v) => { g.Chat.FontSize = Int32.Parse( v );
|
||||
Options.Set( OptionsKey.FontSize, v ); } ),
|
||||
|
||||
Make( 140, -50, "Chat lines", Anchor.Centre, OnWidgetClick,
|
||||
g => g.ChatLines.ToString(),
|
||||
(g, v) => { g.ChatLines = Int32.Parse( v );
|
||||
Options.Set( OptionsKey.ChatLines, v ); } ),
|
||||
|
||||
Make( 140, 0, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
|
||||
Make( 140, -100, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
|
||||
g => g.MouseSensitivity.ToString(),
|
||||
(g, v) => { g.MouseSensitivity = Int32.Parse( v );
|
||||
Options.Set( OptionsKey.Sensitivity, v ); } ),
|
||||
|
||||
Make( 140, 50, "Key bindings", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new KeyBindingsScreen( g ) ), null, null ),
|
||||
Make( 140, -50, "Chat font size", Anchor.Centre, OnWidgetClick,
|
||||
g => g.Chat.FontSize.ToString(),
|
||||
(g, v) => { g.Chat.FontSize = Int32.Parse( v );
|
||||
Options.Set( OptionsKey.FontSize, v ); } ),
|
||||
|
||||
Make( 140, 0, "Chat lines", Anchor.Centre, OnWidgetClick,
|
||||
g => g.ChatLines.ToString(),
|
||||
(g, v) => { g.ChatLines = Int32.Parse( v );
|
||||
Options.Set( OptionsKey.ChatLines, v ); } ),
|
||||
|
||||
Make( 140, 50, "Arial chat font", Anchor.Centre, OnWidgetClick,
|
||||
g => g.Drawer2D.UseBitmappedChat ? "no" : "yes",
|
||||
(g, v) => {
|
||||
g.Drawer2D.UseBitmappedChat = v == "no";
|
||||
Options.Set( OptionsKey.ArialChatFont, v == "yes" );
|
||||
game.Events.RaiseChatFontChanged(); } ),
|
||||
|
||||
// Extra stuff
|
||||
!network.IsSinglePlayer ? null :
|
||||
Make( -140, -150, "Singleplayer physics", Anchor.Centre, OnWidgetClick,
|
||||
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
|
||||
(g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),
|
||||
(g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),
|
||||
Make( 140, -150, "Pushback block placing", Anchor.Centre, OnWidgetClick,
|
||||
g => g.PushbackBlockPlacing ? "yes" : "no",
|
||||
(g, v) => g.PushbackBlockPlacing = (v == "yes" ) ),
|
||||
@ -69,10 +74,10 @@ namespace ClassicalSharp {
|
||||
new BooleanValidator(),
|
||||
new IntegerValidator( 16, 4096 ),
|
||||
|
||||
new IntegerValidator( 1, 100 ),
|
||||
new IntegerValidator( 6, 30 ),
|
||||
new IntegerValidator( 1, 30 ),
|
||||
new IntegerValidator( 1, 100 ),
|
||||
null,
|
||||
new BooleanValidator(),
|
||||
|
||||
network.IsSinglePlayer ? new BooleanValidator() : null,
|
||||
new BooleanValidator()
|
||||
|
@ -19,17 +19,28 @@ namespace ClassicalSharp {
|
||||
public override void Init() {
|
||||
titleFont = new Font( "Arial", 16, FontStyle.Bold );
|
||||
buttons = new ButtonWidget[] {
|
||||
Make( -140, -100, "Options", Anchor.Centre, (g, w) => g.SetNewScreen( new OptionsScreen( g ) ) ),
|
||||
Make( -140, -50, "Environment settings", Anchor.Centre, (g, w) => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),
|
||||
Make( -140, 0, "Select texture pack", Anchor.Centre, (g, w) => g.SetNewScreen( new TexturePackScreen( g ) ) ),
|
||||
Make( -140, 50, "Hotkeys", Anchor.Centre, (g, w) => g.SetNewScreen( new HotkeyScreen( g ) ) ),
|
||||
// Column 1
|
||||
Make( -140, -100, "Options", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new OptionsScreen( g ) ) ),
|
||||
Make( -140, -50, "Environment settings", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new EnvSettingsScreen( g ) ) ),
|
||||
|
||||
Make( 140, -100, "Save level", Anchor.Centre, (g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
||||
Make( -140, 0, "Hotkeys", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new HotkeyScreen( g ) ) ),
|
||||
Make( -140, 50, "Key bindings", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new KeyBindingsScreen( g ) ) ),
|
||||
// Column 2
|
||||
Make( 140, -100, "Save level", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new SaveLevelScreen( g ) ) ),
|
||||
!game.Network.IsSinglePlayer ? null :
|
||||
Make( 140, -50, "Load level", Anchor.Centre, (g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
||||
Make( 140, -50, "Load level", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new LoadLevelScreen( g ) ) ),
|
||||
// TODO: singleplayer Generate level screen
|
||||
|
||||
Make( 0, 55, "Back to game", Anchor.BottomOrRight, (g, w) => g.SetNewScreen( new NormalScreen( g ) ) ),
|
||||
Make( 140, 50, "Select texture pack", Anchor.Centre,
|
||||
(g, w) => g.SetNewScreen( new TexturePackScreen( g ) ) ),
|
||||
// Other
|
||||
Make( 0, 55, "Back to game", Anchor.BottomOrRight,
|
||||
(g, w) => g.SetNewScreen( new NormalScreen( g ) ) ),
|
||||
Make( 0, 5, "Quit game", Anchor.BottomOrRight, (g, w) => g.Exit() ),
|
||||
};
|
||||
}
|
||||
|
@ -42,14 +42,16 @@ namespace ClassicalSharp {
|
||||
public override void Init() {
|
||||
X = 10;
|
||||
DrawTextArgs args = new DrawTextArgs( "_", boldFont, false );
|
||||
caretTexture = game.Drawer2D.MakeTextTexture( ref args, 0, 0 );
|
||||
caretTexture = game.Drawer2D.UseBitmappedChat ?
|
||||
game.Drawer2D.MakeBitmappedTextTexture( ref args, 0, 0 ) :
|
||||
game.Drawer2D.MakeTextTexture( ref args, 0, 0 );
|
||||
chatInputText.WordWrap( ref parts, ref partLens, 64 );
|
||||
|
||||
maxWidth = 0;
|
||||
args = new DrawTextArgs( null, font, false );
|
||||
for( int i = 0; i < lines; i++ ) {
|
||||
args.Text = parts[i];
|
||||
sizes[i] = game.Drawer2D.MeasureSize( ref args );
|
||||
sizes[i] = game.Drawer2D.MeasureChatSize( ref args );
|
||||
maxWidth = Math.Max( maxWidth, sizes[i].Width );
|
||||
}
|
||||
|
||||
@ -80,11 +82,11 @@ namespace ClassicalSharp {
|
||||
caretCol = nextCaretCol;
|
||||
} else {
|
||||
args.Text = parts[indexY].Substring( 0, indexX );
|
||||
Size trimmedSize = game.Drawer2D.MeasureSize( ref args );
|
||||
Size trimmedSize = game.Drawer2D.MeasureChatSize( ref args );
|
||||
caretTexture.X1 = 10 + trimmedSize.Width;
|
||||
|
||||
args.Text = new String( parts[indexY][indexX], 1 );
|
||||
Size charSize = game.Drawer2D.MeasureSize( ref args );
|
||||
Size charSize = game.Drawer2D.MeasureChatSize( ref args );
|
||||
caretTexture.Width = charSize.Width;
|
||||
|
||||
caretTexture.Y1 = sizes[0].Height * indexY;
|
||||
@ -112,7 +114,7 @@ namespace ClassicalSharp {
|
||||
args.Text = parts[i];
|
||||
|
||||
drawer.Clear( backColour, 0, yyy, sizes[i].Width, sizes[i].Height );
|
||||
drawer.DrawText( ref args, 0, yyy );
|
||||
drawer.DrawChatText( ref args, 0, yyy );
|
||||
yyy += sizes[i].Height;
|
||||
}
|
||||
chatInputTexture = drawer.Make2DTexture( bmp, size, 10, y );
|
||||
|
@ -4,7 +4,7 @@
|
||||
<ProjectGuid>{BEB1C785-5CAD-48FF-A886-876BF0A318D4}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>ClassicalSharp</RootNamespace>
|
||||
<AssemblyName>ClassicalSharp</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
|
@ -109,6 +109,7 @@ namespace ClassicalSharp {
|
||||
ModelCache.InitCache();
|
||||
AsyncDownloader = new AsyncDownloader( skinServer );
|
||||
Drawer2D = new GdiPlusDrawer2D( Graphics );
|
||||
Drawer2D.UseBitmappedChat = !Options.GetBool( OptionsKey.ArialChatFont, false );
|
||||
|
||||
TerrainAtlas1D = new TerrainAtlas1D( Graphics );
|
||||
TerrainAtlas = new TerrainAtlas2D( Graphics, Drawer2D );
|
||||
|
@ -268,13 +268,6 @@ namespace ClassicalSharp {
|
||||
Key key = e.Key;
|
||||
if( SimulateMouse( key, true ) ) return;
|
||||
|
||||
// TODO: this is a temp debug statement
|
||||
// NOTE: this is a temp debug statement
|
||||
if( key == Key.F8 ) {
|
||||
game.Drawer2D.UseBitmappedChat = !game.Drawer2D.UseBitmappedChat;
|
||||
game.Events.RaiseChatFontChanged();
|
||||
return;
|
||||
}
|
||||
if( key == Key.F4 && (game.IsKeyDown( Key.AltLeft ) || game.IsKeyDown( Key.AltRight )) ) {
|
||||
game.Exit();
|
||||
} else if( key == Keys[KeyBinding.Screenshot] ) {
|
||||
|
@ -12,6 +12,7 @@ namespace ClassicalSharp {
|
||||
public const string Sensitivity = "mousesensitivity";
|
||||
public const string Speed = "speedmultiplier";
|
||||
public const string ChatLines = "chatlines";
|
||||
public const string ArialChatFont = "arialchatfont";
|
||||
|
||||
public const string MouseLeft = "mouseleft";
|
||||
public const string MouseMiddle = "mousemiddle";
|
||||
|
Loading…
x
Reference in New Issue
Block a user