/// <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; }
public HeadsUpDisplay(IGameControl game_control) { PANELS = new List<Aptima.Asim.DDD.Gui.Common.GameLib.Gui.Panel>(); game_control.GetTargetControl().MouseClick += new MouseEventHandler(MouseClick); game_control.GetTargetControl().MouseDoubleClick += new MouseEventHandler(MouseDoubleClick); game_control.GetTargetControl().MouseDown += new MouseEventHandler(MouseDown); game_control.GetTargetControl().MouseMove += new MouseEventHandler(MouseMove); game_control.GetTargetControl().MouseUp += new MouseEventHandler(MouseUp); game_control.GetTargetControl().MouseWheel += new MouseEventHandler(MouseWheel); game_control.GetTargetControl().KeyDown += new KeyEventHandler(KeyDown); game_control.GetTargetControl().KeyPress += new KeyPressEventHandler(KeyPress); game_control.GetTargetControl().KeyUp += new KeyEventHandler(KeyUp); }
public HeadsUpDisplay(IGameControl game_control) { PANELS = new List <Aptima.Asim.DDD.Gui.Common.GameLib.Gui.Panel>(); game_control.GetTargetControl().MouseClick += new MouseEventHandler(MouseClick); game_control.GetTargetControl().MouseDoubleClick += new MouseEventHandler(MouseDoubleClick); game_control.GetTargetControl().MouseDown += new MouseEventHandler(MouseDown); game_control.GetTargetControl().MouseMove += new MouseEventHandler(MouseMove); game_control.GetTargetControl().MouseUp += new MouseEventHandler(MouseUp); game_control.GetTargetControl().MouseWheel += new MouseEventHandler(MouseWheel); game_control.GetTargetControl().KeyDown += new KeyEventHandler(KeyDown); game_control.GetTargetControl().KeyPress += new KeyPressEventHandler(KeyPress); game_control.GetTargetControl().KeyUp += new KeyEventHandler(KeyUp); }
public void BindGameController() { _mouse_up = new MouseEventHandler(OnMouseUp); _game_control.GetTargetControl().MouseUp += _mouse_up; _mouse_click = new MouseEventHandler(OnMouseClick); _game_control.GetTargetControl().MouseClick += _mouse_click; _mouse_down = new MouseEventHandler(OnMouseDown); _game_control.GetTargetControl().MouseDown += _mouse_down; _mouse_move = new MouseEventHandler(OnMouseMove); _game_control.GetTargetControl().MouseMove += _mouse_move; _mouse_wheel = new MouseEventHandler(OnMouseWheel); _game_control.GetTargetControl().MouseWheel += _mouse_wheel; _mouse_double_click = new MouseEventHandler(OnMouseDoubleClick); _game_control.GetTargetControl().MouseDoubleClick += _mouse_double_click; _key_press = new KeyPressEventHandler(OnKeyPress); _game_control.GetTargetControl().KeyPress += _key_press; _key_down = new KeyEventHandler(OnKeyDown); _game_control.GetTargetControl().KeyDown += _key_down; _key_up = new KeyEventHandler(OnKeyUp); _game_control.GetTargetControl().KeyUp += _key_up; }