From d41ada0c450a5c5649e0eaf7b8b9a6f0dad6803c Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Mon, 9 Nov 2015 02:13:41 +0100 Subject: [PATCH] simplify inclusion of personal animations which not meant to be included in the official repo --- Makefile | 1 + config.in | 7 ++++++- src/display_loop.c | 4 ++++ src/user/Makefile | 25 +++++++++++++++++++++++++ src/user/config.in | 18 ++++++++++++++++++ src/user/user_loop.c | 23 +++++++++++++++++++++++ src/user/user_loop.h | 11 +++++++++++ 7 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 src/user/Makefile create mode 100644 src/user/config.in create mode 100644 src/user/user_loop.c create mode 100644 src/user/user_loop.h diff --git a/Makefile b/Makefile index 52fa4cc..02a2abf 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ include $(MAKETOPDIR)/defaults.mk @ echo "SUBDIRS += $(TOPDIR)/animations" >> $@ @ echo "SUBDIRS += $(TOPDIR)/animations/bitmapscroller" >> $@ @ echo "SUBDIRS += $(TOPDIR)/smallani" >> $@ + @ echo "SUBDIRS += $(TOPDIR)/user" >> $@ @ (for subdir in `grep -e "^#define .*_SUPPORT" $(TOPDIR)/autoconf.h \ | sed -e "s/^#define /$(TOPDIR)\//" -e "s/_SUPPORT.*//" \ | tr "[A-Z]\\n" "[a-z] " `; do \ diff --git a/config.in b/config.in index 291303b..17595ff 100644 --- a/config.in +++ b/config.in @@ -90,6 +90,11 @@ source src/animations/config.in ############################################################################### -### small Animations Menu ##################################################### +### Small Animations Menu ##################################################### source src/smallani/config.in ############################################################################### + + +### User Menu ################################################################# +source src/user/config.in +############################################################################### diff --git a/src/display_loop.c b/src/display_loop.c index 8227b34..441324f 100644 --- a/src/display_loop.c +++ b/src/display_loop.c @@ -51,6 +51,8 @@ # include "joystick/joystick.h" #endif +#include "user/user_loop.h" + volatile unsigned char oldMode, oldOldmode, reverseMode, mode; jmp_buf newmode_jmpbuf; @@ -320,6 +322,8 @@ void display_loop(){ break; #endif +#include "user/user_loop.c" + #ifdef MENU_SUPPORT case 0xFDu: mode = 1; diff --git a/src/user/Makefile b/src/user/Makefile new file mode 100644 index 0000000..173e0f1 --- /dev/null +++ b/src/user/Makefile @@ -0,0 +1,25 @@ +# This file eases the integration of your personal animations which are not +# meant to be included in the official Borgware-2D repository. +# +# Just add your own source files to the SRC variable (checking for options +# introduced in your config.in file) as shown in the commented samples. + +MAKETOPDIR = ../.. + +TARGET = libuser.a + +include $(MAKETOPDIR)/defaults.mk + + +# ifeq ($(ANIMATION_MY_SIMPLE_ANIM),y) +# SRC += my_simple_anim.c +# endif + +# ifeq ($(ANIMATION_MY_COMPLEX_ANIM),y) +# SRC += my_complex_anim.c +# endif + + +include $(MAKETOPDIR)/rules.mk + +include $(MAKETOPDIR)/depend.mk diff --git a/src/user/config.in b/src/user/config.in new file mode 100644 index 0000000..9820b48 --- /dev/null +++ b/src/user/config.in @@ -0,0 +1,18 @@ +# This file eases the integration of your personal animations which are not +# meant to be included in the official Borgware-2D repository. +# +# Just add configurations options for your animations here as shown in the +# commented samples. + +mainmenu_option next_comment +comment "User Animations" + comment "Insert config options for your own animations here!" + +# bool "A simple anim" ANIMATION_MY_SIMPLE_ANIM $RANDOM_SUPPORT + +# dep_bool_menu "A complex anim" ANIMATION_MY_COMPLEX_ANIM $RANDOM_SUPPORT +# int "Sample integer config value" MY_SAMPLE_INT 100 +# bool "Sample boolean config value" MY_SAMPLE_BOOL y +# endmenu + +endmenu diff --git a/src/user/user_loop.c b/src/user/user_loop.c new file mode 100644 index 0000000..aebe851 --- /dev/null +++ b/src/user/user_loop.c @@ -0,0 +1,23 @@ +/* This file eases the integration of your personal animations which are not + meant to be included in the official Borgware-2D repository. + + It is inserted at the middle of the big switch/case block of the + src/display_loop.c file. Please make sure that your use a mode number + greater or equal than 200 to avoid conflicts with newer upstream + animations. + + Just add your header #include directives as shown in the commented + samples. */ + +// #ifdef ANIMATION_MY_SIMPLE_ANIM +// case 200: +// my_simple_animation(); +// break; +// #endif + +// #ifdef ANIMATION_MY_COMPLEX_ANIM +// case 201: +// my_complex_animation(MY_SAMPLE_INT, MY_SAMPLE_BOOL); +// break; +// #endif + diff --git a/src/user/user_loop.h b/src/user/user_loop.h new file mode 100644 index 0000000..cd33b4c --- /dev/null +++ b/src/user/user_loop.h @@ -0,0 +1,11 @@ +/* This file eases the integration of your personal animations which are not + meant to be included in the official Borgware-2D repository. + + It is inserted at the beginning of the src/display_loop.c file. + + Just add your header #include directives as shown in the commented + samples. */ + +// #include "my_simple_animation.h" + +// #include "my_complex_animation.h"