Пример #1
0
 /// <summary>
 /// ����һ��RMVX��ʽ���α�
 /// </summary>
 ///
 /// <returns></returns>
 public static LTexture MakeCursor(int w, int h)
 {
     LPixmap cursor = new LPixmap(w, h, true);
     cursor.SetColor(0, 0, 0, 255);
     cursor.FillRect(0, 0, w, h);
     cursor.SetColor(255, 255, 255, 255);
     cursor.FillRect(1, 1, w - 2, h - 2);
     cursor.SetColor(0, 0, 0, 255);
     cursor.FillRect(4, 4, w - 8, h - 8);
     cursor.SetColor(0, 0, 0, 255);
     cursor.FillRect(w / 4, 0, w / 2, h);
     cursor.SetColor(0, 0, 0, 255);
     cursor.FillRect(0, h / 4, w, h / 2);
     Color[] basePixels = cursor.GetData();
     int length = basePixels.Length;
     Color c = Color.Black;
     for (int i = 0; i < length; i++)
     {
         if (c.Equals(basePixels[i]))
         {
             basePixels[i].PackedValue = LSystem.TRANSPARENT;
         }
     }
     cursor.SetData(basePixels);
     return cursor.Texture;
 }
Пример #2
0
        /// <summary>
        /// 绘制一个RMVX样式的游标
        /// </summary>
        ///
        /// <returns></returns>
        public static LTexture MakeCursor(int w, int h)
        {
            LPixmap cursor = new LPixmap(w, h, true);

            cursor.SetColor(0, 0, 0, 255);
            cursor.FillRect(0, 0, w, h);
            cursor.SetColor(255, 255, 255, 255);
            cursor.FillRect(1, 1, w - 2, h - 2);
            cursor.SetColor(0, 0, 0, 255);
            cursor.FillRect(4, 4, w - 8, h - 8);
            cursor.SetColor(0, 0, 0, 255);
            cursor.FillRect(w / 4, 0, w / 2, h);
            cursor.SetColor(0, 0, 0, 255);
            cursor.FillRect(0, h / 4, w, h / 2);
            Color[] basePixels = cursor.GetData();
            int     length     = basePixels.Length;
            Color   c          = Color.Black;

            for (int i = 0; i < length; i++)
            {
                if (c.Equals(basePixels[i]))
                {
                    basePixels[i].PackedValue = LSystem.TRANSPARENT;
                }
            }
            cursor.SetData(basePixels);
            return(cursor.Texture);
        }
Пример #3
0
        public static LTexture CreateTexture(int width, int height, LColor c)
        {
            LPixmap image = new LPixmap(width, height, false);

            image.SetColor(c);
            image.FillRect(0, 0, width, height);
            return(image.Texture);
        }
Пример #4
0
        private void InitDesktop()
        {
            if (desktop != null && sprites != null)
            {
                return;
            }
            this.desktop = new Desktop(this, GetWidth(), GetHeight());
            this.sprites = new Sprites(GetWidth(), GetHeight());
            if (dialog == null)
            {
                LPixmap g = new LPixmap(GetWidth() - 20,
                                        GetHeight() / 2 - 20, true);
                g.SetAlphaValue(0, 0, 0, 125);
                g.FillRect(0, 0, g.GetWidth(), g.GetHeight());
                g.Dispose();
                dialog = g.Texture;
                g      = null;
            }
            this.message = new LMessage(dialog, 0, 0);
            this.message.SetFontColor(LColor.white);
            int size = message.GetWidth() / (message.GetMessageFont().GetSize());

            if (LSystem.scaleWidth != 1 || LSystem.scaleHeight != 1)
            {
                if (size % 2 != 0)
                {
                    size = size + 2;
                }
                else
                {
                    size = size + 3;
                }
            }
            else
            {
                if (size % 2 != 0)
                {
                    size = size - 3;
                }
                else
                {
                    size = size - 4;
                }
            }
            this.message.SetMessageLength(size);
            this.message.SetLocation((GetWidth() - message.GetWidth()) / 2,
                                     GetHeight() - message.GetHeight() - 10);
            this.message.SetVisible(false);
            this.select = new LSelect(dialog, 0, 0);
            this.select.SetLocation(message.X(), message.Y());
            this.scrCG = new AVGCG();
            this.desktop.Add(message);
            this.desktop.Add(select);
            this.select.SetVisible(false);
        }
