bbText could write interger/float on screen?
Blitz3D SDK Forums/Blitz3D SDK Programming/bbText could write interger/float on screen?
I've try this
int mouseX,mouseY;
mouseX = bbMouseX();
mouseY = bbMouseY();
bbText (0,0,mouseX);
bbText (0,20,mouseY);
it did not work because bbText, bbPrint, bbWrite accept only text parameter. anyone coule help? thank you.
Try converting it over to a string then first. What language are you using?
I am not using C but in EBasic or PowerBasic I'd use:
bbText(0,0,str$(mouseX))
bbText(0,20,str$(mouseY))
or:
bbText(0,0,"MX: "+str$(mouseX)+" MY: "+str$(mouseY))
str$ translates a number into a string. I am sure you can use a C equivalent.
Barney
ar... I've finished it up with something like this
int mouseX,mouseY;
char buff[10] ;
mouseX = bbMouseX();
mouseY = bbMouseY();
bbText(0,20,"Mouse X:");
bbText(100,20,itoa(mouseX,buff,10));
bbText(0,40,"Mouse Y:");
bbText(100,40,itoa(mouseY,buff,10));
however, I cannot combine text and converted text into one command. thank you guys,
MeowZ you can combine text and converted text with the C function:- sprintf()
useage: sprintf( buff, "%s %d", "Mouse X:",mouseX);
Check your C documentation for details :)
Cheers,
Roy
Hi Roy,
We cannot use ?printf() to print text on Blitz3d. - -a
in B3D window, must use bbText.
thank you,
Hi MeowZ,
sprintf() is a C string formatting function - it does'nt print anything!
If MouseX=100 then the output for my above example would store the formatted text "Mouse X: 100" in the buffer you declared as char buff[10] though you would have to increase the size of that buffer to something larger.
You would then print the text using bbText(0,20,buff)
Cheers,
Roy
Oh..yessssss
Thank you very much, Roy.