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(); }
public void CompileGame(string path) { LoadModules("syn/Modules/"); var app = new SynGame(BaseModules, path); SynToC sync = new SynToC(app, "sync/game.cs"); return; }
private void WriteGameHost(SynGame game) { WriteClassHeader("SynGameHost", "SynGameHostC"); foreach (var state in game.Game.States) { WriteStateVar(state); } WriteGameNew(game.Game); WriteClassFooter(); }
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); }
public void RunGame(string path) { var app = new SynGame(BaseModules, path); app.Run(); }