Changeset 189 for trunk/Packages/CevoComponents
- Timestamp:
- May 7, 2020, 12:46:55 AM (5 years ago)
- Location:
- trunk/Packages/CevoComponents
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/Directories.pas
r169 r189 10 10 11 11 function LocalizedFilePath(const Path: string): string; 12 procedure InitUnit;12 procedure UnitInit; 13 13 function GetSavedDir(Home: Boolean = False): string; 14 14 function GetMapsDir(Home: Boolean = False): string; 15 function GetGraphicsDir: string; 16 function GetSoundsDir: string; 15 17 16 18 … … 30 32 31 33 if Lang = '' then begin 32 33 34 34 for i := 1 to Paramcount - 1 do 35 if (ParamStrUTF8(i) = '--LANG') or (ParamStrUTF8(i) = '-l') or 36 (ParamStrUTF8(i) = '--lang') then 35 37 Lang := ParamStrUTF8(i + 1); 36 38 end; … … 59 61 end; 60 62 61 procedure InitUnit;63 procedure UnitInit; 62 64 var 63 65 AppDataDir: string; … … 113 115 end; 114 116 117 function GetGraphicsDir: string; 118 begin 119 Result := HomeDir + 'Graphics'; 120 end; 121 122 function GetSoundsDir: string; 123 begin 124 Result := HomeDir + 'Sounds'; 125 end; 126 115 127 end. -
trunk/Packages/CevoComponents/DrawDlg.pas
r174 r189 176 176 // ButtonDownSound, ButtonUpSound: string; 177 177 begin 178 // ButtonDownSound :=Sounds.Lookup('BUTTON_DOWN');179 // ButtonUpSound :=Sounds.Lookup('BUTTON_UP');178 // ButtonDownSound := Sounds.Lookup('BUTTON_DOWN'); 179 // ButtonUpSound := Sounds.Lookup('BUTTON_UP'); 180 180 for cix := 0 to ComponentCount - 1 do 181 181 if Components[cix] is TButtonBase then 182 182 begin 183 183 TButtonBase(Components[cix]).Graphic := GrExt[HGrSystem].Data; 184 // if ButtonDownSound <>'*' then185 // DownSound :=HomeDir+'Sounds'+ DirectorySeparator + ButtonDownSound + '.wav';186 // if ButtonUpSound <>'*' then187 // UpSound :=HomeDir+'Sounds'+ DirectorySeparator + ButtonUpSound + '.wav';184 // if ButtonDownSound <> '*' then 185 // DownSound := GetSoundsDir + DirectorySeparator + ButtonDownSound + '.wav'; 186 // if ButtonUpSound <> '*' then 187 // UpSound := GetSoundsDir + DirectorySeparator + ButtonUpSound + '.wav'; 188 188 if Components[cix] is TButtonA then 189 189 TButtonA(Components[cix]).Font := UniFont[ftButton]; -
trunk/Packages/CevoComponents/ScreenTools.pas
r188 r189 188 188 189 189 UniFont: array [TFontType] of TFont; 190 AppRegistryKey: string = '\SOFTWARE\C-evo';190 Gamma: Integer; // global gamma correction (cent) 191 191 192 192 procedure UnitInit; 193 193 procedure UnitDone; 194 procedure InitGammaLookupTable; 195 194 196 195 197 implementation … … 204 206 {$ENDIF} 205 207 206 Gamma: Integer; // global gamma correction (cent) 207 GammaLookupTable: array [0 .. 255] of Byte; 208 GammaLookupTable: array [0..255] of Byte; 208 209 209 210 {$IFDEF WINDOWS} … … 468 469 Source := TBitmap.Create; 469 470 Source.PixelFormat := pf24bit; 470 FileName := HomeDir + 'Graphics'+ DirectorySeparator + Name;471 FileName := GetGraphicsDir + DirectorySeparator + Name; 471 472 if not LoadGraphicFile(Source, FileName) then begin 472 473 Result := -1; … … 1352 1353 with MainTexture do begin 1353 1354 MainTextureAge := Age; 1354 LoadGraphicFile(Image, HomeDir + 'Graphics'+ DirectorySeparator +1355 LoadGraphicFile(Image, GetGraphicsDir + DirectorySeparator + 1355 1356 'Texture' + IntToStr(Age + 1) + '.jpg'); 1356 1357 clBevelLight := Colors.Canvas.Pixels[clkAge0 + Age, cliBevelLight]; … … 1391 1392 1392 1393 if Sounds = nil then Sounds := TStringTable.Create; 1393 if not Sounds.LoadFromFile( HomeDir + 'Sounds'+ DirectorySeparator + 'sound.txt') then1394 if not Sounds.LoadFromFile(GetSoundsDir + DirectorySeparator + 'sound.txt') then 1394 1395 begin 1395 1396 FreeAndNil(Sounds); … … 1470 1471 1471 1472 procedure UnitInit; 1472 var 1473 Reg: TRegistry; 1474 begin 1475 Reg := TRegistry.Create; 1476 with Reg do 1477 try 1478 OpenKey(AppRegistryKey, True); 1479 if ValueExists('Gamma') then 1480 Gamma := ReadInteger('Gamma') 1481 else 1482 begin 1483 Gamma := 100; 1484 WriteInteger('Gamma', Gamma); 1485 end; 1486 if ValueExists('Locale') then 1487 LocaleCode := ReadString('Locale') 1488 else 1489 LocaleCode := ''; 1490 finally 1491 Free; 1492 end; 1493 1494 if Gamma <> 100 then InitGammaLookupTable; 1473 begin 1474 Gamma := 100; 1475 InitGammaLookupTable; 1495 1476 1496 1477 {$IFDEF WINDOWS} … … 1512 1493 Templates := TBitmap.Create; 1513 1494 Templates.PixelFormat := pf24bit; 1514 LoadGraphicFile(Templates, HomeDir + 'Graphics'+ DirectorySeparator +1495 LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator + 1515 1496 'Templates.png', gfNoGamma); 1516 1497 Colors := TBitmap.Create; 1517 1498 Colors.PixelFormat := pf24bit; 1518 LoadGraphicFile(Colors, HomeDir + 'Graphics'+ DirectorySeparator + 'Colors.png');1499 LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png'); 1519 1500 Paper := TBitmap.Create; 1520 1501 Paper.PixelFormat := pf24bit; 1521 LoadGraphicFile(Paper, HomeDir + 'Graphics'+ DirectorySeparator + 'Paper.jpg');1502 LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg'); 1522 1503 BigImp := TBitmap.Create; 1523 1504 BigImp.PixelFormat := pf24bit; 1524 LoadGraphicFile(BigImp, HomeDir + 'Graphics'+ DirectorySeparator + 'Icons.png');1505 LoadGraphicFile(BigImp, GetGraphicsDir + DirectorySeparator + 'Icons.png'); 1525 1506 MainTexture.Image := TBitmap.Create; 1526 1507 MainTextureAge := -2; … … 1532 1513 procedure UnitDone; 1533 1514 var 1534 Reg: TRegistry;1535 1515 I: integer; 1536 1516 begin 1537 Reg := TRegistry.Create;1538 with Reg do1539 try1540 OpenKey(AppRegistryKey, True);1541 WriteString('Locale', LocaleCode);1542 WriteInteger('Gamma', Gamma);1543 if FullScreen then WriteInteger('ScreenMode', 1)1544 else WriteInteger('ScreenMode', 0);1545 finally1546 Free;1547 end;1548 1549 1517 RestoreResolution; 1550 1518 for I := 0 to nGrExt - 1 do begin -
trunk/Packages/CevoComponents/Sound.pas
r174 r189 290 290 Result := (WavFileName <> '') and (WavFileName[1] <> '[') and (WavFileName <> '*'); 291 291 if Result then 292 // SndPlaySound(pchar( HomeDir+'Sounds' +DirectorySeparator+WavFileName+'.wav'),SND_ASYNC)293 PlaySound( HomeDir + 'Sounds'+ DirectorySeparator + WavFileName);292 // SndPlaySound(pchar(GetSoundsDir + DirectorySeparator + WavFileName + '.wav'), SND_ASYNC) 293 PlaySound(GetSoundsDir + DirectorySeparator + WavFileName); 294 294 {$ENDIF} 295 295 end; … … 307 307 Assert(WavFileName[1] <> '['); 308 308 if (WavFileName <> '') and (WavFileName[1] <> '[') and (WavFileName <> '*') then 309 PrepareSound( HomeDir + 'Sounds'+ DirectorySeparator + WavFileName);309 PrepareSound(GetSoundsDir + DirectorySeparator + WavFileName); 310 310 {$ENDIF} 311 311 end;
Note:
See TracChangeset
for help on using the changeset viewer.