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