Exemple #1
0
        public MyGame()
        {
            _graphicsDeviceManager = new GraphicsDeviceManager(this);

            _keyboardManager = new KeyboardManager(this);
            _mouseManager = new MouseManager(this);
        }
Exemple #2
0
 public LogicGraph()
 {
     graphicsDeviceManager = new GraphicsDeviceManager(this);
     sm = new ScreenManager(this);
     MouseHelper = new MouseHelper(this);
     Content.RootDirectory = "Content";
 }
        public ShaderCompilerGame()
        {
            _graphicsDeviceManager = new GraphicsDeviceManager(this);

            _data = new ShaderData();
            _builder = new ShaderBuilder(_data);
        }
        public SharpDXRenderProvider()
        {
            GraphicsDeviceManager = new GraphicsDeviceManager(this);

            //no vsync
            GraphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
        }
 protected override void VirtualConstructor(GraphicsDeviceManager gdm)
 {
     gdm.PreferMultiSampling = true;
     gdm.PreferredBackBufferWidth = 1280;
     gdm.PreferredBackBufferHeight = 800;
     //gdm.SynchronizeWithVerticalRetrace = true;
     //IsFixedTimeStep = true;
 }
        public Main()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            audioManager = new AudioManager(this);
            mouseManager = new MouseManager(this);
            keyboardManager = new KeyboardManager(this);
            IsMouseVisible = true;
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;
            WindowCreated += WindowShown;
            GameStateChanged += NewGameState;

            content = Content;
            try
            {
                XmlDocument read = new XmlDocument();
                read.Load("Settings.xml");
                try
                {
                    muted = bool.Parse(read.SelectSingleNode("/Settings/Muted").InnerText);
                    vol = (muted) ? 0 : .025f;
                }
                catch
                {
                    Console.WriteLine("Muted value is invalid; setting to false.");
                    read.SelectSingleNode("/Settings/Muted").InnerText = "false";
                    vol = .25f;
                }
                try
                {
                    fullscreen = bool.Parse(read.SelectSingleNode("/Settings/Fullscreen").InnerText);
                    graphics.IsFullScreen = fullscreen;
                }
                catch
                {
                    Console.WriteLine("Fullscreen value is invalid; setting to false.");
                    read.SelectSingleNode("/Settings/Fullscreen").InnerText = "false";
                    graphics.IsFullScreen = false;
                }
                read.Save("Settings.xml");
            }
            catch
            {
                Console.WriteLine("Could not load settings file; most likely the file doesn't exist.");
                Console.WriteLine("Generating settings file and setting all options to default.");
                XmlDocument settings = new XmlDocument();
                XmlNode rootNode = settings.CreateElement("Settings");
                settings.AppendChild(rootNode);
                XmlNode userNode = settings.CreateElement("Muted");
                userNode.InnerText = "false";
                rootNode.AppendChild(userNode);
                userNode = settings.CreateElement("Fullscreen");
                userNode.InnerText = "false";
                rootNode.AppendChild(userNode);
                settings.Save("Settings.xml");
            }
        }
 public MyGame()
     : base()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     keyboardManager = new KeyboardManager(this);
     graphics.PreferredBackBufferWidth = 320;
     graphics.PreferredBackBufferHeight = 240;
 }
Exemple #8
0
 public Game1()
 {
     Graphics = new GraphicsDeviceManager(this);
     Graphics.PreferredBackBufferWidth = 1024;
     Graphics.PreferredBackBufferHeight = 768;
     Graphics.PreferMultiSampling = true;
     
     Content.RootDirectory = "Content";
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="HelloWorldGame" /> class.
        /// </summary>
        public HelloWorldGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomEffectGame" /> class.
        /// </summary>
        public CustomEffectGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            graphicsDeviceManager.PreferredDepthStencilFormat = DepthFormat.None;

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
        }
        public CanvasEngine(CanvasProgram program)
        {
            this.program = program;

             var graphicsDeviceManager = new GraphicsDeviceManager(this) {
            PreferredBackBufferWidth = 1280,
            PreferredBackBufferHeight = 720,
            DeviceCreationFlags = SharpDX.Direct3D11.DeviceCreationFlags.Debug
             };
        }
 public VisionQuestGame(SharedData data)
 {
     _data = data;
     _graphicsDeviceManager = new GraphicsDeviceManager(this)
     {
         PreferredBackBufferWidth = _data.Size.Width,
         PreferredBackBufferHeight = _data.Size.Height
     };
     Content.RootDirectory = "Content";
 }
