Changeset 189 for trunk/Packages/CevoComponents/ScreenTools.pas
- Timestamp:
- May 7, 2020, 12:46:55 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.