Split graphics host contract
This commit is contained in:
48
engine/Age.Engine/Hosting/IGraphicsHost.cs
Normal file
48
engine/Age.Engine/Hosting/IGraphicsHost.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Age.Engine.Model;
|
||||
|
||||
namespace Age.Engine.Hosting;
|
||||
|
||||
public interface IGraphicsHost
|
||||
{
|
||||
void FillSurfaceRect(SurfaceRectFill fill) { }
|
||||
void CopySurfaceRect(SurfaceRectCopy copy) { }
|
||||
void PresentObjectRange(GfxState gfx, long firstHandle, long count) { }
|
||||
|
||||
// Normal playback reaches op 0x21c and parks until a queued 0x223 transition completes. The
|
||||
// read/message-skip branch reaches op 0x20c and presents the completed endpoint immediately.
|
||||
void WaitForForegroundTransition(GfxState gfx) { }
|
||||
void PresentFrame(GfxState gfx) { }
|
||||
|
||||
// Legacy SYS4 screen-transition family (ops 0x21, 0x22, and 0x25): scripts render complete
|
||||
// frames into numbered surfaces, then block while the engine alpha-composites an endpoint.
|
||||
// Native bypasses the timed service when ADV fast-forward is already active at opcode dispatch.
|
||||
void FadeSurfaceWithBlack(
|
||||
GfxState gfx, int surface, long intervalArgument, SurfaceBlackFadeDirection direction,
|
||||
bool forceEndpoint = false) { }
|
||||
void CrossfadeSurfaces(
|
||||
GfxState gfx, int sourceSurface, int targetSurface, long intervalArgument,
|
||||
bool forceEndpoint = false) { }
|
||||
|
||||
void CreateTexture(int slot, int width, int height);
|
||||
|
||||
/// <summary>Return a stable RGBA snapshot of one numbered surface, or null when unavailable.</summary>
|
||||
RgbaImage? CaptureSurfacePixels(int slot) => null;
|
||||
|
||||
/// <summary>Replace one numbered surface from decoded RGBA pixels. False means unsupported.</summary>
|
||||
bool ReplaceSurfacePixels(int slot, RgbaImage image) => false;
|
||||
|
||||
void SetTexture(long resourceId, int slot);
|
||||
void SetTexture(long resourceId, int slot, long colorKey) => SetTexture(resourceId, slot);
|
||||
void ReleaseSurface(int slot) { }
|
||||
|
||||
/// <summary>Clear the selected target's pixels; -1 denotes the main backbuffer.</summary>
|
||||
void ClearRenderTarget(int surfaceSlot) { }
|
||||
|
||||
void ReleaseSurfaceRange(int firstSlot, int count)
|
||||
{
|
||||
for (int slot = firstSlot; slot < firstSlot + count; slot++) ReleaseSurface(slot);
|
||||
}
|
||||
|
||||
void DrawTexture(int slot, int srcX, int srcY, int width, int height, int dstX, int dstY);
|
||||
(int Width, int Height) GetTextureSize(int slot);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public enum SurfaceBlackFadeDirection
|
||||
ToBlack,
|
||||
}
|
||||
|
||||
public interface IHost : IDiagnosticHost, ILifecycleHost, IAudioHost, IMovieHost
|
||||
public interface IHost : IDiagnosticHost, ILifecycleHost, IAudioHost, IMovieHost, IGraphicsHost
|
||||
{
|
||||
/// <summary>Present AGERc's modal full-width editor. Cancel preserves CurrentText.</summary>
|
||||
FullwidthTextEditResult EditFullwidthString(FullwidthTextEditRequest request)
|
||||
@@ -84,9 +84,6 @@ public interface IHost : IDiagnosticHost, ILifecycleHost, IAudioHost, IMovieHost
|
||||
void EndTextHistoryPresentation(GfxState gfx) => EndTextHistoryPresentation();
|
||||
int MessageWindowAlphaSetting => 0;
|
||||
void SetMessageWindowAlphaSetting(int value) { }
|
||||
void FillSurfaceRect(SurfaceRectFill fill) { }
|
||||
void CopySurfaceRect(SurfaceRectCopy copy) { }
|
||||
void PresentObjectRange(GfxState gfx, long firstHandle, long count) { }
|
||||
void ConfigureAdvWaitIndicator(AdvWaitIndicatorConfig config) { }
|
||||
// Op 0x212 supplies the ordinary retained handle used to publish the configured atlas cell.
|
||||
void BindAdvWaitIndicator(
|
||||
@@ -134,33 +131,4 @@ public interface IHost : IDiagnosticHost, ILifecycleHost, IAudioHost, IMovieHost
|
||||
// Optional diagnostic override. Native ReadTextDB state is VM/profile-owned; interactive hosts
|
||||
// normally leave this false.
|
||||
bool IsAdvReadSkipActive => false;
|
||||
// Normal playback reaches op 0x21c and parks until a queued 0x223 transition completes. The
|
||||
// read/message-skip branch reaches op 0x20c and presents the completed endpoint immediately.
|
||||
void WaitForForegroundTransition(GfxState gfx) { }
|
||||
void PresentFrame(GfxState gfx) { }
|
||||
// Legacy SYS4 screen-transition family (ops 0x21, 0x22, and 0x25): scripts render complete
|
||||
// frames into numbered surfaces, then block while the engine alpha-composites an endpoint.
|
||||
// Native bypasses the timed service when ADV fast-forward is already active at opcode dispatch.
|
||||
void FadeSurfaceWithBlack(
|
||||
GfxState gfx, int surface, long intervalArgument, SurfaceBlackFadeDirection direction,
|
||||
bool forceEndpoint = false) { }
|
||||
void CrossfadeSurfaces(
|
||||
GfxState gfx, int sourceSurface, int targetSurface, long intervalArgument,
|
||||
bool forceEndpoint = false) { }
|
||||
void CreateTexture(int slot, int width, int height);
|
||||
/// <summary>Return a stable RGBA snapshot of one numbered surface, or null when unavailable.</summary>
|
||||
RgbaImage? CaptureSurfacePixels(int slot) => null;
|
||||
/// <summary>Replace one numbered surface from decoded RGBA pixels. False means unsupported.</summary>
|
||||
bool ReplaceSurfacePixels(int slot, RgbaImage image) => false;
|
||||
void SetTexture(long resourceId, int slot);
|
||||
void SetTexture(long resourceId, int slot, long colorKey) => SetTexture(resourceId, slot);
|
||||
void ReleaseSurface(int slot) { }
|
||||
/// <summary>Clear the selected target's pixels; -1 denotes the main backbuffer.</summary>
|
||||
void ClearRenderTarget(int surfaceSlot) { }
|
||||
void ReleaseSurfaceRange(int firstSlot, int count)
|
||||
{
|
||||
for (int slot = firstSlot; slot < firstSlot + count; slot++) ReleaseSurface(slot);
|
||||
}
|
||||
void DrawTexture(int slot, int srcX, int srcY, int width, int height, int dstX, int dstY);
|
||||
(int Width, int Height) GetTextureSize(int slot);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user