Skip to content

Commit

Permalink
Updated Rampastring.XNAUI, fixed duplicate cursor image, lowered FPS …
Browse files Browse the repository at this point in the history
…to 60 and made all animations / transitions independent of FPS
  • Loading branch information
Rampastring committed Dec 20, 2016
1 parent a1dc10f commit 378b984
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DXMainClient/DXGUI/Generic/GameInProgressWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace DTAClient.DXGUI
/// </summary>
public class GameInProgressWindow : XNAPanel
{
private const double FPS = 120.0;
private const double FPS = 60.0;
private const double POWER_SAVING_FPS = 5.0;

public GameInProgressWindow(WindowManager windowManager) : base(windowManager)
Expand Down
17 changes: 12 additions & 5 deletions DXMainClient/DXGUI/Generic/LoadingScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ public LoadingScreen(WindowManager windowManager) : base(windowManager)

private static readonly object locker = new object();

MapLoader mapLoader;
private MapLoader mapLoader;

PrivateMessagingPanel privateMessagingPanel;
private PrivateMessagingPanel privateMessagingPanel;

bool load = false;
private bool load = false;

private bool visibleSpriteCursor = false;

public override void Initialize()
{
Expand Down Expand Up @@ -146,7 +148,7 @@ private void Finish()

WindowManager.RemoveControl(this);

Cursor.Visible = true;
Cursor.Visible = visibleSpriteCursor;
}

public override void Update(GameTime gameTime)
Expand All @@ -161,7 +163,12 @@ public override void Update(GameTime gameTime)
}

load = true;
Cursor.Visible = false;

if (Cursor.Visible)
{
Cursor.Visible = false;
visibleSpriteCursor = true;
}

base.Update(gameTime);
}
Expand Down
8 changes: 4 additions & 4 deletions DXMainClient/DXGUI/Generic/TopBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public class TopBar : XNAPanel
const double EVENT_DOWN_TIME_WAIT_SECONDS = 2.0;
const double STARTUP_DOWN_TIME_WAIT_SECONDS = 3.5;

const double DOWN_MOVEMENT_RATE = 2.0;
const double UP_MOVEMENT_RATE = 2.0;
const double DOWN_MOVEMENT_RATE = 1.7;
const double UP_MOVEMENT_RATE = 1.7;
const int APPEAR_CURSOR_THRESHOLD_Y = 8;

public TopBar(WindowManager windowManager, CnCNetManager connectionManager) : base(windowManager)
Expand Down Expand Up @@ -292,7 +292,7 @@ public override void Update(GameTime gameTime)
{
if (locationY < 0)
{
locationY += DOWN_MOVEMENT_RATE;
locationY += DOWN_MOVEMENT_RATE * (gameTime.ElapsedGameTime.TotalMilliseconds / 10.0);
ClientRectangle = new Rectangle(ClientRectangle.X, (int)locationY,
ClientRectangle.Width, ClientRectangle.Height);
}
Expand All @@ -305,7 +305,7 @@ public override void Update(GameTime gameTime)
{
if (locationY > -ClientRectangle.Height - 1)
{
locationY -= UP_MOVEMENT_RATE;
locationY -= UP_MOVEMENT_RATE * (gameTime.ElapsedGameTime.TotalMilliseconds / 10.0);
ClientRectangle = new Rectangle(ClientRectangle.X, (int)locationY,
ClientRectangle.Width, ClientRectangle.Height);
}
Expand Down
2 changes: 1 addition & 1 deletion DXMainClient/DXGUI/Multiplayer/GameLobby/MapPreviewBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public override void Initialize()
indicator.Enabled = false;
indicator.AngularVelocity = angularVelocity;
indicator.HoverRemapColor = hoverRemapColor;
indicator.ReservedAngularVelocity = reservedAngularVelocity;
indicator.ReversedAngularVelocity = reservedAngularVelocity;
indicator.WaypointTexture = AssetLoader.LoadTexture(string.Format("slocindicator{0}.png", i + 1));
indicator.Tag = i;
indicator.LeftClick += Indicator_LeftClick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class PlayerLocationIndicator : XNAControl
public int FontIndex { get; set; }

public double AngularVelocity = 0.015;
public double ReservedAngularVelocity = -0.0075;
public double ReversedAngularVelocity = -0.0075;

public Color HoverRemapColor { get; set; }

Expand Down Expand Up @@ -149,7 +149,9 @@ public override void Update(GameTime gameTime)
{
base.Update(gameTime);

angle += Players.Count > 0 ? ReservedAngularVelocity : AngularVelocity;
double frameTimeCoefficient = gameTime.ElapsedGameTime.TotalMilliseconds / 10.0;

angle += Players.Count > 0 ? ReversedAngularVelocity * frameTimeCoefficient : AngularVelocity * frameTimeCoefficient;

if (Players.Count > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions DXMainClient/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.3.2")]
[assembly: AssemblyFileVersion("2.0.3.2")]
[assembly: AssemblyVersion("2.0.3.3")]
[assembly: AssemblyFileVersion("2.0.3.3")]
Binary file modified References/Windows/Rampastring.XNAUI.dll
Binary file not shown.
Binary file modified References/WindowsGL/Rampastring.XNAUI.dll
Binary file not shown.
Binary file modified References/XNA/Rampastring.XNAUI.dll
Binary file not shown.

2 comments on commit 378b984

@GrantBartlett
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rampastring what was the instruction for the new cursor please?

@Rampastring
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GrantBartlett Simply create a "cursor.cur" file and place it to the Resources\ directory. It needs to be in the special Windows .cur file format, a regular image won't work.

Please sign in to comment.