예제 #1
0
 protected override void LoadContent()
 {
     ConsoleRenderer.Initialize();
     StyleManager.CreateTextures(GraphicsDevice);
     MapRenderer.Initialize(GraphicsDevice);
     DeferredRenderer.Initialize(GraphicsDevice);
     Renderer2D.Initialize(GraphicsDevice);
 }
예제 #2
0
        public static void Initialize()
        {
            // set the current culture to the invariant culture
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // initialize the logging service
            Log.Initialize(LogLevel.All);
            Log.AddListener(new ConsoleLogListener());
            Log.AddListener(new GameLogListener());
            Log.AddListener(new FileLogListener("GBHGame.log", false));

            Log.Write(LogLevel.Info, "GBH2 v0 initializing");
            Log.Write(LogLevel.Critical, "jeremych is an egghead and a nabsalad");

            ConVar.Initialize();
            FileSystem.Initialize();
            Win32System.Initialize();
            MapGeometry.Initialize();
            //StyleManager.Load("Styles/bil.sty");
            //MapManager.Load("Maps/MP1-comp.gmp");
            Camera.Initialize();
            NetManager.Initialize(29960);
            Client.Initialize();
            Server.Initialize();

            GameWindow.Initialize();

            com_maxFPS      = ConVar.Register("com_maxFPS", 0, "Maximum framerate for the game loop.", ConVarFlags.Archived);
            timescale       = ConVar.Register("timescale", 1.0f, "Scale time by this amount", ConVarFlags.Cheat);
            sv_running      = ConVar.Register("sv_running", true, "Is the server running?", ConVarFlags.ReadOnly);
            cl_running      = ConVar.Register("cl_running", false, "Is the client running?", ConVarFlags.ReadOnly);
            sv_paused       = ConVar.Register("sv_paused", false, "Is the server paused?", ConVarFlags.ReadOnly);
            cl_paused       = ConVar.Register("cl_paused", false, "Is the client paused?", ConVarFlags.ReadOnly);
            net_showpackets = ConVar.Register("net_showpackets", false, "Show network packets.", ConVarFlags.None);
            mapname         = ConVar.Register("mapname", "", "Current mapname", ConVarFlags.ReadOnly);
            nickname        = ConVar.Register("nickname", Environment.GetEnvironmentVariable("username"), "Your nickname", ConVarFlags.Archived);

            Renderer.Initialize();
            MaterialManager.ReadMaterialFile("base.material");
            MaterialManager.ReadMaterialFile("Styles/bil.material");
            ConsoleRenderer.Initialize();
            //StyleManager.CreateTextures(Renderer.Device);
            MapRenderer.Initialize(Renderer.Device);
            DeferredRenderer.Initialize(Renderer.Device);
            Renderer2D.Initialize(Renderer.Device);

            // jeez, people these days just need to get a *proper* nickname
            if (ConVar.GetValue <string>("nicknamee") == Environment.GetEnvironmentVariable("username"))
            {
                Log.Write(LogLevel.Info, "It looks it's your first time running GBH2. Please type 'nickname <WANTED NICKNAME>' to set your nickname.");
            }

            var     path  = Directory.GetCurrentDirectory() + "\\config.ini";
            IniFile ini   = new IniFile(path);
            var     value = ini.IniReadValue("CONFIG", "nickname");

            if (value != null)
            {
                ConVar.SetValue <string>("nicknamee", value);
            }
        }