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;
104 virtual void SetTintMethod(TintMethod method) = 0;
106 virtual bool SetDisplayMode(
const DisplayMode &mode) = 0;
108 virtual void UpdateDeviceScreen(
const Size &screen_size) = 0;
110 virtual bool IsModeSet()
const = 0;
113 virtual bool IsNativeSizeValid()
const = 0;
115 virtual bool SetRenderFrame(
const Rect &dst_rect) = 0;
116 virtual bool IsRenderFrameValid()
const = 0;
118 virtual int GetDisplayDepthForNativeDepth(
int native_color_depth)
const = 0;
119 virtual IGfxModeList *GetSupportedModeList(
int color_depth) = 0;
120 virtual bool IsModeSupported(
const DisplayMode &mode) = 0;
122 virtual PGfxFilter GetGraphicsFilter()
const = 0;
123 virtual Size GetNativeSize()
const = 0;
124 virtual Rect GetRenderDestination()
const = 0;
125 virtual void SetCallbackForPolling(GFXDRV_CLIENTCALLBACK callback) = 0;
127 virtual void SetCallbackToDrawScreen(GFXDRV_CLIENTCALLBACK callback, GFXDRV_CLIENTCALLBACK post_callback) = 0;
128 virtual void SetCallbackOnInit(GFXDRV_CLIENTCALLBACKINITGFX callback) = 0;
132 virtual void SetCallbackOnSpriteEvt(GFXDRV_CLIENTCALLBACKEVT callback) = 0;
134 virtual void ClearRectangle(
int x1,
int y1,
int x2,
int y2,
RGB *colorToUse) = 0;
137 virtual int GetCompatibleBitmapFormat(
int color_depth) = 0;
140 virtual IDriverDependantBitmap *CreateDDB(
int width,
int height,
int color_depth,
bool opaque =
false) = 0;
144 virtual IDriverDependantBitmap *CreateRenderTargetDDB(
int width,
int height,
int color_depth,
bool opaque =
false) = 0;
153 Shared::Bitmap *bitmap =
nullptr,
bool hasAlpha =
true,
bool opaque =
false) = 0;
154 virtual void UpdateSharedDDB(uint32_t sprite_id,
Shared::Bitmap *bitmap =
nullptr,
bool hasAlpha =
true,
bool opaque =
false) = 0;
156 virtual void ClearSharedDDB(uint32_t sprite_id) = 0;
164 Shared::GraphicFlip flip = Shared::kFlip_None,
PBitmap surface =
nullptr) = 0;
166 virtual void EndSpriteBatch() = 0;
170 virtual void SetScreenFade(
int red,
int green,
int blue) = 0;
173 virtual void SetScreenTint(
int red,
int green,
int blue) = 0;
179 virtual void SetStageScreen(
const Size &sz,
int x = 0,
int y = 0) = 0;
181 virtual void ClearDrawLists() = 0;
182 virtual void RenderToBackBuffer() = 0;
183 virtual void Render() = 0;
187 virtual void Render(
int xoff,
int yoff, Shared::GraphicFlip flip) = 0;
193 virtual bool DoesSupportVsyncToggle() = 0;
195 virtual bool SetVsync(
bool enabled) = 0;
197 virtual bool GetVsync()
const = 0;
204 virtual void RenderSpritesAtScreenResolution(
bool enabled,
int supersampling = 1) = 0;
209 virtual void FadeOut(
int speed,
int targetColourRed,
int targetColourGreen,
int targetColourBlue) = 0;
211 virtual void FadeIn(
int speed, PALETTE p,
int targetColourRed,
int targetColourGreen,
int targetColourBlue) = 0;
213 virtual void BoxOutEffect(
bool blackingOut,
int speed,
int delay) = 0;
214 virtual void UseSmoothScaling(
bool enabled) = 0;
215 virtual bool SupportsGammaControl() = 0;
216 virtual void SetGamma(
int newGamma) = 0;
226 virtual Shared::Bitmap *GetStageBackBuffer(
bool mark_dirty =
false) = 0;
235 virtual bool RequiresFullRedrawEachFrame() = 0;
236 virtual bool HasAcceleratedTransform() = 0;
237 virtual bool UsesMemoryBackBuffer() = 0;
Definition: achievements_tables.h:27
Definition: allegro_bitmap.h:44
Definition: gfx_defines.h:60
Definition: graphics_driver.h:98
Definition: geometry.h:215
Definition: geometry.h:144
Definition: gfx_defines.h:33
Definition: gfx_mode_list.h:38
Definition: graphics_driver.h:85