Example #1
0
        /// <summary>
        /// Starts the Game Framework, registers a form and a gamecontroller.
        /// The form is required to intercept keyboard and mouse input.
        /// The GameController initializes scenes and feeds them to the GameController.
        /// </summary>
        /// <param name="form"></param>
        /// <param name="game_control"></param>
        public void Run(Form form, IGameControl game_control)
        {
            if (form == null)
            {
                throw new ApplicationException("Must supply a windows Form.");
            }
            _main_window = form;
            if (game_control == null)
            {
                throw new ApplicationException("Game Control is uninitialized.");
            }
            _CANVAS_ = new Canvas();
            QueryPerformanceFrequency(ref _ticks_per_second);

            _game_control          = game_control;
            _CANVAS_.TargetControl = _game_control.GetTargetControl();

            _game_control.InitializeCanvasOptions(_CANVAS_.Options);
            _CANVAS_.InitializeCanvas();

            _AvailableScenes_ = _game_control.InitializeScenes(this);
            _AvailableScenes_[CURRENT_SCENE].Initialize(this);
            _game_control.SceneChanged(CURRENT_SCENE);

            Idle              = new EventHandler(GameLoop);
            Application.Idle += Idle;
        }
Example #2
0
        /// <summary>
        /// Starts the Game Framework, registers a form and a gamecontroller.
        /// The form is required to intercept keyboard and mouse input.
        /// The GameController initializes scenes and feeds them to the GameController.
        /// </summary>
        /// <param name="form"></param>
        /// <param name="game_control"></param>
        public void Run(Form form, IGameControl game_control)
        {
            if (form == null)
            {
                throw new ApplicationException("Must supply a windows Form.");
            }
            _main_window = form;
            if (game_control == null)
            {
                throw new ApplicationException("Game Control is uninitialized.");
            }
            _CANVAS_ = new Canvas();
            QueryPerformanceFrequency(ref _ticks_per_second);

            _game_control = game_control;
            _CANVAS_.TargetControl = _game_control.GetTargetControl();

            _game_control.InitializeCanvasOptions(_CANVAS_.Options);
            _CANVAS_.InitializeCanvas();

            _AvailableScenes_ = _game_control.InitializeScenes(this);
            _AvailableScenes_[CURRENT_SCENE].Initialize(this);
            _game_control.SceneChanged(CURRENT_SCENE);

            Idle = new EventHandler(GameLoop);
            Application.Idle += Idle;

        }