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-pendingscreenchanges.h" 35 #include "atari-screen.h" 37 #define MAX_HZ_SHAKE 16 // Falcon only 38 #define MAX_V_SHAKE 16 55 {
"direct",
"Direct rendering", (int)GraphicsMode::DirectRendering },
56 {
"single",
"Single buffering", (int)GraphicsMode::SingleBuffering },
57 {
"triple",
"Triple buffering", (int)GraphicsMode::TripleBuffering },
58 {
nullptr,
nullptr, 0 }
62 int getDefaultGraphicsMode()
const override {
return (
int)GraphicsMode::TripleBuffering; }
64 int getGraphicsMode()
const override {
return (
int)_currentState.mode; }
68 int getScreenChangeID()
const override {
return 0; }
70 void beginGFXTransaction()
override;
73 int16 getHeight()
const override {
return _currentState.height; }
74 int16 getWidth()
const override {
return _currentState.width; }
75 void setPalette(
const byte *colors, uint start, uint num)
override;
76 void grabPalette(byte *colors, uint start, uint num)
const override;
77 void copyRectToScreen(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
79 void unlockScreen()
override;
80 void fillScreen(uint32 col)
override;
81 void fillScreen(
const Common::Rect &r, uint32 col)
override;
82 void updateScreen()
override;
83 void setShakePos(
int shakeXOffset,
int shakeYOffset)
override;
84 void setFocusRectangle(
const Common::Rect& rect)
override {}
85 void clearFocusRectangle()
override {}
87 void showOverlay(
bool inGUI)
override;
88 void hideOverlay()
override;
89 bool isOverlayVisible()
const override {
return _overlayVisible; }
91 void clearOverlay()
override;
93 void copyRectToOverlay(
const void *buf,
int pitch,
int x,
int y,
int w,
int h)
override;
94 int16 getOverlayHeight()
const override {
return 480; }
95 int16 getOverlayWidth()
const override {
return _vgaMonitor ? 640 : 640*1.2; }
97 bool showMouse(
bool visible)
override;
98 void warpMouse(
int x,
int y)
override;
99 void setMouseCursor(
const void *buf, uint w, uint h,
int hotspotX,
int hotspotY, uint32 keycolor,
100 bool dontScale =
false,
const Graphics::PixelFormat *format = NULL,
const byte *mask = NULL)
override;
101 void setCursorPalette(
const byte *colors, uint start, uint num)
override;
103 Common::Point getMousePosition()
const {
return _workScreen->cursor.getPosition(); }
104 void updateMousePosition(
int deltaX,
int deltaY);
110 typedef void* (*AtariMemAlloc)(
size_t bytes);
111 typedef void (*AtariMemFree)(
void *ptr);
113 void allocateSurfaces();
117 enum class GraphicsMode : int {
124 enum CustomEventAction {
125 kActionToggleAspectRatioCorrection = 100,
128 #ifndef DISABLE_FANCY_THEMES 129 int16 getMaximumScreenHeight()
const {
return 480; }
130 int16 getMaximumScreenWidth()
const {
return _tt ? 320 : (_vgaMonitor ? 640 : 640*1.2); }
132 int16 getMaximumScreenHeight()
const {
return _tt ? 480 : 240; }
133 int16 getMaximumScreenWidth()
const {
return _tt ? 320 : (_vgaMonitor ? 320 : 320*1.2); }
138 void copyRectToScreenInternal(
const void *buf,
int pitch,
int x,
int y,
int w,
int h,
143 bool isOverlayDirectRendering()
const;
145 virtual AtariMemAlloc getStRamAllocFunc()
const {
146 return [](
size_t bytes) {
return (
void*)Mxalloc(bytes, MX_STRAM); };
148 virtual AtariMemFree getStRamFreeFunc()
const {
149 return [](
void *ptr) { Mfree(ptr); };
153 int destX,
int destY,
158 virtual void drawMaskedSprite(
Graphics::Surface &dstSurface,
int dstBitsPerPixel,
160 int destX,
int destY,
163 virtual Common::Rect alignRect(
int x,
int y,
int w,
int h)
const = 0;
169 int getOverlayPaletteSize()
const {
170 #ifndef DISABLE_FANCY_THEMES 171 return _tt ? 16 : 256;
177 bool _vgaMonitor =
true;
179 bool _checkUnalignedPitch =
false;
181 struct GraphicsState {
183 : inTransaction(
false)
184 , mode(GraphicsMode::Unknown)
196 GraphicsState _pendingState;
197 GraphicsState _currentState;
200 bool _aspectRatioCorrection =
false;
211 Screen *_screen[BUFFER_COUNT] = {};
212 Screen *_workScreen =
nullptr;
213 Screen *_oldWorkScreen =
nullptr;
217 bool _overlayVisible =
true;
218 bool _overlayPending =
true;
219 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-pendingscreenchanges.h:32
Definition: atari-graphics.h:40
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