mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-24 10:02:08 -05:00
Allow using scroll wheel in 'colour scheme' in launcher, other minor touchups.
This commit is contained in:
parent
26f9b1d31f
commit
6478ddb987
8 changed files with 38 additions and 17 deletions
|
@ -54,7 +54,7 @@ namespace ClassicalSharp {
|
|||
|
||||
void ReconnectClick( Game g, Widget w ) {
|
||||
string connectString = "Connecting to " + game.IPAddress + ":" + game.Port + "..";
|
||||
game.SetNewScreen( new LoadingMapScreen( game, connectString, "Reticulating splines" ) );
|
||||
game.SetNewScreen( new LoadingMapScreen( game, connectString, "Waiting for handshake" ) );
|
||||
game.Network.Connect( game.IPAddress, game.Port );
|
||||
}
|
||||
|
||||
|
|
|
@ -187,16 +187,16 @@ namespace ClassicalSharp {
|
|||
void CreateEditingWidgets() {
|
||||
DisposeEditingWidgets();
|
||||
|
||||
buttons[8] = Make( -140, 60, "Key: " + curHotkey.BaseKey,
|
||||
250, 30, textFont, BaseKeyClick );
|
||||
buttons[9] = Make( 140, 60, "Modifiers: " + MakeFlagsString( curHotkey.Flags ),
|
||||
250, 30, textFont, ModifiersClick );
|
||||
buttons[8] = Make( -140, 55, "Key: " + curHotkey.BaseKey,
|
||||
250, 35, textFont, BaseKeyClick );
|
||||
buttons[9] = Make( 140, 55, "Modifiers: " + MakeFlagsString( curHotkey.Flags ),
|
||||
250, 35, textFont, ModifiersClick );
|
||||
buttons[10] = Make( -10, 120, curHotkey.MoreInput ? "yes" : "no",
|
||||
50, 25, textFont, LeaveOpenClick );
|
||||
buttons[11] = Make( -100, 160, "Save changes",
|
||||
160, 30, textFont, SaveChangesClick );
|
||||
buttons[12] = Make( 100, 160, "Remove hotkey",
|
||||
160, 30, textFont, RemoveHotkeyClick );
|
||||
buttons[11] = Make( -120, 160, "Save changes",
|
||||
180, 35, textFont, SaveChangesClick );
|
||||
buttons[12] = Make( 120, 160, "Remove hotkey",
|
||||
180, 35, textFont, RemoveHotkeyClick );
|
||||
|
||||
currentAction = MenuInputWidget.Create(
|
||||
game, 0, 90, 600, 25, "", Anchor.Centre, Anchor.Centre,
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace ClassicalSharp {
|
|||
targetWidget = selectedWidget;
|
||||
inputWidget = MenuInputWidget.Create( game, 0, 150, 400, 25, button.GetValue( game ), Anchor.Centre,
|
||||
Anchor.Centre, regularFont, titleFont, validator );
|
||||
buttons[okayIndex] = ButtonWidget.Create( game, 240, 150, 30, 30, "OK",
|
||||
buttons[okayIndex] = ButtonWidget.Create( game, 240, 150, 40, 30, "OK",
|
||||
Anchor.Centre, Anchor.Centre, titleFont, OnWidgetClick );
|
||||
InputOpened();
|
||||
UpdateDescription( targetWidget );
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace ClassicalSharp {
|
|||
LoadIcon();
|
||||
string connectString = "Connecting to " + IPAddress + ":" + Port + "..";
|
||||
Graphics.WarnIfNecessary( Chat );
|
||||
SetNewScreen( new LoadingMapScreen( this, connectString, "Reticulating splines" ) );
|
||||
SetNewScreen( new LoadingMapScreen( this, connectString, "Waiting for handshake" ) );
|
||||
Network.Connect( IPAddress, Port );
|
||||
}
|
||||
|
||||
|
|
|
@ -88,12 +88,12 @@ namespace ClassicalSharp.Particles {
|
|||
Vector3 maxBB = game.BlockInfo.MaxBB[block];
|
||||
int minU = Math.Min( (int)(minBB.X * 16), (int)(minBB.Z * 16) );
|
||||
int maxU = Math.Min( (int)(maxBB.X * 16), (int)(maxBB.Z * 16) );
|
||||
int minV = (int)(minBB.Y * 16), maxV = (int)(maxBB.Y * 16);
|
||||
int minV = (int)(16 - maxBB.Y * 16), maxV = (int)(16 - minBB.Y * 16);
|
||||
// This way we can avoid creating particles which outside the bounds and need to be clamped
|
||||
if( minU < 13 && maxU > 13 ) maxU = 13;
|
||||
if( minV < 13 && maxV > 13 ) maxV = 13;
|
||||
|
||||
for( int i = 0; i < 25; i++ ) {
|
||||
for( int i = 0; i < 30; i++ ) {
|
||||
double velX = rnd.NextDouble() * 0.8 - 0.4; // [-0.4, 0.4]
|
||||
double velZ = rnd.NextDouble() * 0.8 - 0.4;
|
||||
double velY = rnd.NextDouble() + 0.2;
|
||||
|
@ -110,7 +110,7 @@ namespace ClassicalSharp.Particles {
|
|||
rec.V1 = baseRec.V1 + rnd.Next( minV, maxV ) * uvScale;
|
||||
rec.U2 = Math.Min( baseRec.U1 + maxU * uvScale, rec.U1 + elemSize );
|
||||
rec.V2 = Math.Min( baseRec.V1 + maxV * uvScale, rec.V1 + elemSize );
|
||||
double life = 1.5 - rnd.NextDouble();
|
||||
double life = 0.3 + rnd.NextDouble() * 0.7;
|
||||
|
||||
TerrainParticle p = AddParticle( terrainParticles, ref terrainCount, false );
|
||||
p.ResetState( pos, velocity, life );
|
||||
|
|
|
@ -75,7 +75,6 @@ namespace Launcher2 {
|
|||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
game.Window.Mouse.WheelChanged += MouseWheelChanged;
|
||||
game.Window.Mouse.ButtonUp += MouseButtonUp;
|
||||
|
||||
Resize();
|
||||
|
@ -159,7 +158,7 @@ namespace Launcher2 {
|
|||
game.ConnectToServer( table.servers, Get( hashIndex ) );
|
||||
}
|
||||
|
||||
void MouseWheelChanged( object sender, MouseWheelEventArgs e ) {
|
||||
protected override void MouseWheelChanged( object sender, MouseWheelEventArgs e ) {
|
||||
LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];
|
||||
table.CurrentIndex -= e.Delta;
|
||||
table.ClampIndex();
|
||||
|
@ -183,7 +182,6 @@ namespace Launcher2 {
|
|||
public override void Dispose() {
|
||||
base.Dispose();
|
||||
tableFont.Dispose();
|
||||
game.Window.Mouse.WheelChanged -= MouseWheelChanged;
|
||||
|
||||
LauncherTableWidget table = widgets[tableIndex] as LauncherTableWidget;
|
||||
if( table != null ) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using ClassicalSharp;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace Launcher2 {
|
||||
|
||||
|
@ -53,6 +54,23 @@ namespace Launcher2 {
|
|||
}
|
||||
}
|
||||
|
||||
protected override void MouseWheelChanged( object sender, MouseWheelEventArgs e ) {
|
||||
if( lastInput == null ) return;
|
||||
int index = Array.IndexOf<LauncherWidget>( widgets, lastInput );
|
||||
if( index >= 15 ) return;
|
||||
|
||||
byte col;
|
||||
if( !Byte.TryParse( lastInput.Text, out col ) )
|
||||
return;
|
||||
int newCol = col + e.Delta;
|
||||
|
||||
Utils.Clamp( ref newCol, 0, 255 );
|
||||
lastInput.Text = newCol.ToString();
|
||||
if( lastInput.CaretPos >= lastInput.Text.Length )
|
||||
lastInput.CaretPos = -1;
|
||||
TextChanged( lastInput );
|
||||
}
|
||||
|
||||
void MakeAllRGBTriplets( bool force ) {
|
||||
MakeRGBTriplet( LauncherSkin.BackgroundCol, force, -100 );
|
||||
MakeRGBTriplet( LauncherSkin.ButtonBorderCol, force, -60 );
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace Launcher2 {
|
|||
buttonFont = titleFont;
|
||||
game.Window.Mouse.Move += MouseMove;
|
||||
game.Window.Mouse.ButtonDown += MouseButtonDown;
|
||||
game.Window.Mouse.WheelChanged += MouseWheelChanged;
|
||||
|
||||
game.Window.KeyPress += KeyPress;
|
||||
game.Window.Keyboard.KeyDown += KeyDown;
|
||||
|
@ -138,6 +139,9 @@ namespace Launcher2 {
|
|||
.Redraw( drawer, text, inputFont, inputHintFont );
|
||||
}
|
||||
|
||||
protected virtual void MouseWheelChanged( object sender, MouseWheelEventArgs e ) {
|
||||
}
|
||||
|
||||
protected LauncherInputWidget lastInput;
|
||||
protected virtual void InputClick( int mouseX, int mouseY ) {
|
||||
LauncherInputWidget input = (LauncherInputWidget)selectedWidget;
|
||||
|
@ -197,6 +201,7 @@ namespace Launcher2 {
|
|||
public override void Dispose() {
|
||||
game.Window.Mouse.Move -= MouseMove;
|
||||
game.Window.Mouse.ButtonDown -= MouseButtonDown;
|
||||
game.Window.Mouse.WheelChanged -= MouseWheelChanged;
|
||||
|
||||
game.Window.KeyPress -= KeyPress;
|
||||
game.Window.Keyboard.KeyDown -= KeyDown;
|
||||
|
|
Loading…
Add table
Reference in a new issue