Пример #5
0
        /// <summary>
        /// ˳ÐòΪ±³¾°£¬Ç°¾°£¬Öо°
        /// </summary>
        ///
        /// <param name="c1"></param>
        /// <param name="c2"></param>
        /// <param name="c3"></param>
        /// <returns></returns>
        public LTexture LoadBarColor(Color c1, Color c2, Color c3)
        {
            if (colors.Count > 10)
            {
                lock (colors)
                {
                    foreach (LTexture tex2d in colors.Values)
                    {
                        if (tex2d != null)
                        {
                            tex2d.Destroy();
                        }
                    }
                    colors.Clear();
                }
            }
            int hash = 1;

            hash = LSystem.Unite(hash, c1.PackedValue);
            hash = LSystem.Unite(hash, c2.PackedValue);
            hash = LSystem.Unite(hash, c3.PackedValue);
            LTexture texture_0 = null;

            lock (colors)
            {
                texture_0 = (LTexture)CollectionUtils.Get(colors, hash);
            }
            if (texture_0 == null)
            {
                LPixmap image = new LPixmap(8, 8, true);
                image.SetColor(c1);
                image.FillRect(0, 0, 4, 4);
                image.SetColor(c2);
                image.FillRect(4, 0, 4, 4);
                image.SetColor(c3);
                image.FillRect(0, 4, 4, 4);
                image.Dispose();
                texture_0 = image.Texture;
                CollectionUtils.Put(colors, hash, texture_0);
            }
            return(this.texture = texture_0);
        }
Пример #6
0
 public static LTexture CreateTexture(int width, int height, LColor c)
 {
     LPixmap image = new LPixmap(width, height, false);
     image.SetColor(c);
     image.FillRect(0, 0, width, height);
     return image.Texture;
 }
Пример #7
0
 private void InitDesktop()
 {
     if (desktop != null && sprites != null)
     {
         return;
     }
     this.desktop = new Desktop(this, GetWidth(), GetHeight());
     this.sprites = new Sprites(GetWidth(), GetHeight());
     if (dialog == null)
     {
         LPixmap g = new LPixmap(GetWidth() - 20,
                 GetHeight() / 2 - 20, true);
         g.SetAlphaValue(0, 0, 0, 125);
         g.FillRect(0, 0, g.GetWidth(), g.GetHeight());
         g.Dispose();
         dialog = g.Texture;
         g = null;
     }
     this.message = new LMessage(dialog, 0, 0);
     this.message.SetFontColor(LColor.white);
     int size = message.GetWidth() / (message.GetMessageFont().GetSize());
     if (LSystem.scaleWidth != 1 || LSystem.scaleHeight != 1)
     {
         if (size % 2 != 0)
         {
             size = size + 2;
         }
         else
         {
             size = size + 3;
         }
     }
     else
     {
         if (size % 2 != 0)
         {
             size = size - 3;
         }
         else
         {
             size = size - 4;
         }
     }
     this.message.SetMessageLength(size);
     this.message.SetLocation((GetWidth() - message.GetWidth()) / 2,
             GetHeight() - message.GetHeight() - 10);
     this.message.SetVisible(false);
     this.select = new LSelect(dialog, 0, 0);
     this.select.SetLocation(message.X(), message.Y());
     this.scrCG = new AVGCG();
     this.desktop.Add(message);
     this.desktop.Add(select);
     this.select.SetVisible(false);
 }
Пример #8
0
 /// <summary>
 /// ˳��Ϊ������ǰ�����о�
 /// </summary>
 ///
 /// <param name="c1"></param>
 /// <param name="c2"></param>
 /// <param name="c3"></param>
 /// <returns></returns>
 public LTexture LoadBarColor(Color c1, Color c2, Color c3)
 {
     if (colors.Count > 10)
     {
         lock (colors)
         {
             foreach (LTexture tex2d in colors.Values)
             {
                 if (tex2d != null)
                 {
                     tex2d.Destroy();
                 }
             }
             colors.Clear();
         }
     }
     int hash = 1;
     hash = LSystem.Unite(hash, c1.PackedValue);
     hash = LSystem.Unite(hash, c2.PackedValue);
     hash = LSystem.Unite(hash, c3.PackedValue);
     LTexture texture_0 = null;
     lock (colors)
     {
         texture_0 = (LTexture)CollectionUtils.Get(colors, hash);
     }
     if (texture_0 == null)
     {
         LPixmap image = new LPixmap(8, 8, true);
         image.SetColor(c1);
         image.FillRect(0, 0, 4, 4);
         image.SetColor(c2);
         image.FillRect(4, 0, 4, 4);
         image.SetColor(c3);
         image.FillRect(0, 4, 4, 4);
         image.Dispose();
         texture_0 = image.Texture;
         CollectionUtils.Put(colors, hash, texture_0);
     }
     return (this.texture = texture_0);
 }