Fix issues with mouse cursor position on High-DPI displays.

This commit is contained in:
UnknownShadow200 2015-09-19 13:25:11 +10:00
parent 4b51c5c4c0
commit 1a754f149e
3 changed files with 5 additions and 6 deletions

View File

@ -64,11 +64,11 @@ namespace ClassicalSharp {
byte typeCode = reader.ReadByte(); byte typeCode = reader.ReadByte();
if( typeCode != TC_OBJECT ) ParseError( TC_OBJECT, typeCode ); if( typeCode != TC_OBJECT ) ParseError( TC_OBJECT, typeCode );
ClassDescription desc = ReadClassDescription(); ClassDescription desc = ReadClassDescription();
ReadClassData( desc.Fields, desc.Flags ); ReadClassData( desc.Fields );
return desc; return desc;
} }
void ReadClassData( FieldDescription[] fields, byte flags ) { void ReadClassData( FieldDescription[] fields ) {
for( int i = 0; i < fields.Length; i++ ) { for( int i = 0; i < fields.Length; i++ ) {
switch( fields[i].Type ) { switch( fields[i].Type ) {
case FieldType.Byte: case FieldType.Byte:
@ -158,9 +158,7 @@ namespace ClassicalSharp {
struct ClassDescription { struct ClassDescription {
public string ClassName; public string ClassName;
public byte Flags;
public FieldDescription[] Fields; public FieldDescription[] Fields;
public object Value;
} }
struct FieldDescription { struct FieldDescription {

View File

@ -57,7 +57,8 @@ namespace ClassicalSharp {
int cenX = bounds.Left + bounds.Width / 2; int cenX = bounds.Left + bounds.Width / 2;
int cenY = bounds.Top + bounds.Height / 2; int cenY = bounds.Top + bounds.Height / 2;
game.DesktopCursorPos = new Point( cenX, cenY ); game.DesktopCursorPos = new Point( cenX, cenY );
previous = new Point( cenX, cenY ); // Fixes issues with large DPI displays on Windows >= 8.0.
previous = game.DesktopCursorPos;
} }
public override void RegrabMouse() { public override void RegrabMouse() {

View File

@ -6,7 +6,7 @@ You can get the latest binaries [here](https://github.com/UnknownShadow200/Class
#### What ClassicalSharp is #### What ClassicalSharp is
* Works with both minecraft.net and classicube.net accounts. * Works with both minecraft.net and classicube.net accounts.
* Lightweight, minimal memory usage compared to the standard client. * Lightweight, minimal memory usage compared to the standard client.
* Works with effectively all graphics cards that support OpenGL. * Works with effectively all graphics cards that support OpenGL or Direct3D 9.
* Provides single-player support. (only flatgrass generator, but can load .dat and .fcm maps) * Provides single-player support. (only flatgrass generator, but can load .dat and .fcm maps)
It does not: It does not: