summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-30 09:25:41 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-12-03 16:48:02 -0600
commited47f0586d961b846b0b828b7ae76b1675fb4b77 (patch)
treec7071ceb9337ec526398f98eb025bd9ae34403cd /apps
parent1bfd1cc5fc1cc73c8582ac76fc1d5683cc7dce60 (diff)
downloadnuttx-ed47f0586d961b846b0b828b7ae76b1675fb4b77.tar.gz
nuttx-ed47f0586d961b846b0b828b7ae76b1675fb4b77.tar.bz2
nuttx-ed47f0586d961b846b0b828b7ae76b1675fb4b77.zip
Beginning of a 1st person game
Diffstat (limited to 'apps')
-rw-r--r--apps/graphics/traveller/Kconfig27
-rwxr-xr-xapps/graphics/traveller/include/trv_debug.h139
-rwxr-xr-xapps/graphics/traveller/include/trv_types.h73
3 files changed, 239 insertions, 0 deletions
diff --git a/apps/graphics/traveller/Kconfig b/apps/graphics/traveller/Kconfig
new file mode 100644
index 000000000..0906ebab9
--- /dev/null
+++ b/apps/graphics/traveller/Kconfig
@@ -0,0 +1,27 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+config GRAPHICS_TRAVELER
+ bool "Traveller game"
+ default n
+ select SYSTEM_INIFILE
+ ---help---
+ Enable or disable the graphic Traveller game
+
+if GRAPHICS_TRAVELER
+
+config GRAPHICS_TRAVELER_DEBUG_LEVEL
+ int "Debug output level"
+ default 0
+ range 0 3
+ ---help---
+ DEBUG_LEVEL == 3 turns off sound and video and enables verbose debug
+ messages on stdout.
+ DEBUG_LEVEL == 2 turns off sound and video and enables normal debug
+ output
+ DEBUG_LEVEL == 1 turns off sound and enables normal debug output
+ OTHERWISE, all debugging features are disabled.
+
+endif # GRAPHICS_TRAVELER
diff --git a/apps/graphics/traveller/include/trv_debug.h b/apps/graphics/traveller/include/trv_debug.h
new file mode 100755
index 000000000..33632df5f
--- /dev/null
+++ b/apps/graphics/traveller/include/trv_debug.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+ * apps/graphics/traveller/trv_debug.h
+ *
+ * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DEBUG_H
+#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DEBUG_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include "trv_types.h"
+
+#include <debug.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Feature Selection Switches
+ *
+ * CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 3 turns off sound and video and
+ * enables verbose debug messages on stdout.
+ * CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 2 turns off sound and video and
+ * enables normal debug output
+ * CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 1 turns off sound and enables
+ * normal debug output
+ * OTHERWISE, all debugging features are disabled.
+ */
+
+#define ENABLE_SOUND 1
+#define ENABLE_VIDEO 1
+#undef TRV_VERBOSE
+
+#ifndef CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL
+# define CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL 0
+#ielf (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 3)
+# undef ENABLE_SOUND
+# undef ENABLE_VIDEO
+# define TRV_VERBOSE 1
+#elif (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 2)
+# undef ENABLE_SOUND
+# undef ENABLE_VIDEO
+#elif (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL == 1)
+# undef ENABLE_SOUND
+#endif
+
+/* Sound is not yet supported */
+
+#undef ENABLE_SOUND
+
+/* Debug output macros */
+
+#ifdef CONFIG_CPP_HAVE_VARARGS
+# if (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL > 0)
+
+# define trv_debug(format, ...) \
+ printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
+
+# ifdef TRV_VERBOSE
+# define trv_vdebug(format, ...) \
+ printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
+
+# else
+# define vdbg(x...)
+# endif
+
+# else
+
+# define dbg(x...)
+# define vdbg(x...)
+
+# endif
+#else
+
+ /* Variadic macros NOT supported */
+
+# if (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL > 0)
+# ifdef TRV_VERBOSE
+# define trv_vdebug trv_debug
+# else
+# define trv_vdebug (void)
+# endif
+# else
+# define trv_debug (void)
+# define trv_vdebug (void)
+# endif
+
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/* The debugging interfaces are normally accessed via the macros provided
+ * above. If the cross-compiler's C pre-processor supports a variable
+ * number of macro arguments, then those macros below will map all
+ * debug statements to printf.
+ *
+ * If the cross-compiler's pre-processor does not support variable length
+ * arguments, then this additional interface will be built.
+ */
+
+#ifndef CONFIG_CPP_HAVE_VARARGS && (CONFIG_GRAPHICS_TRAVELLER_DEBUG_LEVEL > 0)
+int trv_debug(FAR const char *format, ...);
+#endif
+
+#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_DEBUG_H */
diff --git a/apps/graphics/traveller/include/trv_types.h b/apps/graphics/traveller/include/trv_types.h
new file mode 100755
index 000000000..eb6c8549c
--- /dev/null
+++ b/apps/graphics/traveller/include/trv_types.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * apps/graphics/traveller/trv_types.h
+ *
+ * Copyright (C) 2014 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_TYPES_H
+#define __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_TYPES_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/nx/nxglib.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* The maximum size of a line (for example, in the .INI file) */
+
+#define TRV_MAX_LINE 256
+
+/* Size of one (internal) pixel */
+
+#define TRV_PIXEL_MAX UINT8_MAX
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+typedef uint8_t trv_pixel_t;
+typedef nxgl_mxpixel_t dev_pixel_t;
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#endif /* __APPS_GRAPHICS_TRAVELLER_INCLUDE_TRV_TYPES_H */