2019-12-11 00:51:42 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
2021-03-29 21:41:11 -04:00
|
|
|
#include "CoreDefs.h"
|
2019-12-23 17:43:10 -05:00
|
|
|
#include "GpPixelFormat.h"
|
2019-12-22 00:35:30 -05:00
|
|
|
#include "EGpStandardCursor.h"
|
2019-12-21 18:40:17 -05:00
|
|
|
|
2020-09-26 16:45:52 -04:00
|
|
|
#include <stdint.h>
|
2021-03-18 17:08:11 -04:00
|
|
|
#include <stddef.h>
|
2020-09-26 16:45:52 -04:00
|
|
|
|
2019-12-21 18:40:17 -05:00
|
|
|
struct IGpDisplayDriverSurface;
|
2020-02-23 20:21:04 -05:00
|
|
|
struct IGpCursor;
|
2020-07-03 02:46:43 -04:00
|
|
|
struct IGpPrefsHandler;
|
2020-06-13 04:33:41 -04:00
|
|
|
struct GpDisplayDriverProperties;
|
2019-12-21 18:40:17 -05:00
|
|
|
|
2020-05-18 02:03:17 -04:00
|
|
|
struct GpDisplayDriverSurfaceEffects
|
|
|
|
|
{
|
|
|
|
|
GpDisplayDriverSurfaceEffects();
|
|
|
|
|
|
|
|
|
|
bool m_darken;
|
2020-05-18 03:30:25 -04:00
|
|
|
bool m_flicker;
|
|
|
|
|
int32_t m_flickerAxisX;
|
|
|
|
|
int32_t m_flickerAxisY;
|
|
|
|
|
int32_t m_flickerStartThreshold;
|
|
|
|
|
int32_t m_flickerEndThreshold;
|
2020-05-22 21:14:43 -04:00
|
|
|
float m_desaturation;
|
2020-05-18 02:03:17 -04:00
|
|
|
};
|
|
|
|
|
|
2019-12-21 18:40:17 -05:00
|
|
|
// Display drivers are responsible for timing and calling the game tick function.
|
|
|
|
|
struct IGpDisplayDriver
|
|
|
|
|
{
|
2020-10-20 23:43:02 -04:00
|
|
|
typedef void (*SurfaceInvalidateCallback_t) (void *context);
|
|
|
|
|
|
2021-03-29 21:41:11 -04:00
|
|
|
GP_ASYNCIFY_PARANOID_VIRTUAL bool Init() GP_ASYNCIFY_PARANOID_PURE;
|
|
|
|
|
GP_ASYNCIFY_PARANOID_VIRTUAL void ServeTicks(int tickCount) GP_ASYNCIFY_PARANOID_PURE;
|
2021-03-26 17:05:38 -04:00
|
|
|
virtual void ForceSync() = 0;
|
2021-03-29 21:41:11 -04:00
|
|
|
GP_ASYNCIFY_PARANOID_VIRTUAL void Shutdown() GP_ASYNCIFY_PARANOID_PURE;
|
2019-12-21 18:40:17 -05:00
|
|
|
|
2020-11-30 02:59:02 -05:00
|
|
|
// Returns the initial resolution before any display resolution events are posted
|
|
|
|
|
virtual void GetInitialDisplayResolution(unsigned int *width, unsigned int *height) = 0;
|
2019-12-21 18:40:17 -05:00
|
|
|
|
2020-10-20 23:43:02 -04:00
|
|
|
virtual IGpDisplayDriverSurface *CreateSurface(size_t width, size_t height, size_t pitch, GpPixelFormat_t pixelFormat, SurfaceInvalidateCallback_t invalidateCallback, void *invalidateContext) = 0;
|
2020-05-18 02:03:17 -04:00
|
|
|
virtual void DrawSurface(IGpDisplayDriverSurface *surface, int32_t x, int32_t y, size_t width, size_t height, const GpDisplayDriverSurfaceEffects *effects) = 0;
|
2019-12-21 18:40:17 -05:00
|
|
|
|
2021-03-29 21:41:11 -04:00
|
|
|
GP_ASYNCIFY_PARANOID_VIRTUAL IGpCursor *CreateBWCursor(size_t width, size_t height, const void *pixelData, const void *maskData, size_t hotSpotX, size_t hotSpotY) GP_ASYNCIFY_PARANOID_PURE;
|
|
|
|
|
GP_ASYNCIFY_PARANOID_VIRTUAL IGpCursor *CreateColorCursor(size_t width, size_t height, const void *pixelDataRGBA, size_t hotSpotX, size_t hotSpotY) GP_ASYNCIFY_PARANOID_PURE;
|
2020-09-26 21:15:43 -04:00
|
|
|
|
2020-02-23 20:21:04 -05:00
|
|
|
virtual void SetCursor(IGpCursor *cursor) = 0;
|
2019-12-22 00:35:30 -05:00
|
|
|
virtual void SetStandardCursor(EGpStandardCursor_t standardCursor) = 0;
|
|
|
|
|
|
2019-12-21 18:40:17 -05:00
|
|
|
virtual void UpdatePalette(const void *paletteData) = 0;
|
2020-04-05 02:15:49 -04:00
|
|
|
|
|
|
|
|
virtual void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) = 0;
|
2020-06-20 02:08:22 -04:00
|
|
|
virtual void SetBackgroundDarkenEffect(bool isDark) = 0;
|
2020-04-18 00:18:20 -04:00
|
|
|
|
2020-07-03 13:53:10 -04:00
|
|
|
virtual void SetUseICCProfile(bool useICCProfile) = 0;
|
|
|
|
|
|
2020-04-18 00:18:20 -04:00
|
|
|
virtual void RequestToggleFullScreen(uint32_t timestamp) = 0;
|
2020-06-20 01:33:26 -04:00
|
|
|
virtual void RequestResetVirtualResolution() = 0;
|
2020-06-13 04:33:41 -04:00
|
|
|
|
2020-07-20 23:38:31 -04:00
|
|
|
virtual bool IsFullScreen() const = 0;
|
|
|
|
|
|
2020-06-13 04:33:41 -04:00
|
|
|
virtual const GpDisplayDriverProperties &GetProperties() const = 0;
|
2020-07-03 02:46:43 -04:00
|
|
|
virtual IGpPrefsHandler *GetPrefsHandler() const = 0;
|
2019-12-21 18:40:17 -05:00
|
|
|
};
|
2020-05-18 02:03:17 -04:00
|
|
|
|
|
|
|
|
inline GpDisplayDriverSurfaceEffects::GpDisplayDriverSurfaceEffects()
|
|
|
|
|
: m_darken(false)
|
2020-05-18 03:30:25 -04:00
|
|
|
, m_flicker(false)
|
|
|
|
|
, m_flickerAxisX(0)
|
|
|
|
|
, m_flickerAxisY(0)
|
|
|
|
|
, m_flickerStartThreshold(0)
|
|
|
|
|
, m_flickerEndThreshold(0)
|
2020-05-22 21:14:43 -04:00
|
|
|
, m_desaturation(0)
|
2020-05-18 03:30:25 -04:00
|
|
|
{
|
2020-05-18 02:03:17 -04:00
|
|
|
}
|