Beispiel #1
0
        public static void Init()
        {
            ContextSettings settings = new ContextSettings (32, 8, 4, 3, 3);
              Styles windowStyle = Styles.Close;

              if (FULLSCREEN) {
            windowStyle = Styles.Fullscreen;
            Game.Width = FULLSCREEN_WIDTH;
            Game.Height = FULLSCREEN_HEIGHT;
            Game.CameraWidth = FULLSCREEN_WIDTH;
            Game.CameraHeight = FULLSCREEN_HEIGHT;
              }

              Context = new RenderWindow (new VideoMode ((uint)Game.Width, (uint)Game.Height), WindowTitleText, windowStyle, settings);

              Context.Closed += OnClose;
              Context.KeyPressed += KeyPressed;
              Context.KeyReleased += KeyReleased;
              Context.SetKeyRepeatEnabled (true);

              Rand = new Random ();
              EventMgr = new EventManager ();
              World = new GameWorld ();

              Camera = new View ();
              Camera.Center = new Vector2f (CameraWidth / 2, CameraHeight / 2);
              Camera.Size = new Vector2f (CameraWidth, CameraHeight); // Half Size
              Context.SetView (Camera);
        }
Beispiel #2
0
        public static void Init()
        {
            Context = new RenderWindow(new VideoMode(Width, Height), WindowTitle);
              Context.Closed += OnClose;
              Context.KeyPressed += KeyPressed;
              Context.KeyReleased += KeyReleased;
              Context.MouseMoved += MouseMoved;
              Context.MouseButtonPressed += MouseButtonPressed;
              Context.MouseButtonReleased += MouseButtonReleased;
              Context.MouseWheelMoved += MouseWheelMoved;
              Context.JoystickButtonPressed += JoystickButtonPressed;
              Context.JoystickButtonReleased += JoystickButtonReleased;
              Context.JoystickConnected += JoystickConnected;
              Context.JoystickDisconnected += JoystickDisconnected;
              Context.JoystickMoved += JoystickMoved;

              Rand = new Random();
              EventMgr = new EventManager();
              World = new GameWorld();
        }
Beispiel #3
0
        public static void Init()
        {
            ContextSettings settings = new ContextSettings (32, 8, 4, 3, 3);
              Styles windowStyle = Styles.Close;

              if (FULLSCREEN) {
            windowStyle = Styles.Fullscreen;
            Game.Width = FULLSCREEN_WIDTH;
            Game.Height = FULLSCREEN_HEIGHT;
            Game.CameraWidth = FULLSCREEN_WIDTH;
            Game.CameraHeight = FULLSCREEN_HEIGHT;
              }

              Context = new RenderWindow (new VideoMode ((uint)Game.Width, (uint)Game.Height), WindowTitleText, windowStyle, settings);

              Context.Closed += OnClose;
              Context.KeyPressed += KeyPressed;
              Context.KeyReleased += KeyReleased;
            //      Context.MouseMoved += MouseMoved;
            //      Context.MouseButtonPressed += MouseButtonPressed;
            //      Context.MouseButtonReleased += MouseButtonReleased;
            //      Context.MouseWheelMoved += MouseWheelMoved;
            //      Context.JoystickButtonPressed += JoystickButtonPressed;
            //      Context.JoystickButtonReleased += JoystickButtonReleased;
            //      Context.JoystickConnected += JoystickConnected;
            //      Context.JoystickDisconnected += JoystickDisconnected;
            //      Context.JoystickMoved += JoystickMoved;
              Context.SetKeyRepeatEnabled (true);

              Rand = new Random ();
              EventMgr = new EventManager ();
              World = new GameWorld ();

              Camera = new View ();
              Camera.Center = new Vector2f (CameraWidth / 2, CameraHeight / 2);
              Camera.Size = new Vector2f (CameraWidth, CameraHeight); // Half Size
              Context.SetView (Camera);
              // Context.SetView(Context.DefaultView); // Resets the view to the window size. Good for drawing UI
        }