changeset 573:14640d0688d3

Make timeline stuff optional.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 05 Apr 2013 00:32:06 +0300
parents 5a051ead61db
children 2c3afff104c6
files Makefile.gen config.mak.in dmengine.c dmengine.h dmsimple.c
diffstat 5 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.gen	Sun Mar 17 04:34:12 2013 +0200
+++ b/Makefile.gen	Fri Apr 05 00:32:06 2013 +0300
@@ -15,6 +15,10 @@
 ###
 ### Editor
 ###
+ifeq ($(DM_USE_TIMELINE),yes)
+DM_CFLAGS+=-DDM_USE_TIMELINE
+DMLIB_OBJS += dmtimeline.o dmtimelinew.o
+
 ifeq ($(DM_BUILD_EDITOR),yes)
 ifneq ($(DEMO_BIN),)
 BINARIES += ed_$(DEMO_BIN)
@@ -22,6 +26,7 @@
 TMPFILES += $(OBJPATH)moc_*
 endif
 endif
+endif
 
 EDITOR_PRO = editor.pro
 EDITOR_MAKEFILE = Makefile.editor
@@ -240,7 +245,7 @@
 DMLIB_A=$(OBJPATH)dmlib.a
 DMLIB_OBJS += dmfile.o dmbstr.o dmlib.o dmlerp.o dmstring.o \
 	dmargs.o dmvecmat.o dmperlin.o dmimage.o \
-	dmwav.o	dmengine.o dmtimeline.o dmtimelinew.o dmq3d.o
+	dmwav.o	dmengine.o  dmq3d.o
 
 ifeq ($(DM_BUILD_TESTS),yes)
 BINARIES += vecmattest fptest
--- a/config.mak.in	Sun Mar 17 04:34:12 2013 +0200
+++ b/config.mak.in	Fri Apr 05 00:32:06 2013 +0300
@@ -8,6 +8,9 @@
 # that is implemented via modified stb_image.c's PNG loader.
 DM_USE_LIBPNG=yes
 
+# Timeline support? (required for editor and complex demos)
+DM_USE_TIMELINE=yes
+
 # Build Qt based demo editor?
 DM_BUILD_EDITOR=yes
 
--- a/dmengine.c	Sun Mar 17 04:34:12 2013 +0200
+++ b/dmengine.c	Fri Apr 05 00:32:06 2013 +0300
@@ -356,5 +356,3 @@
 {
     return engineGetTime(engine, t) / 1000;
 }
-
-
--- a/dmengine.h	Sun Mar 17 04:34:12 2013 +0200
+++ b/dmengine.h	Fri Apr 05 00:32:06 2013 +0300
@@ -102,6 +102,9 @@
 } DMEffect;
 
 
+#ifdef DM_USE_TIMELINE
+
+
 typedef struct
 {
     Uint32 start, duration;
@@ -185,15 +188,19 @@
     DMPreparedEventGroup **groups;
 } DMPreparedTimeline;
 
+#endif
+
 
 typedef struct DMEngineData
 {
     DMResourceLib *resources;
     void **effectData;
 
+#ifdef DM_USE_TIMELINE
     DMResource *timeline;
     DMTimeline *tl;
     DMPreparedTimeline *ptl;
+#endif
 
     int frameTime, frameCount,
         startTime, endTime,
@@ -240,6 +247,7 @@
 DMEffect *engineFindEffectByName(const char *name);
 
 
+#ifdef DM_USE_TIMELINE
 // Basic timeline handling
 int  dmLoadTimeline(DMResource *res, DMTimeline **tl);
 void dmFreeTimeline(DMTimeline *tl);
@@ -275,6 +283,8 @@
 int  dmTimelineEventSetEffectByIndex(DMTimelineEvent *event, const int index);
 int  dmTimelineEventSetEffectByName(DMTimelineEvent *event, const char *name);
 
+#endif // DM_USE_TIMELINE
+
 
 // Resource helpers
 #define engineGetResImage(eng, x, name) \
--- a/dmsimple.c	Sun Mar 17 04:34:12 2013 +0200
+++ b/dmsimple.c	Fri Apr 05 00:32:06 2013 +0300
@@ -295,6 +295,7 @@
     }
 
     // Use a timeline, if set
+#ifdef DM_USE_TIMELINE
     if (engine.timeline != NULL)
     {
         if ((err = dmLoadTimeline(engine.timeline, &engine.tl)) != DMERR_OK)
@@ -311,6 +312,7 @@
             goto error_exit;
         }
     }
+#endif
 
     dmPrint(1, "Starting up.\n");
 
@@ -390,11 +392,13 @@
             if ((err = engine.demoRender(&engine)) != DMERR_OK)
                 goto error_exit;
         }
+#ifdef DM_USE_TIMELINE
         else
         {
             if ((err = dmExecuteTimeline(engine.ptl, engine.screen, engineGetTick(&engine))) != DMERR_OK)
                 goto error_exit;
         }
+#endif
 
         // Flip screen
         if (SDL_MUSTLOCK(engine.screen) != 0)
@@ -430,8 +434,11 @@
 #endif
     SDL_UnlockAudio();
 
+#ifdef DM_USE_TIMELINE
     dmFreeTimeline(engine.tl);
     dmFreePreparedTimelineData(engine.ptl);
+#endif
+
     engineShutdownEffects(&engine);
     dmres_close(engine.resources);