コード例 #1
0
 public static void ExecutionPart(Queue <Statement> queue, ScopesManager sm)
 {
     foreach (Statement stat in queue)
     {
         stat.execute(sm);
         Console.WriteLine("{ " + stat + " }");
     }
 }
コード例 #2
0
        public void execute(ScopesManager sm)
        {
            IComposite variable = sm.GetMyType(varType);

            if (variable != null)
            {
                var tmp = Prototype.CloneObject(variable) as IComposite;
                tmp.Name = name;
                sm.declareVar(name, tmp);
            }
            else
            {
                throw new RuntimeException("Nie ma takiego typu");
            }
        }
コード例 #3
0
        public void execute(ScopesManager sm)
        {
            IComposite variable   = sm.GetMyType(varType);
            Composite  collection = new Composite(name);

            if (variable == null)
            {
                throw new RuntimeException("Nie ma takiego typu");
            }

            for (int i = 0; i < count; ++i)
            {
                IComposite tmp2 = Prototype.CloneObject(variable) as IComposite;
                tmp2.Position += new SFML.System.Vector2f(i * 30.0f, i * 30.0f);
                collection.Add(tmp2);
            }

            sm.declareVar(name, collection);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            RenderWindow app = new RenderWindow(new VideoMode(ProgramGlobals.RESOLUTION_X, ProgramGlobals.RESOLUTION_Y), "SFML Works!");

            app.Closed += new EventHandler(OnClose);

            Stopwatch sw = new Stopwatch();
            float     dT;

            Color windowColor = new Color(255, 255, 255);

            Parser            parser = new Parser("./testCode.txt");
            Queue <Statement> queue  = parser.Run();

            ScopesManager sm = new ScopesManager();

            ExecutionPart(queue, sm);

            sw.Start();
            long lastCheck = 0;

            while (app.IsOpen)
            {
                app.DispatchEvents();
                dT        = sw.ElapsedMilliseconds - lastCheck;
                lastCheck = sw.ElapsedMilliseconds;

                app.Clear(windowColor);

                sm.Update(dT);
                sm.Draw(app);

                app.Display();
            }
            Console.ReadKey();
        }
コード例 #5
0
        public void execute(ScopesManager sm)
        {
            sm.NewScope();
            Statement stat;

            if (relationOp.eval(expr1, expr2))
            {
                while (statements.Count > 0)
                {
                    stat = statements.Dequeue();
                    stat.execute(sm);
                }
            }
            else
            {
                while (statements.Count > 0)
                {
                    stat = statements.Dequeue();
                    stat.execute(sm);
                }
            }

            //sm.DestroyScope();
        }
コード例 #6
0
 public void execute(ScopesManager sm)
 {
 }