Example #1
0
        public void CompileGame(SynGame game)
        {
            Tab = 0;
            WriteHeader();

            WriteGameHost(game);

            Tab = 1;

            foreach (var state in game.Game.States)
            {
                WriteState(state);
            }

            foreach (var m2 in game.Mods)
            {
                foreach (var mod in m2.SubModules)
                {
                    WriteModule(mod);
                }
            }

            Tab = 0;

            WriteFooter();
        }
Example #2
0
        public void CompileGame(string path)
        {
            LoadModules("syn/Modules/");
            var app = new SynGame(BaseModules, path);

            SynToC sync = new SynToC(app, "sync/game.cs");

            return;
        }
Example #3
0
        private void WriteGameHost(SynGame game)
        {
            WriteClassHeader("SynGameHost", "SynGameHostC");


            foreach (var state in game.Game.States)
            {
                WriteStateVar(state);
            }



            WriteGameNew(game.Game);

            WriteClassFooter();
        }
Example #4
0
        public SynToC(SynGame game, string outPath = "sync/test.cs")
        {
            osfuncs.Add("getTicks");
            osfuncs.Add("rnd");
            osfuncs.Add("rndInt");
            osfuncs.Add("drawImg");
            osfuncs.Add("drawImgCentered");
            osfuncs.Add("drawLine");
            osfuncs.Add("appWidth");
            osfuncs.Add("appHeight");


            WriteFile(outPath);

            CompileGame(game);

            EndWrite();

            string cscode = File.ReadAllText(outPath);

            dynamic cs = CSScriptLibrary.CSScript.Evaluator.LoadCode(cscode);
        }
Example #5
0
        public void RunGame(string path)
        {
            var app = new SynGame(BaseModules, path);

            app.Run();
        }