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 / Problem with using files and using the data i get

Author
Message
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 14th Jun 2006 20:09
Ok, for some reason.... this just aint working!
I am trying to get integer values from a file, but they arnt working for some reason.

Here is where I get the data:

iResolutionX = INT(dbReadString(1));
iResolutionY = INT(dbReadString(1));
iColorBits = INT(dbReadString(1));

Here is where I try to use it:

dbSetDisplayMode(iResolutionX,iResolutionY,iColorBits);

For some reason, the display mode doesnt change.

5/14/06- 1720 lines into my 3D game engine! Player Movement and File System completed. Working on weapon inventory and player classes.
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 14th Jun 2006 21:51
Your trying to read a string into a integer variable - no wonder it wont change.

Come to the last Unofficial DBPro Convention (http://convention.logicstudios.net/)
Dont do anything I wouldn't do. But if you do, take pictures.
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 15th Jun 2006 01:20
doesnt INT cast the data as integer?

Current Project: Galaxy Conquest
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 15th Jun 2006 02:00 Edited at: 15th Jun 2006 02:01
dbReadString returns a char * so you are creating an int, and assigning it the address of the pointer (not the address of the data the pointer is pointing to), some string functions in C++ return an int which holds the address of the first char in a string! you can use atoi( char* ) to cast a string into an int, or dbVal( char* ) either will work.

My W.I.P project
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 15th Jun 2006 02:38
dbVal doesnt work, but atoi does

It says dbVal is an undeclared identifier.

Thanks =)

Current Project: Galaxy Conquest
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 15th Jun 2006 02:58
can you not just use:

sscanf( szMyFile, "%d,%d,%d", &nWidth, &nHeight, &nBits );

Where szMyFile contains a string as "800,600,32"

Paul.


Home of the Cartography Shop - DarkBASIC Professional map importer
Briere
19
Years of Service
User Offline
Joined: 28th Feb 2005
Location: Amherst New York, United States
Posted: 15th Jun 2006 03:29
I could.
Ill post this here, since I dont want to make another thread.

How do I change which color is treated as transpartent?

Current Project: Galaxy Conquest
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 15th Jun 2006 12:48 Edited at: 15th Jun 2006 12:54
Quote: "
dbSetImageColorkey

This command will set the general colorkey for all images. A colorkey allows you to specify a particular RGB colour that will be treated as transparent by the image when used. Transparent pixels of an image are not drawn. You must use this command before loading or grabbing an image in order that a suitable alpha map be generated from the transparent pixels of the desired image to be calculated. The alpha map is then used to decide which pixels are drawn and which pixels are never rendered.

Syntax
void dbSetImageColorKey ( int iRed, int iGreen, int iBlue )
"


Yeah the dbVal command is missing from the DarkSDKText.h header file, but it is in the library file so the header just needs modifying.

My W.I.P project
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 15th Jun 2006 16:13
Quote: "can you not just use:

sscanf( szMyFile, "%d,%d,%d", &nWidth, &nHeight, &nBits );"

Very insecure...

Come to the last Unofficial DBPro Convention (http://convention.logicstudios.net/)
Dont do anything I wouldn't do. But if you do, take pictures.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 15th Jun 2006 17:59
Ok well, it was merely a suggestion off the top of my head.. being that I'd persoanlly use tinyxml and XML files

Paul.


Home of the Cartography Shop - DarkBASIC Professional map importer
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 16th Jun 2006 23:13
I'll let you off this time - after all you are doing the .Net interface thingie.

Come to the last Unofficial DBPro Convention (http://convention.logicstudios.net/)
Dont do anything I wouldn't do. But if you do, take pictures.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 17th Jun 2006 01:30
Rofl!!


Home of the Cartography Shop - DarkBASIC Professional map importer

Login to post a reply

Server time is: 2024-11-19 06:48:29
Your offset time is: 2024-11-19 06:48:29