implement achievements, console supports copy to clipboard

This commit is contained in:
Ondrej Novak 2025-04-18 20:03:47 +02:00
parent f5450c0f92
commit 936bafca5a
12 changed files with 133 additions and 25 deletions

View file

@ -32,7 +32,7 @@ char game_display_init(const INI_CONFIG_SECTION *display_section, const char *ti
cfg.window_height = ini_get_int(display_section, "window_height", 480);
cfg.window_width = ini_get_int(display_section, "window_width", 640);
const char *filter = ini_get_string(display_section, "crt_filter", "auto");
const char *filter = ini_get_string(display_section, "crt_filter", "none");
if (istrcmp(filter,"none") == 0) cfg.crt_filter = SDLContext::CrtFilterType::none;
else if (istrcmp(filter,"scanlines") == 0) cfg.crt_filter = SDLContext::CrtFilterType::scanlines;
else if (istrcmp(filter,"scanlines_2") == 0) cfg.crt_filter = SDLContext::CrtFilterType::scanlines_2;
@ -276,3 +276,8 @@ void game_display_sprite_set_zindex(int sprite_id, int zindex) {
auto &sdl = get_sdl_global_context();
sdl.sprite_set_zindex(sprite_id, zindex);
}
void game_display_disable_crt_effect_temporary(char disable) {
auto &sdl = get_sdl_global_context();
sdl.disable_crt_effect_temprary(disable?true:false);
}

View file

@ -38,6 +38,7 @@ void game_display_sprite_set_zindex(int sprite_id, int zindex);
void game_display_hide_sprite(int sprite_id);
///unload sprite and free index
void game_display_unload_sprite(int sprite);
void game_display_disable_crt_effect_temporary(char disable);
void *DxPrepareWalk(int ypos);
void DxZoomWalk(void *handle, int ypos, int *points,float phase, void *lodka);

View file

@ -107,3 +107,6 @@ char is_joystick_used() {
char is_joystick_enabled() {
return get_sdl_global_context().is_joystick_enabled()?1:0;
}
char copy_text_to_clipboard(const char *text) {
return !SDL_SetClipboardText(text);
}

View file

@ -14,7 +14,7 @@
#include <steam/steam_api.h>
#include <stdbool.h>
#include <thread>
#include <mutex>.
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <string_view>
@ -673,7 +673,7 @@ void SDLContext::refresh_screen() {
recalc_rect.y = _mouse_rect.y - static_cast<int>(f.y * _mouse_size);
SDL_RenderCopy(_renderer.get(), _mouse.get(), NULL, &recalc_rect);
}
if (winrc.h >= 720 && _crt_filter != CrtFilterType::none && _enable_crt) {
if (winrc.h >= 720 && _crt_filter != CrtFilterType::none && _enable_crt && !_disable_crt_tmp) {
if (!_crt_effect) {
SDL_Texture *txt;
generateCRTTexture(_renderer.get(), &txt, winrc.w, winrc.h, _crt_filter);
@ -1135,3 +1135,7 @@ SDLContext::JoystickButton SDLContext::button_from_string(std::string_view s) {
return JoystickButton::disabled;
}
void SDLContext::disable_crt_effect_temprary(bool disable) {
_disable_crt_tmp = disable;
}

View file

@ -162,6 +162,7 @@ public:
bool is_joystick_used() const;
bool is_joystick_enabled() const;
void disable_crt_effect_temprary(bool disable);
protected:
struct SDL_Deleter {
@ -224,6 +225,7 @@ protected:
int aspect_y = 3;
CrtFilterType _crt_filter= CrtFilterType::autoselect;
bool _enable_crt = true;
bool _disable_crt_tmp = false;
std::function<void()> _quit_callback;
JoystickConfig _jcontrol_map;
bool _jcontrol_mod_key = false;