コード例 #1
0
 public void Clear()
 {
     lock (charas)
     {
         charas.Clear();
     }
 }
コード例 #2
0
 public static void CreateCache(bool free)
 {
     if (free)
     {
         if (scriptContext == null)
         {
             scriptContext = new Dictionary <object, object>(1000);
         }
         else
         {
             scriptContext.Clear();
         }
         if (functions == null)
         {
             functions = new ArrayMap(20);
         }
         else
         {
             functions.Clear();
         }
         if (setEnvironmentList == null)
         {
             setEnvironmentList = new Dictionary <object, object>(20);
         }
         else
         {
             setEnvironmentList.Clear();
         }
         if (conditionEnvironmentList == null)
         {
             conditionEnvironmentList = new ArrayMap(30);
         }
         else
         {
             conditionEnvironmentList.Clear();
         }
     }
     else
     {
         if (scriptContext == null)
         {
             scriptContext = new Dictionary <object, object>(1000);
         }
         if (functions == null)
         {
             functions = new ArrayMap(20);
         }
         if (setEnvironmentList == null)
         {
             setEnvironmentList = new Dictionary <object, object>(20);
         }
         if (conditionEnvironmentList == null)
         {
             conditionEnvironmentList = new ArrayMap(30);
         }
     }
 }
コード例 #3
0
 public override void Dispose()
 {
     base.Dispose();
     if (textures != null)
     {
         textures.Clear();
     }
     if (collisionChecker != null)
     {
         collisionChecker.Dispose();
         collisionChecker = null;
     }
     if (objects != null)
     {
         Object[] o = objects.ToActors();
         for (int i = 0; i < o.Length; i++)
         {
             Actor actor = (Actor)o[i];
             if (actor != null)
             {
                 actor.Dispose();
                 actor = null;
             }
         }
     }
     if (batch != null)
     {
         batch.Dispose();
     }
 }
コード例 #4
0
ファイル: CollisionManager.cs プロジェクト: zx8326123/LGame
 public void Clear()
 {
     lock (typeof(CollisionManager)) {
         if (collisionChecker != null)
         {
             collisionChecker.Dispose();
             collisionChecker.Clear();
         }
         if (freeObjects != null)
         {
             freeObjects.Clear();
         }
         if (collisionClasses != null)
         {
             CollectionUtils.Clear(collisionClasses);
         }
     }
 }
コード例 #5
0
        private void Parse(Stream file)
        {
            if (displays == null)
            {
                displays = new ArrayMap(DEFAULT_MAX_CHAR);
            }
            else
            {
                displays.Clear();
            }
            try {
                StreamReader ins = new StreamReader(file,
                                                    System.Text.Encoding.UTF8);
                info   = ins.ReadLine();
                common = ins.ReadLine();
                page   = ins.ReadLine();

                ArrayMap kerning = new ArrayMap(
                    64);
                List <CharDef> charDefs = new List <CharDef>(
                    DEFAULT_MAX_CHAR);

                int  maxChar = 0;
                bool done    = false;
                for (; !done;)
                {
                    string line = ins.ReadLine();
                    if (line == null)
                    {
                        done = true;
                    }
                    else
                    {
                        if (line.StartsWith("chars c"))
                        {
                        }
                        else if (line.StartsWith("char"))
                        {
                            CharDef def = ParseChar(line);
                            if (def != null)
                            {
                                maxChar = MathUtils.Max(maxChar, def.id);
                                charDefs.Add(def);
                            }
                        }
                        if (line.StartsWith("kernings c"))
                        {
                        }
                        else if (line.StartsWith("kerning"))
                        {
                            StringTokenizer tokens = new StringTokenizer(line, " =");
                            tokens.NextToken();
                            tokens.NextToken();
                            short first = short.Parse(tokens.NextToken());
                            tokens.NextToken();
                            int second = int.Parse(tokens.NextToken());
                            tokens.NextToken();
                            int          offset = int.Parse(tokens.NextToken());
                            List <short> values = (List <short>)kerning.GetValue(first);
                            if (values == null)
                            {
                                values = new List <short>();
                                kerning.Put(first, values);
                            }
                            values.Add((short)((offset << 8) | second));
                        }
                    }
                }

                this.chars = new CharDef[maxChar + 1];

                for (IEnumerator <CharDef> iter = charDefs.GetEnumerator(); iter.MoveNext();)
                {
                    CharDef def = (CharDef)iter.Current;
                    chars[def.id] = def;
                }
                ArrayMap.Entry[] entrys = kerning.ToEntrys();
                for (int j = 0; j < entrys.Length; j++)
                {
                    ArrayMap.Entry entry      = entrys[j];
                    short          first      = (short)entry.GetKey();
                    List <short>   valueList  = (List <short>)entry.GetValue();
                    short[]        valueArray = new short[valueList.Count];
                    int            i          = 0;
                    for (IEnumerator <short> valueIter = valueList.GetEnumerator(); valueIter
                         .MoveNext(); i++)
                    {
                        valueArray[i] = (short)valueIter.Current;
                    }
                    chars[first].kerning = valueArray;
                }
            } catch (IOException e) {
                Log.Exception(e);
                throw new Exception("Invalid font file: " + file);
            }
        }
