Skip to content

Commit

Permalink
upgrade to SDL 2
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
jacob1 committed May 26, 2018
1 parent 38fac70 commit e5230b5
Show file tree
Hide file tree
Showing 55 changed files with 367 additions and 932 deletions.
18 changes: 9 additions & 9 deletions SConscript
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/PowderToy.h
Expand Up @@ -5,5 +5,4 @@ void ClipboardPush(ByteString text);
ByteString ClipboardPull();
int GetModifiers();
bool LoadWindowPosition(int scale);
void SetCursorEnabled(int enabled);
unsigned int GetTicks();

0 comments on commit e5230b5

Please sign in to comment.