Cross platform relative file loading is fairly easy to do in Python, but it is still not easy enough for a short time constrain.
Convenient class for loading images using relative path painless
Create a loader pointing at the origin. Any loading is relative to the origin Paths passed to the methods of this object are lists where each element is either a directory name or a file name. ([dir1,dir2,file.txt])
Parameters: | origin – path string |
---|
Returns a path string relative to the origin
Parameters: | path – a path in list format |
---|---|
Returns: | path string |
check if all characters in the string are in ‘0’ to ‘9’, and there is more than 1 character
Return type: | bool |
---|
Load all files in a directory. Assume they are all images.
Parameters: |
|
---|---|
Returns: | Dict mapping the striped filename to its surface |
Load all files that have purely numerical name in a directory, assume they are images. Return a list of surface in the order of the numerical values.
Parameters: | path – Path relative to the origin in list format pointing to a directory |
---|---|
Returns: | a list of surfaces |
Load a sequence of image named 1.ext...*frames*.ext from path ext must be consistent
Parameters: |
|
---|---|
Returns: | a list of surfaces |
Load an image file
Parameters: |
|
---|---|
Returns: | surface |