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.

DarkBASIC Discussion / Loading images....

Author
Message
Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 02:23
I'm trying to make a game, where people can load thier images into a file (that will come with the game) and they can use thier images in the game. How do I do this?

Read Ender's Game. And all its sequals.
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 27th Apr 2006 02:33
that depends..., it is easy to simply put images into a file.

But if per say some1 else downloaded an earlier version of this 'game' where it didn't have the file how would he get it.

A.) they cannot unless they have the newest version
b.) put in some code to upload the images to a server, so they can ALSO be downloaded by older versions

I need a bit more info if you wish this question anwsered properlly.

Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 02:37
No, this is not an online game. Just imagine you download a zip file that has a folder and an exe. in it. The exe (my game) can use the images in the folder. I guess what im asking is, where does DarkBasic get its images? I use DarkEdit and all the images are in the dark edit folder. Did that make sense?

Read Ender's Game. And all its sequals.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Apr 2006 02:39
Simply create a folder for your images (Eg: \Images) and another one for the user's images (Eg: \UserImages).

The user can add their own images to their folder and in your program you use the command:

Perform Checklist For Files

...on the UserImages folder. If there are more than zero images in the users images folder then you can select them at random. If there aren't any, then your prog needs to do nothing.

TDK_Man

General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 27th Apr 2006 02:40
o, i believe so - when you compile and make a 'FINAL' exe it shall store all the images into it.

Meaning it gathers all the images you use, and puts them into the exe for you.

You can of course make a standard exe, and keep all the images exposed to the world


============================
Dark basic gets its images from what ever project file you have selected.

For example you create a game named SephiIsGod, and save it into a folder named that. Any images loaded in will have to exist inside that folder

Hope i've explained it well enough for you.

============================

Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 02:43
Yeah, OK. TDK hit the spot. Ill fool around with that command.

Read Ender's Game. And all its sequals.
Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 02:49
The PERFORM CHECKLIST FOR FILES command is doing something, I dont know what though...

Maybe my question is, where does DarkBasic get the files I load into it, and how can I change that location?

Read Ender's Game. And all its sequals.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Apr 2006 02:50
Look, all you do is use Buid Final with your images in the same folder as your DBA and they will be included in the final EXE.

When the exe program is run by the user, if it doesn't already exist, then simply create the users image directory in your program and invite them to add their own. Alternatively, include the empty folder in the install package for your program.

TDK_Man

Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 02:55
Ok, now I get it. Darkbasic uses the images in the folder it is in. Thanks.




Stay tuned for further updates! And don't even think about touching that dial!

Read Ender's Game. And all its sequals.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Apr 2006 02:56
Images used by your program, to be included in the exe when you use Build Final should be in the project root - ie the same as your DBA file.

Don't use a folder for the images used in your program. Let your exe create any other required folders.

In your program, when you use the Load command, any path you supply assumes that you are already in the root directory. You don't put C:\ blah blah blah. Instead, put the path relative to where the exe is.

TDK_Man

Zone Chicken
21
Years of Service
User Offline
Joined: 25th Jan 2004
Location: `~-..-~`~-..-~`
Posted: 27th Apr 2006 02:56
Function EnviromentTileLoader()
set dir "Media\Enviroment Tiles"
delete file "Thumbs.db"
Perform Checklist for files
TotalLoadedTiles = Checklist Quantity()
for x = 3 to TotalLoadedTiles
TileName$ = Checklist String$(x)
load image TileName$,Tiles,1
sprite Tiles,1024,b + 73,Tiles
inc b,80
hide sprite Tiles
inc Tiles,1
next x
Endfunction

there is a function i used when i was working on a 2d editor.

set dir "Media\Enviroment Tiles"
delete file "Thumbs.db"
Perform Checklist for files
TotalLoadedTiles = Checklist Quantity()
for x = 3 to TotalLoadedTiles
TileName$ = Checklist String$(x)
load image TileName$,Tiles,1

is what your looking for you set the directory first, always delete thumbs.db first since this will return in the quantity even tough it is not a image its windows thumb nail viewer file and you don't want that.
Then check how many files are in that directory and store the total then use a array to load up the images.

Your signature has been erased by a mod -- please resize to under 600x120...
Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 03:06 Edited at: 27th Apr 2006 03:07
input "File1=",file1$
load image file1$,1


So if this .exe was in a file along with say, "picture.bmp" , I ran the program, and typed in "picture.bmp", would the picture load?

Read Ender's Game. And all its sequels.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Apr 2006 03:12
Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 03:19
Progress!

Read Ender's Game. And all its sequels.
Ooska
20
Years of Service
User Offline
Joined: 29th Aug 2004
Location:
Posted: 27th Apr 2006 03:24
OK, say a file was in the file that DB was in. And in that file, another image. Would DB load that picture as well?

Read Ender's Game. And all its sequels.
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 27th Apr 2006 04:17
It "could" if you code it correctly.

If per say you created a folder named "Images" and used it as a directory to save / load the images from. It will only be usuable if it is in the same directory though.

My only other advise..., trial and error my friend. It is the best way of learning

Login to post a reply

Server time is: 2025-05-23 15:19:19
Your offset time is: 2025-05-23 15:19:19