Exemple #13
0
 public MazeEngine(RenderControl target)
 {
     _graphicsDeviceManager = new GraphicsDeviceManager(this)
     {
         PreferredBackBufferWidth = target.Width,
         PreferredBackBufferHeight = target.Height
     };
     _target = target;
     
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="Project1Game" /> class.
        /// </summary>
        public Project1Game()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
            keyboardManager = new KeyboardManager(this);
            mouseManager = new MouseManager(this);
        }
        public AdnRenderer()
        {
            // Mandatory: Creates a graphics manager.
            _graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

            _models = new List<DxMesh>();
        }
Exemple #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ModelRenderingGame" /> class.
        /// </summary>
        public ModelRenderingGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            graphicsDeviceManager.PreferredGraphicsProfile = new FeatureLevel[] { FeatureLevel.Level_9_1, };

            pointer = new PointerManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
        }
        private List<Sprite> spriteList = new List<Sprite>(); //the buildASprite method will fill this up with sprites

        #endregion Fields

        #region Constructors

        public purpleplatypusClient()
        {
            myGraphicsDeviceManager = new GraphicsDeviceManager(this);

            Device.RegisterDevice(UsagePage.Generic, UsageId.GenericKeyboard, DeviceFlags.None);
            Device.KeyboardInput += (sender, args) => keyboardEvent(args);

            Device.RegisterDevice(UsagePage.Generic, UsageId.GenericMouse, DeviceFlags.None);
            Device.MouseInput += (sender, args) => mouseEvent(args);

            this.Window.AllowUserResizing = true;
        }
Exemple #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DxExempel2" /> class.
        /// </summary>
        public DxExempel2()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

            // Initialize input keyboard system
            keyboard = new KeyboardManager(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="OcclusionQueryGame" /> class.
        /// </summary>
        public OcclusionQueryGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

            // Initialize input mouse system
            mouse = new MouseManager(this);
        }
Exemple #20
0
        public GameApp()
        {
            _deviceManager = new GraphicsDeviceManager(this);

            screenWidth = 1280;
            screenHeight = 720;
            _deviceManager.PreferredBackBufferWidth = ScreenWidth;
            _deviceManager.PreferredBackBufferHeight = ScreenHeight;

            Content.RootDirectory = "Content";

            sw = new Stopwatch();
        }
Exemple #21
0
        /// <summary>
        /// Construct any component instances here.
        /// </summary>
        public MyGame()
        {
            // GraphicsDeviceManager is mandatory for a game to run
            _graphicsDeviceManager = new GraphicsDeviceManager(this);

            // initialize the scene renderer system
            _sceneRenderer = new SceneRenderer(this);

            // initialize the camera provider, it will register the camera service also
            _cameraProvider = new CameraProvider(this);

            // Set the content root directory relative to current executable's folder
            Content.RootDirectory = "Content";
        }
        private ViewportF _currentViewport; // the current viewport of the 3D swap chain

        public ForegroundSwapChainGame()
        {
            _graphicsDeviceManager = new GraphicsDeviceManager(this);
            _graphicsDeviceManager.DeviceCreationFlags |= SharpDX.Direct3D11.DeviceCreationFlags.BgraSupport;

            // we will create and destroy the foreground swap chain in these event handlers
            _graphicsDeviceManager.DeviceChangeBegin += HandleDeviceChangeBegin;
            _graphicsDeviceManager.DeviceChangeEnd += HandleDeviceChangeEnd;

            // initialize the keyboard manager
            _keyboardManager = new KeyboardManager(this);

            Content.RootDirectory = "Content";
        }
        public Platformer()
        {
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            graphicsDeviceManager.SynchronizeWithVerticalRetrace = false;

            windowHeight = App.RootFrame.RenderSize.Width;
            windowWidth = App.RootFrame.RenderSize.Height;

            TouchPanel.EnabledGestures = GestureType.Flick;

            graphicsDeviceManager.SupportedOrientations = DisplayOrientation.LandscapeRight;

            Content.RootDirectory = "Content";
        }
