picture viewer/ importer
Posted 06 July 2012 - 04:26 PM
Posted 06 July 2012 - 06:21 PM
"To manipulate files in the file system you can use the following functions:
file_exists(fname) Returns whether the file with the given name exists (true) or not (false).
file_delete(fname) Deletes the file with the given name.
file_rename(oldname,newname) Renames the file with name oldname into newname.
file_copy(fname,newname) Copies the file fname to the newname.
directory_exists(dname) Returns whether the indicated directory does exist. The name must include the full path, not a relative path.
directory_create(dname) Creates a directory with the given name (including the path towards it) if it does not exist. The name must include the full path, not a relative path.
file_find_first(mask,attr) Returns the name of the first file that satisfies the mask and the attributes. If no such file exists, the empty string is returned. The mask can contain a path and can contain wildchars, for example 'C:\temp\*.doc'. The attributes give the additional files you want to see. (So the normal files are always returned when they satisfy the mask.) You can add up the following constants to see the type of files you want:
fa_readonly read-only files
fa_hidden hidden files
fa_sysfile system files
fa_volumeid volume-id files
fa_archive archived files
file_find_next() Returns the name of the next file that satisfies the previously given mask and the attributes. If no such file exists, the empty string is returned.
file_find_close() Must be called after handling all files to free memory.
file_attributes(fname,attr) Returns whether the file has all the attributes given in attr. Use a combination of the constants indicated above."
I would try looking for a extension first, but if don't find one that suits, I'd look for a code solution, using the functions above or from the rest of the "file" section in the manual.
Posted 06 July 2012 - 06:40 PM
Then use "sprite_add" or "background_add" to add the picture as a sprite or background
Then use "draw_sprite" or "draw_background" to draw the picture to the screen.
back = nooneWhen button pressed
var fname; fname = get_open_filename('Images|*.bmp;*.png;*.jpg',""); if(file_exists(fname)) back = background_add(fname,0,0);Draw
Edited by Frigg, 06 July 2012 - 06:57 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users