Browse Source

build: refactor autotools files for out-of-tree builds.

All these changes will allow us to more easily add Lol Engine as a
submodule of another Git project.
legacy
Sam Hocevar 9 years ago
parent
commit
c6f4070e70
35 changed files with 495 additions and 436 deletions
  1. +5
    -5
      build/autotools/common.am
  2. +207
    -0
      build/autotools/m4/lol-conf.m4
  3. +17
    -5
      build/autotools/m4/lol-gl.m4
  4. +32
    -20
      build/autotools/m4/lol-sdl.m4
  5. +7
    -7
      build/msbuild/lol.vars.props
  6. +28
    -208
      configure.ac
  7. +2
    -2
      doc/Makefile.am
  8. +1
    -1
      doc/samples/Makefile.am
  9. +1
    -1
      doc/samples/meshviewer/Makefile.am
  10. +1
    -1
      doc/tutorial/Makefile.am
  11. +1
    -8
      src/Makefile.am
  12. +11
    -9
      src/application/application.cpp
  13. +13
    -11
      src/audio.cpp
  14. +1
    -1
      src/data/font/Makefile.am
  15. +9
    -9
      src/eglapp.cpp
  16. +2
    -2
      src/gpu/renderer.cpp
  17. +2
    -2
      src/gpu/vertexbuffer.cpp
  18. +4
    -4
      src/image/codec/gdiplus-image.cpp
  19. +3
    -3
      src/image/codec/imlib2-image.cpp
  20. +3
    -3
      src/image/codec/sdl-image.cpp
  21. +4
    -4
      src/image/image.cpp
  22. +14
    -12
      src/image/movie.cpp
  23. +9
    -7
      src/lol/engine-internal.h
  24. +9
    -7
      src/lol/engine.h
  25. +9
    -7
      src/lolgl.h
  26. +11
    -9
      src/mesh/mesh.h
  27. +14
    -12
      src/platform/d3d9/d3d9input.cpp
  28. +25
    -25
      src/platform/sdl/sdlapp.cpp
  29. +25
    -25
      src/platform/sdl/sdlinput.cpp
  30. +8
    -8
      src/sample.cpp
  31. +3
    -3
      src/scene.cpp
  32. +1
    -1
      src/t/Makefile.am
  33. +11
    -9
      src/video.cpp
  34. +1
    -1
      tools/Makefile.am
  35. +1
    -4
      tools/lolunit/lolunit.h

+ 5
- 5
build/autotools/common.am View File

@@ -74,7 +74,7 @@ CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.data) \
all-local: all-local-android all-local: all-local-android
clean-local: clean-local-android clean-local: clean-local-android


if USE_ANDROID
if LOL_USE_ANDROID
all-local-android: $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), .$(p).androidstamp) all-local-android: $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), .$(p).androidstamp)
.%.androidstamp: %$(EXEEXT) .%.androidstamp: %$(EXEEXT)
$(eval p := $(^:%$(EXEEXT)=%)) $(eval p := $(^:%$(EXEEXT)=%))
@@ -82,13 +82,13 @@ all-local-android: $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), .$(p).androidstamp)
rm -rf "$(d)" rm -rf "$(d)"
$(MKDIR_P) "$(d)" $(sort $(foreach f, $($(p)_DATA), "$(d)/assets/$(dir $(f))")) $(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 $(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" $(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" $(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" $(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" $(MKDIR_P) "$(d)/libs/armeabi"
$(LN_S) "$(abs_builddir)/$(p)$(EXEEXT)" "$(d)/libs/armeabi/lib$(p).so" $(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" $(LN_S) "$${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/armeabi/libstlport_shared.so" "$(d)/libs/armeabi"


+ 207
- 0
build/autotools/m4/lol-conf.m4 View File

@@ -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


+ 17
- 5
build/autotools/m4/lol-gl.m4 View File

@@ -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 dnl Find which version of OpenGL to use
ac_cv_my_have_gl="no" ac_cv_my_have_gl="no"
@@ -114,9 +126,9 @@ AC_CHECK_HEADER(GL/glew.h,
LIBS="${LIBS_save}"]) LIBS="${LIBS_save}"])
if test "${ac_cv_my_have_glew}" != "no"; then 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(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 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. dnl Poor man's GL feature detection if all else failed.
save_LIBS="${LIBS}" 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]]) AC_MSG_WARN([[No OpenGL or OpenGL ES implementation found]])
fi fi


])# LOL_CHECK_OPENGL
]) # LOL_AC_CHECK_OPENGL





+ 32
- 20
build/autotools/m4/lol-sdl.m4 View File

@@ -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 Find which version of SDL to use (always required on Linux or Win32)
dnl dnl
dnl Defined C/C++ macros: 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_H -- whether to include <SDL.h>
dnl HAVE_SDL_SDL_H -- whether to include <SDL/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 HAVE_SDL2_SDL_H -- whether to include <SDL2/SDL.h>
dnl Generated automake conditionals: 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 Generated shell variables:
dnl SDL_CFLAGS -- flags for SDL compilation dnl SDL_CFLAGS -- flags for SDL compilation
dnl SDL_LIBS -- flags for SDL linking 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 if test "x${ac_cv_my_have_sdl}" = xno; then
AC_MSG_WARN([SDL v2 not found]) AC_MSG_WARN([SDL v2 not found])
else 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 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 if test "x${ac_cv_my_have_sdl_mixer}" = xno; then
AC_MSG_WARN([SDL_mixer not found]) AC_MSG_WARN([SDL_mixer not found])
else 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 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 if test "x${ac_cv_my_have_sdl_image}" = xno; then
AC_MSG_WARN([SDL_image not found]) AC_MSG_WARN([SDL_image not found])
else 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 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 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 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





+ 7
- 7
build/msbuild/lol.vars.props View File

@@ -27,8 +27,8 @@
<SdlLibs Condition="'$(Platform)'=='x64'">$(SdlDir)\lib\x86_64-msvc;$(SdlImageDir)\lib\x86_64-msvc;$(SdlMixerDir)\lib\x86_64-msvc</SdlLibs> <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)'=='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> <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 --> <!-- GTK+ & GtkGl -->
<GtkDir>$(ExternalDir)\gtk-2.22.1</GtkDir> <GtkDir>$(ExternalDir)\gtk-2.22.1</GtkDir>
@@ -44,7 +44,7 @@
<FfmpegLibs Condition="'$(Platform)'=='Win32'">$(FfmpegDir)\lib\i686-w64-mingw32</FfmpegLibs> <FfmpegLibs Condition="'$(Platform)'=='Win32'">$(FfmpegDir)\lib\i686-w64-mingw32</FfmpegLibs>
<FfmpegLibs Condition="'$(Platform)'=='x64'">$(FfmpegDir)\lib\x86_64-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> <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 --> <!-- Assimp -->
@@ -55,7 +55,7 @@
<!-- <AssimpDeps>zlibstatic.lib;assimp.lib</AssimpDeps> --> <!-- <AssimpDeps>zlibstatic.lib;assimp.lib</AssimpDeps> -->
<AssimpDeps Condition="'$(Configuration)'=='Release'">zlibstatic.lib;assimp.lib</AssimpDeps> <AssimpDeps Condition="'$(Configuration)'=='Release'">zlibstatic.lib;assimp.lib</AssimpDeps>
<AssimpDeps Condition="'$(Configuration)'=='Debug'">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 --> <!-- libcaca -->
<CacaDir>$(ExternalDir)\libcaca-0.99.beta18</CacaDir> <CacaDir>$(ExternalDir)\libcaca-0.99.beta18</CacaDir>
@@ -67,7 +67,7 @@


