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 / How can I write this code in DarkGDK

Author
Message
Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 18th May 2013 22:49 Edited at: 19th May 2013 00:44


Is there a way to do this without using set cursor and dbInput connands? Is there a way to do it just like this cout and print it all on the same line?

This is just where I would want to mix C++ with GDK but can never seem to get it to work
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 19th May 2013 02:25 Edited at: 19th May 2013 02:27
You can do that in a DGDK program just fine.
It "won't work" if you expect it to read input from the DGDK render window though (hint: cout -> console out).

Luckily the concept used here comes from a more abstract datatype than the console stream and thus you can use it with strings. It will require another line to work with the built-in DGDK functions, but you can write your own wrappers to avoid that too if you like.
What you basically want to use are the classes string and stringstream.

You'd use them like so (paste into a set-up and working DGDK program):


Note that the endl part is irrelevant; DBP (or DGDK) doesn't handle line breaks automatically for you. You can do it easily enough yourself by wrapping the printing function and splitting the string at newline characters though.

Hope that helps give you an idea


"Why do programmers get Halloween and Christmas mixed up?"
Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 19th May 2013 03:10
That does help Thanks What is GDK 2? Is that the version that some forum member made then went missing in action for a long time? Where can you get it and what does it cost and is it better?
Timidon
18
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 19th May 2013 20:40 Edited at: 19th May 2013 20:46
Quote: "Thanks What is GDK 2? Is that the version that some forum member made then went missing in action for a long time? Where can you get it and what does it cost and is it better? "


I am thinking so. I just started using DGK 2.0RC 4, The biggest difference is that most of the string and file functions have been removed, such as a dbIntToString(12) type command. The designer thought it would be better to let the owners on basic language handle that, forced me to create my own mid length string commands. So that drove me up the walls for few days, did force me to learn a bit more. The nifty plugg in wraper has a few holes in it as I learned with the Darknet pluggin, its a good idea just to plug them in manualy at this time.

Quote: "Where can you get it"


[href]http://forum.thegamecreators.com/?m=forum_view&t=196865&b=22
[/href]

I also will say the documentation is better and easier to understand.

Hope that helps.

There are many answers but just one question" ~ Jerilith the Mad
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th May 2013 19:51
I bought DGDK2.0. It doesn't even work as well as DGDK1.0 (different issues with each version). Overall, I would suggest sticking with 1.0 because 2.0 seems to be dead in the water (Mistrel fell off the face of the earth ~6-9months ago).
Formatting a string can be done with "sprintf":


Here is a good place to find commands in c++:
http://www.cplusplus.com/reference/cstdio/sprintf/

The fastest code is the code never written.
Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 25th May 2013 04:21
I got the string thing worked out, found a couple of different to do it. Can;t seem to get dbInput to work right but will figure it out. I didn't buy 2.0. Some say it is ok, lots say it is buggy. I didn't even download the trial version. I read what some said and didn't think it was worth the time to DL it and set it up.

Login to post a reply

Server time is: 2024-03-29 02:29:47
Your offset time is: 2024-03-29 02:29:47