Restore SDL 1.2 on Windows to a working state. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4774 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-11-29 03:07:33 +00:00
parent 731e4ffa99
commit a1ec634dec
4 changed files with 27 additions and 4 deletions

View file

@ -109,6 +109,7 @@ static mutex_t m_initprintf;
uint16_t *joydead, *joysatur;
#ifdef _WIN32
# if SDL_MAJOR_VERSION != 1
//
// win_gethwnd() -- gets the window handle
//
@ -127,6 +128,7 @@ HWND win_gethwnd(void)
return 0;
}
# endif
//
// win_gethinstance() -- gets the application instance
//
@ -245,13 +247,14 @@ void wm_setapptitle(const char *name)
Bstrncpyz(apptitle, name, sizeof(apptitle));
#if !defined(__APPLE__)
appicon = loadappicon();
if (!appicon)
appicon = loadappicon();
#endif
#if SDL_MAJOR_VERSION == 1
SDL_WM_SetCaption(apptitle, NULL);
if (appicon)
if (appicon && sdl_surface)
SDL_WM_SetIcon(appicon, 0);
#else
SDL_SetWindowTitle(sdl_window, apptitle);

View file

@ -1,4 +1,4 @@
// SDL 1.2 compatibility. Not for Windows, Android, iOS or anything with a working port of SDL 2.0
// SDL 1.2 compatibility.
#include <SDL/SDL_events.h>
@ -33,6 +33,22 @@ int32_t wm_ynbox(const char *name, const char *fmt, ...)
return 0;
}
#ifdef _WIN32
HWND win_gethwnd(void)
{
struct SDL_SysWMinfo wmInfo;
SDL_VERSION(&wmInfo.version);
if (SDL_GetWMInfo(&wmInfo) != 1)
{
initprintf("win_gethwnd: SDL_GetWindowWMInfo() failed: %s\n", SDL_GetError());
return 0;
}
return wmInfo.window;
}
#endif
#ifdef USE_OPENGL
void setvsync(int32_t sync)
{
@ -174,7 +190,9 @@ static inline char grabmouse_low(char a)
// high-resolution timers for profiling
uint64_t getu64ticks(void)
{
#if defined __APPLE__
# if defined _WIN32
return win_getu64ticks();
# elif defined __APPLE__
return mach_absolute_time();
# elif _POSIX_TIMERS>0 && defined _POSIX_MONOTONIC_CLOCK
// This is SDL HG's SDL_GetPerformanceCounter() when clock_gettime() is

View file

@ -292,5 +292,6 @@ int32_t addsearchpath_ProgramFiles(const char *p)
// Workaround for a bug in mingwrt-4.0.0 and up where a function named main() in misc/src/libcrt/gdtoa/qnan.c takes precedence over the proper one in src/libcrt/crt/main.c.
#if (defined __MINGW32__ && EDUKE32_GCC_PREREQ(4,8)) || EDUKE32_CLANG_PREREQ(3,4)
# undef main
# include "mingw_main.c"
#endif

View file

@ -1,6 +1,7 @@
#include "compat.h"
#include "sdlappicon.h"
#include "sdl_inc.h"
static uint8_t sdlappicon_pixels[] = {
#if defined _WIN32 && SDL_MAJOR_VERSION==1