<!-- GDI+ --> <!-- GDI+ -->
<GdiDeps>Gdiplus.lib</GdiDeps> <GdiDeps>Gdiplus.lib</GdiDeps>
<Win32Defines>USE_GDIPLUS;$(Win32Defines)</Win32Defines>
<Win32Defines>LOL_USE_GDIPLUS;$(Win32Defines)</Win32Defines>


<!-- OpenGL & GLEW --> <!-- OpenGL & GLEW -->
<GlewDir>$(ExternalDir)\glew-1.9.0</GlewDir> <GlewDir>$(ExternalDir)\glew-1.9.0</GlewDir>
@@ -76,14 +76,14 @@
<GlLibs Condition="'$(Platform)'=='x64'">$(GlewDir)\lib\x86_64-w64-mingw32</GlLibs> <GlLibs Condition="'$(Platform)'=='x64'">$(GlewDir)\lib\x86_64-w64-mingw32</GlLibs>
<GlDeps Condition="'$(Platform)'=='Win32'">opengl32.lib;glew32s.lib</GlDeps> <GlDeps Condition="'$(Platform)'=='Win32'">opengl32.lib;glew32s.lib</GlDeps>
<GlDeps Condition="'$(Platform)'=='x64'">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 --> <!-- Xinput -->
<XinputIncludes>$(DXSDK_DIR)\Include</XinputIncludes> <XinputIncludes>$(DXSDK_DIR)\Include</XinputIncludes>
<XinputLibs Condition="'$(Platform)'=='Win32'">$(DXSDK_DIR)\Lib\x86</XinputLibs> <XinputLibs Condition="'$(Platform)'=='Win32'">$(DXSDK_DIR)\Lib\x86</XinputLibs>
<XinputLibs Condition="'$(Platform)'=='x64'">$(DXSDK_DIR)\Lib\x64</XinputLibs> <XinputLibs Condition="'$(Platform)'=='x64'">$(DXSDK_DIR)\Lib\x64</XinputLibs>
<XinputDeps>xinput.lib</XinputDeps> <XinputDeps>xinput.lib</XinputDeps>
<Win32Defines>USE_XINPUT;$(Win32Defines)</Win32Defines>
<Win32Defines>LOL_USE_XINPUT;$(Win32Defines)</Win32Defines>


<!-- Windows-specific --> <!-- Windows-specific -->
<Win32Defines>HAVE_STDIO_H;$(Win32Defines)</Win32Defines> <Win32Defines>HAVE_STDIO_H;$(Win32Defines)</Win32Defines>


+ 28
- 208
configure.ac View File

@@ -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_INIT(lolengine, 0.0)
AC_PREREQ(2.50) AC_PREREQ(2.50)
@@ -14,6 +24,9 @@ AC_SUBST(LOLUNIT_VERSION)
LOLREMEZ_VERSION=0.2 LOLREMEZ_VERSION=0.2
AC_SUBST(LOLREMEZ_VERSION) AC_SUBST(LOLREMEZ_VERSION)


AC_SUBST(lol_srcdir, '${top_srcdir}')
AC_SUBST(lol_builddir, '${top_builddir}')

AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)


AM_PROG_CC_C_O AM_PROG_CC_C_O
@@ -22,15 +35,6 @@ AC_PROG_CXX
AC_PROG_CXXCPP AC_PROG_CXXCPP
AC_PROG_RANLIB 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. dnl C++11 and later mode. Checked early so that we don't run into surprises.
version_flag='' version_flag=''
LOL_TRY_CXXFLAGS(-std=c++0x, [version_flag='-std=c++0x']) 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$]) m4_pattern_forbid([^PKG_PROG_PKG_CONFIG$])


dnl Same for Lol Engine M4 files. 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. dnl Do not use PKG_CONFIG_LIBDIR when cross-compiling.
@@ -178,17 +182,19 @@ if test "${enable_doc}" != "no"; then
fi fi
AC_PATH_PROG(DOT, dot, no) AC_PATH_PROG(DOT, dot, no)
if test "${DOT}" != "no"; then if test "${DOT}" != "no"; then
USE_DOT="YES"
LOL_USE_DOT="YES"
else else
USE_DOT="NO"
LOL_USE_DOT="NO"
fi fi
fi fi
fi fi
dnl XXX: disable LaTeX because we use too much memory dnl XXX: disable LaTeX because we use too much memory
LATEX=no LATEX=no
AM_CONDITIONAL(BUILD_DOCUMENTATION, test "${DOXYGEN}" != "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 dnl Debug symbols
@@ -238,177 +244,16 @@ AC_TRY_LINK(
AC_LANG_POP(C++) 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" ac_cv_my_have_caca="no"
PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:]) PKG_CHECK_MODULES(CACA, caca >= 0.99.beta17, [ac_cv_my_have_caca="yes"], [:])
if test "${ac_cv_my_have_caca}" != "no"; then 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 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) 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(GTK, gtk+-2.0, [ac_cv_my_have_gtkgl="yes"], [:])
PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"]) PKG_CHECK_MODULES(GTKGL, gtkgl-2.0, [:], [ac_cv_my_have_gtkgl="no"])
if test "${ac_cv_my_have_gtkgl}" != "no"; then 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 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? 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? dnl Should we ship non-free data?
AM_CONDITIONAL(HAVE_NONFREE, true) AM_CONDITIONAL(HAVE_NONFREE, true)



