Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbText command

Author
Message
Dartec
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location:
Posted: 16th Sep 2008 14:28
Hi, I am getting nowhere with using dbText. I always get a compile error when I try to use dbText to display some text.

If I use dbText (0,0,"Hello"); this works fine but I wish to display the camera position x,y,z.

Below is my code, I am playing with the tutorials to learn so modifying as I understand things:

[// get camera x position
xval = dbCameraPositionX (0);
dbStr$ (xtext, xval);
// camera position co-ords
dbText ( 0, 0, xtext);]

The help file on Dark GDK give the commands and syntax but not sure as to the syntax:

eg: help file says - char* dbStr$ ( char* szString, int iValue )

so do I type: char* dbstr$ ( char* xtext, xval);

I have tried all ways and still get error when compiling such as:

'main.cpp(78) : error C3861: 'dbStr$': identifier not found'

or

'main.cpp(78) : error C2440: 'initializing' : cannot convert from 'int' to 'char *'

I am at alost as to print the text I want - such a simple task surely?

Regards.
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 16th Sep 2008 18:41

I think?
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 16th Sep 2008 23:13 Edited at: 16th Sep 2008 23:14
Try this


Dartec
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location:
Posted: 17th Sep 2008 01:55
Gentlemen, many thanks for your code snippets and help. I tried both and the latter one worked so not sure why the former didn't.

Will play with the former as to why it isn't working and still giving the same errors.

As said the latter does and I tried a font change and it responed.

So once again many thanks gents for putting me back on the track.

Regards
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 17th Sep 2008 22:29
I think the dollar sign shouldnt be in there. must be bad documentation, as uaual from TGC. were in a world of our own, us GDKers
Dartec
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location:
Posted: 18th Sep 2008 01:54
This is the problem, the examples do not work or give errors which do not make sense or is not clear from the help file syntax.

From your snippet jezza and the change of $ sign line 2:

dbStr (char* xtext, xval); - gives these errors:

error C2144: syntax error : 'char' should be preceded by ')'
error C2661: 'dbStr' : no overloaded function takes 0 arguments
error C2059: syntax error : ')'

so no idea as to why.

I upgraded Express to SP1 would Dark GDK need to be upgraded, just a thought.

cheers.
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 18th Sep 2008 12:08 Edited at: 18th Sep 2008 12:08
dbStr was used wrong this will work:



Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 19th Sep 2008 10:45
i use commands similar to :



to display camera/mouse/keypressed commands all the time

The above code will set an integer "mouseclick" to hold the values of the mouse buttons being clicked, and spritecollide holds the value of any sprite that comes into collision with "iMySprite", then we simply display the values of the Camera X, Y, Z positions, and the values of "mouseclick" and "spritecollide" using the dbText() function, obtaining its char* value by calling the dbStr() function to convert the integers "mouseclick" and "spritecollide" aswell as those returned by calling dbCameraPosition() to char* values useable by dbText()

If it ain't broke.... DONT FIX IT !!!
Dartec
16
Years of Service
User Offline
Joined: 14th Sep 2008
Location:
Posted: 22nd Sep 2008 11:37
Thank you.

I am just getting used to moveing around with dbContralCameraUsingArrows, plus the difference with Rotate, Turn, Pitch and Roll. Next I wil try mouse control.

Login to post a reply

Server time is: 2024-09-30 07:29:33
Your offset time is: 2024-09-30 07:29:33