Paul Sexton avatar Paul Sexton committed 99bb1b0

Add some conditionally-compiled code to cope with non-SVN version of libtcod (1.4.3b1), as the argument lists of some functions have changed since then.

Comments (0)

Files changed (2)

 
 5. PARSE-RGB.ASD, ASDF system definition file for PARSE-RGB.LISP
 
-CL-TCOD has been tested with SBCL 1.0.32, CLISP 2.48, and Clozure 1.4 on Linux;
-and with CLISP 2.48 on Windows XP. It should work on any common lisp
-implementation where CFFI works.
+CL-TCOD has been tested with SBCL 1.0.32 and Clozure 1.4 on Linux. 
 
 **Note** that it has not been used on a Mac; if you do this you may need to
 tell CFFI what the name of the compiled libtcod library under MacOS is. To do
    (tcod:console-init-root 80 25 "Test" nil)
    (tcod:console-clear tcod:*root*)
    (tcod:console-print-left tcod:*root* 1 1 :set "Hello, world!~%")
-   (tcod:console-flush)
+   (tcod:console-wait-for-keypress t)
 
 
 
 
 (setf cffi:*default-foreign-encoding* :iso-8859-1)
 
+;;; uncomment this form if using pre 1.4.3b1 version of libtcod
+;;;(eval-when (:compile-toplevel :load-toplevel :execute)
+;;;  (pushnew :libtcod-old *features*))
+ 
+ 
 (define-foreign-library libtcod
 	(:unix "libtcod.so")
 	(:windows "libtcod-mingw.dll")
 
 ;;TCODLIB_API void TCOD_console_put_char_ex(TCOD_console_t con,int x, int y,
 ;;                                          int c, TCOD_bkgnd_flag_t flag);
+#-libtcod-old
 (defcfun ("TCOD_console_put_char_ex_wrapper" console-put-char-ex) :void
 	(con console) (x :int) (y :int) (c :unsigned-char)
 	(fg colournum) (bg colournum))
 
 ;; wrapper to TCOD_console_put_char_ex is currently only in SVN
-(unless (cffi:foreign-symbol-pointer "TCOD_console_put_char_ex_wrapper")
-  (defun console-put-char-ex (con x y c fg bg)
+#+libtcod-old
+(defun console-put-char-ex (con x y c fg bg)
     (console-set-fore con x y fg)
-    (console-set-back con x y fg)
-    (console-set-char con x y c)))
+    (console-set-back con x y bg :set)
+    (console-set-char con x y c))
 
     
 ;;TCODLIB_API void TCOD_console_print_left(TCOD_console_t con,int x, int y,
 
 ;;TCODLIB_API void TCOD_console_print_frame(TCOD_console_t con,int x,int y,
 ;; int w,int h, bool empty, const char *fmt, ...);
+#-libtcod-old
 (defcfun ("TCOD_console_print_frame" console-print-frame) :void
   (con console) (x :int) (y :int) (w :int) (h :int)
-  (empty? :boolean) (flag background-flag) (fmt :string) &rest)
+  (empty? :boolean) (flag background-flag) 
+  (fmt :string) &rest)
+
+#+libtcod-old
+(defcfun ("TCOD_console_print_frame" %console-print-frame) :void
+  (con console) (x :int) (y :int) (w :int) (h :int)
+  (empty? :boolean) (fmt :string) &rest)
+
+  
+#+libtcod-old
+(defun console-print-frame (con x y w h empty? flag fmt &rest args)
+  (declare (ignore flag))
+  (%console-print-frame con x y w h empty? 
+    (if (stringp fmt) (apply #'format nil fmt args) +NULL+)))
+  
 
 ;; Added in wrappers.c
+#-libtcod-old
 (defcfun ("TCOD_console_print_double_frame" console-print-double-frame) :void
   (con console) (x :int) (y :int) (w :int) (h :int)
-  (empty? :boolean) (flag background-flag) (fmt :string) &rest)
+  (empty? :boolean) (flag background-flag) 
+  (fmt :string) &rest)
 
+#+libtcod-old
+(defcfun ("TCOD_console_print_double_frame" %console-print-double-frame) :void
+  (con console) (x :int) (y :int) (w :int) (h :int)
+  (empty? :boolean) (fmt :string) &rest)
+
+  
+#+libtcod-old
+(defun console-print-double-frame (con x y w h empty? flag fmt &rest args)
+  (declare (ignore flag))
+  (%console-print-double-frame con x y w h empty? 
+    (if (stringp fmt) (apply #'format nil fmt args) +NULL+)))
+
+  
 ;;TCODLIB_API TCOD_color_t TCOD_console_get_background_color(TCOD_console_t con);
 (defcfun ("TCOD_console_get_background_color"
 	  console-get-background-color) colournum
 
 ;; (sys-flush t) forces an 'update' of the system timer, FPS, etc.
 ;; If render is true, also forces an update of the root console.
+#-libtcod-old
 (defcfun ("TCOD_sys_flush" sys-flush) :void
 	(render :boolean))
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.