gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > easy way to "print" to the emulator screen please?

#47058 - solarwind__ - Mon Jul 04, 2005 5:46 pm

in devkitadvance, you have to literally "draw" the text to the screen with pixels and lots of annoying for loops. But in visualHAM there is a function to just print out to the emulator screen any text just like a "printf();" or a"cout" statement in c. Is there anyway to do that with devkitadv? or is there a place to download header/library files so that i can do that? any help is much appreciated

Thanks in advance
_________________
#solarwind

#47060 - yaustar - Mon Jul 04, 2005 6:24 pm

I believe posprintf does. I haven't used it myself though.

#47061 - poslundc - Mon Jul 04, 2005 6:30 pm

Actually, posprintf is just a GBA-oriented replacement for sprintf, which doesn't innately handle console printing (unless there's an output buffer, like stdout, for it to write to).

Such things are emulator-dependent. My guess is it's probably implemented through a SWI call. You might be able to find out more on VBA's homepage.

Dan.

Edit: Hey, look, I was right: http://vba.ngemu.com/faq.shtml#cat12_5

#47064 - tepples - Mon Jul 04, 2005 7:04 pm

The general technique:
  1. Format your output using siprintf() or posprintf().
  2. Write the text to the screen using something that implements puts().

For step 2, you might want to try my AGBTTY library, which implements putc(), puts(), and write() in a way that's familiar to people coming from C on a PC.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.