hedgewars/uMisc.pas
changeset 3337 75e7455c69ed
parent 3305 91074496d5c9
child 3350 5cd02aafc612
equal deleted inserted replaced
3336:d7c1ffed1e15 3337:75e7455c69ed
   131 
   131 
   132 procedure initModule;
   132 procedure initModule;
   133 procedure freeModule;
   133 procedure freeModule;
   134 procedure SplitBySpace(var a, b: shortstring);
   134 procedure SplitBySpace(var a, b: shortstring);
   135 procedure SplitByChar(var a, b: ansistring; c: char);
   135 procedure SplitByChar(var a, b: ansistring; c: char);
       
   136 function EnumToStr(const en : TGearType) : shortstring; overload;
       
   137 function EnumToStr(const en : TSound) : shortstring; overload;
       
   138 function EnumToStr(const en : TAmmoType) : shortstring; overload;
   136 procedure movecursor(dx, dy: LongInt);
   139 procedure movecursor(dx, dy: LongInt);
   137 function  hwSign(r: hwFloat): LongInt;
   140 function  hwSign(r: hwFloat): LongInt;
   138 function  Min(a, b: LongInt): LongInt;
   141 function  Min(a, b: LongInt): LongInt;
   139 function  Max(a, b: LongInt): LongInt;
   142 function  Max(a, b: LongInt): LongInt;
   140 procedure OutError(Msg: shortstring; isFatalError: boolean);
   143 procedure OutError(Msg: shortstring; isFatalError: boolean);
   165 {$IFNDEF IPHONEOS}
   168 {$IFNDEF IPHONEOS}
   166 procedure MakeScreenshot(filename: shortstring);
   169 procedure MakeScreenshot(filename: shortstring);
   167 {$ENDIF}
   170 {$ENDIF}
   168 
   171 
   169 implementation
   172 implementation
   170 uses Math, uConsole, uStore, uIO, uRandom, uSound;
   173 uses Math, uConsole, uStore, uIO, uRandom, uSound, typinfo;
   171 
   174 
   172 var KBnum: Longword;
   175 var KBnum: Longword;
   173 {$IFDEF DEBUGFILE}
   176 {$IFDEF DEBUGFILE}
   174     f: textfile;
   177     f: textfile;
   175 {$ENDIF}
   178 {$ENDIF}
   195 if i > 0 then
   198 if i > 0 then
   196     begin
   199     begin
   197     b:= copy(a, i + 1, Length(a) - i);
   200     b:= copy(a, i + 1, Length(a) - i);
   198     setlength(a, Pred(i));
   201     setlength(a, Pred(i));
   199     end else b:= '';
   202     end else b:= '';
       
   203 end;
       
   204 
       
   205 function EnumToStr(const en : TGearType) : shortstring; overload;
       
   206 begin
       
   207 EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en))
       
   208 end;
       
   209 
       
   210 function EnumToStr(const en : TSound) : shortstring; overload;
       
   211 begin
       
   212 EnumToStr:= GetEnumName(TypeInfo(TSound), ord(en))
       
   213 end;
       
   214 
       
   215 function EnumToStr(const en : TAmmoType) : shortstring; overload;
       
   216 begin
       
   217 EnumToStr:= GetEnumName(TypeInfo(TAmmoType), ord(en))
   200 end;
   218 end;
   201 
   219 
   202 procedure movecursor(dx, dy: LongInt);
   220 procedure movecursor(dx, dy: LongInt);
   203 var x, y: LongInt;
   221 var x, y: LongInt;
   204 begin
   222 begin