project_files/HedgewarsMobile/Classes/ExtraCategories.m
branchios-develop
changeset 13166 ba5c794adae3
parent 12872 00215a7ec5f5
child 13167 c129707eb1e6
equal deleted inserted replaced
13164:eefd6d066768 13166:ba5c794adae3
    23 
    23 
    24 
    24 
    25 #pragma mark -
    25 #pragma mark -
    26 @implementation UIScreen (safe)
    26 @implementation UIScreen (safe)
    27 
    27 
    28 -(CGFloat) safeScale {
    28 - (CGFloat)safeScale {
    29     CGFloat theScale = 1.0f;
    29     CGFloat theScale = 1.0f;
    30 //    if ([self respondsToSelector:@selector(scale)])
    30 //    if ([self respondsToSelector:@selector(scale)])
    31 //         theScale = [self scale];
    31 //         theScale = [self scale];
    32     return theScale;
    32     return theScale;
    33 }
    33 }
    34 
    34 
    35 -(CGRect) safeBounds {
    35 - (CGRect)safeBounds {
    36     return [self bounds];
    36     return [self bounds];
    37 //    CGRect original = [self bounds];
    37 //    CGRect original = [self bounds];
    38 //    if (IS_ON_PORTRAIT())
    38 //    if (IS_ON_PORTRAIT())
    39 //        return original;
    39 //        return original;
    40 //    else
    40 //    else
    61 
    61 
    62 
    62 
    63 #pragma mark -
    63 #pragma mark -
    64 @implementation UIColor (HWColors)
    64 @implementation UIColor (HWColors)
    65 
    65 
    66 +(UIColor *)darkYellowColor {
    66 + (UIColor *)darkYellowColor {
    67     return [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xC0/255 blue:0 alpha:1];
    67     return [UIColor colorWithRed:(CGFloat)0xFE/255 green:(CGFloat)0xC0/255 blue:0 alpha:1];
    68 }
    68 }
    69 
    69 
    70 +(UIColor *)lightYellowColor {
    70 + (UIColor *)lightYellowColor {
    71     return [UIColor colorWithRed:(CGFloat)0xF0/255 green:(CGFloat)0xD0/255 blue:0 alpha:1];
    71     return [UIColor colorWithRed:(CGFloat)0xF0/255 green:(CGFloat)0xD0/255 blue:0 alpha:1];
    72 }
    72 }
    73 
    73 
    74 +(UIColor *)darkBlueColor {
    74 + (UIColor *)darkBlueColor {
    75     return [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:1];
    75     return [UIColor colorWithRed:(CGFloat)0x0F/255 green:0 blue:(CGFloat)0x42/255 alpha:1];
    76 }
    76 }
    77 
    77 
    78 // older devices don't get any transparency for performance reasons
    78 // older devices don't get any transparency for performance reasons
    79 +(UIColor *)darkBlueColorTransparent {
    79 + (UIColor *)darkBlueColorTransparent {
    80     return [UIColor colorWithRed:(CGFloat)0x0F/255
    80     return [UIColor colorWithRed:(CGFloat)0x0F/255
    81                            green:0
    81                            green:0
    82                             blue:(CGFloat)0x55/255
    82                             blue:(CGFloat)0x55/255
    83                            alpha:IS_NOT_POWERFUL([HWUtils modelType]) ? 1 : 0.6f];
    83                            alpha:IS_NOT_POWERFUL([HWUtils modelType]) ? 1 : 0.6f];
    84 }
    84 }
    85 
    85 
    86 +(UIColor *)blackColorTransparent {
    86 + (UIColor *)blackColorTransparent {
    87     return [UIColor colorWithRed:0
    87     return [UIColor colorWithRed:0
    88                            green:0
    88                            green:0
    89                             blue:0
    89                             blue:0
    90                            alpha:IS_NOT_POWERFUL([HWUtils modelType]) ? 1 : 0.65f];
    90                            alpha:IS_NOT_POWERFUL([HWUtils modelType]) ? 1 : 0.65f];
    91 }
    91 }
   176 
   176 
   177 
   177 
   178 #pragma mark -
   178 #pragma mark -
   179 @implementation NSString (MD5)
   179 @implementation NSString (MD5)
   180 
   180 
   181 -(NSString *)MD5hash {
   181 - (NSString *)MD5hash {
   182     const char *cStr = [self UTF8String];
   182     const char *cStr = [self UTF8String];
   183     unsigned char result[16];
   183     unsigned char result[16];
   184     CC_MD5( cStr, strlen(cStr), result );
   184     CC_MD5( cStr, strlen(cStr), result );
   185     return [NSString stringWithFormat:
   185     return [NSString stringWithFormat:
   186             @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
   186             @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",