Changeset 43
- Timestamp:
- 01/26/07 01:17:49 (2 years ago)
- Files:
-
- trunk/luigi/gui.d (modified) (1 diff)
- trunk/luigi/themes/dxut.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/luigi/gui.d
r42 r43 129 129 /// Finds the specified resource file on the resource path. This could be 130 130 /// an image or anything else. Used to find theme textures internally. 131 /// A list of names passed in will treated as alternative names for the same 132 /// resource file and searched for in the order provided. 131 133 /// Returns null if the resource could not be located on the resource path. 132 char[] find_resource_location(char[] name) {133 writefln("Looking for file: ", name);134 foreach(char[] p; m_resource_path) {135 char[] fullpath = p ~name;136 writefln("Trying file: ", fullpath);137 if (std.file.exists(fullpath)) {138 return fullpath;134 char[] find_resource_location(char[][] name...) { 135 foreach(char[] aname; name) { 136 foreach(char[] p; m_resource_path) { 137 char[] fullpath = p ~ aname; 138 if (std.file.exists(fullpath)) { 139 return fullpath; 140 } 139 141 } 140 142 } trunk/luigi/themes/dxut.d
r42 r43 56 56 try { 57 57 initialize_compressed_texture_extension(); 58 loadCompressedTexture("themes/dxutcontrols.dds", m_texid); 59 //loadCompressedTexture("themes/lena.dds", m_texid); 58 59 char[] filepath = Luigi().find_resource_location( 60 "dxutcontrols.dds", 61 "themes/dxutcontrols.dds", 62 "resource/dxutcontrols.dds" 63 ); 64 if (filepath) { 65 loadCompressedTexture(filepath, m_texid); 66 } else { 67 char[] str = std.string.format( 68 "couldn't find, or failed to load \"%s\"", filepath); 69 report_error(str); 70 return; 71 } 72 60 73 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &m_texw); 61 74 glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &m_texh); … … 1234 1247 void loadCompressedTexture(char[] filename, inout GLuint texid) 1235 1248 { 1236 char[] filepath = Luigi().find_resource_location(filename); 1237 DDSImageData *pDDSdata = null; 1238 if (filepath) { 1239 pDDSdata = loadDDSTextureFile( filepath ); 1240 } else { 1241 char[] str = std.string.format( 1242 "loadDDSTextureFile couldn't find, or failed to load \"%s\"", filename); 1243 report_error(str); 1244 return; 1245 } 1249 DDSImageData *pDDSdata = loadDDSTextureFile( filename ); 1246 1250 1247 1251 if( pDDSdata )
