22 #ifndef BACKENDS_GRAPHICS_ATARI_H 23 #define BACKENDS_GRAPHICS_ATARI_H 25 #include "backends/graphics/graphics.h" 26 #include "common/events.h" 28 #include <mint/osbind.h> 30 #include "common/rect.h" 31 #include "graphics/surface.h" 33 #include "atari-cursor.h" 34 #include "atari-screen.h" 36 #define MAX_HZ_SHAKE 16 // Falcon only 37 #define MAX_V_SHAKE 16 53 {
"direct",
"Direct rendering", (int)GraphicsMode::DirectRendering },
54 {
"single",
"Single buffering", (int)GraphicsMode::SingleBuffering },
55 {
"triple",
"Triple buffering", (int)GraphicsMode::TripleBuffering },
56 {
nullptr,
nullptr, 0 }
60 int getDefaultGraphicsMode()
const override {
return (
int)GraphicsMode::TripleBuffering; }
62 int getGraphicsMode()
const override {
return (
int)_currentState.mode; }
66 int getScreenChangeID()
const override {
return 0; }
68 void beginGFXTransaction()
override;
71 int16 getHeight()
const override {
return _currentState.height; }
72 int16 getWidth()
const override {
return _currentState.width; }
73 void setPalette(
const byte *colors, uint start, uint num)
override;
74 void grabPalette(byte *colors, uint start, uint num)
const override;
75 void copyRectToScreen(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
77 void unlockScreen()
override;
78 void fillScreen(uint32 col)
override;
79 void fillScreen(
const Common::Rect &r, uint32 col)
override;
80 void updateScreen()
override;
81 void setShakePos(
int shakeXOffset,
int shakeYOffset)
override;
82 void setFocusRectangle(
const Common::Rect& rect)
override {}
83 void clearFocusRectangle()
override {}
85 void showOverlay(
bool inGUI)
override;
86 void hideOverlay()
override;
87 bool isOverlayVisible()
const override {
return _overlayVisible; }
89 void clearOverlay()
override;
91 void copyRectToOverlay(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
92 int16 getOverlayHeight()
const override {
return 480; }
93 int16 getOverlayWidth()
const override {
return _vgaMonitor ? 640 : 640*1.2; }
95 bool showMouse(
bool visible)
override;
96 void warpMouse(
int x,
int y)
override;
97 void setMouseCursor(
const void *buf, uint w, uint h,
int hotspotX,
int hotspotY, uint32 keycolor,
98 bool dontScale =
false,
const Graphics::PixelFormat *format = NULL,
const byte *mask = NULL)
override;
99 void setCursorPalette(
const byte *colors, uint start, uint num)
override;
101 Common::Point getMousePosition()
const {
return _workScreen->cursor.getPosition(); }
102 void updateMousePosition(
int deltaX,
int deltaY);
108 typedef void* (*AtariMemAlloc)(
size_t bytes);
109 typedef void (*AtariMemFree)(
void *ptr);
111 void allocateSurfaces();
115 enum class GraphicsMode : int {
122 enum CustomEventAction {
123 kActionToggleAspectRatioCorrection = 100,
126 #ifndef DISABLE_FANCY_THEMES 127 int16 getMaximumScreenHeight()
const {
return 480; }
128 int16 getMaximumScreenWidth()
const {
return _tt ? 320 : (_vgaMonitor ? 640 : 640*1.2); }
130 int16 getMaximumScreenHeight()
const {
return _tt ? 480 : 240; }
131 int16 getMaximumScreenWidth()
const {
return _tt ? 320 : (_vgaMonitor ? 320 : 320*1.2); }
136 void copyRectToScreenInternal(
const void *buf,
int pitch,
int x,
int y,
int w,
int h,
141 bool isOverlayDirectRendering()
const;
143 virtual AtariMemAlloc getStRamAllocFunc()
const {
144 return [](
size_t bytes) {
return (
void*)Mxalloc(bytes, MX_STRAM); };
146 virtual AtariMemFree getStRamFreeFunc()
const {
147 return [](
void *ptr) { Mfree(ptr); };
151 int destX,
int destY,
156 virtual void drawMaskedSprite(
Graphics::Surface &dstSurface,
int dstBitsPerPixel,
158 int destX,
int destY,
161 virtual Common::Rect alignRect(
int x,
int y,
int w,
int h)
const = 0;
167 int getOverlayPaletteSize()
const {
168 #ifndef DISABLE_FANCY_THEMES 169 return _tt ? 16 : 256;
175 bool _vgaMonitor =
true;
177 bool _checkUnalignedPitch =
false;
179 struct GraphicsState {
181 : mode(GraphicsMode::Unknown)
192 GraphicsState _pendingState;
193 GraphicsState _currentState;
196 bool _aspectRatioCorrection =
false;
198 enum PendingScreenChange {
200 kPendingVideoMode = 1<<0,
201 kPendingScreenAddress = 1<<1,
202 kPendingAspectRatioCorrection = 1<<2,
203 kPendingPalette = 1<<3,
204 kPendingShakeScreen = 1<<4,
205 kPendingTransaction = kPendingVideoMode | kPendingScreenAddress | kPendingAspectRatioCorrection,
206 kPendingAll = kPendingTransaction | kPendingPalette | kPendingShakeScreen
208 int _pendingScreenChange = kPendingNone;
217 Screen *_screen[BUFFER_COUNT] = {};
218 Screen *_workScreen =
nullptr;
219 Screen *_oldWorkScreen =
nullptr;
223 bool _overlayVisible =
true;
224 bool _overlayPending =
true;
225 bool _ignoreHideOverlay =
true;
bool notifyEvent(const Common::Event &event) override
void grabPalette(byte *colors, uint start, uint num) const override
Feature
Definition: system.h:403
Definition: atari-screen.h:60
Definition: atari-cursor.h:38
int16 width() const
Definition: rect.h:191
TransactionError
Definition: system.h:1155
int16 left
Definition: rect.h:145
void setPalette(const byte *colors, uint start, uint num) override
Definition: graphics.h:37
Definition: atari-graphics.h:39
void copyRectToSurface(const void *buffer, int srcPitch, int destX, int destY, int width, int height)
int16 height() const
Definition: rect.h:192
Definition: atari-screen.h:44