Update tpt-libs, use SDL2main the way it's meant to be

Also fix the first mouse click not being detected on windows with sdl 2.0.20. Apparenlty, we need SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH set to 1 for it to be detected.
This commit is contained in:
Tamás Bálint Misius 2022-04-09 21:42:28 +02:00
parent b963010187
commit 6fe82d7221
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
24 changed files with 61 additions and 87 deletions

2
.github/build.sh vendored
View File

@ -34,7 +34,7 @@ fi
if [ -z "${build_sh_init-}" ]; then
if [ $TOOLSET_SHORT == "msvc" ]; then
for i in C:/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/**/**/VC/Auxiliary/Build/vcvarsall.bat; do
for i in C:/Program\ Files*/Microsoft\ Visual\ Studio/**/**/VC/Auxiliary/Build/vcvarsall.bat; do
vcvarsall_path=$i
done
if [ $MACHINE_SHORT == "x86_64" ]; then

View File

@ -70,7 +70,7 @@ endif
tpt_libs_vtag = get_option('tpt_libs_vtag')
if tpt_libs_vtag == ''
tpt_libs_vtag = 'v20220217170412'
tpt_libs_vtag = 'v20220410083352'
endif
if use_tpt_libs != 'no'
nope = false
@ -141,6 +141,7 @@ endif
threads_dep = dependency('threads')
zlib_dep = use_tpt_libs != 'no' ? tpt_libs.get_variable('zlib_dep') : dependency('zlib', static: uopt_static == 'system')
sdl2_dep = use_tpt_libs != 'no' ? tpt_libs.get_variable('sdl2_dep') : dependency('sdl2', static: uopt_static == 'system')
sdl2main_dep = use_tpt_libs != 'no' ? tpt_libs.get_variable('sdl2main_dep') : []
project_link_args = []
project_c_args = []
@ -326,6 +327,7 @@ if get_option('build_powder')
threads_dep,
zlib_dep,
sdl2_dep,
sdl2main_dep,
lua_opt_dep,
curl_opt_dep,
fftw_opt_dep,
@ -366,6 +368,7 @@ if get_option('build_font')
threads_dep,
zlib_dep,
sdl2_dep,
sdl2main_dep,
]
if copt_platform == 'win'
font_deps += other_dep

View File

