Skip to content

Commit

Permalink
Merge branch 'sdl2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed May 28, 2018
2 parents 38fac70 + 40d8361 commit ce6c913
Show file tree
Hide file tree
Showing 63 changed files with 1,215 additions and 1,152 deletions.
47 changes: 22 additions & 25 deletions SConscript
Expand Up @@ -231,38 +231,37 @@ def findLibs(env, conf):
if msvc:
libChecks = ['shell32', 'wsock32', 'user32', 'Advapi32', 'ws2_32']
if GetOption('static'):
libChecks += ['libcmt', 'dxguid']
libChecks += ['imm32', 'version', 'Ole32', 'OleAut32']
for i in libChecks:
if not conf.CheckLib(i):
FatalError("Error: some windows libraries not found or not installed, make sure your compiler is set up correctly")
else:
if not conf.CheckLib('mingw32') or not conf.CheckLib('ws2_32'):
FatalError("Error: some windows libraries not found or not installed, make sure your compiler is set up correctly")

if not GetOption('renderer') and not conf.CheckLib('SDLmain'):
FatalError("libSDLmain not found or not installed")
if not GetOption('renderer') and not conf.CheckLib('SDL2main'):
FatalError("libSDL2main not found or not installed")

if not GetOption('renderer'):
#Look for SDL
runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD"
if platform == "Darwin" and conf.CheckFramework("SDL"):
runSdlConfig = False
elif not conf.CheckLib("SDL"):
FatalError("SDL development library not found or not installed")
#Look for SDL
runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD"
if False and platform == "Darwin" and conf.CheckFramework("SDL"):
runSdlConfig = False
elif not conf.CheckLib("SDL2"):
FatalError("SDL development library not found or not installed")

if runSdlConfig:
try:
env.ParseConfig('sdl-config --cflags')
if GetOption('static'):
env.ParseConfig('sdl-config --static-libs')
else:
env.ParseConfig('sdl-config --libs')
except:
pass
if runSdlConfig:
try:
env.ParseConfig('sdl2-config --cflags')
if GetOption('static'):
env.ParseConfig('sdl2-config --static-libs')
else:
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 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 @@ -505,8 +504,6 @@ if GetOption('opengl') or GetOption('opengl-renderer'):

if GetOption('renderer'):
env.Append(CPPDEFINES=['RENDERER'])
else:
env.Append(CPPDEFINES=['USE_SDL'])

if GetOption('font'):
env.Append(CPPDEFINES=['FONTEDITOR'])
Expand Down Expand Up @@ -555,8 +552,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
580 changes: 578 additions & 2 deletions data/icon.cpp

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion data/icon.h
Expand Up @@ -20,4 +20,3 @@
*/
#pragma once
extern const unsigned char app_icon[];
extern const unsigned char app_icon_bitmap[];
13 changes: 11 additions & 2 deletions resources/icon/icontofile.py
@@ -1,7 +1,16 @@
import sys
from PIL import Image
image = Image.open(sys.argv[1])

with open(sys.argv[1], "rb") as icon:
output = ""
formatted = []
for pixel in image.getdata():
formatted.extend("0x{0:02X}".format(byte) for byte in pixel)
for i in range(len(formatted)/16 + 1):
print(", ".join(formatted[i*16:(i+1)*16]) + ",")

"""with open(sys.argv[1], "rb") as icon:
icondata = icon.read()
output = ["0x{0:02X}".format(ord(byte)) for byte in icondata]
for line in range(len(output)/16+1):
print(", ".join(output[line*16:(line+1)*16])+",")
print(", ".join(output[line*16:(line+1)*16])+",")"""
Binary file modified resources/icon/powder-48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/PowderToy.h
Expand Up @@ -4,6 +4,4 @@ void EngineProcess();
void ClipboardPush(ByteString text);
ByteString ClipboardPull();
int GetModifiers();
bool LoadWindowPosition(int scale);
void SetCursorEnabled(int enabled);
unsigned int GetTicks();

0 comments on commit ce6c913

Please sign in to comment.