protected void UpdateArrowTexture(string name = "ButtQuickListDn.tga") { if (D3DTextureManager.Instance[name] == null) return; m_pDownArrowTexture = D3DTextureManager.Instance[name]; m_pDownArrowTexture.SetFrames(4); }
public Static(ControlProperty resource) : base(resource) { m_szDefaultID = DefaultStrings.StaticControl; if (resource.m_bTile != 0) m_bgLayoutType = BGLAYOUT_TYPE.Tile; else m_bgLayoutType = BGLAYOUT_TYPE.Normal; if (resource.m_szTexture.Length > 3) { UpdateImage(resource.m_szTexture); } else { m_pTexture = null; m_bgLayoutType = BGLAYOUT_TYPE.Normal; } m_bVertScrollBar = resource.m_style.HasFlag(WindowStyle.WBS_VSCROLL); m_texScrollUp.SetFrames(4); m_texScrollDown.SetFrames(4); }
public void DrawTexture( Point pt, Rectangle rectOrigin, D3DTexture2D pTexture) { CustomVertex.TransformedTextured[] vertices = new CustomVertex.TransformedTextured[4]; int witWidth = pTexture.BaseSurface.Description.Width; int witHeight = pTexture.BaseSurface.Description.Height; vertices[0].Position = new Vector4(pt.X, pt.Y, 0.0f, 1.0f); vertices[0].Rhw = 1.0f; vertices[0].Tu = ((float)rectOrigin.X/witWidth); vertices[0].Tv = ((float)rectOrigin.Y / witHeight); vertices[1].Position = new Vector4(pt.X + rectOrigin.Width, pt.Y, 0.0f, 1.0f); vertices[1].Rhw = 1.0f; vertices[1].Tu = ((float)(rectOrigin.X + rectOrigin.Width)/witWidth); vertices[1].Tv = ((float)rectOrigin.Y/witHeight); vertices[2].Position = new Vector4(pt.X, pt.Y + rectOrigin.Height, 0.0f, 1.0f); vertices[2].Rhw = 1.0f; vertices[2].Tu = ((float) rectOrigin.X/witWidth); vertices[2].Tv = ((float)(rectOrigin.Y + rectOrigin.Height) / witHeight); vertices[3].Position = new Vector4(pt.X + rectOrigin.Width, pt.Y + rectOrigin.Height, 0.0f, 1.0f); vertices[3].Rhw = 1.0f; vertices[3].Tu = ((float)(rectOrigin.X + rectOrigin.Width) / witWidth); vertices[3].Tv = ((float)(rectOrigin.Y + rectOrigin.Height) / witHeight); m_d3dDevice.SetSamplerState(0, SamplerStageStates.AddressU, true); m_d3dDevice.SetSamplerState(0, SamplerStageStates.AddressV, true); m_d3dDevice.SetSamplerState(0, SamplerStageStates.MinFilter, (int)TextureFilter.Linear); //m_d3dDevice.SetSamplerState(0, SamplerStageStates.MagFilter, (int)TextureFilter.Linear); m_d3dDevice.SetRenderState(RenderStates.CullMode, (int)Cull.None); m_d3dDevice.SetRenderState(RenderStates.AlphaBlendEnable, true); m_d3dDevice.SetRenderState(RenderStates.SourceBlend, (int)Blend.SourceAlpha); m_d3dDevice.SetRenderState(RenderStates.DestinationBlend, (int)Blend.InvSourceAlpha); m_d3dDevice.SetRenderState(RenderStates.ZEnable, false); m_d3dDevice.SetTextureStageState( 0, TextureStageStates.ColorOperation, (int)TextureOperation.SelectArg1 ); m_d3dDevice.SetTextureStageState( 0, TextureStageStates.ColorArgument1, (int)TextureArgument.TextureColor); m_d3dDevice.SetTextureStageState( 0, TextureStageStates.AlphaOperation, (int)TextureOperation.Modulate ); m_d3dDevice.SetTextureStageState(0, TextureStageStates.AlphaArgument1, (int)TextureArgument.TextureColor); m_d3dDevice.SetTextureStageState(0, TextureStageStates.AlphaArgument2, (int)TextureArgument.TFactor); //m_d3dDevice.SetRenderState(RenderStates.TextureFactor, Color.FromArgb(255, 0, 0, 0).ToArgb()); m_d3dDevice.VertexShader = null; m_d3dDevice.SetTexture(0, pTexture.BaseTexture); m_d3dDevice.VertexFormat = CustomVertex.TransformedTextured.Format; m_d3dDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, vertices); m_d3dDevice.SetTexture( 0, null ); }
protected void UpdateImage(string szImage = "") { if (m_bgLayoutType == BGLAYOUT_TYPE.Tile) { if (szImage.Length < 6) szImage = m_szTilebase; else m_szTilebase = szImage; string szPart1 = szImage.Substring(0, szImage.Length - 6); string szPart2 = szImage.Substring(szImage.Length - 4); if (m_tileTextures == null) m_tileTextures = new D3DTexture2D[9]; for (int i = 0; i < 9; i++) { string sztexture = szPart1 + String.Format("{0:00}", i) + szPart2; if (D3DTextureManager.Instance[sztexture] == null) return; m_tileTextures[i] = D3DTextureManager.Instance[sztexture]; } } else { if (szImage == null || szImage.Length < 2) { m_szTexture = ""; m_pTexture = null; return; } if (szImage.Length < 3 || D3DTextureManager.Instance[szImage] == null) { if (D3DTextureManager.Instance[m_szTexture] == null) return; szImage = m_szTexture; } m_szTexture = szImage; m_pTexture = D3DTextureManager.Instance[szImage]; if (m_rectBounds.Width < m_pTexture.Size.Width) m_rectBounds.Width = m_pTexture.Size.Width; if (m_rectBounds.Height < m_pTexture.Size.Height) m_rectBounds.Height = m_pTexture.Size.Height; } }
protected void UpdateTexture(string szImage = "") { if (szImage.Length < 3 || D3DTextureManager.Instance[szImage] == null) { if (D3DTextureManager.Instance[m_szTexture] == null) return; szImage = m_szTexture; } m_szTexture = szImage; m_pTexture = D3DTextureManager.Instance[szImage]; m_pTexture.SetFrames(6); //m_rectBounds = new Rectangle(m_rectBounds.X, m_rectBounds.Y, m_pTexture.Size.Width / 4, m_pTexture.Size.Height); }