Original Post

Apologies in advance for asking another stupid question.

How do I use vbTextOut? I have a font in font.h, and my code, test.c, goes like this:

#include "libgccvb.h"
#include "font.h"

int main ()
{
	copymem ((void*)CharSeg0, (void*)FONT, 8192);

	vbDisplayOn();
	vbDisplayShow();
	vbFXFadeIn();

	vbTextOut(0, 1, 2,"AAAAAAAA");

	while(1) {}
}

But the text still doesn’t display. What kind of tricks do I need to perform?

7 Replies

you need to change all the last H to C
“#include “font.h” should be “#include “font.c”

akumie schrieb:
yeah, I have alot of time but tried sourcecode and failed , way to hard

HorvatM:

vbTextOut requires the font to be in character segment 3, so just change
copymem ((void*)CharSeg0, (void*)FONT, 8192);
to
copymem ((void*)CharSeg3, (void*)FONT, 8192);

Something else: You only need to use either vbDisplayShow() or vbFXFadeIn(), not both. vbFXFadeIn() fades in nicely, while vbDisplayShow() just displays immediately. If you want a fade in, you need to call vbFXFadeIn() after vbTextOut(), otherwise there won’t be anything on the screen yet that could be faded in. 🙂

I really have no idea what I am doing wrong. Can somebody take a look at this?

Attachments:

Gotta set a world first.

#include "libgccvb.h"
#include "font.h"

int main ()
{
	copymem ((void*)CharSeg3, (void*)FONT, 8192);

	vbDisplayOn();
	vbDisplayShow();

	
	vbTextOut(0, 1, 2, "AAAAAAAA");
	vbTextOut(0, 1, 3, "BBBBBBBB");
	vbTextOut(0, 1, 4, "CCCCCCCC");

	vbSetWorld(31, WRLD_ON|0, 0, 0, 0, 0, 0, 0, 384,224);
	vbSetWorld(30, WRLD_END,0, 0, 0, 0, 0, 0, 0,0);

	while(1) {}
}

Make sure the number after WRLD_ON| is the same as the first parameter you have for vbTextOut (in this case, 0). It is the bgmap that you are storing the text to.

You are writing to BGMap0, but you did not define a world to display BGMap0. This should help:

vbSetWorld(31, WRLD_ON, 0, 0, 0, 0, 0, 0, 384, 224);
vbSetWorld(30, WRLD_END, 0, 0, 0, 0, 0, 0, 0, 0);

EDIT: Matt, you beat me by 27 seconds. 😀

Thanks to both!
KR155E, maybe you should mention this in your programming tutorial. Just a suggestion.

I think the demo (http://www.vr32.de/content/downloads/roms/vb_programming_intro_demo.zip) – in fact, pretty much the whole Wiki – is pretty clear on the fact that BGMaps and Objects need to be in Worlds to be displayed…

Is there another tutorial I’m not seeing?

 

Write a reply

You must be logged in to reply to this topic.