/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/Texture.cs
ViewVC logotype

Diff of /trunk/gr2lib/core/coretypes/implementation/Texture.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/gr2lib/core/coretypes/implementation/Texture.cs	2010/07/22 10:20:55	160
+++ trunk/gr2lib/core/coretypes/implementation/Texture.cs	2010/07/22 14:24:07	166
@@ -23,7 +23,7 @@
         private int _Width;
         private int _Height;
         private NameValuePair<string, granny_texture_encoding> _Encoding;
-        private int _SubFormat;
+        private NameValuePair<string, granny_pixel_layout> _SubFormat;
         private Layout _Layout;
         private List<Image> _Images;
 
@@ -39,11 +39,11 @@
         public Texture()// : base("Textures")
         {
             this.FromFileName = "";
-            this.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyTextureTypeString(granny_texture_type.GrannyColorMapTextureType), granny_texture_type.GrannyColorMapTextureType);
+            this.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyEnumTypeString<granny_texture_type>(granny_texture_type.GrannyColorMapTextureType), granny_texture_type.GrannyColorMapTextureType);
             this.Width = 0;
             this.Height = 0;
-            this.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyTextureEncodingString(granny_texture_encoding.GrannyBinkTextureEncoding), granny_texture_encoding.GrannyBinkTextureEncoding);
-            this.SubFormat = 0;
+            this.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyEnumTypeString<granny_texture_encoding>(granny_texture_encoding.GrannyBinkTextureEncoding), granny_texture_encoding.GrannyBinkTextureEncoding);
+            this.SubFormat = new NameValuePair<string, granny_pixel_layout>(coreapi.GetGrannyEnumTypeString<granny_pixel_layout>(granny_pixel_layout.GrannyBGRA8888PixelFormat), granny_pixel_layout.GrannyBGRA8888PixelFormat);
             this.Layout = new Layout();
             this.Images = new List<Image>();
             //this.ExtendedData = new IntPtr();
@@ -53,11 +53,11 @@
         public Texture(int index)
         {
             this.FromFileName = "";
-            this.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyTextureTypeString(granny_texture_type.GrannyColorMapTextureType), granny_texture_type.GrannyColorMapTextureType);
+            this.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyEnumTypeString<granny_texture_type>(granny_texture_type.GrannyColorMapTextureType), granny_texture_type.GrannyColorMapTextureType);
             this.Width = 0;
             this.Height = 0;
-            this.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyTextureEncodingString(granny_texture_encoding.GrannyBinkTextureEncoding), granny_texture_encoding.GrannyBinkTextureEncoding);
-            this.SubFormat = 0;
+            this.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyEnumTypeString<granny_texture_encoding>(granny_texture_encoding.GrannyBinkTextureEncoding), granny_texture_encoding.GrannyBinkTextureEncoding);
+            this.SubFormat = new NameValuePair<string, granny_pixel_layout>(coreapi.GetGrannyEnumTypeString<granny_pixel_layout>(granny_pixel_layout.GrannyBGRA8888PixelFormat), granny_pixel_layout.GrannyBGRA8888PixelFormat);
             this.Layout = new Layout();
             this.Images = new List<Image>();
             //this.ExtendedData = new IntPtr();
@@ -109,11 +109,11 @@
             {
                 Texture managed = new Texture();
                 managed.FromFileName = native.FromFileName;
-                managed.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyTextureTypeString((granny_texture_type)native.TextureType), (granny_texture_type)native.TextureType);
+                managed.TextureType = new NameValuePair<string, granny_texture_type>(coreapi.GetGrannyEnumTypeString<granny_texture_type>((granny_texture_type)native.TextureType), (granny_texture_type)native.TextureType);
                 managed.Width = native.Width;
                 managed.Height = native.Height;
-                managed.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyTextureEncodingString((granny_texture_encoding)native.Encoding), (granny_texture_encoding)native.Encoding);
-                managed.SubFormat = native.SubFormat;
+                managed.Encoding = new NameValuePair<string, granny_texture_encoding>(coreapi.GetGrannyEnumTypeString<granny_texture_encoding>((granny_texture_encoding)native.Encoding), (granny_texture_encoding)native.Encoding);
+                managed.SubFormat = new NameValuePair<string, granny_pixel_layout>(coreapi.GetGrannyEnumTypeString<granny_pixel_layout>((granny_pixel_layout)native.SubFormat), (granny_pixel_layout)native.SubFormat);
                 managed.Layout = Layout.ReadFromNative(native.Layout);
                 IntPtr[] images = Helpers.ReadPtrArrayFromMemory<native.Image>(native.Images);
                 int length = images.Length;
@@ -206,7 +206,8 @@
         [Editor(typeof(UIComboValueSelector<granny_texture_encoding, int>), typeof(UITypeEditor))]
         public NameValuePair<string, granny_texture_encoding> Encoding { get { return _Encoding; } set { _Encoding = value; } }
         [RefreshPropertiesAttribute(RefreshProperties.All)]
-        public int SubFormat { get { return _SubFormat; } set { _SubFormat = value; } }
+        [Editor(typeof(UIComboValueSelector<granny_pixel_layout, int>), typeof(UITypeEditor))]
+        public NameValuePair<string, granny_pixel_layout> SubFormat { get { return _SubFormat; } set { _SubFormat = value; } }
         [RefreshPropertiesAttribute(RefreshProperties.All)]
         [Browsable(true)]
         public Layout Layout { get { return _Layout; } set { _Layout = value; } }

 

  ViewVC Help
Powered by ViewVC 1.1.22