public static void RefreshShaders(TotemGame game) { if (Shaders.ContainsKey("menu")) { Shaders["menu"].Parameters["Resolution"].SetValue(game.Resolution); } }
static void LoadAssetFile <T>( TotemGame game, string path, string extension, Dictionary <string, T> output, string customName = null, string forceClass = null) where T : IJsonSerializable { foreach (string file in FindAllFiles(path, extension)) { var name = Path.GetFileNameWithoutExtension(file); Console.WriteLine("Loading asset: {0}", name); using (FileStream stream = new FileStream(file, FileMode.Open)) using (StreamReader sReader = new StreamReader(stream)) using (Newtonsoft.Json.JsonTextReader reader = new Newtonsoft.Json.JsonTextReader(sReader)) { var obj = JObject.Load(reader); var qualifiedName = customName != null ? (string)obj[customName] : name; if (forceClass != null) { var ent = DeserializationRegister.CreateInstance <T>(forceClass); ent.FromJson(obj); output.Add(qualifiedName, ent); } else { output.Add(qualifiedName, DeserializationRegister.ObjectFromJson <T>(obj)); } } } }
static void LoadContentFile <T>(TotemGame game, string path, string extension, Dictionary <string, T> output) { var content = "Content/" + path; foreach (string file in FindAllFiles(content, extension)) { var dir = Path.GetDirectoryName(file); var name = Path.Combine( dir.Remove(0, Math.Min(content.Length, dir.Length)), Path.GetFileNameWithoutExtension(file) ).Replace('\\', '/'); Console.WriteLine("Loading content: {0}", name); output.Add(name, game.Content.Load <T>(path + "/" + name)); } }
public Input(TotemGame game) { Game = game; //game.Window.TextInput += (sender, e) => { RegisterTextEvent(e.Character); }; }
public GuiManager(TotemGame game) { Game = game; }