Exemple #24
0
        /// <summary>
        /// Hlavní konstruktor.
        /// </summary>
        public GlibWindow()
        {
            gdm = new GraphicsDeviceManager(this);
            fpsClock = new Stopwatch();

            keyboard = new Keyboard(this);
            mouse = new Mouse(this);

            IsFixedTimeStep = false;
            gdm.SynchronizeWithVerticalRetrace = false;

            Content.RootDirectory = "Content";

            VirtualConstructor(gdm);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Project2Game" /> class.
        /// </summary>
        public Project2Game(LevelSelection levelSelection)
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

            this.levelSelection = levelSelection;
            models = new Dictionary<string, Model>();
            Score = 0;
            this.IsFixedTimeStep = !PersistentStateManager.dynamicTimestep; // note the NOT

        }
Exemple #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Project2Game" /> class.
        /// </summary>
        public Project2Game(MainPage main)
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            this.main = main;

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
            models = new Stack<GameModel>(3);

            // Creates a keyboard manager
            input = new GameInput();
            // Initialise event handling.
            input.gestureRecognizer.ManipulationUpdated += OnManipulationUpdated;
        }
Exemple #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomEffectGame" /> class.
        /// </summary>
        public CustomEffectGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            graphicsDeviceManager.PreferredDepthStencilFormat = DepthFormat.None;

            // Add dynamic EffectCompilerSystem, only active on desktop and compiled in debug mode.
            // While the program is running, you can edit the shader and save a new version
            // The EffectCompilerSystem will recompile dynamically the effect without having to
            // reload/recompile the whole application.
            GameSystems.Add(new EffectCompilerSystem(this));

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
        }
Exemple #28
0
        public LarvGame()
        {
            _graphicsDeviceManager = new GraphicsDeviceManager(this);
            _graphicsDeviceManager.DeviceCreationFlags = DeviceCreationFlags.Debug;
            _graphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
            #if false
            var screen = Screen.AllScreens.First(_ => !_.Primary);
            _graphicsDeviceManager.IsFullScreen = true;
            _graphicsDeviceManager.PreferredBackBufferWidth = screen.Bounds.Width;
            _graphicsDeviceManager.PreferredBackBufferHeight = screen.Bounds.Height;
            #else
            _graphicsDeviceManager.PreferredBackBufferWidth = 1920;
            _graphicsDeviceManager.PreferredBackBufferHeight = 1080;
            #endif

            Content.RootDirectory = "Content";
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SpriteBatchAndFontGame" /> class.
        /// </summary>
        public SpriteBatchAndFontGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this); 

            // Force no vsync and use real timestep to print actual FPS
            graphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
            IsFixedTimeStep = false;

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

            // Variable used for FPS
            fpsClock = new Stopwatch();
            fpsText = string.Empty;
        }
Exemple #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SpriteBatchAndFontGame" /> class.
        /// </summary>
        public KeyboardInputGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Create the keyboard manager
            keyboarManager = new KeyboardManager(this);

            // Force no vsync and use real timestep to print actual FPS
            graphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
            IsFixedTimeStep = false;

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
            IsMouseVisible = true;
        }