mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
Fix issues with UnsafeString on Windows XP and below. (Unfortunately, I couldn't work around this without having to allocate strings.)
This commit is contained in:
parent
59a98083b1
commit
df4c6b4b32
@ -36,7 +36,11 @@ namespace ClassicalSharp {
|
|||||||
.Append( ref ptr2, "), chunks/s: " ).AppendNum( ref ptr2, Window.ChunkUpdates )
|
.Append( ref ptr2, "), chunks/s: " ).AppendNum( ref ptr2, Window.ChunkUpdates )
|
||||||
.Append( ref ptr2, ", vertices: " ).AppendNum( ref ptr2, Window.Vertices );
|
.Append( ref ptr2, ", vertices: " ).AppendNum( ref ptr2, Window.Vertices );
|
||||||
}
|
}
|
||||||
fpsTextWidget.SetText( text.value );
|
string textString = text.value;
|
||||||
|
if( Utils2D.needWinXpFix )
|
||||||
|
textString = textString.TrimEnd( Utils2D.trimChars );
|
||||||
|
|
||||||
|
fpsTextWidget.SetText( textString );
|
||||||
maxDelta = 0;
|
maxDelta = 0;
|
||||||
accumulator = 0;
|
accumulator = 0;
|
||||||
fpsCount = 0;
|
fpsCount = 0;
|
||||||
|
@ -12,6 +12,9 @@ namespace ClassicalSharp {
|
|||||||
static Bitmap measuringBmp;
|
static Bitmap measuringBmp;
|
||||||
static Graphics measuringGraphics;
|
static Graphics measuringGraphics;
|
||||||
static Dictionary<int, SolidBrush> brushCache = new Dictionary<int, SolidBrush>( 16 );
|
static Dictionary<int, SolidBrush> brushCache = new Dictionary<int, SolidBrush>( 16 );
|
||||||
|
internal static bool needWinXpFix;
|
||||||
|
internal static char[] trimChars = { '\0' };
|
||||||
|
|
||||||
static Utils2D() {
|
static Utils2D() {
|
||||||
format = StringFormat.GenericTypographic;
|
format = StringFormat.GenericTypographic;
|
||||||
format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
|
format.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
|
||||||
@ -20,6 +23,9 @@ namespace ClassicalSharp {
|
|||||||
//format.FormatFlags |= StringFormatFlags.NoClip;
|
//format.FormatFlags |= StringFormatFlags.NoClip;
|
||||||
measuringBmp = new Bitmap( 1, 1 );
|
measuringBmp = new Bitmap( 1, 1 );
|
||||||
measuringGraphics = Graphics.FromImage( measuringBmp );
|
measuringGraphics = Graphics.FromImage( measuringBmp );
|
||||||
|
measuringGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||||
|
OperatingSystem os = Environment.OSVersion;
|
||||||
|
needWinXpFix = os.Platform == PlatformID.Win32NT && os.Version.Major < 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SolidBrush GetOrCreateBrush( Color color ) {
|
static SolidBrush GetOrCreateBrush( Color color ) {
|
||||||
|
@ -41,6 +41,8 @@ namespace ClassicalSharp {
|
|||||||
DrawTextArgs caretArgs = new DrawTextArgs( GraphicsApi, "_", Color.White, false );
|
DrawTextArgs caretArgs = new DrawTextArgs( GraphicsApi, "_", Color.White, false );
|
||||||
chatCaretTexture = Utils2D.MakeTextTexture( boldFont, 0, 0, ref caretArgs );
|
chatCaretTexture = Utils2D.MakeTextTexture( boldFont, 0, 0, ref caretArgs );
|
||||||
string value = chatInputText.value;
|
string value = chatInputText.value;
|
||||||
|
if( Utils2D.needWinXpFix )
|
||||||
|
value = value.TrimEnd( Utils2D.trimChars );
|
||||||
|
|
||||||
if( chatInputText.Empty ) {
|
if( chatInputText.Empty ) {
|
||||||
caretPos = -1;
|
caretPos = -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user