- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
+ (void) playMovieWithResourceFile: (NSString *) file
{
const char *source = [ file cStringUsingEncoding: [NSString defaultCStringEncoding] ];
size_t length = strlen( source );
char *str = malloc( sizeof( char) * (length + 1) );
memcpy( str, source, sizeof (char) * (length + 1) );
char *type = strstr( str, ".");
*type = 0;
type++; //< now we have extension in type, and name in str cStrings
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSString *sName, *sType;
sName = [ NSString stringWithUTF8String: str ];
sType = [ NSString stringWithUTF8String: type];
[self playMovieWithName: sName Type: sType];
// free str, but do not free type - it is a part of str
free( str );
[pool release];
}
Вроде бы серьезный проект cocos2d-extensions https://github.com/cocos2d/cocos2d-iphone-extensions
Отрезаем расширение у файла :)
Или я что-то не понимаю…