Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Folder Picture Output
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kartikitrak




PostPosted: Wed Jan 12, 2011 2:48 pm   Post subject: Folder Picture Output

How do you output all the pictures in a specific folder?

Basically I want to show a list of all my maps that are in a folder, however I don't know how. It's like Call of Duty when you are selecting a map.

If possible, just a list of all the filenames are good,too.

Also the folder may be updated at anytime and I would like to keep the list updated.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Jan 12, 2011 2:54 pm   Post subject: RE:Folder Picture Output

I think familiarizing yourself with dirmodule is a good starting point
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
kartikitrak




PostPosted: Wed Jan 12, 2011 3:35 pm   Post subject: RE:Folder Picture Output

you have made me feel like an idea... THANK YOU! : )
kartikitrak




PostPosted: Wed Jan 12, 2011 3:42 pm   Post subject: RE:Folder Picture Output

I have tried using the dirmodule however I am just wondering if it will allow you to output all the pictures in the folder.
Tony




PostPosted: Wed Jan 12, 2011 3:44 pm   Post subject: RE:Folder Picture Output

It provides the tools for you to find out what all the files in the folder are. You can use file name endings to figure out if those files are pictures or not, and once you have the name of the pictures, you can do whatever you want with them.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
kartikitrak




PostPosted: Wed Jan 12, 2011 3:51 pm   Post subject: RE:Folder Picture Output

i still don't really get it.

So how to i get the pic.draw feature to use the filenames listed in the screen
Tony




PostPosted: Wed Jan 12, 2011 3:56 pm   Post subject: RE:Folder Picture Output

before you use Pic.Draw you need to use Pic.FileNew, which requires a filename, which you just got Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
kartikitrak




PostPosted: Wed Jan 12, 2011 3:57 pm   Post subject: RE:Folder Picture Output

but does filename represent only one file or the whole list

if it represents one how would you pic.filenew the others
also if it represents the whole list would u just need

pic.filenew (filename)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Jan 12, 2011 4:00 pm   Post subject: RE:Folder Picture Output

No, Pic.FileNew take one name at a time. To go over all of the names, you'd need some sort of a loop.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
kartikitrak




PostPosted: Wed Jan 12, 2011 4:01 pm   Post subject: RE:Folder Picture Output

anyway..i tried with just one picture but i gives me a illegal picture id number 0

var streamNumber : int
var fileName : string
var dir : string
dir := Dir.Current + "/usermaps"
streamNumber := Dir.Open (dir)
assert streamNumber > 0
loop
fileName := Dir.Get (streamNumber)
var pic : int := Pic.FileNew (fileName)
exit when fileName = ""
put fileName
Pic.Draw (pic, 0, 0, picCopy)
end loop
Dir.Close (streamNumber)
Tony




PostPosted: Wed Jan 12, 2011 4:03 pm   Post subject: RE:Folder Picture Output

What is the fileName that it tries to open? Is there such a file in the _current_ directory?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
kartikitrak




PostPosted: Wed Jan 12, 2011 4:05 pm   Post subject: RE:Folder Picture Output

My current directory

/Game
listprogram.t(this is the program)
/usermaps/pic1,pic2
kartikitrak




PostPosted: Wed Jan 12, 2011 4:05 pm   Post subject: RE:Folder Picture Output

Do you have an msn. So we can talk via msn.
Tony




PostPosted: Wed Jan 12, 2011 4:06 pm   Post subject: RE:Folder Picture Output

Yes. When you get the illegal picture ID error, what value does fileName have at that time?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
kartikitrak




PostPosted: Wed Jan 12, 2011 4:07 pm   Post subject: RE:Folder Picture Output

if you didn't get the folder...

the directory that everything is in is: Gane

in that folder there is one folder named usermaps and the turing file.

the turing file is trying to read and output the pictures in the usermaps folder.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: