[Glxtreem-commits] GLXtreem/Source GLXTexture.pas,1.3,1.4
Brought to you by:
andreaz
|
From: Andreas L. <an...@us...> - 2004-04-01 18:03:15
|
Update of /cvsroot/glxtreem/GLXtreem/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3770/Source Modified Files: GLXTexture.pas Log Message: texture in the resource editor Index: GLXTexture.pas =================================================================== RCS file: /cvsroot/glxtreem/GLXtreem/Source/GLXTexture.pas,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GLXTexture.pas 28 Mar 2004 20:06:25 -0000 1.3 --- GLXTexture.pas 1 Apr 2004 17:51:13 -0000 1.4 *************** *** 29,37 **** Uses ! Classes, Types, Windows, SysUtils, Graphics, Jpeg, dglOpenGL, GraphicEx, ! GLXNotification, GLXClasses; --- 29,39 ---- Uses ! Classes, Types, Windows, SysUtils, Graphics, Jpeg, Controls, dglOpenGL, GraphicEx, ! GLXNotification, GLXClasses, ! ! GLXResource; *************** *** 298,301 **** --- 300,326 ---- + //------------------------------------------------------------------------------ + {@Exclude} + Type TGLXTextureResource = class(TGLXResource, IEditor) + private + FTexture: TGLXTexture; + public + {@exclude} + constructor Create; override; + {@exclude} + destructor Destroy; override; + + { Loads the resource from a stream. } + procedure LoadFromStream(Stream:TStream); override; + { Saves the resource to a stream. } + procedure SaveToStream(Stream:TStream); override; + + { Edits the contents of the resource } + Function Edit : Boolean; + { Returns the real resource } + Function getResource: TObject; + end; + + //------------------------------------------------------------------------------ *************** *** 329,332 **** --- 354,358 ---- implementation + Uses GLXTextureEditor; //------------------------------------------------------------------------------ *************** *** 528,531 **** --- 554,559 ---- var Bitmap: TBitmap; begin + IF not Assigned(glDeleteTextures) then Exit; + Delete; *************** *** 923,926 **** --- 951,955 ---- Stream.Write(FTransparentColor, SizeOf(FTransparentColor)); + Stream.Write(MemSize, SizeOf(MemSize)); Stream.CopyFrom(MemStream, MemSize); *************** *** 1105,1107 **** --- 1134,1202 ---- + + + + + + + + + // TGLXTextureResource + //============================================================================== + constructor TGLXTextureResource.Create; + begin + inherited; + FTexture:=TGLXTexture.Create; + end; + + //------------------------------------------------------------------------------ + destructor TGLXTextureResource.Destroy; + begin + FTexture.Free; + inherited; + end; + + //------------------------------------------------------------------------------ + function TGLXTextureResource.Edit: Boolean; + var theForm : TTGLXTextureEditorForm; + begin + theForm:=TTGLXTextureEditorForm.Create(nil); + theForm.Texture:=FTexture; + + Result:= theForm.ShowModal = mrOK; + + theForm.Free; + end; + + //------------------------------------------------------------------------------ + function TGLXTextureResource.getResource: TObject; + begin + Result:=FTexture; + end; + + //------------------------------------------------------------------------------ + procedure TGLXTextureResource.LoadFromStream(Stream: TStream); + begin + inherited; + FTexture.LoadFromStream(Stream); + end; + + //------------------------------------------------------------------------------ + procedure TGLXTextureResource.SaveToStream(Stream: TStream); + begin + inherited; + FTexture.SaveToStream(Stream); + end; + + + + //------------------------------------------------------------------------------ + initialization + //Register + RegisterResourceClass(TGLXTextureResource); + // RegisterResourceClass(TGLXTextureResource, 'TGLXTexture'); + + finalization + //Unregister + UnRegisterResourceClass(TGLXTextureResource); end. |