project_files/HedgewarsMobile/Classes/CommodityFunctions.m
changeset 4510 ce9b8206e681
parent 4356 d1d26f8963a3
child 4512 c6aff8ceada0
equal deleted inserted replaced
4509:816a0bff5019 4510:ce9b8206e681
    23 #import <sys/types.h>
    23 #import <sys/types.h>
    24 #import <sys/sysctl.h>
    24 #import <sys/sysctl.h>
    25 #import <mach/mach.h>
    25 #import <mach/mach.h>
    26 #import <mach/mach_host.h>
    26 #import <mach/mach_host.h>
    27 #import <QuartzCore/QuartzCore.h>
    27 #import <QuartzCore/QuartzCore.h>
    28 #import "AudioToolbox/AudioToolbox.h"
    28 #import <AudioToolbox/AudioToolbox.h>
       
    29 #import <CommonCrypto/CommonDigest.h>
    29 #import "PascalImports.h"
    30 #import "PascalImports.h"
    30 
    31 
    31 BOOL inline rotationManager (UIInterfaceOrientation interfaceOrientation) {
    32 BOOL inline rotationManager (UIInterfaceOrientation interfaceOrientation) {
    32     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) ||
    33     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) ||
    33            (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    34            (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
   181     long resultHeight = (height[0] << (int)24) | (height[1] << (int)16) | (height[2] << (int)8) | height[3];
   182     long resultHeight = (height[0] << (int)24) | (height[1] << (int)16) | (height[2] << (int)8) | height[3];
   182 
   183 
   183     // Return Size.
   184     // Return Size.
   184     return CGSizeMake(resultWidth,resultHeight);
   185     return CGSizeMake(resultWidth,resultHeight);
   185 }
   186 }
       
   187 
       
   188 @implementation NSString (extra)
       
   189 
       
   190 -(NSString *)getMD5hash {
       
   191     const char *cStr = [self UTF8String];
       
   192     unsigned char result[16];
       
   193     CC_MD5( cStr, strlen(cStr), result );
       
   194     return [NSString stringWithFormat:
       
   195             @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
       
   196             result[0], result[1], result[2], result[3], result[4], result[5],
       
   197             result[6], result[7], result[8], result[9], result[10], result[11],
       
   198             result[12], result[13], result[14], result[15]];
       
   199 }
       
   200 
       
   201 
       
   202 @end