28 #ifndef AGS_ENGINE_GFX_GRAPHICS_DRIVER_H 29 #define AGS_ENGINE_GFX_GRAPHICS_DRIVER_H 32 #include "common/std/memory.h" 33 #include "ags/lib/allegro.h" 34 #include "ags/shared/gfx/gfx_def.h" 35 #include "ags/engine/gfx/gfx_defines.h" 36 #include "ags/engine/gfx/gfx_mode_list.h" 37 #include "ags/shared/util/geometry.h" 50 class IDriverDependantBitmap;
53 using Shared::PBitmap;
57 TintSpecifyMaximum = 1
73 float ScaleX = 1.f, ScaleY = 1.f;
78 SpriteTransform(
int x,
int y,
float scalex = 1.0f,
float scaley = 1.0f,
float rotate = 0.0f,
80 : X(x), Y(y), ScaleX(scalex), ScaleY(scaley), Rotate(rotate), Color(
color) {
94 typedef void (*GFXDRV_CLIENTCALLBACK)();
95 typedef bool (*GFXDRV_CLIENTCALLBACKEVT)(
int evt,
int data);
96 typedef void (*GFXDRV_CLIENTCALLBACKINITGFX)(
void *data);
101 virtual const char *GetDriverID() = 0;
103 virtual const char *GetDriverName() = 0;
106 virtual bool RequiresFullRedrawEachFrame() = 0;
108 virtual bool HasAcceleratedTransform() = 0;
110 virtual bool UsesMemoryBackBuffer() = 0;
113 virtual bool ShouldReleaseRenderTargets() = 0;
115 virtual void SetTintMethod(TintMethod method) = 0;
117 virtual bool SetDisplayMode(
const DisplayMode &mode) = 0;
119 virtual void UpdateDeviceScreen(
const Size &screen_size) = 0;
121 virtual bool IsModeSet()
const = 0;
124 virtual bool IsNativeSizeValid()
const = 0;
126 virtual bool SetRenderFrame(
const Rect &dst_rect) = 0;
127 virtual bool IsRenderFrameValid()
const = 0;
129 virtual int GetDisplayDepthForNativeDepth(
int native_color_depth)
const = 0;
130 virtual IGfxModeList *GetSupportedModeList(
int color_depth) = 0;
131 virtual bool IsModeSupported(
const DisplayMode &mode) = 0;
133 virtual PGfxFilter GetGraphicsFilter()
const = 0;
134 virtual Size GetNativeSize()
const = 0;
135 virtual Rect GetRenderDestination()
const = 0;
136 virtual void SetCallbackForPolling(GFXDRV_CLIENTCALLBACK callback) = 0;
138 virtual void SetCallbackToDrawScreen(GFXDRV_CLIENTCALLBACK callback, GFXDRV_CLIENTCALLBACK post_callback) = 0;
139 virtual void SetCallbackOnInit(GFXDRV_CLIENTCALLBACKINITGFX callback) = 0;
143 virtual void SetCallbackOnSpriteEvt(GFXDRV_CLIENTCALLBACKEVT callback) = 0;
145 virtual void ClearRectangle(
int x1,
int y1,
int x2,
int y2,
RGB *colorToUse) = 0;
148 virtual int GetCompatibleBitmapFormat(
int color_depth) = 0;
150 virtual size_t GetAvailableTextureMemory() = 0;
153 virtual IDriverDependantBitmap *CreateDDB(
int width,
int height,
int color_depth,
bool opaque =
false) = 0;
157 virtual IDriverDependantBitmap *CreateRenderTargetDDB(
int width,
int height,
int color_depth,
bool opaque =
false) = 0;
170 Shared::Bitmap *bitmap =
nullptr,
bool has_alpha =
true,
bool opaque =
false) = 0;
171 virtual void UpdateSharedDDB(uint32_t sprite_id,
Shared::Bitmap *bitmap =
nullptr,
bool has_alpha =
true,
bool opaque =
false) = 0;
173 virtual void ClearSharedDDB(uint32_t sprite_id) = 0;
183 Shared::GraphicFlip flip = Shared::kFlip_None,
PBitmap surface =
nullptr, uint32_t filter_flags = 0) = 0;
185 virtual void EndSpriteBatch() = 0;
189 virtual void SetScreenFade(
int red,
int green,
int blue) = 0;
192 virtual void SetScreenTint(
int red,
int green,
int blue) = 0;
198 virtual void SetStageScreen(
const Size &sz,
int x = 0,
int y = 0) = 0;
200 virtual void ClearDrawLists() = 0;
201 virtual void RenderToBackBuffer() = 0;
202 virtual void Render() = 0;
206 virtual void Render(
int xoff,
int yoff, Shared::GraphicFlip flip) = 0;
210 virtual bool GetCopyOfScreenIntoBitmap(
Shared::Bitmap *destination,
const Rect *src_rect,
bool at_native_res,
213 virtual bool DoesSupportVsyncToggle() = 0;
215 virtual bool SetVsync(
bool enabled) = 0;
217 virtual bool GetVsync()
const = 0;
224 virtual void RenderSpritesAtScreenResolution(
bool enabled) = 0;
229 virtual void FadeOut(
int speed,
int targetColourRed,
int targetColourGreen,
int targetColourBlue,
230 uint32_t batch_skip_filter = 0u) = 0;
232 virtual void FadeIn(
int speed, PALETTE p,
int targetColourRed,
int targetColourGreen,
int targetColourBlue,
233 uint32_t batch_skip_filter = 0u) = 0;
235 virtual void BoxOutEffect(
bool blackingOut,
int speed,
int delay, uint32_t batch_skip_filter = 0u) = 0;
236 virtual void UseSmoothScaling(
bool enabled) = 0;
237 virtual bool SupportsGammaControl() = 0;
238 virtual void SetGamma(
int newGamma) = 0;
248 virtual Shared::Bitmap *GetStageBackBuffer(
bool mark_dirty =
false) = 0;
Definition: achievements_tables.h:27
Definition: allegro_bitmap.h:44
Definition: gfx_defines.h:60
Definition: graphics_driver.h:98
Definition: geometry.h:219
Definition: geometry.h:148
Definition: gfx_defines.h:33
Definition: gfx_mode_list.h:38
Definition: graphics_driver.h:85