Пример #1
0
        //=========================================================================================
        /// <summary>
        /// Constructor. Creates the level renderer.
        /// </summary>
        /// <param name="parentLevel"> 
        /// Parent level for the renderer. Contains the objects to be rendered.
        /// </param>
        //=========================================================================================
        public LevelRenderer( Level parentLevel )
        {
            // If the parent level is null then complain in windows debug:

            #if WINDOWS_DEBUG

                if ( parentLevel == null ) throw new Exception("LevelRenderer must have a valid parent Level object");

            #endif

            // Save the parent level:

            m_level = parentLevel;
        }
Пример #2
0
        //=========================================================================================
        /// <summary>
        /// Constructor. Creates a level search query. 
        /// </summary>
        /// 
        /// <param name="parent"> 
        /// Level the search query belongs to. This levels data is what will be searched. 
        /// This cannot be null !
        /// </param>
        //=========================================================================================
        public LevelSearchQuery( Level parent )
        {
            // Ensure that this is not null in debug windows:

            #if WINDOWS_DEBUG

                if ( parent == null ) throw new Exception("LevelSearchQuery must have a valid parent Level object");

            #endif

            // Save the level:

            m_level = parent;
        }
Пример #3
0
        //=========================================================================================
        /// <summary>
        /// Constructor. Creates a new level collision query object. 
        /// </summary>
        /// <param name="parentLevel"> Level this query object belongs to. </param>
        //=========================================================================================
        public LevelCollisionQuery( Level parentLevel )
        {
            // If the parent level is null then complain in windows debug:

            #if WINDOWS_DEBUG

                if ( parentLevel == null ) throw new Exception("LevelRenderer must have a valid parent Level object");

            #endif

            // Save the parent level:

            m_level = parentLevel;

            // Create the arrays of collision results:

            m_collision_results = new CollisionQueryResult[MAX_RESULTS];
            m_intersect_results = new IntersectQueryResult[MAX_RESULTS];
            m_overlap_results   = new OverlapQueryResult[MAX_RESULTS];

            for ( int i = 0 ; i < MAX_RESULTS; i++ )
            {
                m_collision_results[i]  = CollisionQueryResult.NoResult;
                m_intersect_results[i]  = IntersectQueryResult.NoResult;
                m_overlap_results[i]    = OverlapQueryResult.NoResult;
            }
        }
Пример #4
0
        //=========================================================================================
        /// <summary>
        /// Initiliazes the game and loads all it's content.
        /// </summary>
        //=========================================================================================
        protected override void Initialize()
        {
            // Initialise everything

            base.Initialize();

            // Create the graphics system object

            s_graphics_system = new GraphicsSystem( s_graphics_device_manager , Content );

            // Create the audio systems:

            s_effects_audio_system = new AudioSystem
            (
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Sounds.xgs" ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Sounds.xwb" ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Sounds.xsb" ,
                false
            );

            s_music_audio_system = new AudioSystem
            (
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Music.xgs"  ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Music.xwb"  ,
                CONTENT_FOLDER + "\\Sounds\\NinjaGame_Music.xsb"  ,
                false
            );

            // Apply all default preferences:

            CorePreferences.ApplyAllSettings();

            // Create the timing system:

            s_timing_system = new TimingSystem();

            // Create the level and gui:

            s_level = new Level(); s_gui = new Gui();

            // On debug load the debug font and debug shader:

            #if DEBUG

                // Load the font

                s_debug_font = new Font("Content\\Fonts\\Game_24px.xml");

                // Load the shader:

                s_debug_shader = s_graphics_system.LoadEffect("Effects\\colored");

                // Windows debug specific:

                #if WINDOWS_DEBUG

                    // Also allow window to be resized:

                    Window.AllowUserResizing = true;

                    // Set to 640x480

                    Graphics.DeviceManager.PreferredBackBufferWidth     = 640;
                    Graphics.DeviceManager.PreferredBackBufferHeight    = 480;

                    Graphics.DeviceManager.ApplyChanges();

                    // Add debug console commands for core game

                    DebugCore.AddDebugCommands();

                #endif

            #endif

            // Load the main menu

            s_gui.Load("Content\\Guis\\Boot.xml");
        }