mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Fix clicking on chat.
This commit is contained in:
parent
bd9da4d83d
commit
41cd8a3c0b
@ -72,6 +72,7 @@ namespace ClassicalSharp {
|
||||
FastColour textCol = part.TextColour;
|
||||
float point = font.Size;
|
||||
int xMul = font.Style == FontStyle.Italic ? 1 : 0;
|
||||
int originX = x;
|
||||
|
||||
foreach( char c in text ) {
|
||||
int coords = ConvertToCP437( c );
|
||||
@ -101,6 +102,12 @@ namespace ClassicalSharp {
|
||||
}
|
||||
x += PtToPx( point, srcWidth + 1 );
|
||||
}
|
||||
|
||||
if( font.Style == FontStyle.Underline ) {
|
||||
int* dstRow = fastBmp.GetRowPtr( y );
|
||||
for( int xx = originX; xx < x; xx++ )
|
||||
dstRow[xx] = FastColour.Green.ToArgb();
|
||||
}
|
||||
}
|
||||
|
||||
public override Size MeasureBitmappedSize( ref DrawTextArgs args ) {
|
||||
|
@ -291,7 +291,8 @@ namespace ClassicalSharp {
|
||||
int y = normalChat.Y + normalChat.Height - height;
|
||||
if( new Rectangle( normalChat.X, y, normalChat.Width, height ).Contains( mouseX, mouseY ) ) {
|
||||
string text = normalChat.GetSelected( mouseX, mouseY );
|
||||
if( text != null ) {
|
||||
if( text == null ) return false;
|
||||
|
||||
if( Utils.IsUrlPrefix( text ) ) {
|
||||
game.ShowWarning( new WarningScreen(
|
||||
game, text, OpenUrl, AppendUrl,
|
||||
@ -300,10 +301,11 @@ namespace ClassicalSharp {
|
||||
"Be careful - urls from strangers may link to websites that",
|
||||
" may have viruses, or things you may not want to open/see."
|
||||
) );
|
||||
} else {
|
||||
textInput.AppendText( text );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return textInput.HandlesMouseClick( mouseX, mouseY, button );
|
||||
|
@ -116,10 +116,9 @@ namespace ClassicalSharp {
|
||||
public string GetSelected( int mouseX, int mouseY ) {
|
||||
for( int i = 0; i < Textures.Length; i++ ) {
|
||||
Texture tex = Textures[i];
|
||||
if( tex.IsValid && tex.Bounds.Contains( mouseX, mouseY ) ) {
|
||||
if( tex.IsValid && tex.Bounds.Contains( mouseX, mouseY ) )
|
||||
return GetUrl( i, mouseX ) ?? lines[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,8 @@ namespace ClassicalSharp {
|
||||
|
||||
public sealed class ChatLog : IDisposable {
|
||||
|
||||
public ChatLine Status1, Status2, Status3, BottomRight1 = "F",
|
||||
BottomRight2 = "G", BottomRight3 = "H", Announcement;
|
||||
public ChatLine Status1, Status2, Status3, BottomRight1,
|
||||
BottomRight2, BottomRight3, Announcement;
|
||||
|
||||
Game game;
|
||||
public ChatLog( Game game ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user