GP2X Displaying Text


RiX0R

Idler-Inside
Joined
Sep 20, 2005
Messages
294
Website
rix0r.nl
I hope this question makes any sense -- I'm not very experienced in low-level C coding/Linux library code and whatnot...

What are our options for displaying text on the gp2x? I've used pygame previously, which includes SDL_ttf. SDL_ttf is in some ways a bit annoying to use, but I guess text drawing is always annoying, because it has been on every platform I've had to do it. In any case, it's more than adequate.

Can someone tell me if we have SDL_ttf available on the '2x? If not, can I compile it from source with the ARM compiler and then just link it into my executable?

If so, how would I go about this?

Or are there easier alternatives?

Experienced hackers, please shed your lights B).
 
theoddbot posted on Dec 3 2005 at 01:18 AM said:
I've put a library bundle up, same as I used for pygame.

http://brendan.mine.nu/gp2x-libs-theoddbot.tar.gz

Includes:
cairo
fontconfig
include
libsdl_svg
libsvg-cairo
poppler
SDL_mixer
expat
freetyp
lib
libsvg
libxml2
SDL_gfx
SDL_ttf


Hello. This sounds interesting. Is this a replacement for (eg) the SDL_mixer provided in the libsgp2x.tar.gz bundle? I've had problems getting that to link.
 
Last edited by a moderator:
Andrew Williams (aka evening2005) has a nice set of functions called AW_Font that allow you to display text simply, though you do need a font file or two. You can find the lot in the Pong code.
 
Well, I have also trouble linking sdl_ttf. I use the opn2x toolchain, when I try to link sdl_ttf I get following errors ...

Code:
/home/kim/gp2xdev/bin/../lib/gcc/arm-open2x-linux/4.0.2/../../../../arm-open2x-linux/bin/ld: ERROR: /home/kim/gp2xdev/lib/libSDL_ttf.a(SDL_ttf.o) [B]uses hardware FP, whereas bl0ckz.gpe uses software FP[/B]
/home/kim/gp2xdev/bin/../lib/gcc/arm-open2x-linux/4.0.2/../../../../arm-open2x-linux/bin/ld: [B]failed to merge target specific data of file[/B]

wtf does that means? and how to fix that?
 
nickspoon posted on Dec 3 2005 at 05:32 PM said:
Andrew Williams (aka evening2005) has a nice set of functions called AW_Font that allow you to display text simply, though you do need a font file or two. You can find the lot in the Pong code.

My AWFont class can use font bitmaps created with Bitmap Font Builder. I didn't use SDL_ttf at the time I created AWFont because I couldn't make it work with our PS2 Linux dev kits at work. If SDL_ttf works on the GP2X, that would be far better, but if not, AWFont is a quick and easy solution.
 
Last edited by a moderator:
synkro posted on Dec 5 2005 at 01:07 AM said:
Well, I have also trouble linking sdl_ttf. I use the opn2x toolchain, when I try to link sdl_ttf I get following errors ...

Code:
/home/kim/gp2xdev/bin/../lib/gcc/arm-open2x-linux/4.0.2/../../../../arm-open2x-linux/bin/ld: ERROR: /home/kim/gp2xdev/lib/libSDL_ttf.a(SDL_ttf.o) [B]uses hardware FP, whereas bl0ckz.gpe uses software FP[/B]
/home/kim/gp2xdev/bin/../lib/gcc/arm-open2x-linux/4.0.2/../../../../arm-open2x-linux/bin/ld: [B]failed to merge target specific data of file[/B]

wtf does that means? and how to fix that?
It means that libSDL_ttf was compiled without -msoft-float (uses hardware FP), while the other libs (possibly including glibc) were compiled with -msoft-float.

Solution: recmpile SDL_ttf using the -msoft-float flag.
 
Last edited by a moderator:
RiX0R posted on Dec 9 2005 at 11:32 PM said:
I'm having the same problem.

Does the GP2X even have a floating point unit?
No, which is why a lot of stuff is compiled with soft-float so it can use the optimised arm floating point support in gcc. Without soft-float and a recent version of gcc, any app that makes extensive use of floating points will grind to a halt on the gp2x. But the thing is if one lib uses soft-float, everything else used in the app (including the app itself) must also be compiled with soft-float.
 
Last edited by a moderator:
So the solution would be to recompile SDL_ttf with soft-float (instead of the other way around).

I'm not quite feeling up to the challenge, so theoddbot, could you pretty please recompile that library packge you graciously shared with us?
 
Yes, please, rebuild the library.
I have a finished game, but I can't compile it for the GP2x due to the problems with the SDL_ttf and the freetype libs.

Thank you very much.
 
theoddbot posted on Dec 10 2005 at 08:41 PM said:
Thought I had plonked it in here earlier. It's missing SDL_mixer.

http://brendan.mine.nu/theoddbot-libs-open...ft-float.tar.gz

I tried thos bit when I use SDL_ttf I get:
Code:
/usr/lib/libfreetype.a(ftgzip.o): In function `ft_gzip_file_init':
ftgzip.c:(.text+0x3c4): undefined reference to `inflateInit2_'
usr/lib/libfreetype.a(ftgzip.o): In function `ft_gzip_file_done':
ftgzip.c:(.text+0x42c): undefined reference to `inflateEnd'
/usr/lib/libfreetype.a(ftgzip.o): In function `ft_gzip_file_reset':
ftgzip.c:(.text+0x508): undefined reference to `inflateReset'
/usr/lib/libfreetype.a(ftgzip.o): In function `ft_gzip_file_fill_output':
ftgzip.c:(.text+0x79c): undefined reference to `inflate'
. . . even though I have -lz in my linker flags
 
Last edited by a moderator:
w00t! it works! I just had -lz at the wrong position. . . . now sdl_mixer and some other minor issues and everything is done!
 
a big thanks to theoddbot for compililing these libs, i was beginning to think there would never be a proper working setup for devkitgp2x :)

i noticed that sdl_image is missing from the distribution. no worries though, just copy the libs and headers from snaffs ones and they work fine. if snaffs sdl_mixer worked then it should work fine also (never tried it myself so dont take my word).
 
The new libraries worked perfect in my case :)
I have compiled a game called Debian vs Pimientos, which is available in the GP2X General Board.
 
Back
Top