@ -230,6 +230,7 @@ void RecreateWindow()
SDL_RenderSetIntegerScale(sdl_renderer, SDL_TRUE);
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, WINDOWW, WINDOWH);
SDL_RaiseWindow(sdl_window);
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
//Uncomment this to enable resizing
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
@ -457,10 +458,6 @@ void EngineProcess()
#endif
}
#ifdef main
# undef main // thank you sdl
#endif
int main(int argc, char * argv[])
{
currentWidth = WINDOWW;

View File

@ -54,10 +54,6 @@ void writeFile(ByteString filename, std::vector<char> & fileData)
}
}
#ifdef main
# undef main // thank you sdl
#endif
int main(int argc, char *argv[])
{
ByteString outputPrefix, inputFilename;

View File

@ -301,6 +301,7 @@ bool RecreateWindow()
SDL_RenderSetIntegerScale(sdl_renderer, SDL_TRUE);
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, WINDOWW, WINDOWH);
SDL_RaiseWindow(sdl_window);
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
//Uncomment this to enable resizing
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
@ -716,10 +717,6 @@ int GuessBestScale()
return guess;
}
#ifdef main
# undef main // thank you sdl
#endif
int main(int argc, char * argv[])
{
#if defined(_DEBUG) && defined(_MSC_VER)

View File

@ -525,22 +525,3 @@ std::wstring WinWiden(const ByteString &source)
#endif
}
#ifdef WIN
# undef main // thank you sdl
int main(int argc, char *argv[]);
int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
int argc;
std::vector<ByteString> argv;
std::vector<char *> argp;
wchar_t **wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
for (auto i = 0; i < argc; ++i)
{
argv.push_back(Platform::WinNarrow(std::wstring(wargv[i])));
argp.push_back(&argv.back()[0]);
}
LocalFree(wargv);
return main(argc, &argp[0]);
}
#endif

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-arm64-mac-gcc-static-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-arm64-mac-gcc-static-v20220217170412.zip
source_filename = tpt-libs-prebuilt-arm64-mac-gcc-static-v20220217170412.zip
source_hash = f5cb8a1e434bbd732235482a75fd5eaf338fa020d95aa2be201748e5366b7e81

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-arm64-mac-gcc-static-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-arm64-mac-gcc-static-v20220410083352.zip
source_filename = tpt-libs-prebuilt-arm64-mac-gcc-static-v20220410083352.zip
source_hash = 14b529c24f24d3cb07d2f10152c9aeb55685613afc90760fd3aed246b0653c00

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220217170412.zip
source_filename = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220217170412.zip
source_hash = 79e5c97d991dbcbdc2950cfd58fe57eee00bace7d0accf31a1a1e14a105d5a77

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220410083352.zip
source_filename = tpt-libs-prebuilt-i686-win-msvc-dynamic-v20220410083352.zip
source_hash = 4b4db479e87898e9f5f9d7805396ef1ed8b46a34eaeff077e3b720c54306ee19

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-i686-win-msvc-static-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-i686-win-msvc-static-v20220217170412.zip
source_filename = tpt-libs-prebuilt-i686-win-msvc-static-v20220217170412.zip
source_hash = cf84e7b5b31ac947bae2d2cddafd11840a158982c533789035afe1b4c881bc82

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-i686-win-msvc-static-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-i686-win-msvc-static-v20220410083352.zip
source_filename = tpt-libs-prebuilt-i686-win-msvc-static-v20220410083352.zip
source_hash = d1ebd911231da6f266eea128a27d8d85d474a1ed1c4f53a7760cbbb4ed5f35e8

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220217170412.zip
source_filename = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220217170412.zip
source_hash = 50384ef30e77317bc8e11ef0e3dd5dcca46ed2a223a74ae917e6b19926de905a

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220410083352.zip
source_filename = tpt-libs-prebuilt-x86_64-lin-gcc-static-v20220410083352.zip
source_hash = 076881617230f80faf4b868c7090eb53d9f76078691568051a9cfb97ab8f1787

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220217170412.zip
source_filename = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220217170412.zip
source_hash = a648b73d0bf9e5fba790f3720a82e972192676c25b8cadded6bbf4b831aedb87

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220410083352.zip
source_filename = tpt-libs-prebuilt-x86_64-mac-gcc-static-v20220410083352.zip
source_hash = cd21543d8ec2c1c697af574902c588a7afaf91e0b64f24981c3d4ea210dd8df3

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220217170412.zip
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220217170412.zip
source_hash = 0243eaa887e902f1567e7ef86c29dc0b28aea4532fd7a71216f5aa812647d85c

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220410083352.zip
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-dynamic-v20220410083352.zip
source_hash = dde61bacaa5e4ca37ec0696d69dadc2aeb553fe1e62f35c5968d6a9575424614

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-mingw-static-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-mingw-static-v20220217170412.zip
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-static-v20220217170412.zip
source_hash = 8f2c42d336ce9160ceb8624bbeaeb9155ea7a3a995c573fe95bdf3f2292bc630

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-mingw-static-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-x86_64-win-mingw-static-v20220410083352.zip
source_filename = tpt-libs-prebuilt-x86_64-win-mingw-static-v20220410083352.zip
source_hash = a5f3cba05b449198d2bb17546ea459acfb243b0927c01969505b72c7152f7edb

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220217170412.zip
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220217170412.zip
source_hash = 6ce386393aacaa62b153c63b45c695bef764b3fe62e138f7c5459688a1987235

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220410083352.zip
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-dynamic-v20220410083352.zip
source_hash = 2f4136e82f80f9ea36e752e46fa26f95d007730cfeb67a73d1125aafb8fdf109

View File

@ -1,6 +0,0 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-msvc-static-v20220217170412
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220217170412/tpt-libs-prebuilt-x86_64-win-msvc-static-v20220217170412.zip
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-static-v20220217170412.zip
source_hash = 72a8a40c90e79fd19c9030517006b699ef8adbba68341c5501d30265444bf0b9

View File

@ -0,0 +1,6 @@
[wrap-file]
directory = tpt-libs-prebuilt-x86_64-win-msvc-static-v20220410083352
source_url = https://github.com/The-Powder-Toy/tpt-libs/releases/download/v20220410083352/tpt-libs-prebuilt-x86_64-win-msvc-static-v20220410083352.zip
source_filename = tpt-libs-prebuilt-x86_64-win-msvc-static-v20220410083352.zip
source_hash = b476b5c991d352b993bc3784690ed00b1f66e7dd87e221c8fb0de9ffb398b2a0