upgrade to SDL 2

Still currently in process, there are some issues:
Windows version doesn't work, mac version might not work, opengl might not work
Icon doesn't work (on Linux at least)
Lua will need some changes, there are some sdl 1.2 hacks in there
When entering fullscreen, the window loses focus
When holding down mouse out of bounds, mouse move events stop being sent
When letting go of mouse out of bounds, mouseup event doesn't take into account double scale mode
Clicking on startup without moving mouse will draw at 0,0 for a frame
Renderer probably won't compile because USE_SDL doesn't entirely work

... and maybe others

Some nice things were done though:
no more blit2, sdl can do the scaling itself
3d effect removed, no reason to support this joke any longer
No need to support copy/paste ourselves, sdl does it now
text handling done much better now, separate events for key presses and text input
when a new window is shown, all events ignored until next tick (ignore textinput event if window shown from key press event like console)
This commit is contained in:
jacob1
2018-04-15 18:53:02 -04:00
parent 38fac7046a
commit e5230b5b9f
55 changed files with 367 additions and 932 deletions

View File

@@ -245,24 +245,24 @@ def findLibs(env, conf):
if not GetOption('renderer'):
#Look for SDL
runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD"
if platform == "Darwin" and conf.CheckFramework("SDL"):
if False and platform == "Darwin" and conf.CheckFramework("SDL"):
runSdlConfig = False
elif not conf.CheckLib("SDL"):
elif not conf.CheckLib("SDL2"):
FatalError("SDL development library not found or not installed")
if runSdlConfig:
try:
env.ParseConfig('sdl-config --cflags')
env.ParseConfig('sdl2-config --cflags')
if GetOption('static'):
env.ParseConfig('sdl-config --static-libs')
env.ParseConfig('sdl2-config --static-libs')
else:
env.ParseConfig('sdl-config --libs')
env.ParseConfig('sdl2-config --libs')
except:
pass
#look for SDL.h
if not GetOption('renderer') and not conf.CheckCHeader('SDL.h'):
if conf.CheckCHeader('SDL/SDL.h'):
if not GetOption('renderer') and not conf.CheckCHeader('SDL2.h'):
if conf.CheckCHeader('SDL2/SDL.h'):
env.Append(CPPDEFINES=["SDL_INC"])
else:
FatalError("SDL.h not found")
@@ -555,8 +555,8 @@ if platform == "Windows":
envCopy = env.Clone()
envCopy.Append(CCFLAGS='-mstackrealign')
sources += envCopy.Object('src/simulation/Gravity.cpp')
elif platform == "Darwin":
sources += ["src/SDLMain.m"]
#elif platform == "Darwin":
# sources += ["src/SDLMain.m"]
#Program output name