improve video initialization, use more compatible and common format

This commit is contained in:
Ondrej Novak 2025-05-04 13:36:17 +02:00
parent c7b575821c
commit 5643814710
5 changed files with 196 additions and 38 deletions

View file

@ -33,7 +33,6 @@ public:
CrtFilterType crt_filter;
int composer;
const char *scale_quality;
const char *hint_renderer;
bool fullscreen;
int aspect_x;
int aspect_y;
@ -171,6 +170,7 @@ protected:
void operator()(SDL_Renderer *);
void operator()(SDL_Surface *);
void operator()(SDL_Texture *);
void operator()(SDL_PixelFormat* f);
};
struct BlendTransitionReq {
@ -238,13 +238,16 @@ protected:
std::unique_ptr<SDL_Texture, SDL_Deleter> _texture2;
std::unique_ptr<SDL_Texture, SDL_Deleter> _crt_effect;
std::unique_ptr<SDL_Texture, SDL_Deleter> _mouse;
std::unique_ptr<SDL_PixelFormat, SDL_Deleter> _main_pixel_format;
unique_value<SDL_AudioDeviceID, SDL_Audio_Deleter> _audio;
SDL_Texture *_visible_texture = nullptr;
SDL_Texture *_hidden_texture = nullptr;
uint32_t _texture_render_format = SDL_PIXELFORMAT_ARGB1555;
bool _fullscreen_mode = false;
bool _present = false;
bool _convert_format = false;
std::atomic<bool> _key_control = false;
std::atomic<bool> _key_shift = false;
std::atomic<bool> _key_capslock = false;
@ -253,6 +256,7 @@ protected:
std::vector<char> _display_update_queue;
std::vector<uint32_t> converted_pixels;
using QueueIter = const char *;
std::queue<uint16_t> _keyboard_queue;
SDL_Rect _mouse_rect;
@ -308,4 +312,8 @@ protected:
void generate_j_event(int button, char up);
static int adjust_deadzone(int v, short deadzone);
void update_texture_with_conversion(SDL_Texture * texture,
const SDL_Rect * rect,
const void *pixels, int pitch);
};