1
0
mirror of synced 2025-02-06 14:24:21 +01:00

refactor - SampleFramework -> FDK (#780)

This commit is contained in:
Wei-Cheng Yeh (IID) 2025-01-08 05:54:07 +08:00 committed by GitHub
parent c54aa0b97d
commit 2f4cddd2fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 40 additions and 43 deletions

View File

@ -22,7 +22,7 @@ public class CTimer : CTimerBase {
return performanceTimer?.ElapsedMilliseconds ?? 0;
case TimerType.MultiMedia:
return SampleFramework.Game.TimeMs;
return Game.TimeMs;
case TimerType.GetTickCount:
return (long)Environment.TickCount;

View File

@ -32,7 +32,7 @@ using Silk.NET.OpenGLES.Extensions.ImGui;
using Silk.NET.Windowing;
using SkiaSharp;
namespace SampleFramework;
namespace FDK;
/// <summary>
/// Presents an easy to use wrapper for making games and samples.

View File

@ -1,4 +1,4 @@
namespace SampleFramework;
namespace FDK;
public static class GameWindowSize {
public static int Width = 1280;

View File

@ -4,7 +4,7 @@ using Silk.NET.Core.Contexts;
using Silk.NET.GLFW;
using Silk.NET.Windowing;
namespace SampleFramework;
namespace FDK;
public class AngleContext : IGLContext {
private nint Display;

View File

@ -1,6 +1,6 @@
using Silk.NET.OpenGLES;
namespace SampleFramework;
namespace FDK;
public enum BlendType {
Normal,

View File

@ -1,6 +1,6 @@
using Silk.NET.OpenGLES;
namespace SampleFramework;
namespace FDK;
public static class ShaderHelper {
public static uint CreateShader(string code, ShaderType shaderType) {

View File

@ -88,7 +88,7 @@ public class CInputManager : IDisposable {
} catch { }
}
SampleFramework.Game.InitImGuiController(window, Context);
Game.InitImGuiController(window, Context);
}
private void ConnectionChanged(Silk.NET.Input.IInputDevice device, bool connected) {

View File

@ -33,7 +33,7 @@ public class CSoundTimer : CTimerBase {
} else {
if (FDK.SoundManager.bUseOSTimer)
{
return SampleFramework.Game.TimeMs; // match TimerType.MultiMedia behavior
return Game.TimeMs; // match TimerType.MultiMedia behavior
} else {
return this.Device.ElapsedTimeMs
+ (this.Device.SystemTimer.SystemTimeMs - this.Device.UpdateSystemTimeMs);

View File

@ -1,5 +1,4 @@
using System.Drawing;
using SampleFramework;
using Silk.NET.Maths;
using Silk.NET.OpenGLES;
using SkiaSharp;

View File

@ -1517,8 +1517,8 @@ internal class CConfigIni : INotifyPropertyChanged {
this.bEnableVSync = true;
this.nWindowBaseXPosition = 100; // #30675 2013.02.04 ikanick add
this.nWindowBaseYPosition = 100;
this.nWindowWidth = SampleFramework.GameWindowSize.Width; // #23510 2010.10.31 yyagi add
this.nWindowHeight = SampleFramework.GameWindowSize.Height; //
this.nWindowWidth = GameWindowSize.Width; // #23510 2010.10.31 yyagi add
this.nWindowHeight = GameWindowSize.Height; //
this.nMsSleepPerFrame = -1; // #xxxxx 2011.11.27 yyagi add
this.nMsSleepUnfocused = 1; // #23568 2010.11.04 ikanick add
this._bGuitarEnabled = true;
@ -2765,7 +2765,7 @@ internal class CConfigIni : INotifyPropertyChanged {
case "WindowWidth": {
this.nWindowWidth = CConversion.ParseIntInRange(value, 1, 65535, this.nWindowWidth);
if (this.nWindowWidth <= 0) {
this.nWindowWidth = SampleFramework.GameWindowSize.Width;
this.nWindowWidth = GameWindowSize.Width;
}
break;
@ -2773,7 +2773,7 @@ internal class CConfigIni : INotifyPropertyChanged {
case "WindowHeight": {
this.nWindowHeight = CConversion.ParseIntInRange(value, 1, 65535, this.nWindowHeight);
if (this.nWindowHeight <= 0) {
this.nWindowHeight = SampleFramework.GameWindowSize.Height;
this.nWindowHeight = GameWindowSize.Height;
}
break;

View File

@ -5,7 +5,6 @@ using System.Reflection;
using System.Runtime.InteropServices;
using FDK;
using ImGuiNET;
using SampleFramework;
namespace OpenTaiko;
@ -25,7 +24,7 @@ public static class ImGuiDebugWindow {
private static readonly string[] sortNames = ["Memory Usage (Highest -> Lowest)", "Memory Usage (Lowest -> Highest)", "Pointer ID"];
private static string reloadTexPath = "";
public static void Draw() {
if (SampleFramework.Game.ImGuiController == null) return;
if (Game.ImGuiController == null) return;
#region Fetch allocated memory
if (SoundManager.PlayTimer.SystemTimeMs - memoryReadTimer > 5000) {

View File

@ -7,7 +7,6 @@ using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using DiscordRPC;
using FDK;
using SampleFramework;
using Silk.NET.Maths;
using SkiaSharp;
using Rectangle = System.Drawing.Rectangle;

View File

@ -9,8 +9,8 @@ namespace OpenTaiko {
public static void Draw(int opacity = 255) {
if (OpenTaiko.Tx.Tile_Black != null) {
OpenTaiko.Tx.Tile_Black.Opacity = opacity;
for (int i = 0; i <= SampleFramework.GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) {
for (int j = 0; j <= SampleFramework.GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) {
for (int i = 0; i <= FDK.GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) {
for (int j = 0; j <= FDK.GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) {
OpenTaiko.Tx.Tile_Black.t2D描画(i, j);
}
}

View File

@ -32,7 +32,7 @@ internal class CStage起動 : CStage {
langList[i] = OpenTaiko.tテクスチャの生成(langSelectFont.DrawText(CLangManager.Languages[i], System.Drawing.Color.White));
langListHighlighted[i] = OpenTaiko.tテクスチャの生成(langSelectFont.DrawText(CLangManager.Languages[i], System.Drawing.Color.Red));
}
langSelectOffset = new int[2] { SampleFramework.GameWindowSize.Width / 2, (SampleFramework.GameWindowSize.Height - langList.Select(tex => tex.szTextureSize.Height).Sum() - langSelectTitle.szTextureSize.Height) / 2 };
langSelectOffset = new int[2] { GameWindowSize.Width / 2, (GameWindowSize.Height - langList.Select(tex => tex.szTextureSize.Height).Sum() - langSelectTitle.szTextureSize.Height) / 2 };
}
this.list進行文字列 = new List<string>();

View File

@ -94,8 +94,8 @@ internal class CActCalibrationMode : CActivity {
if (OpenTaiko.Tx.Tile_Black != null) {
OpenTaiko.Tx.Tile_Black.Opacity = 128;
for (int i = 0; i <= SampleFramework.GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) {
for (int j = 0; j <= SampleFramework.GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) {
for (int i = 0; i <= GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) {
for (int j = 0; j <= GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) {
OpenTaiko.Tx.Tile_Black.t2D描画(i, j);
}
}
@ -113,7 +113,7 @@ internal class CActCalibrationMode : CActivity {
OpenTaiko.Tx.Notes[0]?.t2D描画(OpenTaiko.Skin.nScrollFieldX[0], OpenTaiko.Skin.nScrollFieldY[0], new RectangleF(0, 0, OpenTaiko.Skin.Game_Notes_Size[0], OpenTaiko.Skin.Game_Notes_Size[1]));
for (int x = OpenTaiko.Skin.nScrollFieldX[0]; x < SampleFramework.GameWindowSize.Width + 500; x += 500) {
for (int x = OpenTaiko.Skin.nScrollFieldX[0]; x < GameWindowSize.Width + 500; x += 500) {
OpenTaiko.Tx.Bar?.t2D描画(
(x - CalibrateTick.CurrentValue) + ((OpenTaiko.Skin.Game_Notes_Size[0] - OpenTaiko.Tx.Bar.szTextureSize.Width) / 2),
OpenTaiko.Skin.nScrollFieldY[0],

View File

@ -387,7 +387,7 @@ internal class CStageコンフィグ : CStage {
null,
30,
true))) {
status_text.t2D_DisplayImage_AnchorCenter(SampleFramework.GameWindowSize.Width / 2, SampleFramework.GameWindowSize.Height / 2);
status_text.t2D_DisplayImage_AnchorCenter(GameWindowSize.Width / 2, GameWindowSize.Height / 2);
}
}
}

View File

@ -2741,7 +2741,7 @@ internal class CActSelect曲リスト : CActivity {
CSongUniqueID csu = null,
CSongListNode reference = null
) {
if (x >= SampleFramework.GameWindowSize.Width || y >= SampleFramework.GameWindowSize.Height)
if (x >= GameWindowSize.Width || y >= GameWindowSize.Height)
return;
var IsSongLocked = OpenTaiko.Databases.DBSongUnlockables.tIsSongLocked(reference);

View File

@ -315,9 +315,9 @@ internal class CStage曲読み込み : CStage {
if (OpenTaiko.Tx.Tile_Black != null) {
OpenTaiko.Tx.Tile_Black.Opacity = (int)(ct待機.CurrentValue <= 51 ? (255 - ct待機.CurrentValue / 0.2f) : (this.ct待機.CurrentValue - 949) / 0.2);
for (int i = 0; i <= (SampleFramework.GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
for (int i = 0; i <= (GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
{
for (int j = 0; j <= (SampleFramework.GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
for (int j = 0; j <= (GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
{
OpenTaiko.Tx.Tile_Black.t2D描画(i * OpenTaiko.Tx.Tile_Black.szTextureSize.Width, j * OpenTaiko.Tx.Tile_Black.szTextureSize.Height);
}

View File

@ -16,7 +16,7 @@ internal class CAct演奏AVI : CActivity {
if (nチャンネル番号 == 0x54 && OpenTaiko.ConfigIni.bEnableAVI) {
this.rVD = rVD;
if (this.rVD != null) {
this.ratio1 = Math.Min((float)SampleFramework.GameWindowSize.Height / ((float)this.rVD.FrameSize.Height), (float)SampleFramework.GameWindowSize.Width / ((float)this.rVD.FrameSize.Height));
this.ratio1 = Math.Min((float)GameWindowSize.Height / ((float)this.rVD.FrameSize.Height), (float)GameWindowSize.Width / ((float)this.rVD.FrameSize.Height));
if (!rVD.bPlaying) this.rVD.Start();
}
@ -39,7 +39,7 @@ internal class CAct演奏AVI : CActivity {
this.tx描画用.vcScaleRatio.Y = this.ratio1;
if (OpenTaiko.ConfigIni.eClipDispType.HasFlag(EClipDispType.BackgroundOnly)) {
this.tx描画用.t2D拡大率考慮描画(CTexture.RefPnt.Center, SampleFramework.GameWindowSize.Width / 2, SampleFramework.GameWindowSize.Height / 2);
this.tx描画用.t2D拡大率考慮描画(CTexture.RefPnt.Center, GameWindowSize.Width / 2, GameWindowSize.Height / 2);
}
}
return 0;
@ -49,13 +49,13 @@ internal class CAct演奏AVI : CActivity {
if (this.rVD == null || this.tx描画用 == null || !OpenTaiko.ConfigIni.eClipDispType.HasFlag(EClipDispType.WindowOnly))
return;
float[] fRatio = new float[] { (SampleFramework.GameWindowSize.Width / 2) - 4.0f, (SampleFramework.GameWindowSize.Height / 2) - 4.0f }; //中央下表示
float[] fRatio = new float[] { (GameWindowSize.Width / 2) - 4.0f, (GameWindowSize.Height / 2) - 4.0f }; //中央下表示
float ratio = Math.Min((float)(fRatio[0] / this.rVD.FrameSize.Width), (float)(fRatio[1] / this.rVD.FrameSize.Height));
this.tx描画用.vcScaleRatio.X = ratio;
this.tx描画用.vcScaleRatio.Y = ratio;
this.tx描画用.t2D拡大率考慮描画(CTexture.RefPnt.Down, SampleFramework.GameWindowSize.Width / 2, SampleFramework.GameWindowSize.Height);
this.tx描画用.t2D拡大率考慮描画(CTexture.RefPnt.Down, GameWindowSize.Width / 2, GameWindowSize.Height);
}
// CActivity 実装

View File

@ -420,8 +420,8 @@ internal class CAct演奏Drumsゲームモード : CActivity {
else
OpenTaiko.Tx.Tile_Black.Opacity = 0;
for (int i = 0; i <= (SampleFramework.GameWindowSize.Width / 64); i++) {
for (int j = 0; j <= (SampleFramework.GameWindowSize.Height / 64); j++) {
for (int i = 0; i <= (GameWindowSize.Width / 64); i++) {
for (int j = 0; j <= (GameWindowSize.Height / 64); j++) {
OpenTaiko.Tx.Tile_Black.t2D描画(i * 64, j * 64);
}
}

View File

@ -1964,7 +1964,7 @@ internal class CStage演奏ドラム画面 : CStage演奏画面共通 {
}
if ((pChip.bVisible && !pChip.bHideBarLine) && (OpenTaiko.Tx.Bar != null)) {
if (x >= 0 && x <= SampleFramework.GameWindowSize.Width) {
if (x >= 0 && x <= GameWindowSize.Width) {
if (pChip.bBranch) {
//this.tx小節線_branch.t2D描画( CDTXMania.app.Device, x - 3, y, new Rectangle( 0, 0, 3, 130 ) );
OpenTaiko.Tx.Bar_Branch?.t2D描画(x + ((OpenTaiko.Skin.Game_Notes_Size[0] - OpenTaiko.Tx.Bar_Branch.szTextureSize.Width) / 2), y, new Rectangle(0, 0, OpenTaiko.Tx.Bar_Branch.szTextureSize.Width, OpenTaiko.Skin.Game_Notes_Size[1]));

View File

@ -35,9 +35,9 @@ internal class CActFIFOBlack : CActivity {
// Size clientSize = CDTXMania.app.Window.ClientSize; // #23510 2010.10.31 yyagi: delete as of no one use this any longer.
if (OpenTaiko.Tx.Tile_Black != null) {
OpenTaiko.Tx.Tile_Black.Opacity = (this.mode == EFIFOMode.FadeIn) ? (((100 - this.counter.CurrentValue) * 0xff) / 100) : ((this.counter.CurrentValue * 0xff) / 100);
for (int i = 0; i <= (SampleFramework.GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
for (int i = 0; i <= (GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
{
for (int j = 0; j <= (SampleFramework.GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
for (int j = 0; j <= (GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
{
OpenTaiko.Tx.Tile_Black.t2D描画(i * OpenTaiko.Tx.Tile_Black.szTextureSize.Width, j * OpenTaiko.Tx.Tile_Black.szTextureSize.Height);
}

View File

@ -47,9 +47,9 @@ internal class CActFIFOResult : CActivity {
OpenTaiko.Tx.Tile_Black.Opacity = (((this.counter.CurrentValue) * 0xff) / 100);
}
for (int i = 0; i <= (SampleFramework.GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
for (int i = 0; i <= (GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
{
for (int j = 0; j <= (SampleFramework.GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
for (int j = 0; j <= (GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
{
OpenTaiko.Tx.Tile_Black.t2D描画(i * OpenTaiko.Tx.Tile_Black.szTextureSize.Width, j * OpenTaiko.Tx.Tile_Black.szTextureSize.Height);
}

View File

@ -57,9 +57,9 @@ internal class CActFIFOStart : CActivity {
if (OpenTaiko.stageSongSelect.nChoosenSongDifficulty[0] >= (int)Difficulty.Tower) {
if (OpenTaiko.Tx.Tile_Black != null) {
OpenTaiko.Tx.Tile_Black.Opacity = this.mode == EFIFOMode.FadeOut ? -1000 + counter.CurrentValue : 255 - counter.CurrentValue;
for (int i = 0; i <= (SampleFramework.GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
for (int i = 0; i <= (GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
{
for (int j = 0; j <= (SampleFramework.GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
for (int j = 0; j <= (GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
{
OpenTaiko.Tx.Tile_Black.t2D描画(i * OpenTaiko.Tx.Tile_Black.szTextureSize.Width, j * OpenTaiko.Tx.Tile_Black.szTextureSize.Height);
}

View File

@ -43,9 +43,9 @@ internal class CActFIFOWhite : CActivity {
// Size clientSize = CDTXMania.app.Window.ClientSize; // #23510 2010.10.31 yyagi: delete as of no one use this any longer.
if (OpenTaiko.Tx.Tile_Black != null) {
OpenTaiko.Tx.Tile_Black.Opacity = (this.mode == EFIFOMode.FadeIn) ? (((100 - this.counter.CurrentValue) * 0xff) / 100) : ((this.counter.CurrentValue * 0xff) / 100);
for (int i = 0; i <= (SampleFramework.GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
for (int i = 0; i <= (GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
{
for (int j = 0; j <= (SampleFramework.GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
for (int j = 0; j <= (GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
{
OpenTaiko.Tx.Tile_Black.t2D描画(i * OpenTaiko.Tx.Tile_Black.szTextureSize.Width, j * OpenTaiko.Tx.Tile_Black.szTextureSize.Height);
}

View File

@ -367,9 +367,9 @@ class CActNewHeya : CActivity {
if (OpenTaiko.Tx.Tile_Black != null) {
OpenTaiko.Tx.Tile_Black.Opacity = InFade.CurrentValue / 2;
for (int i = 0; i <= (SampleFramework.GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
for (int i = 0; i <= (GameWindowSize.Width / OpenTaiko.Tx.Tile_Black.szTextureSize.Width); i++) // #23510 2010.10.31 yyagi: change "clientSize.Width" to "640" to fix FIFO drawing size
{
for (int j = 0; j <= (SampleFramework.GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
for (int j = 0; j <= (GameWindowSize.Height / OpenTaiko.Tx.Tile_Black.szTextureSize.Height); j++) // #23510 2010.10.31 yyagi: change "clientSize.Height" to "480" to fix FIFO drawing size
{
OpenTaiko.Tx.Tile_Black.t2D描画(i * OpenTaiko.Tx.Tile_Black.szTextureSize.Width, j * OpenTaiko.Tx.Tile_Black.szTextureSize.Height);
}