diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-03-24 13:37:12 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-03-24 13:37:12 +0000 |
commit | 5ce375d1b7493e41a3ac14b979932d6cf7d73285 (patch) | |
tree | abe27c1d976f31545ef1f2f4cf3a856686491f9f | |
parent | 59314cc9dc1812715687edb8a92fbe9d1b6d2591 (diff) | |
download | usdx-5ce375d1b7493e41a3ac14b979932d6cf7d73285.tar.gz usdx-5ce375d1b7493e41a3ac14b979932d6cf7d73285.tar.xz usdx-5ce375d1b7493e41a3ac14b979932d6cf7d73285.zip |
Copyed PNG Texture Support from UltraStar 0.5.3
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@23 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UTexture.pas | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 767d53ec..b50ab6bf 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -11,7 +11,7 @@ unit UTexture; // Arrow (for arrows, white is white, gray has color, black is transparent);
interface
-uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes;
+uses OpenGL12, Windows, Math, Classes, SysUtils, Graphics, JPEG, UThemes, PNGImage;
procedure glGenTextures(n: GLsizei; var textures: GLuint); stdcall; external opengl32;
//procedure glBindTexture(target: GLenum; texture: GLuint); stdcall; external opengl32;
@@ -192,6 +192,7 @@ var Res: TResourceStream;
TextureB: TBitmap;
TextureJ: TJPEGImage;
+ TexturePNG: TPNGObject;
Pet: integer;
Pet2: integer;
@@ -215,10 +216,14 @@ begin end;
if FromRegistry or ((not FromRegistry) and FileExists(Nazwa)) then begin
-
TextureB := TBitmap.Create;
- if Format = 'JPG' then begin
+ if Format = 'BMP' then begin
+ if FromRegistry then TextureB.LoadFromStream(Res)
+ else TextureB.LoadFromFile(Nazwa);
+ end
+
+ else if Format = 'JPG' then begin
TextureJ := TJPEGImage.Create;
if FromRegistry then TextureJ.LoadFromStream(Res)
else begin
@@ -229,10 +234,19 @@ begin end;
TextureB.Assign(TextureJ);
TextureJ.Free;
- end;
- if Format = 'BMP' then begin
- if FromRegistry then TextureB.LoadFromStream(Res)
- else TextureB.LoadFromFile(Nazwa);
+ end
+
+ else if Format = 'PNG' then begin
+ TexturePNG := TPNGObject.Create;
+ if FromRegistry then TexturePNG.LoadFromStream(Res)
+ else begin
+ if FileExists(Nazwa) then
+ TexturePNG.LoadFromFile(Nazwa)
+ else
+ Exit;
+ end;
+ TextureB.Assign(TexturePNG);
+ TexturePNG.Free;
end;
if FromRegistry then Res.Free;
|