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 / Its quiet in here...

Author
Message
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 7th Aug 2005 21:10
Hey SDK users

Seems quite in this forum? I guess everyone is doing the same as me, i.e. sat down with a C++ book

Seriously, anyone up to anything that's going to show off the SDK? Or.. any dates for the next update?

p.s. while I'm here, does anyone know how you print out hoe many objects are in a list using dbText? i.e. I have a list (via the joys of STL) of game objects and I want to know how many I've spawned. I loop the list using an iterator, something like this..



..and I tried to do dbText(10,10,dbStr(objlist.end)), but I don't think the .end can cast to a string. But then, I'm new to this Maybe there is a total or size thang that I'm missing.

Cheers in advance!
zao420
20
Years of Service
User Offline
Joined: 5th Aug 2003
Location: Canada
Posted: 7th Aug 2005 21:18
hey Lampton i am pretty new aswell, but wouldn't you use

dbText(10,10,dbStr( objlist.size() ))
size will return an int and should have no problem converting to string with dbStr.

now if you want to print out each object you would use the code you posted.

can anuone else say this is right.

http://cavesoft.no-ip.com
WIP Version of my site. Usally it is offline.
http://dev-cavesoft.no-ip.com
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 8th Aug 2005 15:16
Hi ya,

Ah .size.. that makes sense I tried your suggestion out, but I got the following error -



Cheers!
Troll Fiddler
19
Years of Service
User Offline
Joined: 19th Jan 2005
Location: Mayo, Ireland
Posted: 8th Aug 2005 15:17
Why don't you use a factory to spawn objects and use a field in it to keep track of the number of objects? Don't forget a method to decrement the count when things die (if you want a count of active objects rather than just the amount spawned).
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Aug 2005 16:14 Edited at: 8th Aug 2005 16:17
Ah, don't you just love the C promotion rules?

Basically, objlist.size() returns an 'unsigned int', and there is no dbStr() function with an exact match. It can't choose one, because there are two equally plausible choices ( dbStr(int) and dbStr(float) ) and either one will cause a loss of precision in the conversion.

Try 'dbStr( (int)objlist.size() )'

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 13th Aug 2005 15:12
@Troll Fiddler, yup that was my next move, however IanM's suggestion worked a treat.

Cheers both

Login to post a reply

Server time is: 2024-04-16 20:04:46
Your offset time is: 2024-04-16 20:04:46