コード例 #6
0
ファイル: NSDictionary.cs プロジェクト: zx8326123/LGame
 public void Clear()
 {
     _dict.Clear();
 }
コード例 #7
0
        public virtual void PaintObjects(GLEx g, int minX, int minY, int maxX, int maxY)
        {
            lock (objects)
            {
                IIterator it = objects.Iterator();
                for (; it.HasNext();)
                {
                    thing = (Actor)it.Next();
                    if (!thing.visible)
                    {
                        continue;
                    }
                    isListener = (thing.actorListener != null);

                    if (isVSync)
                    {
                        if (isListener)
                        {
                            thing.actorListener.Update(elapsedTime);
                        }
                        thing.Update(elapsedTime);
                    }

                    RectBox rect = thing.GetRectBox();
                    actorX      = minX + thing.GetX();
                    actorY      = minY + thing.GetY();
                    actorWidth  = rect.width;
                    actorHeight = rect.height;
                    if (actorX + actorWidth < minX || actorX > maxX ||
                        actorY + actorHeight < minY || actorY > maxY)
                    {
                        continue;
                    }
                    LTexture actorImage = thing.GetImage();
                    if (actorImage != null)
                    {
                        width          = (actorImage.GetWidth() * thing.scaleX);
                        height         = (actorImage.GetHeight() * thing.scaleY);
                        isBitmapFilter = (thing.filterColor != null);
                        thing.SetLastPaintSeqNum(paintSeq++);
                        angle      = thing.GetRotation();
                        colorAlpha = thing.alpha;

                        if (thing.isAnimation)
                        {
                            if (isBitmapFilter)
                            {
                                g.DrawTexture(actorImage, actorX, actorY, width,
                                              height, angle, thing.filterColor);
                            }
                            else
                            {
                                if (colorAlpha != 1f)
                                {
                                    g.SetAlpha(colorAlpha);
                                }
                                g.DrawTexture(actorImage, actorX, actorY, width,
                                              height, angle);
                                if (colorAlpha != 1f)
                                {
                                    g.SetAlpha(1f);
                                }
                            }
                        }
                        else
                        {
                            int texId = actorImage.GetTextureID();

                            LTextureBatch batch = (LTextureBatch)textures
                                                  .GetValue(texId);

                            if (batch == null)
                            {
                                LTextureBatch pBatch = LTextureBatch
                                                       .BindBatchCache(this, texId,
                                                                       actorImage);
                                batch = pBatch;
                                batch.GLBegin();

                                textures.Put(texId, batch);
                            }

                            batch.SetTexture(actorImage);

                            if (isBitmapFilter)
                            {
                                batch.Draw(actorX, actorY, width, height, angle,
                                           thing.filterColor);
                            }
                            else
                            {
                                if (colorAlpha != 1f)
                                {
                                    alphaColor.a = colorAlpha;
                                }
                                batch.Draw(actorX, actorY, width, height, angle,
                                           alphaColor);
                                if (colorAlpha != 1f)
                                {
                                    alphaColor.a = 1;
                                }
                            }
                        }
                    }
                    if (thing.isConsumerDrawing)
                    {
                        if (actorX == 0 && actorY == 0)
                        {
                            thing.Draw(g);
                            if (isListener)
                            {
                                thing.actorListener.Draw(g);
                            }
                        }
                        else
                        {
                            g.Translate(actorX, actorY);
                            thing.Draw(g);
                            if (isListener)
                            {
                                thing.actorListener.Draw(g);
                            }
                            g.Translate(-actorX, -actorY);
                        }
                    }
                }

                int size = textures.Size();
                if (size > 0)
                {
                    for (int i = 0; i < size; i++)
                    {
                        LTextureBatch batch = (LTextureBatch)textures.Get(i);
                        batch.GLEnd();
                    }
                    textures.Clear();
                }
            }
        }
コード例 #8
0
ファイル: SpriteBatchScreen.cs プロジェクト: zx8326123/LGame
 public virtual void ClearActionKey()
 {
     keyActions.Clear();
     keySize = 0;
 }
コード例 #9
0
ファイル: SpriteBatchScreen.cs プロジェクト: vb0067/LGame
 public void ClearActionKey()
 {
     keyActions.Clear();
 }