All these changes will allow us to more easily add Lol Engine as a submodule of another Git project.legacy
@@ -74,7 +74,7 @@ CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.data) \ | |||
all-local: all-local-android | |||
clean-local: clean-local-android | |||
if USE_ANDROID | |||
if LOL_USE_ANDROID | |||
all-local-android: $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), .$(p).androidstamp) | |||
.%.androidstamp: %$(EXEEXT) | |||
$(eval p := $(^:%$(EXEEXT)=%)) | |||
@@ -82,13 +82,13 @@ all-local-android: $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), .$(p).androidstamp) | |||
rm -rf "$(d)" | |||
$(MKDIR_P) "$(d)" $(sort $(foreach f, $($(p)_DATA), "$(d)/assets/$(dir $(f))")) | |||
$(foreach f, $($(p)_DATA), $(LN_S) "$(abs_srcdir)/$(f)" "$(d)/assets/$(f)" &&) true | |||
$(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(top_srcdir)/build/android/AndroidManifest.xml" > "$(d)/AndroidManifest.xml" | |||
$(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(lol_srcdir)/build/android/AndroidManifest.xml" > "$(d)/AndroidManifest.xml" | |||
$(MKDIR_P) "$(d)/src/net/lolengine" | |||
$(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(top_srcdir)/build/android/LolActivity.java" > "$(d)/src/net/lolengine/LolActivity.java" | |||
$(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(lol_srcdir)/build/android/LolActivity.java" > "$(d)/src/net/lolengine/LolActivity.java" | |||
$(MKDIR_P) "$(d)/res/values" | |||
$(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(top_srcdir)/build/android/strings.xml" > "$(d)/res/values/strings.xml" | |||
$(SED) -e 's,@PROGRAM@,$(subst -,_,$(p)),' "$(lol_srcdir)/build/android/strings.xml" > "$(d)/res/values/strings.xml" | |||
$(MKDIR_P) "$(d)/res/drawable" | |||
cp "$(top_srcdir)/build/android/icon.png" "$(d)/res/drawable/" | |||
cp "$(lol_srcdir)/build/android/icon.png" "$(d)/res/drawable/" | |||
$(MKDIR_P) "$(d)/libs/armeabi" | |||
$(LN_S) "$(abs_builddir)/$(p)$(EXEEXT)" "$(d)/libs/armeabi/lib$(p).so" | |||
$(LN_S) "$${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/armeabi/libstlport_shared.so" "$(d)/libs/armeabi" | |||
@@ -0,0 +1,207 @@ | |||
# LOL_AC_SUBST() | |||
# --------------------- | |||
AC_DEFUN([LOL_AC_SUBST], [ | |||
dnl How to use the Lol Engine outside this tree | |||
LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS" | |||
LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS" | |||
LOL_DEPS="${LOL_DEPS} \$(lol_builddir)/src/liblol-core.a" | |||
LOL_DEPS="${LOL_DEPS} \$(lol_builddir)/src/bullet/liblol-bullet.a" | |||
LOL_DEPS="${LOL_DEPS} \$(lol_builddir)/src/lua/liblol-lua.a" | |||
dnl How to use the Lol Engine inside this tree | |||
AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(lol_srcdir)/src" | |||
AM_CPPFLAGS="${AM_CPPFLAGS} -DLOL_CONFIG_SOURCESUBDIR=\\\"\$(subdir)\\\"" | |||
AM_CPPFLAGS="${AM_CPPFLAGS} ${LOL_CFLAGS}" | |||
AM_LDFLAGS="${AM_LDFLAGS} ${LOL_DEPS}" | |||
AM_LDFLAGS="${AM_LDFLAGS} ${LOL_LIBS}" | |||
dnl Extra flags | |||
AC_SUBST(LOL_CFLAGS) | |||
AC_SUBST(LOL_LIBS) | |||
AC_SUBST(LOL_DEPS) | |||
AC_SUBST(AM_CFLAGS) | |||
AC_SUBST(AM_CPPFLAGS) | |||
AC_SUBST(AM_CXXFLAGS) | |||
AC_SUBST(AM_LDFLAGS) | |||
]) # LOL_AC_SUBST | |||
# LOL_AC_CHECK() | |||
# --------------------- | |||
AC_DEFUN([LOL_AC_CHECK], [ | |||
dnl Check that the C++ compiler really works | |||
AC_LANG_PUSH(C++) | |||
AC_MSG_CHECKING(for a fully working C++ compiler) | |||
AC_TRY_LINK([], [], | |||
[AC_MSG_RESULT(yes)], | |||
[AC_MSG_RESULT(no) | |||
AC_MSG_ERROR([[C++ compiler cannot link executables]])]) | |||
AC_LANG_POP(C++) | |||
dnl Use mingw threads if necessary | |||
if true; then | |||
LOL_CFLAGS="$LOL_CFLAGS -I\$(lol_srcdir)/external/mingw-std-threads-0.0.ac5c9e3b/include/" | |||
fi | |||
dnl Use pegtl? Yes, always | |||
if true; then | |||
LOL_CFLAGS="$LOL_CFLAGS -I\$(lol_srcdir)/external/pegtl-1.3.1-e7752e81/include" | |||
fi | |||
dnl Use Imgui? Yes, always | |||
if true; then | |||
LOL_CFLAGS="$LOL_CFLAGS -I\$(lol_srcdir)/external/imgui" | |||
fi | |||
dnl Use NativeClient? | |||
ac_cv_my_have_nacl="no" | |||
AC_LANG_PUSH(C++) | |||
AC_CHECK_HEADERS(ppapi/cpp/instance.h, | |||
[ac_cv_my_have_nacl="yes" | |||
LOL_LIBS="${LOL_LIBS} -lnosys" | |||
if test "${ac_cv_my_build_mode}" = "xrelease"; then | |||
LOL_TRY_CXXFLAGS(-s, [AM_CXXFLAGS="${AM_CXXFLAGS} -s"]) | |||
fi]) | |||
AC_LANG_POP(C++) | |||
AM_CONDITIONAL(LOL_USE_NACL, test "${ac_cv_my_have_nacl}" != "no") | |||
dnl Use Android? FIXME: super hacks! | |||
ac_cv_my_have_android="no" | |||
AC_CHECK_LIB(log, __android_log_vprint, | |||
[ac_cv_my_have_android="yes" | |||
LOL_LIBS="${LOL_LIBS} -llog -landroid -module -lEGL -lGLESv2"]) | |||
AM_CONDITIONAL(LOL_USE_ANDROID, test "${ac_cv_my_have_android}" != "no") | |||
dnl Use EGL? | |||
ac_cv_my_have_egl="no" | |||
PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:]) | |||
if test "${ac_cv_my_have_egl}" != "no"; then | |||
AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) | |||
EGL_LIBS="${EGL_LIBS} -lX11" | |||
fi | |||
AC_CHECK_LIB(EGL, main, | |||
[ac_cv_my_have_egl="yes" | |||
AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) | |||
EGL_LIBS="-lEGL"]) | |||
dnl Raspberry Pi is different, check for it with extra libs; also we | |||
dnl look for a different function to bypass autoconf caching | |||
AC_CHECK_LIB(EGL, eglGetDisplay, | |||
[ac_cv_my_have_egl="yes" | |||
AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) | |||
EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"], | |||
[:], | |||
[-lvcos -lvchiq_arm -lbcm_host -lGLESv2]) | |||
AM_CONDITIONAL(LOL_USE_EGL, test "${ac_cv_my_have_egl}" != "no") | |||
dnl Use libpng? (replacement for SDL_image) | |||
ac_cv_my_have_libpng="no" | |||
PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:]) | |||
if test "${ac_cv_my_have_libpng}" != "no"; then | |||
AC_DEFINE(LOL_USE_LIBPNG, 1, Define to 1 to use libpng) | |||
fi | |||
AM_CONDITIONAL(LOL_USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no") | |||
dnl Use Imlib2? | |||
ac_cv_my_have_imlib2="no" | |||
PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:]) | |||
if test "${ac_cv_my_have_imlib2}" != "no"; then | |||
AC_DEFINE(LOL_USE_IMLIB2, 1, Define to 1 to use Imlib2) | |||
LOL_CFLAGS="${LOL_CFLAGS} ${IMLIB2_CFLAGS}" | |||
LOL_LIBS="${LOL_LIBS} ${IMLIB2_LIBS}" | |||
fi | |||
AM_CONDITIONAL(LOL_USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes") | |||
dnl Use Windows GDI+? | |||
ac_cv_my_have_gdiplus="no" | |||
AC_LANG_PUSH(C++) | |||
AC_CHECK_HEADERS(gdiplus.h, | |||
[ac_cv_my_have_gdiplus="yes" | |||
LOL_LIBS="${LOL_LIBS} -lgdiplus"], | |||
[ac_cv_my_have_gdiplus="no"], | |||
[#include <algorithm> | |||
using std::min; | |||
using std::max; | |||
#include <windows.h>]) | |||
AC_LANG_POP(C++) | |||
if test "${ac_cv_my_have_gdiplus}" != "no"; then | |||
AC_DEFINE(LOL_USE_GDIPLUS, 1, Define to 1 to use GDI+) | |||
fi | |||
AM_CONDITIONAL(LOL_USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes") | |||
dnl Use libavcodec? (required for movie encoding) | |||
ac_cv_my_have_ffmpeg="yes" | |||
PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no]) | |||
PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no]) | |||
PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no]) | |||
if test "${ac_cv_my_have_ffmpeg}" = "no"; then | |||
ac_cv_my_have_ffmpeg="yes" | |||
AC_CHECK_HEADERS(libavcodec/avcodec.h, [:], [ac_cv_my_have_ffmpeg=no]) | |||
AC_CHECK_HEADERS(libavformat/avformat.h, [:], [ac_cv_my_have_ffmpeg=no]) | |||
AC_CHECK_HEADERS(libswscale/swscale.h, [:], [ac_cv_my_have_ffmpeg=no]) | |||
if test "${ac_cv_my_have_ffmpeg}" = "yes"; then | |||
LIBAVFORMAT_LIBS="-lavformat" | |||
LIBAVCODEC_LIBS="-lavcodec -lavutil" | |||
LIBSWSCALE_LIBS="-lswscale -lswresample" | |||
AC_CHECK_LIB(ws2_32, main, LOL_LIBS="${LOL_LIBS} -lws2_32") | |||
fi | |||
fi | |||
if test "${ac_cv_my_have_ffmpeg}" != "no"; then | |||
AC_DEFINE(LOL_USE_FFMPEG, 1, Define to 1 to use FFmpeg) | |||
LOL_CFLAGS="${LOL_CFLAGS} ${LIBAVFORMAT_CFLAGS} ${LIBAVCODEC_CFLAGS} ${SWSCALE_CFLAGS}" | |||
LOL_LIBS="${LOL_LIBS} ${LIBAVFORMAT_LIBS} ${LIBAVCODEC_LIBS} ${LIBSWSCALE_LIBS}" | |||
fi | |||
AM_CONDITIONAL(LOL_USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" != "no") | |||
dnl Are we building using MinGW? | |||
LOL_TRY_CXXFLAGS(-mwindows -mwin32, | |||
[AM_CXXFLAGS="${AM_CXXFLAGS} -mwindows -mwin32" | |||
LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"]) | |||
dnl Are we building using Emscripten? | |||
ac_cv_my_have_emscripten="no" | |||
AC_CHECK_HEADERS(emscripten.h, | |||
[ac_cv_my_have_emscripten="yes" | |||
dnl XXX: activate this if memory heap is too small | |||
#AM_CXXFLAGS="${AM_CXXFLAGS} -s ALLOW_MEMORY_GROWTH=1" | |||
dnl HACK: until emcc properly adds these to EMSDK_OPTS | |||
CPPFLAGS="${CPPFLAGS} -U__i386__ -U__x86_64__ -U__i386 -U__x86_64 -Ui386 -Ux86_64" | |||
CPPFLAGS="${CPPFLAGS} -U__SSE__ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUNDING" | |||
CPPFLAGS="${CPPFLAGS} -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -U__STRICT_ANSI__" | |||
CPPFLAGS="${CPPFLAGS} -U__CYGWIN__"]) | |||
AM_CONDITIONAL(LOL_USE_EMSCRIPTEN, test "${ac_cv_my_have_emscripten}" != "no") | |||
dnl Are we on an OS X or iOS platform? | |||
LOL_TRY_LDFLAGS(-framework Foundation, | |||
[LOL_LIBS="${LOL_LIBS} -framework Foundation"]) | |||
LOL_TRY_LDFLAGS(-framework CoreGraphics, | |||
[LOL_LIBS="${LOL_LIBS} -framework CoreGraphics"]) | |||
LOL_TRY_LDFLAGS(-framework CoreData, | |||
[LOL_LIBS="${LOL_LIBS} -framework CoreData"]) | |||
LOL_TRY_LDFLAGS(-framework UIKit, | |||
[LOL_LIBS="${LOL_LIBS} -framework UIKit"]) | |||
dnl Other complex checks | |||
LOL_AC_CHECK_OPENGL() | |||
LOL_AC_CHECK_SDL() | |||
]) # LOL_AC_CHECK | |||
@@ -1,7 +1,19 @@ | |||
dnl | |||
dnl Lol Engine | |||
dnl | |||
dnl Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
dnl | |||
dnl Lol Engine is free software. It comes without any warranty, to | |||
dnl the extent permitted by applicable law. You can redistribute it | |||
dnl and/or modify it under the terms of the Do What the Fuck You Want | |||
dnl to Public License, Version 2, as published by the WTFPL Task Force. | |||
dnl See http://www.wtfpl.net/ for more details. | |||
dnl | |||
# LOL_CHECK_OPENGL() | |||
# LOL_AC_CHECK_OPENGL() | |||
# ------------------ | |||
AC_DEFUN([LOL_CHECK_OPENGL], | |||
AC_DEFUN([LOL_AC_CHECK_OPENGL], | |||
[ | |||
dnl Find which version of OpenGL to use | |||
ac_cv_my_have_gl="no" | |||
@@ -114,9 +126,9 @@ AC_CHECK_HEADER(GL/glew.h, | |||
LIBS="${LIBS_save}"]) | |||
if test "${ac_cv_my_have_glew}" != "no"; then | |||
AC_DEFINE(HAVE_GLES_2X, 1, Define to 1 if GLES 2.x is available) | |||
AC_DEFINE(USE_GLEW, 1, Define to 1 to use libglew) | |||
AC_DEFINE(LOL_USE_GLEW, 1, Define to 1 to use libglew) | |||
fi | |||
AM_CONDITIONAL(USE_GLEW, test "${ac_cv_my_have_glew}" != "no") | |||
AM_CONDITIONAL(LOL_USE_GLEW, test "${ac_cv_my_have_glew}" != "no") | |||
dnl Poor man's GL feature detection if all else failed. | |||
save_LIBS="${LIBS}" | |||
@@ -129,6 +141,6 @@ if test "${ac_cv_my_have_gl}" = "no"; then | |||
AC_MSG_WARN([[No OpenGL or OpenGL ES implementation found]]) | |||
fi | |||
])# LOL_CHECK_OPENGL | |||
]) # LOL_AC_CHECK_OPENGL | |||
@@ -1,23 +1,35 @@ | |||
dnl | |||
dnl Lol Engine | |||
dnl | |||
dnl Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
dnl | |||
dnl Lol Engine is free software. It comes without any warranty, to | |||
dnl the extent permitted by applicable law. You can redistribute it | |||
dnl and/or modify it under the terms of the Do What the Fuck You Want | |||
dnl to Public License, Version 2, as published by the WTFPL Task Force. | |||
dnl See http://www.wtfpl.net/ for more details. | |||
dnl | |||
# LOL_CHECK_SDL() | |||
# --------------- | |||
AC_DEFUN([LOL_CHECK_SDL], | |||
# LOL_AC_CHECK_SDL() | |||
# ------------------ | |||
AC_DEFUN([LOL_AC_CHECK_SDL], | |||
[ | |||
dnl Find which version of SDL to use (always required on Linux or Win32) | |||
dnl | |||
dnl Defined C/C++ macros: | |||
dnl USE_SDL -- whether SDL v2 was found | |||
dnl USE_OLD_SDL -- whether SDL v1 was found | |||
dnl USE_SDL_IMAGE -- whether SDL_image (v1 or v2) was found | |||
dnl USE_SDL_MIXER -- whether SDL_mixer (v1 or v2) was found | |||
dnl LOL_USE_SDL -- whether SDL v2 was found | |||
dnl LOL_USE_OLD_SDL -- whether SDL v1 was found | |||
dnl LOL_USE_SDL_IMAGE -- whether SDL_image (v1 or v2) was found | |||
dnl LOL_USE_SDL_MIXER -- whether SDL_mixer (v1 or v2) was found | |||
dnl HAVE_SDL_H -- whether to include <SDL.h> | |||
dnl HAVE_SDL_SDL_H -- whether to include <SDL/SDL.h> | |||
dnl HAVE_SDL2_SDL_H -- whether to include <SDL2/SDL.h> | |||
dnl Generated automake conditionals: | |||
dnl USE_SDL -- whether SDL v2 was found | |||
dnl USE_OLD_SDL -- whether SDL v1 was found | |||
dnl USE_SDL_IMAGE -- whether SDL_image was found | |||
dnl USE_SDL_MIXER -- whether SDL_mixer was found | |||
dnl LOL_USE_SDL -- whether SDL v2 was found | |||
dnl LOL_USE_OLD_SDL -- whether SDL v1 was found | |||
dnl LOL_USE_SDL_IMAGE -- whether SDL_image was found | |||
dnl LOL_USE_SDL_MIXER -- whether SDL_mixer was found | |||
dnl Generated shell variables: | |||
dnl SDL_CFLAGS -- flags for SDL compilation | |||
dnl SDL_LIBS -- flags for SDL linking | |||
@@ -155,29 +167,29 @@ dnl Convert all this into conditionals | |||
if test "x${ac_cv_my_have_sdl}" = xno; then | |||
AC_MSG_WARN([SDL v2 not found]) | |||
else | |||
AC_DEFINE(USE_SDL, 1, Define to 1 to use SDL) | |||
AC_DEFINE(LOL_USE_SDL, 1, Define to 1 to use SDL) | |||
fi | |||
AM_CONDITIONAL(USE_SDL, test "x${ac_cv_my_have_sdl}" = xyes) | |||
AM_CONDITIONAL(LOL_USE_SDL, test "x${ac_cv_my_have_sdl}" = xyes) | |||
if test "x${ac_cv_my_have_sdl_mixer}" = xno; then | |||
AC_MSG_WARN([SDL_mixer not found]) | |||
else | |||
AC_DEFINE(USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer) | |||
AC_DEFINE(LOL_USE_SDL_MIXER, 1, Define to 1 to use SDL_mixer) | |||
fi | |||
AM_CONDITIONAL(USE_SDL_MIXER, test "x${ac_cv_my_have_sdl_mixer}" = xyes) | |||
AM_CONDITIONAL(LOL_USE_SDL_MIXER, test "x${ac_cv_my_have_sdl_mixer}" = xyes) | |||
if test "x${ac_cv_my_have_sdl_image}" = xno; then | |||
AC_MSG_WARN([SDL_image not found]) | |||
else | |||
AC_DEFINE(USE_SDL_IMAGE, 1, Define to 1 to use SDL_image) | |||
AC_DEFINE(LOL_USE_SDL_IMAGE, 1, Define to 1 to use SDL_image) | |||
fi | |||
AM_CONDITIONAL(USE_SDL_IMAGE, test "x${ac_cv_my_have_sdl_image}" = xyes) | |||
AM_CONDITIONAL(LOL_USE_SDL_IMAGE, test "x${ac_cv_my_have_sdl_image}" = xyes) | |||
if test "x${ac_cv_my_have_old_sdl}" != xno; then | |||
AC_DEFINE(USE_OLD_SDL, 1, Define to 1 to use SDL) | |||
AC_DEFINE(LOL_USE_OLD_SDL, 1, Define to 1 to use SDL) | |||
fi | |||
AM_CONDITIONAL(USE_OLD_SDL, test "x${ac_cv_my_have_old_sdl}" = xyes) | |||
AM_CONDITIONAL(LOL_USE_OLD_SDL, test "x${ac_cv_my_have_old_sdl}" = xyes) | |||
])# LOL_CHECK_SDL | |||
]) # LOL_AC_CHECK_SDL | |||
@@ -27,8 +27,8 @@ | |||
<SdlLibs Condition="'$(Platform)'=='x64'">$(SdlDir)\lib\x86_64-msvc;$(SdlImageDir)\lib\x86_64-msvc;$(SdlMixerDir)\lib\x86_64-msvc</SdlLibs> | |||
<SdlDeps Condition="'$(Platform)'=='Win32'">SDL2.lib;SDL2main.lib;SDL2_image.lib;SDL2_mixer.lib</SdlDeps> | |||
<SdlDeps Condition="'$(Platform)'=='x64'">SDL2.lib;SDL2main.lib;SDL2_image.lib;SDL2_mixer.lib</SdlDeps> | |||
<Win32Defines>HAVE_SDL_H;USE_SDL;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>USE_SDL_MIXER;USE_SDL_IMAGE;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>HAVE_SDL_H;LOL_USE_SDL;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>LOL_USE_SDL_MIXER;LOL_USE_SDL_IMAGE;$(Win32Defines)</Win32Defines> | |||
<!-- GTK+ & GtkGl --> | |||
<GtkDir>$(ExternalDir)\gtk-2.22.1</GtkDir> | |||
@@ -44,7 +44,7 @@ | |||
<FfmpegLibs Condition="'$(Platform)'=='Win32'">$(FfmpegDir)\lib\i686-w64-mingw32</FfmpegLibs> | |||
<FfmpegLibs Condition="'$(Platform)'=='x64'">$(FfmpegDir)\lib\x86_64-w64-mingw32</FfmpegLibs> | |||
<FfmpegDeps>swscale.lib;avformat.lib;avcodec.lib;swresample.lib;avutil.lib;ws2_32.lib</FfmpegDeps> | |||
<Win32Defines>USE_FFMPEG;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>LOL_USE_FFMPEG;$(Win32Defines)</Win32Defines> | |||
--> | |||
<!-- Assimp --> | |||
@@ -55,7 +55,7 @@ | |||
<!-- <AssimpDeps>zlibstatic.lib;assimp.lib</AssimpDeps> --> | |||
<AssimpDeps Condition="'$(Configuration)'=='Release'">zlibstatic.lib;assimp.lib</AssimpDeps> | |||
<AssimpDeps Condition="'$(Configuration)'=='Debug'">zlibstatic.lib;assimp.lib</AssimpDeps> | |||
<Win32Defines>USE_ASSIMP;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>LOL_USE_ASSIMP;$(Win32Defines)</Win32Defines> | |||
<!-- libcaca --> | |||
<CacaDir>$(ExternalDir)\libcaca-0.99.beta18</CacaDir> | |||
@@ -67,7 +67,7 @@ | |||
<!-- GDI+ --> | |||
<GdiDeps>Gdiplus.lib</GdiDeps> | |||
<Win32Defines>USE_GDIPLUS;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>LOL_USE_GDIPLUS;$(Win32Defines)</Win32Defines> | |||
<!-- OpenGL & GLEW --> | |||
<GlewDir>$(ExternalDir)\glew-1.9.0</GlewDir> | |||
@@ -76,14 +76,14 @@ | |||
<GlLibs Condition="'$(Platform)'=='x64'">$(GlewDir)\lib\x86_64-w64-mingw32</GlLibs> | |||
<GlDeps Condition="'$(Platform)'=='Win32'">opengl32.lib;glew32s.lib</GlDeps> | |||
<GlDeps Condition="'$(Platform)'=='x64'">opengl32.lib;glew32s.lib</GlDeps> | |||
<Win32Defines>HAVE_GL_2X;USE_GLEW;GLEW_STATIC;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>HAVE_GL_2X;LOL_USE_GLEW;GLEW_STATIC;$(Win32Defines)</Win32Defines> | |||
<!-- Xinput --> | |||
<XinputIncludes>$(DXSDK_DIR)\Include</XinputIncludes> | |||
<XinputLibs Condition="'$(Platform)'=='Win32'">$(DXSDK_DIR)\Lib\x86</XinputLibs> | |||
<XinputLibs Condition="'$(Platform)'=='x64'">$(DXSDK_DIR)\Lib\x64</XinputLibs> | |||
<XinputDeps>xinput.lib</XinputDeps> | |||
<Win32Defines>USE_XINPUT;$(Win32Defines)</Win32Defines> | |||
<Win32Defines>LOL_USE_XINPUT;$(Win32Defines)</Win32Defines> | |||
<!-- Windows-specific --> | |||
<Win32Defines>HAVE_STDIO_H;$(Win32Defines)</Win32Defines> | |||
@@ -1,4 +1,14 @@ | |||
dnl configure script for Lol Engine | |||
dnl | |||
dnl Lol Engine | |||
dnl | |||
dnl Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
dnl | |||
dnl Lol Engine is free software. It comes without any warranty, to | |||
dnl the extent permitted by applicable law. You can redistribute it | |||
dnl and/or modify it under the terms of the Do What the Fuck You Want | |||
dnl to Public License, Version 2, as published by the WTFPL Task Force. | |||
dnl See http://www.wtfpl.net/ for more details. | |||
dnl | |||
AC_INIT(lolengine, 0.0) | |||
AC_PREREQ(2.50) | |||
@@ -14,6 +24,9 @@ AC_SUBST(LOLUNIT_VERSION) | |||
LOLREMEZ_VERSION=0.2 | |||
AC_SUBST(LOLREMEZ_VERSION) | |||
AC_SUBST(lol_srcdir, '${top_srcdir}') | |||
AC_SUBST(lol_builddir, '${top_builddir}') | |||
AC_CONFIG_HEADER(config.h) | |||
AM_PROG_CC_C_O | |||
@@ -22,15 +35,6 @@ AC_PROG_CXX | |||
AC_PROG_CXXCPP | |||
AC_PROG_RANLIB | |||
dnl Check that the C++ compiler really works | |||
AC_LANG_PUSH(C++) | |||
AC_MSG_CHECKING(for a fully working C++ compiler) | |||
AC_TRY_LINK([], [], | |||
[AC_MSG_RESULT(yes)], | |||
[AC_MSG_RESULT(no) | |||
AC_MSG_ERROR([[C++ compiler cannot link executables]])]) | |||
AC_LANG_POP(C++) | |||
dnl C++11 and later mode. Checked early so that we don't run into surprises. | |||
version_flag='' | |||
LOL_TRY_CXXFLAGS(-std=c++0x, [version_flag='-std=c++0x']) | |||
@@ -61,7 +65,7 @@ m4_pattern_forbid([^PKG_CHECK_MODULES$]) | |||
m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$]) | |||
dnl Same for Lol Engine M4 files. | |||
m4_pattern_forbid([^LOL_]) | |||
m4_pattern_forbid([^LOL_AC_]) | |||
dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling. | |||
@@ -178,17 +182,19 @@ if test "${enable_doc}" != "no"; then | |||
fi | |||
AC_PATH_PROG(DOT, dot, no) | |||
if test "${DOT}" != "no"; then | |||
USE_DOT="YES" | |||
LOL_USE_DOT="YES" | |||
else | |||
USE_DOT="NO" | |||
LOL_USE_DOT="NO" | |||
fi | |||
fi | |||
fi | |||
dnl XXX: disable LaTeX because we use too much memory | |||
LATEX=no | |||
AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "no") | |||
AM_CONDITIONAL(USE_LATEX, test "${LATEX}" != "no") | |||
AM_CONDITIONAL(USE_DOT, test "${DOT}" != "no") | |||
AM_CONDITIONAL(LOL_USE_LATEX, test "${LATEX}" != "no") | |||
AM_CONDITIONAL(LOL_USE_DOT, test "${DOT}" != "no") | |||
AC_SUBST(LOL_USE_DOT) | |||
dnl Debug symbols | |||
@@ -238,177 +244,16 @@ AC_TRY_LINK( | |||
AC_LANG_POP(C++) | |||
dnl Are we building using MinGW? | |||
LOL_TRY_CXXFLAGS(-mwindows -mwin32, | |||
[AM_CXXFLAGS="${AM_CXXFLAGS} -mwindows -mwin32" | |||
LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"]) | |||
dnl Are we building using Emscripten? | |||
ac_cv_my_have_emscripten="no" | |||
AC_CHECK_HEADERS(emscripten.h, | |||
[ac_cv_my_have_emscripten="yes" | |||
dnl XXX: activate this if memory heap is too small | |||
#AM_CXXFLAGS="${AM_CXXFLAGS} -s ALLOW_MEMORY_GROWTH=1" | |||
dnl HACK: until emcc properly adds these to EMSDK_OPTS | |||
CPPFLAGS="${CPPFLAGS} -U__i386__ -U__x86_64__ -U__i386 -U__x86_64 -Ui386 -Ux86_64" | |||
CPPFLAGS="${CPPFLAGS} -U__SSE__ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUNDING" | |||
CPPFLAGS="${CPPFLAGS} -UHAVE_GCC_ASM_FOR_X87 -DEMSCRIPTEN -U__STRICT_ANSI__" | |||
CPPFLAGS="${CPPFLAGS} -U__CYGWIN__"]) | |||
AM_CONDITIONAL(USE_EMSCRIPTEN, test "${ac_cv_my_have_emscripten}" != "no") | |||
dnl Are we on the Xbox 360? | |||
dnl Answer: NO! we don't know how to build for it anyway | |||
AM_CONDITIONAL(USE_X360, false) | |||
dnl Are we on an OS X or iOS platform? | |||
LOL_TRY_LDFLAGS(-framework Foundation, | |||
[LOL_LIBS="${LOL_LIBS} -framework Foundation"]) | |||
LOL_TRY_LDFLAGS(-framework CoreGraphics, | |||
[LOL_LIBS="${LOL_LIBS} -framework CoreGraphics"]) | |||
LOL_TRY_LDFLAGS(-framework CoreData, | |||
[LOL_LIBS="${LOL_LIBS} -framework CoreData"]) | |||
LOL_TRY_LDFLAGS(-framework UIKit, | |||
[LOL_LIBS="${LOL_LIBS} -framework UIKit"]) | |||
LOL_CHECK_OPENGL | |||
LOL_CHECK_SDL | |||
dnl Use mingw threads if necessary | |||
if true; then | |||
LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/mingw-std-threads-0.0.ac5c9e3b/include/" | |||
fi | |||
dnl Use pegtl? Yes, always | |||
if true; then | |||
LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/pegtl-1.3.1-e7752e81/include" | |||
fi | |||
dnl Use Imgui? Yes, always | |||
if true; then | |||
LOL_CFLAGS="$LOL_CFLAGS -I\$(top_srcdir)/external/imgui" | |||
fi | |||
dnl Use NativeClient? | |||
ac_cv_my_have_nacl="no" | |||
AC_LANG_PUSH(C++) | |||
AC_CHECK_HEADERS(ppapi/cpp/instance.h, | |||
[ac_cv_my_have_nacl="yes" | |||
LOL_LIBS="${LOL_LIBS} -lnosys" | |||
if test "${ac_cv_my_build_mode}" = "xrelease"; then | |||
LOL_TRY_CXXFLAGS(-s, [AM_CXXFLAGS="${AM_CXXFLAGS} -s"]) | |||
fi]) | |||
AC_LANG_POP(C++) | |||
AM_CONDITIONAL(USE_NACL, test "${ac_cv_my_have_nacl}" != "no") | |||
dnl Use Android? FIXME: super hacks! | |||
ac_cv_my_have_android="no" | |||
AC_CHECK_LIB(log, __android_log_vprint, | |||
[ac_cv_my_have_android="yes" | |||
LOL_LIBS="${LOL_LIBS} -llog -landroid -module -lEGL -lGLESv2"]) | |||
AM_CONDITIONAL(USE_ANDROID, test "${ac_cv_my_have_android}" != "no") | |||
dnl Use EGL? | |||
ac_cv_my_have_egl="no" | |||
PKG_CHECK_MODULES(EGL, egl, [ac_cv_my_have_egl="yes"], [:]) | |||
if test "${ac_cv_my_have_egl}" != "no"; then | |||
AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl) | |||
EGL_LIBS="${EGL_LIBS} -lX11" | |||
fi | |||
AC_CHECK_LIB(EGL, main, | |||
[ac_cv_my_have_egl="yes" | |||
AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl) | |||
EGL_LIBS="-lEGL"]) | |||
dnl Raspberry Pi is different, check for it with extra libs; also we | |||
dnl look for a different function to bypass autoconf caching | |||
AC_CHECK_LIB(EGL, eglGetDisplay, | |||
[ac_cv_my_have_egl="yes" | |||
AC_DEFINE(USE_EGL, 1, Define to 1 to use libegl) | |||
EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"], | |||
[:], | |||
[-lvcos -lvchiq_arm -lbcm_host -lGLESv2]) | |||
AM_CONDITIONAL(USE_EGL, test "${ac_cv_my_have_egl}" != "no") | |||
dnl Use libpng? (replacement for SDL_image) | |||
ac_cv_my_have_libpng="no" | |||
PKG_CHECK_MODULES(LIBPNG, libpng, [ac_cv_my_have_libpng="yes"], [:]) | |||
if test "${ac_cv_my_have_libpng}" != "no"; then | |||
AC_DEFINE(USE_LIBPNG, 1, Define to 1 to use libpng) | |||
fi | |||
AM_CONDITIONAL(USE_LIBPNG, test "${ac_cv_my_have_libpng}" != "no") | |||
LOL_AC_CHECK() | |||
dnl Use Windows GDI+? | |||
ac_cv_my_have_gdiplus="no" | |||
AC_LANG_PUSH(C++) | |||
AC_CHECK_HEADERS(gdiplus.h, | |||
[ac_cv_my_have_gdiplus="yes" | |||
LOL_LIBS="${LOL_LIBS} -lgdiplus"], | |||
[ac_cv_my_have_gdiplus="no"], | |||
[#include <algorithm> | |||
using std::min; | |||
using std::max; | |||
#include <windows.h>]) | |||
AC_LANG_POP(C++) | |||
if test "${ac_cv_my_have_gdiplus}" != "no"; then | |||
AC_DEFINE(USE_GDIPLUS, 1, Define to 1 to use GDI+) | |||
fi | |||
AM_CONDITIONAL(USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes") | |||
dnl Use libcaca? (required for font generation) | |||
dnl Use libcaca? (required for font generation) | |||
ac_cv_my_have_caca="no" | |||
PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:]) | |||
if test "${ac_cv_my_have_caca}" != "no"; then | |||
AC_DEFINE(USE_CACA, 1, Define to 1 to use libcaca) | |||
AC_DEFINE(LOL_USE_CACA, 1, Define to 1 to use libcaca) | |||
fi | |||
AM_CONDITIONAL(USE_CACA, test "${ac_cv_my_have_caca}" != "no") | |||
# Use Imlib2? | |||
ac_cv_my_have_imlib2="no" | |||
PKG_CHECK_MODULES(IMLIB2, imlib2, [ac_cv_my_have_imlib2="yes"], [:]) | |||
if test "${ac_cv_my_have_imlib2}" != "no"; then | |||
AC_DEFINE(USE_IMLIB2, 1, Define to 1 to use Imlib2) | |||
LOL_CFLAGS="${LOL_CFLAGS} ${IMLIB2_CFLAGS}" | |||
LOL_LIBS="${LOL_LIBS} ${IMLIB2_LIBS}" | |||
fi | |||
AM_CONDITIONAL(USE_IMLIB2, test "${ac_cv_my_have_imlib2}" = "yes") | |||
# Use libavcodec? (required for movie encoding) | |||
ac_cv_my_have_ffmpeg="yes" | |||
PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no]) | |||
PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no]) | |||
PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no]) | |||
if test "${ac_cv_my_have_ffmpeg}" = "no"; then | |||
ac_cv_my_have_ffmpeg="yes" | |||
AC_CHECK_HEADERS(libavcodec/avcodec.h, [:], [ac_cv_my_have_ffmpeg=no]) | |||
AC_CHECK_HEADERS(libavformat/avformat.h, [:], [ac_cv_my_have_ffmpeg=no]) | |||
AC_CHECK_HEADERS(libswscale/swscale.h, [:], [ac_cv_my_have_ffmpeg=no]) | |||
if test "${ac_cv_my_have_ffmpeg}" = "yes"; then | |||
LIBAVFORMAT_LIBS="-lavformat" | |||
LIBAVCODEC_LIBS="-lavcodec -lavutil" | |||
LIBSWSCALE_LIBS="-lswscale -lswresample" | |||
AC_CHECK_LIB(ws2_32, main, LOL_LIBS="${LOL_LIBS} -lws2_32") | |||
fi | |||
fi | |||
if test "${ac_cv_my_have_ffmpeg}" != "no"; then | |||
AC_DEFINE(USE_FFMPEG, 1, Define to 1 to use FFmpeg) | |||
LOL_CFLAGS="${LOL_CFLAGS} ${LIBAVFORMAT_CFLAGS} ${LIBAVCODEC_CFLAGS} ${SWSCALE_CFLAGS}" | |||
LOL_LIBS="${LOL_LIBS} ${LIBAVFORMAT_LIBS} ${LIBAVCODEC_LIBS} ${LIBSWSCALE_LIBS}" | |||
fi | |||
AM_CONDITIONAL(USE_FFMPEG, test "${ac_cv_my_have_ffmpeg}" != "no") | |||
AM_CONDITIONAL(LOL_USE_CACA, test "${ac_cv_my_have_caca}" != "no") | |||
dnl Use GTK+? (required for the deushax editor) | |||
@@ -416,9 +261,9 @@ ac_cv_my_have_gtkgl="no" | |||
PKG_CHECK_MODULES(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:]) | |||
PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"]) | |||
if test "${ac_cv_my_have_gtkgl}" != "no"; then | |||
AC_DEFINE(USE_GTKGL, 1, Define to 1 to use GtkGl) | |||
AC_DEFINE(LOL_USE_GTKGL, 1, Define to 1 to use GtkGl) | |||
fi | |||
AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no") | |||
AM_CONDITIONAL(LOL_USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no") | |||
dnl Can we build neercs? | |||
@@ -428,37 +273,12 @@ AM_CONDITIONAL(BUILD_NEERCS, test "${ac_cv_my_have_caca}" != "no") | |||
dnl Should we ship non-free data? | |||
AM_CONDITIONAL(HAVE_NONFREE, true) | |||
dnl Extra libraries we may need | |||
AC_SUBST(MATH_LIBS) | |||
AC_SUBST(PAM_LIBS) | |||
AC_SUBST(UTIL_LIBS) | |||
dnl How to use the Lol Engine outside this tree | |||
LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS" | |||
LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS" | |||
LOL_DEPS="${LOL_DEPS} \$(top_builddir)/src/liblol-core.a" | |||
LOL_DEPS="${LOL_DEPS} \$(top_builddir)/src/bullet/liblol-bullet.a" | |||
LOL_DEPS="${LOL_DEPS} \$(top_builddir)/src/lua/liblol-lua.a" | |||
dnl How to use the Lol Engine inside this tree | |||
AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/src" | |||
AM_CPPFLAGS="${AM_CPPFLAGS} -DLOL_CONFIG_SOURCESUBDIR=\\\"\$(subdir)\\\"" | |||
AM_CPPFLAGS="${AM_CPPFLAGS} ${LOL_CFLAGS}" | |||
AM_LDFLAGS="${AM_LDFLAGS} ${LOL_DEPS}" | |||
AM_LDFLAGS="${AM_LDFLAGS} ${LOL_LIBS}" | |||
dnl Extra flags | |||
AC_SUBST(LOL_CFLAGS) | |||
AC_SUBST(LOL_LIBS) | |||
AC_SUBST(LOL_DEPS) | |||
AC_SUBST(AM_CFLAGS) | |||
AC_SUBST(AM_CPPFLAGS) | |||
AC_SUBST(AM_CXXFLAGS) | |||
AC_SUBST(AM_LDFLAGS) | |||
AC_SUBST(USE_DOT) | |||
LOL_AC_SUBST() | |||
AC_CONFIG_FILES( | |||
[Makefile | |||
@@ -14,7 +14,7 @@ man_MANS = lolengine.1 | |||
if BUILD_DOCUMENTATION | |||
htmldoc_DATA = html/doxygen.css | |||
htmldocdir = $(datadir)/doc/lolengine-dev/html | |||
if USE_LATEX | |||
if LOL_USE_LATEX | |||
pdfdoc_DATA = latex/lolengine.pdf | |||
pdfdocdir = $(datadir)/doc/lolengine-dev/pdf | |||
endif | |||
@@ -31,7 +31,7 @@ endif | |||
stamp-latex: stamp-doxygen | |||
if BUILD_DOCUMENTATION | |||
if USE_LATEX | |||
if LOL_USE_LATEX | |||
rm -f latex/lolengine.tex latex/lolengine.pdf | |||
$(SED) -i -e 's/setlength{/renewcommand{/' latex/refman.tex | |||
$(SED) -i -e 's/.*usepackage.*times.*//' latex/refman.tex | |||
@@ -27,7 +27,7 @@ btphystest_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/bullet \ | |||
-DHAVE_PHYS_USE_BULLET | |||
btphystest_DEPENDENCIES = @LOL_DEPS@ | |||
btphystest_LDFLAGS = $(AM_LDFLAGS) | |||
if USE_EMSCRIPTEN | |||
if LOL_USE_EMSCRIPTEN | |||
btphystest_LDFLAGS += \ | |||
--preload-file data/CatsSheet.png \ | |||
-s TOTAL_MEMORY=$(shell expr 32 '*' 1024 '*' 1024) | |||
@@ -9,7 +9,7 @@ meshviewer_SOURCES = meshviewer.cpp meshviewer.h \ | |||
meshviewer_CPPFLAGS = $(AM_CPPFLAGS) | |||
meshviewer_DEPENDENCIES = @LOL_DEPS@ | |||
meshviewer_LDFLAGS = $(AM_LDFLAGS) | |||
if USE_EMSCRIPTEN | |||
if LOL_USE_EMSCRIPTEN | |||
meshviewer_LDFLAGS += -s EXPORTED_FUNCTIONS="['_main', '_C_Send']" | |||
endif | |||
@@ -29,7 +29,7 @@ noinst_PROGRAMS = 01_triangle 02_cube 03_noise 04_texture 05_easymesh \ | |||
06_sprite_CPPFLAGS = $(AM_CPPFLAGS) | |||
06_sprite_DEPENDENCIES = @LOL_DEPS@ | |||
06_sprite_LDFLAGS = $(AM_LDFLAGS) | |||
if USE_EMSCRIPTEN | |||
if LOL_USE_EMSCRIPTEN | |||
06_sprite_LDFLAGS += --preload-file 06_sprite.png | |||
endif | |||
@@ -20,7 +20,6 @@ liblol_core_a_SOURCES = \ | |||
$(liblol_core_headers) \ | |||
$(liblol_core_sources) \ | |||
\ | |||
$(xbox_sources) \ | |||
$(nacl_sources) \ | |||
$(sdl_sources) \ | |||
$(d3d9_sources) \ | |||
@@ -140,7 +139,7 @@ sdl_sources = \ | |||
d3d9_sources = \ | |||
platform/d3d9/d3d9input.cpp platform/d3d9/d3d9input.h | |||
if USE_NACL | |||
if LOL_USE_NACL | |||
nacl_sources = \ | |||
platform/nacl/nacl-app.cpp platform/nacl/nacl-app.h \ | |||
platform/nacl/nacl-instance.cpp platform/nacl/nacl-instance.h \ | |||
@@ -149,12 +148,6 @@ nacl_sources = \ | |||
platform/nacl/opengl_context_ptrs.h | |||
endif | |||
if USE_X360 | |||
xbox_sources = \ | |||
platform/xbox/xboxapp.cpp platform/xbox/xboxapp.h \ | |||
platform/xbox/xboxinput.cpp platform/xbox/xboxinput.h | |||
endif | |||
android_sources = \ | |||
image/codec/android-image.cpp \ | |||
platform/android/androidapp.cpp platform/android/androidapp.h | |||
@@ -1,11 +1,13 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#include <lol/engine-internal.h> | |||
@@ -20,7 +22,7 @@ | |||
# include "platform/nacl/nacl-app.h" | |||
#elif __ANDROID__ | |||
# include "platform/android/androidapp.h" | |||
#elif USE_SDL || USE_OLD_SDL | |||
#elif LOL_USE_SDL || LOL_USE_OLD_SDL | |||
# include "platform/sdl/sdlapp.h" | |||
# include "platform/sdl/sdlinput.h" | |||
#elif HAVE_GLES_2X | |||
@@ -61,7 +63,7 @@ protected: | |||
//NOT HANDLED YET | |||
#elif __ANDROID__ | |||
//NOT HANDLED YET | |||
#elif USE_SDL || USE_OLD_SDL | |||
#elif LOL_USE_SDL || LOL_USE_OLD_SDL | |||
SdlAppDisplay display; | |||
#elif HAVE_GLES_2X | |||
/* FIXME: this macro is only deactivated if we include "lolgl.h" */ | |||
@@ -121,7 +123,7 @@ class ApplicationData | |||
NaClApp app; | |||
#elif __ANDROID__ | |||
AndroidApp app; | |||
#elif USE_SDL || USE_OLD_SDL | |||
#elif LOL_USE_SDL || LOL_USE_OLD_SDL | |||
SdlApp app; | |||
#elif HAVE_GLES_2X | |||
/* FIXME: this macro is only deactivated if we include "lolgl.h" */ | |||
@@ -1,16 +1,18 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#include <lol/engine-internal.h> | |||
#if USE_SDL_MIXER | |||
#if LOL_USE_SDL_MIXER | |||
# if HAVE_SDL_SDL_H | |||
# include <SDL/SDL.h> | |||
# include <SDL/SDL_mixer.h> | |||
@@ -32,7 +34,7 @@ namespace lol | |||
void Audio::Setup(int channels) | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
Mix_OpenAudio(22050, AUDIO_S16, channels, 1024); | |||
#else | |||
UNUSED(channels); | |||
@@ -41,7 +43,7 @@ void Audio::Setup(int channels) | |||
void Audio::SetVolume(int channel, int volume) | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
Mix_Volume(channel,volume); | |||
#else | |||
UNUSED(channel); | |||
@@ -50,7 +52,7 @@ void Audio::SetVolume(int channel, int volume) | |||
void Audio::MuteAll() | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
Mix_Volume(-1,0); | |||
#else | |||
UNUSED(false); | |||
@@ -59,7 +61,7 @@ void Audio::MuteAll() | |||
void Audio::UnmuteAll() | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
Mix_Volume(-1,MIX_MAX_VOLUME); | |||
#else | |||
UNUSED(false); | |||
@@ -3,7 +3,7 @@ include $(top_srcdir)/build/autotools/common.am | |||
EXTRA_DIST += ascii.png | |||
if USE_CACA | |||
if LOL_USE_CACA | |||
all: ascii.png | |||
ascii.png: | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -12,7 +12,7 @@ | |||
#include <lol/engine-internal.h> | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
#if defined LOL_USE_EGL && !defined __ANDROID__ | |||
# if defined HAVE_BCM_HOST_H | |||
# include <bcm_host.h> | |||
# else | |||
@@ -24,7 +24,7 @@ | |||
# include <EGL/eglext.h> | |||
#endif | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
# if HAVE_SDL2_SDL_H | |||
# include <SDL2/SDL.h> | |||
# elif HAVE_SDL_SDL_H | |||
@@ -36,7 +36,7 @@ | |||
#include "lolgl.h" | |||
#include "eglapp.h" | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
# include "platform/sdl/sdlinput.h" | |||
#endif | |||
@@ -52,7 +52,7 @@ class EglAppData | |||
friend class EglApp; | |||
private: | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
#if defined LOL_USE_EGL && !defined __ANDROID__ | |||
EGLDisplay egl_dpy; | |||
EGLContext egl_ctx; | |||
EGLSurface egl_surf; | |||
@@ -73,7 +73,7 @@ private: | |||
EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
data(new EglAppData()) | |||
{ | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
#if defined LOL_USE_EGL && !defined __ANDROID__ | |||
# if defined HAVE_BCM_HOST_H | |||
bcm_host_init(); | |||
@@ -251,7 +251,7 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) : | |||
data->screen_size = uvec2(gwa.width, gwa.height); | |||
# endif | |||
# if USE_SDL || USE_OLD_SDL | |||
# if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
new SdlInput(res.x, res.y, data->screen_size.x, data->screen_size.y); | |||
# endif | |||
@@ -272,14 +272,14 @@ void EglApp::Tick() | |||
{ | |||
/* Tick the renderer, show the frame and clamp to desired framerate. */ | |||
Ticker::TickDraw(); | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
#if defined LOL_USE_EGL && !defined __ANDROID__ | |||
eglSwapBuffers(data->egl_dpy, data->egl_surf); | |||
#endif | |||
} | |||
EglApp::~EglApp() | |||
{ | |||
#if defined USE_EGL && !defined __ANDROID__ | |||
#if defined LOL_USE_EGL && !defined __ANDROID__ | |||
eglDestroyContext(data->egl_dpy, data->egl_ctx); | |||
eglDestroySurface(data->egl_dpy, data->egl_surf); | |||
eglTerminate(data->egl_dpy); | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -63,7 +63,7 @@ private: | |||
Renderer::Renderer(ivec2 size) | |||
: m_data(new RendererData()) | |||
{ | |||
#if defined USE_GLEW && !defined __APPLE__ | |||
#if defined LOL_USE_GLEW && !defined __APPLE__ | |||
/* Initialise GLEW if necessary */ | |||
GLenum glerr = glewInit(); | |||
if (glerr != GLEW_OK) | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -260,7 +260,7 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attribs[]) | |||
|| tlut[type_index].type == GL_DOUBLE | |||
|| tlut[type_index].type == GL_BYTE | |||
|| tlut[type_index].type == GL_UNSIGNED_BYTE | |||
#if defined USE_GLEW && !defined __APPLE__ | |||
#if defined LOL_USE_GLEW && !defined __APPLE__ | |||
/* If this is not available, don't use it */ | |||
|| !glVertexAttribIPointer | |||
#endif | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -13,7 +13,7 @@ | |||
#if HAVE_CONFIG_H | |||
# include "config.h" | |||
#endif | |||
#if USE_GDIPLUS | |||
#if LOL_USE_GDIPLUS | |||
# include <algorithm> | |||
using std::min; | |||
using std::max; | |||
@@ -24,7 +24,7 @@ using std::max; | |||
#include <lol/engine-internal.h> | |||
#if USE_GDIPLUS | |||
#if LOL_USE_GDIPLUS | |||
#include "../../image/image-private.h" | |||
@@ -221,5 +221,5 @@ bool GdiPlusImageCodec::Save(Image *image, char const *path) | |||
} /* namespace lol */ | |||
#endif /* defined USE_GDIPLUS */ | |||
#endif /* defined LOL_USE_GDIPLUS */ | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -12,7 +12,7 @@ | |||
#include <lol/engine-internal.h> | |||
#if defined USE_IMLIB2 | |||
#if defined LOL_USE_IMLIB2 | |||
#include <Imlib2.h> | |||
@@ -121,5 +121,5 @@ bool Imlib2ImageCodec::Save(Image *image, char const *path) | |||
} /* namespace lol */ | |||
#endif /* defined USE_IMLIB2 */ | |||
#endif /* defined LOL_USE_IMLIB2 */ | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -12,7 +12,7 @@ | |||
#include <lol/engine-internal.h> | |||
#if USE_SDL_IMAGE | |||
#if LOL_USE_SDL_IMAGE | |||
#if HAVE_SDL_SDL_H | |||
# include <SDL/SDL.h> | |||
@@ -121,5 +121,5 @@ SDL_Surface *SdlImageCodec::Create32BppSurface(ivec2 size) | |||
} /* namespace lol */ | |||
#endif /* USE_SDL_IMAGE */ | |||
#endif /* LOL_USE_SDL_IMAGE */ | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -34,16 +34,16 @@ static bool RegisterAllCodecs(array<ImageCodec *> &codeclist) | |||
#if defined __ANDROID__ | |||
REGISTER_IMAGE_CODEC(AndroidImageCodec) | |||
#endif | |||
#if defined USE_GDIPLUS | |||
#if defined LOL_USE_GDIPLUS | |||
REGISTER_IMAGE_CODEC(GdiPlusImageCodec) | |||
#endif | |||
#if defined __APPLE__ && defined __MACH__ && defined __arm__ | |||
REGISTER_IMAGE_CODEC(IosImageCodec) | |||
#endif | |||
#if defined USE_SDL_IMAGE | |||
#if defined LOL_USE_SDL_IMAGE | |||
REGISTER_IMAGE_CODEC(SdlImageCodec) | |||
#endif | |||
#if defined USE_IMLIB2 | |||
#if defined LOL_USE_IMLIB2 | |||
REGISTER_IMAGE_CODEC(Imlib2ImageCodec) | |||
#endif | |||
REGISTER_IMAGE_CODEC(DummyImageCodec) | |||
@@ -1,16 +1,18 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#include <lol/engine-internal.h> | |||
#if USE_FFMPEG | |||
#if LOL_USE_FFMPEG | |||
extern "C" | |||
{ | |||
# include <libavformat/avformat.h> | |||
@@ -20,13 +22,13 @@ extern "C" | |||
namespace lol | |||
{ | |||
#if USE_FFMPEG | |||
#if LOL_USE_FFMPEG | |||
static bool g_ready = false; | |||
#endif | |||
class MovieData | |||
{ | |||
#if USE_FFMPEG | |||
#if LOL_USE_FFMPEG | |||
#endif | |||
@@ -40,7 +42,7 @@ class MovieData | |||
Movie::Movie(String const &name, ivec2 size, float fps) | |||
: m_data(new MovieData()) | |||
{ | |||
#if USE_FFMPEG | |||
#if LOL_USE_FFMPEG | |||
if (!g_ready) | |||
{ | |||
g_ready = true; | |||
@@ -51,7 +53,7 @@ Movie::Movie(String const &name, ivec2 size, float fps) | |||
Movie::~Movie() | |||
{ | |||
#if USE_FFMPEG | |||
#if LOL_USE_FFMPEG | |||
#endif | |||
@@ -60,7 +62,7 @@ Movie::~Movie() | |||
void Movie::Feed(Image const &image) | |||
{ | |||
#if USE_FFMPEG | |||
#if LOL_USE_FFMPEG | |||
#endif | |||
} | |||
@@ -1,11 +1,13 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#pragma once | |||
@@ -28,7 +30,7 @@ | |||
#endif | |||
/* If using SDL on Windows or OS X, let it override main() */ | |||
#if (USE_SDL || USE_OLD_SDL) && (_WIN32 || __APPLE__) | |||
#if (LOL_USE_SDL || LOL_USE_OLD_SDL) && (_WIN32 || __APPLE__) | |||
# include <SDL_main.h> | |||
#endif | |||
@@ -1,11 +1,13 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#pragma once | |||
@@ -23,7 +25,7 @@ | |||
#endif | |||
/* If using SDL on Windows or OS X, let it override main() */ | |||
#if (USE_SDL || USE_OLD_SDL) && (_WIN32 || __APPLE__) | |||
#if (LOL_USE_SDL || LOL_USE_OLD_SDL) && (_WIN32 || __APPLE__) | |||
# include <SDL_main.h> | |||
#endif | |||
@@ -1,11 +1,13 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#pragma once | |||
@@ -30,7 +32,7 @@ | |||
/* Include GL development headers. | |||
* Do not include glew.h on OS X, because the version shipped with Fink | |||
* links with X11 whereas we want the system’s Cocoa-friendly GL libs. */ | |||
#if defined USE_GLEW && !defined __APPLE__ | |||
#if defined LOL_USE_GLEW && !defined __APPLE__ | |||
# include <GL/glew.h> | |||
#elif defined HAVE_GL_2X | |||
# if defined __APPLE__ && defined __MACH__ && defined __arm__ | |||
@@ -1,11 +1,13 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#pragma once | |||
@@ -19,7 +21,7 @@ | |||
#include <lol/gpu/indexbuffer.h> | |||
//Assimp supports http://assimp.sourceforge.net/main_features_formats.html | |||
#if USE_ASSIMP | |||
#if LOL_USE_ASSIMP | |||
//Cause build has a problem with function choice. | |||
#if _WIN32 || _WIN64 | |||
#define sin lol::sin | |||
@@ -35,8 +37,8 @@ | |||
#undef asin | |||
#undef cos | |||
#undef acos | |||
#endif //_WIN32 || _WIN64 | |||
#endif //USE_ASSIMP | |||
#endif // _WIN32 || _WIN64 | |||
#endif // LOL_USE_ASSIMP | |||
namespace lol | |||
{ | |||
@@ -1,17 +1,19 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#if HAVE_CONFIG_H | |||
# include "config.h" | |||
#endif | |||
#if defined USE_XINPUT | |||
#if defined LOL_USE_XINPUT | |||
# include <d3d9.h> | |||
# include <xinput.h> | |||
#endif | |||
@@ -34,9 +36,9 @@ class D3d9InputData | |||
friend class D3d9Input; | |||
private: | |||
#if defined USE_XINPUT | |||
#if defined LOL_USE_XINPUT | |||
array<int, InputDeviceInternal*> m_joysticks; | |||
#endif // USE_XINPUT | |||
#endif // LOL_USE_XINPUT | |||
}; | |||
/* | |||
@@ -46,7 +48,7 @@ private: | |||
D3d9Input::D3d9Input() | |||
: m_data(new D3d9InputData()) | |||
{ | |||
#if defined USE_XINPUT | |||
#if defined LOL_USE_XINPUT | |||
for (int i = 0; i < XUSER_MAX_COUNT; i++) | |||
{ | |||
XINPUT_STATE state; | |||
@@ -86,7 +88,7 @@ D3d9Input::D3d9Input() | |||
D3d9Input::~D3d9Input() | |||
{ | |||
#if defined USE_XINPUT | |||
#if defined LOL_USE_XINPUT | |||
/* Unregister all the joysticks we added */ | |||
while (m_data->m_joysticks.count()) | |||
{ | |||
@@ -101,7 +103,7 @@ void D3d9Input::TickGame(float seconds) | |||
{ | |||
Entity::TickGame(seconds); | |||
#if defined USE_XINPUT | |||
#if defined LOL_USE_XINPUT | |||
for (int i = 0; i < m_data->m_joysticks.count(); i++) | |||
{ | |||
XINPUT_STATE state; | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -12,7 +12,7 @@ | |||
#include <lol/engine-internal.h> | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
# if HAVE_SDL2_SDL_H | |||
# include <SDL2/SDL.h> | |||
# elif HAVE_SDL_SDL_H | |||
@@ -25,7 +25,7 @@ | |||
#include "lolgl.h" | |||
#include "platform/sdl/sdlapp.h" | |||
#include "platform/sdl/sdlinput.h" | |||
#if USE_XINPUT | |||
#if LOL_USE_XINPUT | |||
# include "platform/d3d9/d3d9input.h" | |||
#endif | |||
@@ -40,10 +40,10 @@ class SdlAppDisplayData | |||
friend class SdlAppDisplay; | |||
private: | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
SDL_Window *m_window; | |||
SDL_GLContext m_glcontext; | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
SDL_Surface *m_window; | |||
#endif | |||
}; | |||
@@ -54,7 +54,7 @@ private: | |||
SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res) | |||
: data(new SdlAppDisplayData()) | |||
{ | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
ivec2 window_size = res; | |||
ivec2 screen_size = res; | |||
@@ -68,7 +68,7 @@ SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res) | |||
} | |||
} | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
/* This seems to fix the swap context bug. | |||
* However, perfs warning have been may occur. */ | |||
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); | |||
@@ -117,13 +117,13 @@ SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res) | |||
SdlAppDisplay::~SdlAppDisplay() | |||
{ | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
if (data->m_window) | |||
{ | |||
SDL_GL_DeleteContext(data->m_glcontext); | |||
SDL_DestroyWindow(data->m_window); | |||
} | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
if (data->m_window) | |||
SDL_FreeSurface(data->m_window); | |||
#endif | |||
@@ -133,24 +133,24 @@ SdlAppDisplay::~SdlAppDisplay() | |||
void SdlAppDisplay::SetResolution(ivec2 resolution) | |||
{ | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
SDL_SetWindowSize(data->m_window, resolution.x, resolution.y); | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
//Not implemented | |||
#endif | |||
} | |||
void SdlAppDisplay::SetPosition(ivec2 position) | |||
{ | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
SDL_SetWindowPosition(data->m_window, position.x, position.y); | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
//Not implemented | |||
#endif | |||
} | |||
void SdlAppDisplay::Enable() | |||
{ | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
//TODO: Should we do that: ? | |||
SDL_GL_MakeCurrent(data->m_window, data->m_glcontext); | |||
#endif | |||
@@ -158,14 +158,14 @@ void SdlAppDisplay::Enable() | |||
void SdlAppDisplay::Disable() | |||
{ | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
SDL_GL_SwapWindow(data->m_window); | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
SDL_GL_SwapBuffers(); | |||
#endif | |||
} | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
int SceneDisplay::GetPhysicalCount() | |||
{ | |||
return SDL_GetNumVideoDisplays(); | |||
@@ -175,7 +175,7 @@ const char* SceneDisplay::GetPhysicalName(int index) | |||
{ | |||
return SDL_GetDisplayName(index); | |||
} | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
// Not implemented | |||
#endif | |||
@@ -187,10 +187,10 @@ class SdlAppData | |||
friend class SdlApp; | |||
private: | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
SDL_Window *m_window; | |||
SDL_GLContext m_glcontext; | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
SDL_Surface *m_window; | |||
#endif | |||
}; | |||
@@ -201,7 +201,7 @@ private: | |||
SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||
data(new SdlAppData()) | |||
{ | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
ivec2 window_size = res; | |||
ivec2 screen_size = res; | |||
@@ -210,7 +210,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||
Audio::Setup(2); | |||
/* Autoreleased objects */ | |||
#if defined USE_XINPUT | |||
#if defined LOL_USE_XINPUT | |||
/* Prefer D3d9 for joysticks on Windows, because the X360 pads are not | |||
* advertised with the proper number of axes. */ | |||
new D3d9Input(); | |||
@@ -222,7 +222,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||
void SdlApp::ShowPointer(bool show) | |||
{ | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
SDL_ShowCursor(show ? 1 : 0); | |||
#endif | |||
} | |||
@@ -235,9 +235,9 @@ void SdlApp::Tick() | |||
SdlApp::~SdlApp() | |||
{ | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
SDL_Quit(); | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
SDL_Quit(); | |||
#endif | |||
delete data; | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -12,7 +12,7 @@ | |||
#include <lol/engine-internal.h> | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
# if HAVE_SDL2_SDL_H | |||
# include <SDL2/SDL.h> | |||
# elif HAVE_SDL_SDL_H | |||
@@ -39,7 +39,7 @@ | |||
namespace lol | |||
{ | |||
#if USE_OLD_SDL | |||
#if LOL_USE_OLD_SDL | |||
/* Quick and dirty for now... This is deprecated anyway. */ | |||
static int sdl12_to_scancode(int ch, int sc) | |||
{ | |||
@@ -119,11 +119,11 @@ private: | |||
m_tick_in_draw_thread(false) | |||
{ } | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
array<SDL_Joystick *, InputDeviceInternal *> m_joysticks; | |||
InputDeviceInternal *m_mouse; | |||
InputDeviceInternal *m_keyboard; | |||
#endif // USE_SDL | |||
#endif // LOL_USE_SDL | |||
ivec2 m_prevmouse; | |||
vec2 m_app; | |||
@@ -144,19 +144,19 @@ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h) | |||
m_data->m_tick_in_draw_thread = true; | |||
#endif | |||
#if USE_OLD_SDL | |||
#if LOL_USE_OLD_SDL | |||
/* Enable Unicode translation of keyboard events */ | |||
SDL_EnableUNICODE(1); | |||
#endif | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
SDL_Init(SDL_INIT_TIMER | SDL_INIT_JOYSTICK); | |||
#endif | |||
m_data->m_keyboard = InputDeviceInternal::CreateStandardKeyboard(); | |||
m_data->m_mouse = InputDeviceInternal::CreateStandardMouse(); | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
# if !EMSCRIPTEN | |||
# if SDL_FORCE_POLL_JOYSTICK | |||
SDL_JoystickEventState(SDL_QUERY); | |||
@@ -174,15 +174,15 @@ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h) | |||
* - HDAPS, it's not a real joystick. | |||
* - X360 controllers, Xinput handles them better since | |||
* it won't think there is only one trigger axis. */ | |||
# if USE_SDL | |||
# if LOL_USE_SDL | |||
char const *name = SDL_JoystickName(sdlstick); | |||
# elif USE_OLD_SDL | |||
# elif LOL_USE_OLD_SDL | |||
char const *name = SDL_JoystickName(i); | |||
# endif | |||
if (strstr(name, "HDAPS") | |||
# if USE_XINPUT | |||
# if LOL_USE_XINPUT | |||
|| strstr(name, "XBOX 360 For Windows") | |||
# endif //USE_XINPUT | |||
# endif //LOL_USE_XINPUT | |||
|| false) | |||
{ | |||
SDL_JoystickClose(sdlstick); | |||
@@ -206,7 +206,7 @@ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h) | |||
SdlInput::~SdlInput() | |||
{ | |||
#if (USE_SDL || USE_OLD_SDL) && !EMSCRIPTEN | |||
#if (LOL_USE_SDL || LOL_USE_OLD_SDL) && !EMSCRIPTEN | |||
/* Unregister all the joysticks we added */ | |||
while (m_data->m_joysticks.count()) | |||
{ | |||
@@ -236,7 +236,7 @@ void SdlInput::TickDraw(float seconds, Scene &scene) | |||
void SdlInputData::Tick(float seconds) | |||
{ | |||
#if USE_SDL || USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
/* Pump all joystick events because no event is coming to us. */ | |||
# if SDL_FORCE_POLL_JOYSTICK && !EMSCRIPTEN | |||
SDL_JoystickUpdate(); | |||
@@ -263,7 +263,7 @@ void SdlInputData::Tick(float seconds) | |||
case SDL_KEYDOWN: | |||
case SDL_KEYUP: | |||
# if USE_OLD_SDL | |||
# if LOL_USE_OLD_SDL | |||
switch (int sc = sdl12_to_scancode(event.key.keysym.sym, | |||
event.key.keysym.scancode)) | |||
# else | |||
@@ -300,7 +300,7 @@ void SdlInputData::Tick(float seconds) | |||
} | |||
# endif | |||
default: | |||
# if USE_OLD_SDL | |||
# if LOL_USE_OLD_SDL | |||
m_keyboard->SetKey(sc ? sc : event.key.keysym.scancode, | |||
event.type == SDL_KEYDOWN); | |||
# else | |||
@@ -334,7 +334,7 @@ void SdlInputData::Tick(float seconds) | |||
} | |||
break; | |||
# if USE_OLD_SDL | |||
# if LOL_USE_OLD_SDL | |||
case SDL_MOUSEBUTTONDOWN: | |||
case SDL_MOUSEBUTTONUP: | |||
if (event.button.button != SDL_BUTTON_WHEELUP && event.button.button != SDL_BUTTON_WHEELDOWN) | |||
@@ -386,9 +386,9 @@ void SdlInputData::Tick(float seconds) | |||
if (InputDeviceInternal::GetMouseCapture() != m_mousecapture) | |||
{ | |||
m_mousecapture = InputDeviceInternal::GetMouseCapture(); | |||
# if USE_SDL | |||
# if LOL_USE_SDL | |||
SDL_SetRelativeMouseMode(m_mousecapture ? SDL_TRUE : SDL_FALSE); | |||
# elif USE_OLD_SDL | |||
# elif LOL_USE_OLD_SDL | |||
SDL_WM_GrabInput(m_mousecapture ? SDL_GRAB_ON : SDL_GRAB_OFF); | |||
# endif | |||
mouse = (ivec2)m_app / 2; | |||
@@ -414,7 +414,7 @@ void SdlInputData::Tick(float seconds) | |||
//Mouse is focused, Validate the InScreen Key | |||
//Hardcoded 3, not very nice. | |||
# if !EMSCRIPTEN && USE_OLD_SDL | |||
# if !EMSCRIPTEN && LOL_USE_OLD_SDL | |||
m_mouse->SetKey(3, !!(SDL_GetAppState() & SDL_APPMOUSEFOCUS)); | |||
# else | |||
//Handled in PollEvent | |||
@@ -430,7 +430,7 @@ void SdlInputData::Tick(float seconds) | |||
#else | |||
UNUSED(seconds); | |||
#endif //USE_SDL | |||
#endif //LOL_USE_SDL | |||
} | |||
// NOTE: these two functions are pointless now and could be inlined directly | |||
@@ -438,8 +438,8 @@ ivec2 SdlInputData::GetMousePos() | |||
{ | |||
ivec2 ret(-1, -1); | |||
#if USE_SDL || USE_OLD_SDL | |||
# if !EMSCRIPTEN && USE_OLD_SDL | |||
#if LOL_USE_SDL || LOL_USE_OLD_SDL | |||
# if !EMSCRIPTEN && LOL_USE_OLD_SDL | |||
if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) | |||
# endif | |||
{ | |||
@@ -452,9 +452,9 @@ ivec2 SdlInputData::GetMousePos() | |||
void SdlInputData::SetMousePos(ivec2 position) | |||
{ | |||
#if USE_SDL | |||
#if LOL_USE_SDL | |||
// FIXME: how do I warped mouse? | |||
#elif USE_OLD_SDL | |||
#elif LOL_USE_OLD_SDL | |||
SDL_WarpMouse((uint16_t)position.x, (uint16_t)position.y); | |||
#else | |||
UNUSED(position); | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -16,7 +16,7 @@ | |||
#include <cstdio> | |||
#include <cstring> | |||
#if USE_SDL_MIXER | |||
#if LOL_USE_SDL_MIXER | |||
# if HAVE_SDL_SDL_H | |||
# include <SDL/SDL.h> | |||
# include <SDL/SDL_mixer.h> | |||
@@ -42,7 +42,7 @@ class SampleData | |||
private: | |||
String m_name; | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
Mix_Chunk *m_chunk; | |||
int m_channel; | |||
#endif | |||
@@ -57,7 +57,7 @@ Sample::Sample(char const *path) | |||
{ | |||
data->m_name = String("<sample> ") + path; | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
for (auto candidate : System::GetPathList(path)) | |||
{ | |||
data->m_chunk = Mix_LoadWAV(candidate.C()); | |||
@@ -74,7 +74,7 @@ Sample::Sample(char const *path) | |||
Sample::~Sample() | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
if (data->m_chunk) | |||
Mix_FreeChunk(data->m_chunk); | |||
#endif | |||
@@ -93,7 +93,7 @@ char const *Sample::GetName() | |||
void Sample::Play() | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
if (data->m_chunk) | |||
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, 0); | |||
#endif | |||
@@ -101,7 +101,7 @@ void Sample::Play() | |||
void Sample::Loop() | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
if (data->m_chunk) | |||
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, -1); | |||
#endif | |||
@@ -109,7 +109,7 @@ void Sample::Loop() | |||
void Sample::Stop() | |||
{ | |||
#if defined USE_SDL_MIXER | |||
#if defined LOL_USE_SDL_MIXER | |||
if (data->m_channel >= 0) | |||
Mix_HaltChannel(data->m_channel); | |||
data->m_channel = -1; | |||
@@ -53,7 +53,7 @@ static array<SceneDisplay*> m_scene_displays; | |||
static inline void gpu_marker(char const *message) | |||
{ | |||
#if USE_GLEW | |||
#if LOL_USE_GLEW | |||
if (GLEW_GREMEDY_string_marker) | |||
glStringMarkerGREMEDY(0, message); | |||
#endif | |||
@@ -700,7 +700,7 @@ void Scene::render_tiles() // XXX: rename to Blit() | |||
rc.SetBlendEquation(BlendEquation::Add, BlendEquation::Max); | |||
rc.SetAlphaFunc(AlphaFunc::GreaterOrEqual, 0.01f); | |||
#if (defined USE_GLEW || defined HAVE_GL_2X) && !defined HAVE_GLES_2X | |||
#if (defined LOL_USE_GLEW || defined HAVE_GL_2X) && !defined HAVE_GLES_2X | |||
glEnable(GL_TEXTURE_2D); | |||
#endif | |||
@@ -795,7 +795,7 @@ void Scene::render_tiles() // XXX: rename to Blit() | |||
} | |||
#if (defined USE_GLEW || defined HAVE_GL_2X) && !defined HAVE_GLES_2X | |||
#if (defined LOL_USE_GLEW || defined HAVE_GL_2X) && !defined HAVE_GLES_2X | |||
glDisable(GL_TEXTURE_2D); | |||
#endif | |||
} | |||
@@ -6,7 +6,7 @@ noinst_PROGRAMS = $(testsuite) | |||
TESTS = $(testsuite) | |||
# Conditionally built for now because of STLport issues | |||
if !USE_ANDROID | |||
if !LOL_USE_ANDROID | |||
testsuite = test-base test-math test-sys test-image test-entity | |||
endif | |||
@@ -1,11 +1,13 @@ | |||
// | |||
// Lol Engine | |||
// | |||
// Lol Engine | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> | |||
// This program is free software; you can redistribute it and/or | |||
// modify it under the terms of the Do What The Fuck You Want To | |||
// Public License, Version 2, as published by Sam Hocevar. See | |||
// http://www.wtfpl.net/ for more details. | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
// and/or modify it under the terms of the Do What the Fuck You Want | |||
// to Public License, Version 2, as published by the WTFPL Task Force. | |||
// See http://www.wtfpl.net/ for more details. | |||
// | |||
#include <lol/engine-internal.h> | |||
@@ -59,7 +61,7 @@ void Video::SetDebugRenderMode(DebugRenderMode d) | |||
case DebugRenderMode::UV: | |||
{ | |||
#if defined HAVE_GLES_2X | |||
#elif defined USE_GLEW || defined HAVE_GL_2X | |||
#elif defined LOL_USE_GLEW || defined HAVE_GL_2X | |||
glEnable(GL_CULL_FACE); | |||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); | |||
#endif | |||
@@ -68,7 +70,7 @@ void Video::SetDebugRenderMode(DebugRenderMode d) | |||
case DebugRenderMode::Wireframe: | |||
{ | |||
#if defined HAVE_GLES_2X | |||
#elif defined USE_GLEW || defined HAVE_GL_2X | |||
#elif defined LOL_USE_GLEW || defined HAVE_GL_2X | |||
glDisable(GL_CULL_FACE); | |||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); | |||
#endif | |||
@@ -96,7 +98,7 @@ void Video::Destroy() | |||
void Video::Capture(uint32_t *buffer) | |||
{ | |||
#if defined USE_GLEW || defined HAVE_GL_2X || defined HAVE_GLEX_2X | |||
#if defined LOL_USE_GLEW || defined HAVE_GL_2X || defined HAVE_GLEX_2X | |||
GLint v[4]; | |||
glGetIntegerv(GL_VIEWPORT, v); | |||
int width = v[2], height = v[3]; | |||
@@ -13,7 +13,7 @@ make_font_SOURCES = make-font.cpp | |||
make_font_CPPFLAGS = @CACA_CFLAGS@ | |||
make_font_LDFLAGS = @CACA_LIBS@ | |||
if USE_CACA | |||
if LOL_USE_CACA | |||
make_font = make-font | |||
endif | |||
@@ -1,7 +1,7 @@ | |||
// | |||
// Lol Engine — Unit test implementation | |||
// | |||
// Copyright © 2010—2015 Sam Hocevar <sam@hocevar.net> | |||
// Copyright © 2010—2016 Sam Hocevar <sam@hocevar.net> | |||
// | |||
// Lol Engine is free software. It comes without any warranty, to | |||
// the extent permitted by applicable law. You can redistribute it | |||
@@ -26,9 +26,6 @@ | |||
# undef near /* Fuck Microsoft */ | |||
# undef far /* Fuck Microsoft again */ | |||
#elif defined _WIN32 | |||
# if defined USE_D3D9 | |||
# include <d3d9.h> | |||
# endif | |||
# define WIN32_LEAN_AND_MEAN | |||
# include <windows.h> | |||
# undef near /* Fuck Microsoft */ | |||