コード例 #1
0
ファイル: HueTestScene.cs プロジェクト: ViWinfii/UltimaXNA
        public override void Intitialize(UltimaEngine engine)
        {
            base.Intitialize(engine);

            m_Gump      = (Gump)Engine.UserInterface.AddControl(new Gump(Serial.Null, Serial.Null), 0, 0);
            m_Gump.Size = new Point(800, 600);
            m_Gump.AddControl(new ResizePic(m_Gump, 0, 5, 5, 3000, 790, 590));

            int rowwidth = 60;

            // caption string
            m_Label = (TextLabel)m_Gump.AddControl(new TextLabel(m_Gump, 0, 50, 8, 0, null));

            // object that is hued based on the current overhue.
            m_HueDisplay = (HuedControl)m_Gump.AddControl(new HuedControl(m_Gump, 8305));
            m_Gump.LastControl.Position           = new Point(745, 15);
            ((HuedControl)m_Gump.LastControl).Hue = 0;

            // unhued object
            m_Gump.AddControl(new HuedControl(m_Gump));
            m_Gump.LastControl.Position           = new Point(-5, 10);
            ((HuedControl)m_Gump.LastControl).Hue = 0;

            // hue index 1 (uo hue -1), aka one of the "True Black" hues
            m_Gump.AddControl(new HuedControl(m_Gump));
            m_Gump.LastControl.Position           = new Point(3, 10);
            ((HuedControl)m_Gump.LastControl).Hue = 1;

            for (int i = 0; i < 3000; i++)
            {
                m_Gump.AddControl(new HuedControl(m_Gump));
                m_Gump.LastControl.Position           = new Point((i % rowwidth) * 11 - 5, (i / rowwidth) * 10 + 28);
                ((HuedControl)m_Gump.LastControl).Hue = i + 2;
            }

            using (System.IO.FileStream file = new System.IO.FileStream("hues0.png", System.IO.FileMode.Create))
            {
                UltimaData.HuesXNA.HueTexture0.SaveAsPng(file, UltimaData.HuesXNA.HueTexture0.Width, UltimaData.HuesXNA.HueTexture0.Height);
            }

            using (System.IO.FileStream file = new System.IO.FileStream("hues1.png", System.IO.FileMode.Create))
            {
                UltimaData.HuesXNA.HueTexture1.SaveAsPng(file, UltimaData.HuesXNA.HueTexture1.Width, UltimaData.HuesXNA.HueTexture1.Height);
            }
        }