Ejemplo n.º 1
0
 public static void RefreshShaders(TotemGame game)
 {
     if (Shaders.ContainsKey("menu"))
     {
         Shaders["menu"].Parameters["Resolution"].SetValue(game.Resolution);
     }
 }
Ejemplo n.º 2
0
 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));
                     }
                 }
     }
 }
Ejemplo n.º 3
0
        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));
            }
        }
Ejemplo n.º 4
0
 public Input(TotemGame game)
 {
     Game = game;
     //game.Window.TextInput += (sender, e) => { RegisterTextEvent(e.Character); };
 }
Ejemplo n.º 5
0
 public GuiManager(TotemGame game)
 {
     Game = game;
 }