refactor(utils): rename TasFrame to RawTasFrame and add new TasFrame class
- Renamed original TasFrame struct to RawTasFrame to reflect its role as raw binary data - Added new TasFrame class with encapsulated fields and helper methods - Added FpsConverter usage for time delta calculation - Added conversion methods between RawTasFrame and TasFrame - Added getter and setter methods for frame properties - Updated key flag operations to use private field instead of public one - Added new utility files FpsConverter.cs and TasMemory.cs to project
This commit is contained in:
31
BallanceTasEditor/Utils/FpsConverter.cs
Normal file
31
BallanceTasEditor/Utils/FpsConverter.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BallanceTasEditor.Utils {
|
||||
public static class FpsConverter {
|
||||
public static float ToFps(float delta) {
|
||||
if (delta <= 0f)
|
||||
throw new ArgumentOutOfRangeException("invalid time delta (not positive)");
|
||||
|
||||
return 1f / delta;
|
||||
}
|
||||
|
||||
public static uint ToFloorFps(float delta) {
|
||||
return (uint)Math.Floor(ToFps(delta));
|
||||
}
|
||||
|
||||
public static float ToDelta(uint fps) {
|
||||
return ToDelta((float)fps);
|
||||
}
|
||||
|
||||
public static float ToDelta(float fps) {
|
||||
if (fps <= 0f)
|
||||
throw new ArgumentOutOfRangeException("invalid fps (not positive)");
|
||||
|
||||
return 1f / fps;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user