dnl Extra libraries we may need dnl Extra libraries we may need
AC_SUBST(MATH_LIBS) AC_SUBST(MATH_LIBS)
AC_SUBST(PAM_LIBS) AC_SUBST(PAM_LIBS)
AC_SUBST(UTIL_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( AC_CONFIG_FILES(
[Makefile [Makefile


+ 2
- 2
doc/Makefile.am View File

@@ -14,7 +14,7 @@ man_MANS = lolengine.1
if BUILD_DOCUMENTATION if BUILD_DOCUMENTATION
htmldoc_DATA = html/doxygen.css htmldoc_DATA = html/doxygen.css
htmldocdir = $(datadir)/doc/lolengine-dev/html htmldocdir = $(datadir)/doc/lolengine-dev/html
if USE_LATEX
if LOL_USE_LATEX
pdfdoc_DATA = latex/lolengine.pdf pdfdoc_DATA = latex/lolengine.pdf
pdfdocdir = $(datadir)/doc/lolengine-dev/pdf pdfdocdir = $(datadir)/doc/lolengine-dev/pdf
endif endif
@@ -31,7 +31,7 @@ endif


stamp-latex: stamp-doxygen stamp-latex: stamp-doxygen
if BUILD_DOCUMENTATION if BUILD_DOCUMENTATION
if USE_LATEX
if LOL_USE_LATEX
rm -f latex/lolengine.tex latex/lolengine.pdf rm -f latex/lolengine.tex latex/lolengine.pdf
$(SED) -i -e 's/setlength{/renewcommand{/' latex/refman.tex $(SED) -i -e 's/setlength{/renewcommand{/' latex/refman.tex
$(SED) -i -e 's/.*usepackage.*times.*//' latex/refman.tex $(SED) -i -e 's/.*usepackage.*times.*//' latex/refman.tex


+ 1
- 1
doc/samples/Makefile.am View File

@@ -27,7 +27,7 @@ btphystest_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/bullet \
-DHAVE_PHYS_USE_BULLET -DHAVE_PHYS_USE_BULLET
btphystest_DEPENDENCIES = @LOL_DEPS@ btphystest_DEPENDENCIES = @LOL_DEPS@
btphystest_LDFLAGS = $(AM_LDFLAGS) btphystest_LDFLAGS = $(AM_LDFLAGS)
if USE_EMSCRIPTEN
if LOL_USE_EMSCRIPTEN
btphystest_LDFLAGS += \ btphystest_LDFLAGS += \
--preload-file data/CatsSheet.png \ --preload-file data/CatsSheet.png \
-s TOTAL_MEMORY=$(shell expr 32 '*' 1024 '*' 1024) -s TOTAL_MEMORY=$(shell expr 32 '*' 1024 '*' 1024)


+ 1
- 1
doc/samples/meshviewer/Makefile.am View File

@@ -9,7 +9,7 @@ meshviewer_SOURCES = meshviewer.cpp meshviewer.h \
meshviewer_CPPFLAGS = $(AM_CPPFLAGS) meshviewer_CPPFLAGS = $(AM_CPPFLAGS)
meshviewer_DEPENDENCIES = @LOL_DEPS@ meshviewer_DEPENDENCIES = @LOL_DEPS@
meshviewer_LDFLAGS = $(AM_LDFLAGS) meshviewer_LDFLAGS = $(AM_LDFLAGS)
if USE_EMSCRIPTEN
if LOL_USE_EMSCRIPTEN
meshviewer_LDFLAGS += -s EXPORTED_FUNCTIONS="['_main', '_C_Send']" meshviewer_LDFLAGS += -s EXPORTED_FUNCTIONS="['_main', '_C_Send']"
endif endif



+ 1
- 1
doc/tutorial/Makefile.am View File

@@ -29,7 +29,7 @@ noinst_PROGRAMS = 01_triangle 02_cube 03_noise 04_texture 05_easymesh \
06_sprite_CPPFLAGS = $(AM_CPPFLAGS) 06_sprite_CPPFLAGS = $(AM_CPPFLAGS)
06_sprite_DEPENDENCIES = @LOL_DEPS@ 06_sprite_DEPENDENCIES = @LOL_DEPS@
06_sprite_LDFLAGS = $(AM_LDFLAGS) 06_sprite_LDFLAGS = $(AM_LDFLAGS)
if USE_EMSCRIPTEN
if LOL_USE_EMSCRIPTEN
06_sprite_LDFLAGS += --preload-file 06_sprite.png 06_sprite_LDFLAGS += --preload-file 06_sprite.png
endif endif




+ 1
- 8
src/Makefile.am View File

@@ -20,7 +20,6 @@ liblol_core_a_SOURCES = \
$(liblol_core_headers) \ $(liblol_core_headers) \
$(liblol_core_sources) \ $(liblol_core_sources) \
\ \
$(xbox_sources) \
$(nacl_sources) \ $(nacl_sources) \
$(sdl_sources) \ $(sdl_sources) \
$(d3d9_sources) \ $(d3d9_sources) \
@@ -140,7 +139,7 @@ sdl_sources = \
d3d9_sources = \ d3d9_sources = \
platform/d3d9/d3d9input.cpp platform/d3d9/d3d9input.h platform/d3d9/d3d9input.cpp platform/d3d9/d3d9input.h


if USE_NACL
if LOL_USE_NACL
nacl_sources = \ nacl_sources = \
platform/nacl/nacl-app.cpp platform/nacl/nacl-app.h \ platform/nacl/nacl-app.cpp platform/nacl/nacl-app.h \
platform/nacl/nacl-instance.cpp platform/nacl/nacl-instance.h \ platform/nacl/nacl-instance.cpp platform/nacl/nacl-instance.h \
@@ -149,12 +148,6 @@ nacl_sources = \
platform/nacl/opengl_context_ptrs.h platform/nacl/opengl_context_ptrs.h
endif 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 = \ android_sources = \
image/codec/android-image.cpp \ image/codec/android-image.cpp \
platform/android/androidapp.cpp platform/android/androidapp.h platform/android/androidapp.cpp platform/android/androidapp.h


+ 11
- 9
src/application/application.cpp View File

@@ -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> #include <lol/engine-internal.h>
@@ -20,7 +22,7 @@
# include "platform/nacl/nacl-app.h" # include "platform/nacl/nacl-app.h"
#elif __ANDROID__ #elif __ANDROID__
# include "platform/android/androidapp.h" # 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/sdlapp.h"
# include "platform/sdl/sdlinput.h" # include "platform/sdl/sdlinput.h"
#elif HAVE_GLES_2X #elif HAVE_GLES_2X
@@ -61,7 +63,7 @@ protected:
//NOT HANDLED YET //NOT HANDLED YET
#elif __ANDROID__ #elif __ANDROID__
//NOT HANDLED YET //NOT HANDLED YET
#elif USE_SDL || USE_OLD_SDL
#elif LOL_USE_SDL || LOL_USE_OLD_SDL
SdlAppDisplay display; SdlAppDisplay display;
#elif HAVE_GLES_2X #elif HAVE_GLES_2X
/* FIXME: this macro is only deactivated if we include "lolgl.h" */ /* FIXME: this macro is only deactivated if we include "lolgl.h" */
@@ -121,7 +123,7 @@ class ApplicationData
NaClApp app; NaClApp app;
#elif __ANDROID__ #elif __ANDROID__
AndroidApp app; AndroidApp app;
#elif USE_SDL || USE_OLD_SDL
#elif LOL_USE_SDL || LOL_USE_OLD_SDL
SdlApp app; SdlApp app;
#elif HAVE_GLES_2X #elif HAVE_GLES_2X
/* FIXME: this macro is only deactivated if we include "lolgl.h" */ /* FIXME: this macro is only deactivated if we include "lolgl.h" */


+ 13
- 11
src/audio.cpp View File

@@ -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> #include <lol/engine-internal.h>


#if USE_SDL_MIXER
#if LOL_USE_SDL_MIXER
# if HAVE_SDL_SDL_H # if HAVE_SDL_SDL_H
# include <SDL/SDL.h> # include <SDL/SDL.h>
# include <SDL/SDL_mixer.h> # include <SDL/SDL_mixer.h>
@@ -32,7 +34,7 @@ namespace lol


void Audio::Setup(int channels) void Audio::Setup(int channels)
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
Mix_OpenAudio(22050, AUDIO_S16, channels, 1024); Mix_OpenAudio(22050, AUDIO_S16, channels, 1024);
#else #else
UNUSED(channels); UNUSED(channels);
@@ -41,7 +43,7 @@ void Audio::Setup(int channels)


void Audio::SetVolume(int channel, int volume) void Audio::SetVolume(int channel, int volume)
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
Mix_Volume(channel,volume); Mix_Volume(channel,volume);
#else #else
UNUSED(channel); UNUSED(channel);
@@ -50,7 +52,7 @@ void Audio::SetVolume(int channel, int volume)


void Audio::MuteAll() void Audio::MuteAll()
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
Mix_Volume(-1,0); Mix_Volume(-1,0);
#else #else
UNUSED(false); UNUSED(false);
@@ -59,7 +61,7 @@ void Audio::MuteAll()


void Audio::UnmuteAll() void Audio::UnmuteAll()
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
Mix_Volume(-1,MIX_MAX_VOLUME); Mix_Volume(-1,MIX_MAX_VOLUME);
#else #else
UNUSED(false); UNUSED(false);


+ 1
- 1
src/data/font/Makefile.am View File

@@ -3,7 +3,7 @@ include $(top_srcdir)/build/autotools/common.am


EXTRA_DIST += ascii.png EXTRA_DIST += ascii.png


if USE_CACA
if LOL_USE_CACA
all: ascii.png all: ascii.png


ascii.png: ascii.png:


+ 9
- 9
src/eglapp.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -12,7 +12,7 @@


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#if defined USE_EGL && !defined __ANDROID__
#if defined LOL_USE_EGL && !defined __ANDROID__
# if defined HAVE_BCM_HOST_H # if defined HAVE_BCM_HOST_H
# include <bcm_host.h> # include <bcm_host.h>
# else # else
@@ -24,7 +24,7 @@
# include <EGL/eglext.h> # include <EGL/eglext.h>
#endif #endif


#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
# if HAVE_SDL2_SDL_H # if HAVE_SDL2_SDL_H
# include <SDL2/SDL.h> # include <SDL2/SDL.h>
# elif HAVE_SDL_SDL_H # elif HAVE_SDL_SDL_H
@@ -36,7 +36,7 @@


#include "lolgl.h" #include "lolgl.h"
#include "eglapp.h" #include "eglapp.h"
#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
# include "platform/sdl/sdlinput.h" # include "platform/sdl/sdlinput.h"
#endif #endif


@@ -52,7 +52,7 @@ class EglAppData
friend class EglApp; friend class EglApp;


private: private:
#if defined USE_EGL && !defined __ANDROID__
#if defined LOL_USE_EGL && !defined __ANDROID__
EGLDisplay egl_dpy; EGLDisplay egl_dpy;
EGLContext egl_ctx; EGLContext egl_ctx;
EGLSurface egl_surf; EGLSurface egl_surf;
@@ -73,7 +73,7 @@ private:
EglApp::EglApp(char const *title, ivec2 res, float fps) : EglApp::EglApp(char const *title, ivec2 res, float fps) :
data(new EglAppData()) data(new EglAppData())
{ {
#if defined USE_EGL && !defined __ANDROID__
#if defined LOL_USE_EGL && !defined __ANDROID__
# if defined HAVE_BCM_HOST_H # if defined HAVE_BCM_HOST_H
bcm_host_init(); bcm_host_init();


@@ -251,7 +251,7 @@ EglApp::EglApp(char const *title, ivec2 res, float fps) :
data->screen_size = uvec2(gwa.width, gwa.height); data->screen_size = uvec2(gwa.width, gwa.height);
# endif # 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); new SdlInput(res.x, res.y, data->screen_size.x, data->screen_size.y);
# endif # endif


@@ -272,14 +272,14 @@ void EglApp::Tick()
{ {
/* Tick the renderer, show the frame and clamp to desired framerate. */ /* Tick the renderer, show the frame and clamp to desired framerate. */
Ticker::TickDraw(); Ticker::TickDraw();
#if defined USE_EGL && !defined __ANDROID__
#if defined LOL_USE_EGL && !defined __ANDROID__
eglSwapBuffers(data->egl_dpy, data->egl_surf); eglSwapBuffers(data->egl_dpy, data->egl_surf);
#endif #endif
} }


EglApp::~EglApp() EglApp::~EglApp()
{ {
#if defined USE_EGL && !defined __ANDROID__
#if defined LOL_USE_EGL && !defined __ANDROID__
eglDestroyContext(data->egl_dpy, data->egl_ctx); eglDestroyContext(data->egl_dpy, data->egl_ctx);
eglDestroySurface(data->egl_dpy, data->egl_surf); eglDestroySurface(data->egl_dpy, data->egl_surf);
eglTerminate(data->egl_dpy); eglTerminate(data->egl_dpy);


+ 2
- 2
src/gpu/renderer.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -63,7 +63,7 @@ private:
Renderer::Renderer(ivec2 size) Renderer::Renderer(ivec2 size)
: m_data(new RendererData()) : m_data(new RendererData())
{ {
#if defined USE_GLEW && !defined __APPLE__
#if defined LOL_USE_GLEW && !defined __APPLE__
/* Initialise GLEW if necessary */ /* Initialise GLEW if necessary */
GLenum glerr = glewInit(); GLenum glerr = glewInit();
if (glerr != GLEW_OK) if (glerr != GLEW_OK)


+ 2
- 2
src/gpu/vertexbuffer.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // 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_DOUBLE
|| tlut[type_index].type == GL_BYTE || tlut[type_index].type == GL_BYTE
|| tlut[type_index].type == GL_UNSIGNED_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 */ /* If this is not available, don't use it */
|| !glVertexAttribIPointer || !glVertexAttribIPointer
#endif #endif


+ 4
- 4
src/image/codec/gdiplus-image.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -13,7 +13,7 @@
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#if USE_GDIPLUS
#if LOL_USE_GDIPLUS
# include <algorithm> # include <algorithm>
using std::min; using std::min;
using std::max; using std::max;
@@ -24,7 +24,7 @@ using std::max;


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#if USE_GDIPLUS
#if LOL_USE_GDIPLUS


#include "../../image/image-private.h" #include "../../image/image-private.h"


@@ -221,5 +221,5 @@ bool GdiPlusImageCodec::Save(Image *image, char const *path)


} /* namespace lol */ } /* namespace lol */


#endif /* defined USE_GDIPLUS */
#endif /* defined LOL_USE_GDIPLUS */



+ 3
- 3
src/image/codec/imlib2-image.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -12,7 +12,7 @@


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#if defined USE_IMLIB2
#if defined LOL_USE_IMLIB2


#include <Imlib2.h> #include <Imlib2.h>


@@ -121,5 +121,5 @@ bool Imlib2ImageCodec::Save(Image *image, char const *path)


} /* namespace lol */ } /* namespace lol */


#endif /* defined USE_IMLIB2 */
#endif /* defined LOL_USE_IMLIB2 */



+ 3
- 3
src/image/codec/sdl-image.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -12,7 +12,7 @@


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#if USE_SDL_IMAGE
#if LOL_USE_SDL_IMAGE


#if HAVE_SDL_SDL_H #if HAVE_SDL_SDL_H
# include <SDL/SDL.h> # include <SDL/SDL.h>
@@ -121,5 +121,5 @@ SDL_Surface *SdlImageCodec::Create32BppSurface(ivec2 size)


} /* namespace lol */ } /* namespace lol */


#endif /* USE_SDL_IMAGE */
#endif /* LOL_USE_SDL_IMAGE */



+ 4
- 4
src/image/image.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -34,16 +34,16 @@ static bool RegisterAllCodecs(array<ImageCodec *> &codeclist)
#if defined __ANDROID__ #if defined __ANDROID__
REGISTER_IMAGE_CODEC(AndroidImageCodec) REGISTER_IMAGE_CODEC(AndroidImageCodec)
#endif #endif
#if defined USE_GDIPLUS
#if defined LOL_USE_GDIPLUS
REGISTER_IMAGE_CODEC(GdiPlusImageCodec) REGISTER_IMAGE_CODEC(GdiPlusImageCodec)
#endif #endif
#if defined __APPLE__ && defined __MACH__ && defined __arm__ #if defined __APPLE__ && defined __MACH__ && defined __arm__
REGISTER_IMAGE_CODEC(IosImageCodec) REGISTER_IMAGE_CODEC(IosImageCodec)
#endif #endif
#if defined USE_SDL_IMAGE
#if defined LOL_USE_SDL_IMAGE
REGISTER_IMAGE_CODEC(SdlImageCodec) REGISTER_IMAGE_CODEC(SdlImageCodec)
#endif #endif
#if defined USE_IMLIB2
#if defined LOL_USE_IMLIB2
REGISTER_IMAGE_CODEC(Imlib2ImageCodec) REGISTER_IMAGE_CODEC(Imlib2ImageCodec)
#endif #endif
REGISTER_IMAGE_CODEC(DummyImageCodec) REGISTER_IMAGE_CODEC(DummyImageCodec)


+ 14
- 12
src/image/movie.cpp View File

@@ -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> #include <lol/engine-internal.h>


#if USE_FFMPEG
#if LOL_USE_FFMPEG
extern "C" extern "C"
{ {
# include <libavformat/avformat.h> # include <libavformat/avformat.h>
@@ -20,13 +22,13 @@ extern "C"
namespace lol namespace lol
{ {


#if USE_FFMPEG
#if LOL_USE_FFMPEG
static bool g_ready = false; static bool g_ready = false;
#endif #endif


class MovieData class MovieData
{ {
#if USE_FFMPEG
#if LOL_USE_FFMPEG


#endif #endif


@@ -40,7 +42,7 @@ class MovieData
Movie::Movie(String const &name, ivec2 size, float fps) Movie::Movie(String const &name, ivec2 size, float fps)
: m_data(new MovieData()) : m_data(new MovieData())
{ {
#if USE_FFMPEG
#if LOL_USE_FFMPEG
if (!g_ready) if (!g_ready)
{ {
g_ready = true; g_ready = true;
@@ -51,7 +53,7 @@ Movie::Movie(String const &name, ivec2 size, float fps)


Movie::~Movie() Movie::~Movie()
{ {
#if USE_FFMPEG
#if LOL_USE_FFMPEG


#endif #endif


@@ -60,7 +62,7 @@ Movie::~Movie()


void Movie::Feed(Image const &image) void Movie::Feed(Image const &image)
{ {
#if USE_FFMPEG
#if LOL_USE_FFMPEG


#endif #endif
} }


+ 9
- 7
src/lol/engine-internal.h View File

@@ -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 #pragma once
@@ -28,7 +30,7 @@
#endif #endif


/* If using SDL on Windows or OS X, let it override main() */ /* 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> # include <SDL_main.h>
#endif #endif




+ 9
- 7
src/lol/engine.h View File

@@ -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 #pragma once
@@ -23,7 +25,7 @@
#endif #endif


/* If using SDL on Windows or OS X, let it override main() */ /* 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> # include <SDL_main.h>
#endif #endif




+ 9
- 7
src/lolgl.h View File

@@ -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 #pragma once
@@ -30,7 +32,7 @@
/* Include GL development headers. /* Include GL development headers.
* Do not include glew.h on OS X, because the version shipped with Fink * 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. */ * 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> # include <GL/glew.h>
#elif defined HAVE_GL_2X #elif defined HAVE_GL_2X
# if defined __APPLE__ && defined __MACH__ && defined __arm__ # if defined __APPLE__ && defined __MACH__ && defined __arm__


+ 11
- 9
src/mesh/mesh.h View File

@@ -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 #pragma once
@@ -19,7 +21,7 @@
#include <lol/gpu/indexbuffer.h> #include <lol/gpu/indexbuffer.h>


//Assimp supports http://assimp.sourceforge.net/main_features_formats.html //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. //Cause build has a problem with function choice.
#if _WIN32 || _WIN64 #if _WIN32 || _WIN64
#define sin lol::sin #define sin lol::sin
@@ -35,8 +37,8 @@
#undef asin #undef asin
#undef cos #undef cos
#undef acos #undef acos
#endif //_WIN32 || _WIN64
#endif //USE_ASSIMP
#endif // _WIN32 || _WIN64
#endif // LOL_USE_ASSIMP


namespace lol namespace lol
{ {


+ 14
- 12
src/platform/d3d9/d3d9input.cpp View File

@@ -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 #if HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#if defined USE_XINPUT
#if defined LOL_USE_XINPUT
# include <d3d9.h> # include <d3d9.h>
# include <xinput.h> # include <xinput.h>
#endif #endif
@@ -34,9 +36,9 @@ class D3d9InputData
friend class D3d9Input; friend class D3d9Input;


private: private:
#if defined USE_XINPUT
#if defined LOL_USE_XINPUT
array<int, InputDeviceInternal*> m_joysticks; array<int, InputDeviceInternal*> m_joysticks;
#endif // USE_XINPUT
#endif // LOL_USE_XINPUT
}; };


/* /*
@@ -46,7 +48,7 @@ private:
D3d9Input::D3d9Input() D3d9Input::D3d9Input()
: m_data(new D3d9InputData()) : m_data(new D3d9InputData())
{ {
#if defined USE_XINPUT
#if defined LOL_USE_XINPUT
for (int i = 0; i < XUSER_MAX_COUNT; i++) for (int i = 0; i < XUSER_MAX_COUNT; i++)
{ {
XINPUT_STATE state; XINPUT_STATE state;
@@ -86,7 +88,7 @@ D3d9Input::D3d9Input()


D3d9Input::~D3d9Input() D3d9Input::~D3d9Input()
{ {
#if defined USE_XINPUT
#if defined LOL_USE_XINPUT
/* Unregister all the joysticks we added */ /* Unregister all the joysticks we added */
while (m_data->m_joysticks.count()) while (m_data->m_joysticks.count())
{ {
@@ -101,7 +103,7 @@ void D3d9Input::TickGame(float seconds)
{ {
Entity::TickGame(seconds); Entity::TickGame(seconds);


#if defined USE_XINPUT
#if defined LOL_USE_XINPUT
for (int i = 0; i < m_data->m_joysticks.count(); i++) for (int i = 0; i < m_data->m_joysticks.count(); i++)
{ {
XINPUT_STATE state; XINPUT_STATE state;


+ 25
- 25
src/platform/sdl/sdlapp.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -12,7 +12,7 @@


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
# if HAVE_SDL2_SDL_H # if HAVE_SDL2_SDL_H
# include <SDL2/SDL.h> # include <SDL2/SDL.h>
# elif HAVE_SDL_SDL_H # elif HAVE_SDL_SDL_H
@@ -25,7 +25,7 @@
#include "lolgl.h" #include "lolgl.h"
#include "platform/sdl/sdlapp.h" #include "platform/sdl/sdlapp.h"
#include "platform/sdl/sdlinput.h" #include "platform/sdl/sdlinput.h"
#if USE_XINPUT
#if LOL_USE_XINPUT
# include "platform/d3d9/d3d9input.h" # include "platform/d3d9/d3d9input.h"
#endif #endif


@@ -40,10 +40,10 @@ class SdlAppDisplayData
friend class SdlAppDisplay; friend class SdlAppDisplay;


private: private:
#if USE_SDL
#if LOL_USE_SDL
SDL_Window *m_window; SDL_Window *m_window;
SDL_GLContext m_glcontext; SDL_GLContext m_glcontext;
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
SDL_Surface *m_window; SDL_Surface *m_window;
#endif #endif
}; };
@@ -54,7 +54,7 @@ private:
SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res) SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res)
: data(new SdlAppDisplayData()) : data(new SdlAppDisplayData())
{ {
#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
ivec2 window_size = res; ivec2 window_size = res;
ivec2 screen_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. /* This seems to fix the swap context bug.
* However, perfs warning have been may occur. */ * However, perfs warning have been may occur. */
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1); SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
@@ -117,13 +117,13 @@ SdlAppDisplay::SdlAppDisplay(char const *title, ivec2 res)


SdlAppDisplay::~SdlAppDisplay() SdlAppDisplay::~SdlAppDisplay()
{ {
#if USE_SDL
#if LOL_USE_SDL
if (data->m_window) if (data->m_window)
{ {
SDL_GL_DeleteContext(data->m_glcontext); SDL_GL_DeleteContext(data->m_glcontext);
SDL_DestroyWindow(data->m_window); SDL_DestroyWindow(data->m_window);
} }
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
if (data->m_window) if (data->m_window)
SDL_FreeSurface(data->m_window); SDL_FreeSurface(data->m_window);
#endif #endif
@@ -133,24 +133,24 @@ SdlAppDisplay::~SdlAppDisplay()


void SdlAppDisplay::SetResolution(ivec2 resolution) void SdlAppDisplay::SetResolution(ivec2 resolution)
{ {
#if USE_SDL
#if LOL_USE_SDL
SDL_SetWindowSize(data->m_window, resolution.x, resolution.y); SDL_SetWindowSize(data->m_window, resolution.x, resolution.y);
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
//Not implemented //Not implemented
#endif #endif
} }
void SdlAppDisplay::SetPosition(ivec2 position) void SdlAppDisplay::SetPosition(ivec2 position)
{ {
#if USE_SDL
#if LOL_USE_SDL
SDL_SetWindowPosition(data->m_window, position.x, position.y); SDL_SetWindowPosition(data->m_window, position.x, position.y);
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
//Not implemented //Not implemented
#endif #endif
} }


void SdlAppDisplay::Enable() void SdlAppDisplay::Enable()
{ {
#if USE_SDL
#if LOL_USE_SDL
//TODO: Should we do that: ? //TODO: Should we do that: ?
SDL_GL_MakeCurrent(data->m_window, data->m_glcontext); SDL_GL_MakeCurrent(data->m_window, data->m_glcontext);
#endif #endif
@@ -158,14 +158,14 @@ void SdlAppDisplay::Enable()


void SdlAppDisplay::Disable() void SdlAppDisplay::Disable()
{ {
#if USE_SDL
#if LOL_USE_SDL
SDL_GL_SwapWindow(data->m_window); SDL_GL_SwapWindow(data->m_window);
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
#endif #endif
} }


#if USE_SDL
#if LOL_USE_SDL
int SceneDisplay::GetPhysicalCount() int SceneDisplay::GetPhysicalCount()
{ {
return SDL_GetNumVideoDisplays(); return SDL_GetNumVideoDisplays();
@@ -175,7 +175,7 @@ const char* SceneDisplay::GetPhysicalName(int index)
{ {
return SDL_GetDisplayName(index); return SDL_GetDisplayName(index);
} }
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
// Not implemented // Not implemented
#endif #endif


@@ -187,10 +187,10 @@ class SdlAppData
friend class SdlApp; friend class SdlApp;


private: private:
#if USE_SDL
#if LOL_USE_SDL
SDL_Window *m_window; SDL_Window *m_window;
SDL_GLContext m_glcontext; SDL_GLContext m_glcontext;
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
SDL_Surface *m_window; SDL_Surface *m_window;
#endif #endif
}; };
@@ -201,7 +201,7 @@ private:
SdlApp::SdlApp(char const *title, ivec2 res, float fps) : SdlApp::SdlApp(char const *title, ivec2 res, float fps) :
data(new SdlAppData()) data(new SdlAppData())
{ {
#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
ivec2 window_size = res; ivec2 window_size = res;
ivec2 screen_size = res; ivec2 screen_size = res;


@@ -210,7 +210,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) :
Audio::Setup(2); Audio::Setup(2);


/* Autoreleased objects */ /* Autoreleased objects */
#if defined USE_XINPUT
#if defined LOL_USE_XINPUT
/* Prefer D3d9 for joysticks on Windows, because the X360 pads are not /* Prefer D3d9 for joysticks on Windows, because the X360 pads are not
* advertised with the proper number of axes. */ * advertised with the proper number of axes. */
new D3d9Input(); new D3d9Input();
@@ -222,7 +222,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) :


void SdlApp::ShowPointer(bool show) void SdlApp::ShowPointer(bool show)
{ {
#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
SDL_ShowCursor(show ? 1 : 0); SDL_ShowCursor(show ? 1 : 0);
#endif #endif
} }
@@ -235,9 +235,9 @@ void SdlApp::Tick()


SdlApp::~SdlApp() SdlApp::~SdlApp()
{ {
#if USE_SDL
#if LOL_USE_SDL
SDL_Quit(); SDL_Quit();
#elif USE_OLD_SDL
#elif LOL_USE_OLD_SDL
SDL_Quit(); SDL_Quit();
#endif #endif
delete data; delete data;


+ 25
- 25
src/platform/sdl/sdlinput.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -12,7 +12,7 @@


#include <lol/engine-internal.h> #include <lol/engine-internal.h>


#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
# if HAVE_SDL2_SDL_H # if HAVE_SDL2_SDL_H
# include <SDL2/SDL.h> # include <SDL2/SDL.h>
# elif HAVE_SDL_SDL_H # elif HAVE_SDL_SDL_H
@@ -39,7 +39,7 @@
namespace lol namespace lol
{ {


#if USE_OLD_SDL
#if LOL_USE_OLD_SDL
/* Quick and dirty for now... This is deprecated anyway. */ /* Quick and dirty for now... This is deprecated anyway. */
static int sdl12_to_scancode(int ch, int sc) static int sdl12_to_scancode(int ch, int sc)
{ {
@@ -119,11 +119,11 @@ private:
m_tick_in_draw_thread(false) 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; array<SDL_Joystick *, InputDeviceInternal *> m_joysticks;
InputDeviceInternal *m_mouse; InputDeviceInternal *m_mouse;
InputDeviceInternal *m_keyboard; InputDeviceInternal *m_keyboard;
#endif // USE_SDL
#endif // LOL_USE_SDL


ivec2 m_prevmouse; ivec2 m_prevmouse;
vec2 m_app; 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; m_data->m_tick_in_draw_thread = true;
#endif #endif


#if USE_OLD_SDL
#if LOL_USE_OLD_SDL
/* Enable Unicode translation of keyboard events */ /* Enable Unicode translation of keyboard events */
SDL_EnableUNICODE(1); SDL_EnableUNICODE(1);
#endif #endif


#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
SDL_Init(SDL_INIT_TIMER | SDL_INIT_JOYSTICK); SDL_Init(SDL_INIT_TIMER | SDL_INIT_JOYSTICK);
#endif #endif


m_data->m_keyboard = InputDeviceInternal::CreateStandardKeyboard(); m_data->m_keyboard = InputDeviceInternal::CreateStandardKeyboard();
m_data->m_mouse = InputDeviceInternal::CreateStandardMouse(); m_data->m_mouse = InputDeviceInternal::CreateStandardMouse();


#if USE_SDL || USE_OLD_SDL
#if LOL_USE_SDL || LOL_USE_OLD_SDL
# if !EMSCRIPTEN # if !EMSCRIPTEN
# if SDL_FORCE_POLL_JOYSTICK # if SDL_FORCE_POLL_JOYSTICK
SDL_JoystickEventState(SDL_QUERY); 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. * - HDAPS, it's not a real joystick.
* - X360 controllers, Xinput handles them better since * - X360 controllers, Xinput handles them better since
* it won't think there is only one trigger axis. */ * it won't think there is only one trigger axis. */
# if USE_SDL
# if LOL_USE_SDL
char const *name = SDL_JoystickName(sdlstick); char const *name = SDL_JoystickName(sdlstick);
# elif USE_OLD_SDL
# elif LOL_USE_OLD_SDL
char const *name = SDL_JoystickName(i); char const *name = SDL_JoystickName(i);
# endif # endif
if (strstr(name, "HDAPS") if (strstr(name, "HDAPS")
# if USE_XINPUT
# if LOL_USE_XINPUT
|| strstr(name, "XBOX 360 For Windows") || strstr(name, "XBOX 360 For Windows")
# endif //USE_XINPUT
# endif //LOL_USE_XINPUT
|| false) || false)
{ {
SDL_JoystickClose(sdlstick); SDL_JoystickClose(sdlstick);
@@ -206,7 +206,7 @@ SdlInput::SdlInput(int app_w, int app_h, int screen_w, int screen_h)


SdlInput::~SdlInput() SdlInput::~SdlInput()
{ {
#if (USE_SDL || USE_OLD_SDL) && !EMSCRIPTEN
#if (LOL_USE_SDL || LOL_USE_OLD_SDL) && !EMSCRIPTEN
/* Unregister all the joysticks we added */ /* Unregister all the joysticks we added */
while (m_data->m_joysticks.count()) while (m_data->m_joysticks.count())
{ {
@@ -236,7 +236,7 @@ void SdlInput::TickDraw(float seconds, Scene &scene)


void SdlInputData::Tick(float seconds) 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. */ /* Pump all joystick events because no event is coming to us. */
# if SDL_FORCE_POLL_JOYSTICK && !EMSCRIPTEN # if SDL_FORCE_POLL_JOYSTICK && !EMSCRIPTEN
SDL_JoystickUpdate(); SDL_JoystickUpdate();
@@ -263,7 +263,7 @@ void SdlInputData::Tick(float seconds)


case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
# if USE_OLD_SDL
# if LOL_USE_OLD_SDL
switch (int sc = sdl12_to_scancode(event.key.keysym.sym, switch (int sc = sdl12_to_scancode(event.key.keysym.sym,
event.key.keysym.scancode)) event.key.keysym.scancode))
# else # else
@@ -300,7 +300,7 @@ void SdlInputData::Tick(float seconds)
} }
# endif # endif
default: default:
# if USE_OLD_SDL
# if LOL_USE_OLD_SDL
m_keyboard->SetKey(sc ? sc : event.key.keysym.scancode, m_keyboard->SetKey(sc ? sc : event.key.keysym.scancode,
event.type == SDL_KEYDOWN); event.type == SDL_KEYDOWN);
# else # else
@@ -334,7 +334,7 @@ void SdlInputData::Tick(float seconds)
} }
break; break;


# if USE_OLD_SDL
# if LOL_USE_OLD_SDL
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
if (event.button.button != SDL_BUTTON_WHEELUP && event.button.button != SDL_BUTTON_WHEELDOWN) 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) if (InputDeviceInternal::GetMouseCapture() != m_mousecapture)
{ {
m_mousecapture = InputDeviceInternal::GetMouseCapture(); m_mousecapture = InputDeviceInternal::GetMouseCapture();
# if USE_SDL
# if LOL_USE_SDL
SDL_SetRelativeMouseMode(m_mousecapture ? SDL_TRUE : SDL_FALSE); 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); SDL_WM_GrabInput(m_mousecapture ? SDL_GRAB_ON : SDL_GRAB_OFF);
# endif # endif
mouse = (ivec2)m_app / 2; mouse = (ivec2)m_app / 2;
@@ -414,7 +414,7 @@ void SdlInputData::Tick(float seconds)


//Mouse is focused, Validate the InScreen Key //Mouse is focused, Validate the InScreen Key
//Hardcoded 3, not very nice. //Hardcoded 3, not very nice.
# if !EMSCRIPTEN && USE_OLD_SDL
# if !EMSCRIPTEN && LOL_USE_OLD_SDL
m_mouse->SetKey(3, !!(SDL_GetAppState() & SDL_APPMOUSEFOCUS)); m_mouse->SetKey(3, !!(SDL_GetAppState() & SDL_APPMOUSEFOCUS));
# else # else
//Handled in PollEvent //Handled in PollEvent
@@ -430,7 +430,7 @@ void SdlInputData::Tick(float seconds)


#else #else
UNUSED(seconds); UNUSED(seconds);
#endif //USE_SDL
#endif //LOL_USE_SDL
} }


// NOTE: these two functions are pointless now and could be inlined directly // NOTE: these two functions are pointless now and could be inlined directly
@@ -438,8 +438,8 @@ ivec2 SdlInputData::GetMousePos()
{ {
ivec2 ret(-1, -1); 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) if (SDL_GetAppState() & SDL_APPMOUSEFOCUS)
# endif # endif
{ {
@@ -452,9 +452,9 @@ ivec2 SdlInputData::GetMousePos()


void SdlInputData::SetMousePos(ivec2 position) void SdlInputData::SetMousePos(ivec2 position)
{ {
#if USE_SDL
#if LOL_USE_SDL
// FIXME: how do I warped mouse? // 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); SDL_WarpMouse((uint16_t)position.x, (uint16_t)position.y);
#else #else
UNUSED(position); UNUSED(position);


+ 8
- 8
src/sample.cpp View File

@@ -1,7 +1,7 @@
// //
// Lol Engine // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -16,7 +16,7 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>


#if USE_SDL_MIXER
#if LOL_USE_SDL_MIXER
# if HAVE_SDL_SDL_H # if HAVE_SDL_SDL_H
# include <SDL/SDL.h> # include <SDL/SDL.h>
# include <SDL/SDL_mixer.h> # include <SDL/SDL_mixer.h>
@@ -42,7 +42,7 @@ class SampleData


private: private:
String m_name; String m_name;
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
Mix_Chunk *m_chunk; Mix_Chunk *m_chunk;
int m_channel; int m_channel;
#endif #endif
@@ -57,7 +57,7 @@ Sample::Sample(char const *path)
{ {
data->m_name = String("<sample> ") + path; data->m_name = String("<sample> ") + path;


#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
for (auto candidate : System::GetPathList(path)) for (auto candidate : System::GetPathList(path))
{ {
data->m_chunk = Mix_LoadWAV(candidate.C()); data->m_chunk = Mix_LoadWAV(candidate.C());
@@ -74,7 +74,7 @@ Sample::Sample(char const *path)


Sample::~Sample() Sample::~Sample()
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
if (data->m_chunk) if (data->m_chunk)
Mix_FreeChunk(data->m_chunk); Mix_FreeChunk(data->m_chunk);
#endif #endif
@@ -93,7 +93,7 @@ char const *Sample::GetName()


void Sample::Play() void Sample::Play()
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
if (data->m_chunk) if (data->m_chunk)
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, 0); data->m_channel = Mix_PlayChannel(-1, data->m_chunk, 0);
#endif #endif
@@ -101,7 +101,7 @@ void Sample::Play()


void Sample::Loop() void Sample::Loop()
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
if (data->m_chunk) if (data->m_chunk)
data->m_channel = Mix_PlayChannel(-1, data->m_chunk, -1); data->m_channel = Mix_PlayChannel(-1, data->m_chunk, -1);
#endif #endif
@@ -109,7 +109,7 @@ void Sample::Loop()


void Sample::Stop() void Sample::Stop()
{ {
#if defined USE_SDL_MIXER
#if defined LOL_USE_SDL_MIXER
if (data->m_channel >= 0) if (data->m_channel >= 0)
Mix_HaltChannel(data->m_channel); Mix_HaltChannel(data->m_channel);
data->m_channel = -1; data->m_channel = -1;


+ 3
- 3
src/scene.cpp View File

@@ -53,7 +53,7 @@ static array<SceneDisplay*> m_scene_displays;


static inline void gpu_marker(char const *message) static inline void gpu_marker(char const *message)
{ {
#if USE_GLEW
#if LOL_USE_GLEW
if (GLEW_GREMEDY_string_marker) if (GLEW_GREMEDY_string_marker)
glStringMarkerGREMEDY(0, message); glStringMarkerGREMEDY(0, message);
#endif #endif
@@ -700,7 +700,7 @@ void Scene::render_tiles() // XXX: rename to Blit()
rc.SetBlendEquation(BlendEquation::Add, BlendEquation::Max); rc.SetBlendEquation(BlendEquation::Add, BlendEquation::Max);
rc.SetAlphaFunc(AlphaFunc::GreaterOrEqual, 0.01f); 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); glEnable(GL_TEXTURE_2D);
#endif #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); glDisable(GL_TEXTURE_2D);
#endif #endif
} }


+ 1
- 1
src/t/Makefile.am View File

@@ -6,7 +6,7 @@ noinst_PROGRAMS = $(testsuite)
TESTS = $(testsuite) TESTS = $(testsuite)


# Conditionally built for now because of STLport issues # 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 testsuite = test-base test-math test-sys test-image test-entity
endif endif




+ 11
- 9
src/video.cpp View File

@@ -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> #include <lol/engine-internal.h>
@@ -59,7 +61,7 @@ void Video::SetDebugRenderMode(DebugRenderMode d)
case DebugRenderMode::UV: case DebugRenderMode::UV:
{ {
#if defined HAVE_GLES_2X #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); glEnable(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
#endif #endif
@@ -68,7 +70,7 @@ void Video::SetDebugRenderMode(DebugRenderMode d)
case DebugRenderMode::Wireframe: case DebugRenderMode::Wireframe:
{ {
#if defined HAVE_GLES_2X #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); glDisable(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
#endif #endif
@@ -96,7 +98,7 @@ void Video::Destroy()


void Video::Capture(uint32_t *buffer) 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]; GLint v[4];
glGetIntegerv(GL_VIEWPORT, v); glGetIntegerv(GL_VIEWPORT, v);
int width = v[2], height = v[3]; int width = v[2], height = v[3];


+ 1
- 1
tools/Makefile.am View File

@@ -13,7 +13,7 @@ make_font_SOURCES = make-font.cpp
make_font_CPPFLAGS = @CACA_CFLAGS@ make_font_CPPFLAGS = @CACA_CFLAGS@
make_font_LDFLAGS = @CACA_LIBS@ make_font_LDFLAGS = @CACA_LIBS@


if USE_CACA
if LOL_USE_CACA
make_font = make-font make_font = make-font
endif endif



+ 1
- 4
tools/lolunit/lolunit.h View File

@@ -1,7 +1,7 @@
// //
// Lol Engine — Unit test implementation // 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 // Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it // the extent permitted by applicable law. You can redistribute it
@@ -26,9 +26,6 @@
# undef near /* Fuck Microsoft */ # undef near /* Fuck Microsoft */
# undef far /* Fuck Microsoft again */ # undef far /* Fuck Microsoft again */
#elif defined _WIN32 #elif defined _WIN32
# if defined USE_D3D9
# include <d3d9.h>
# endif
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# include <windows.h> # include <windows.h>
# undef near /* Fuck Microsoft */ # undef near /* Fuck Microsoft */


Loading…
Cancel
Save