コード例 #1
0
        public DoggoEngine(String GameName)
        {
            //Initialize SDL without setting up Subsystems
            SDL2.SDL.SDL_Init(0);

            #region Graphics And Compute Interface Loading
            //Get our available graphics Settings
            GraphicsSettings mySettings = EngineSettings.LoadSettingsFile <GraphicsSettings>();//new GraphicsSettings("GraphicsSettings.xml");

            //Load the RendererWindow
            RendererWindow myRenderWindow = new RendererWindow(0, 0, GameName, mySettings.myRendererType, mySettings.SCREEN_WIDTH, mySettings.SCREEN_HEIGHT);

            //Gets our renderer singleton component
            RendererManagerComponent RendererComponentObject = RendererManagerComponent.Get();

            //Gets our Compute singleton component
            ComputeManagerComponent ComputeComponentObject = ComputeManagerComponent.Get();

            //Load proper initializers based on RendererType
            switch (mySettings.myRendererType)
            {
            case RendererType.OPENGL:
                throw new NotImplementedException();
                break;

            case RendererType.VULKAN:
                VulkanInitializer myInitializerClass = new VulkanInitializer(GameName, myRenderWindow, mySettings);
                RendererComponentObject.Initialize(myInitializerClass.RenderingManager);
                ComputeComponentObject.Initialize(myInitializerClass.ComputeManager);
                break;
            }
            #endregion

            //Gets the InputManager's Singleton Component
            InputManagerComponent myManager = InputManagerComponent.Get();

            //Gets the AudioManager's Singleton Component
            AudioManagerComponent myAudioManager = AudioManagerComponent.Get();

            //Prints out all currently unwritten tests that should've been done before actually writing the code.
#if DEBUG
            var         Assembly2 = Assembly.GetEntryAssembly();
            List <Type> myTYpes   = new List <Type>();
            myTYpes.AddRange(Assembly2.GetTypes());
            myTYpes.AddRange(Assembly.GetExecutingAssembly().GetTypes());
            Debug.WriteLine("/////////////////////////////////////////////////////////////////////////");
            Debug.WriteLine("Unwritten Tests: ");
            foreach (Type a in myTYpes)
            {
                var myAttributes = a.GetCustomAttributes <TestReminderAttribute>() as TestReminderAttribute[];
                foreach (TestReminderAttribute A in myAttributes)
                {
                    A.PrintTestInformational();
                }
            }
            Debug.WriteLine("/////////////////////////////////////////////////////////////////////////");
#endif

            //Creates the world manager with all subsystems inside of it ready for use.
            myWorldManager = new WorldManager();

            //Passes the WorldManager to the developer
            SetupGame(myWorldManager, WorldManager.myCurrentResourceManager);

            //Makes sure that the developer set the active world so that it doesn't throw a cryptic error down the line which requires them to contact me.
            if (myWorldManager.ActiveWorld == null)
            {
                throw new Exception("An active world wasn't created in SetupGame!");
            }
        }
コード例 #2
0
        public KeyboardInputSystem(World MyBase) : base(MyBase)
        {
            InputManagerComponent myComponent = InputManagerComponent.Get();

            myComponent.RegisterEventFilter(KeyboardInputFilter);
        }