www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/27/16:37:31

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro 2.2 's textout function
Date: Thu, 27 Feb 1997 20:17:19 +0000
Organization: None
Distribution: world
Message-ID: <0wbObdAPveFzEwZw@talula.demon.co.uk>
References: <199702251244 DOT NAA06888 AT gil DOT physik DOT rwth-aachen DOT de>
<5ev21b$iav AT news DOT ox DOT ac DOT uk> <33147146 DOT 6CAB AT eev DOT e-technik DOT uni-erlangen DOT de>
<x3E$qCAytJFzEwpN AT talula DOT demon DOT co DOT uk>
<3315B82F DOT 4A6F AT eev DOT e-technik DOT uni-erlangen DOT de>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 53
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

>I think, I was to lazy to write (unsigned char*) before "HELLO" in
>
>    textout(screen,font,(unsigned char*) "HELLO",20,10,1)

I don't think you should have to write that! This will teach me to test 
things more thouroughly: after I changed the type to unsigned, I forgot 
to make sure it worked in C++ (there's no problem with the type difference 
in C).

There's an easy fix, though. In allegro.h, just after the definition of 
destroy_font() (line 918), insert the lines:

<-- snip -->


#ifdef __cplusplus

}  /* end of extern "C" */


__INLINE__ void textout(BITMAP *bmp, FONT *f, char *str, int x, int y, int color)
{
   textout(bmp, f, (unsigned char *)str, x, y, color);
}


__INLINE__ void textout_centre(BITMAP *bmp, FONT *f, char *str, int x, int y, int color)
{
   textout_centre(bmp, f, (unsigned char *)str, x, y, color);
}


__INLINE__ int text_length(FONT *f, char *str)
{
   return text_length(f, (unsigned char *)str);
}


extern "C" {

#endif   /* ifdef __cplusplus */


<-- snip -->

I can't think of any problems that thich could cause. I'll upload a 
patched 2.2 tomorrow...


/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Beauty is a French phonetic corruption of a short cloth neck ornament.
 */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019