ApplyChanges() public method

public ApplyChanges ( ) : void
return void
コード例 #1
0
ファイル: Main.cs プロジェクト: Shmaug/Voxel-Generator
        public Main()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
            graphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
            graphics.PreferMultiSampling = true;
            graphics.ApplyChanges();

            Window.AllowUserResizing = true;
            Window.ClientSizeChanged += (object sender, EventArgs e) => {
                if (player != null && player.Camera != null)
                    player.Camera.AspectRatio = (float)Window.ClientBounds.Width / Window.ClientBounds.Height;

                graphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
                graphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
                graphics.ApplyChanges();

                if (world != null) {
                    world.sunRenderTarget = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                    world.postfxRenderTarget1 = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                    world.postfxRenderTarget2 = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                    world.sceneRenderTarget = new RenderTarget2D(GraphicsDevice, Window.ClientBounds.Width, Window.ClientBounds.Height, false, GraphicsDevice.PresentationParameters.BackBufferFormat, GraphicsDevice.PresentationParameters.DepthStencilFormat);
                }
            };

            ((System.Windows.Forms.Form)System.Windows.Forms.Form.FromChildHandle(Window.Handle)).WindowState = System.Windows.Forms.FormWindowState.Maximized;
        }
コード例 #2
0
ファイル: Configuration.cs プロジェクト: hkeeble/GroupProject
        public Configuration(Game game)
            : base(game)
        {
            graphics = new GraphicsDeviceManager(game);
            Game_Library.Configuration config = game.Content.Load<Game_Library.Configuration>("Interface/Configuration");
            Width = config.Width;
            Height = config.Height;
            Fullscreen = config.Fullscreen;

            if (Fullscreen == true)
            {
                graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                graphics.ApplyChanges();
                if (graphics.IsFullScreen == false)
                    graphics.ToggleFullScreen();
            }
            else
            {
                graphics.PreferredBackBufferHeight = Height;
                graphics.PreferredBackBufferWidth = Width;
                graphics.ApplyChanges();
                if (graphics.IsFullScreen == true)
                    graphics.ToggleFullScreen();
            }
            game.Window.ClientSizeChanged += new EventHandler<EventArgs>(OnResize);
        }
コード例 #3
0
        public Game1()
        {
            Content.RootDirectory = "Content";
            graphics = new GraphicsDeviceManager(this);
            //this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 54f);
            #if WINDOWS_PHONE
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 480;
            #endif

            #if XBOX || WINDOWS
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            #endif
            graphics.PreferMultiSampling = true;
            parameters.MultiSampleCount = 16;
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            graphics.ApplyChanges();

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Camera.ViewportWidth = graphics.PreferredBackBufferWidth;
            Camera.ViewportHeight = graphics.PreferredBackBufferHeight;
            Camera.SetScreenRectangle();

            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new PressStartScreen(), null);

            //Guide.SimulateTrialMode = false;
        }
コード例 #4
0
ファイル: Game1.cs プロジェクト: J-O-K-E-R/3951
        //private double score = 0;

        public Game1() {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 1600;  // set this value to the desired width of your window
            graphics.PreferredBackBufferHeight = 900;   // set this value to the desired height of your window
            graphics.ApplyChanges();
            Content.RootDirectory = "Content";
        }
コード例 #5
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            List<String> ws = EugLib.Tools.toArgv(EugLib.FileStream.readFile("files/WinSize"));
            int a,b;
            if (ws.Count >= 2 && int.TryParse(ws.ElementAt(0), out a) && int.TryParse(ws.ElementAt(1), out b))
            {
                graphics.PreferredBackBufferWidth = a;
                graphics.PreferredBackBufferHeight = b;
            }
            else
            {
                graphics.PreferredBackBufferWidth = 900;
                graphics.PreferredBackBufferHeight = 600;
                EugLib.FileStream.writeFile("files/WinSize", graphics.PreferredBackBufferWidth.ToString() + " " + graphics.PreferredBackBufferHeight.ToString());
            }
            graphics.ApplyChanges();
            this.Window.AllowUserResizing = true;
            Rectangle winsize = Window.ClientBounds;
            keyboardState = Keyboard.GetState();
            mouseState = Mouse.GetState();

            son = new Son();

            scenes = new Dictionary<Scene, AbstractScene>();
            scenes.Add(Scene.InGame, new InGame(winsize, keyboardState, mouseState));
            scenes.Add(Scene.MainMenu, new MainMenu(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Extra, new SceneExtras(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Credit, new SceneCredit(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Titre, new SceneTitre(winsize, keyboardState, mouseState));
            scenes.Add(Scene.Options, new SceneOptions(winsize, keyboardState, mouseState));
            currentScene = Scene.Titre;
        }
コード例 #6
0
 public static void Initialize(ref GraphicsDeviceManager graphics)
 {
     GraphicsHandler.graphics = graphics;
     graphics.PreferredBackBufferWidth = (int)GameOptions.Resolution.X;
     graphics.PreferredBackBufferHeight = (int)GameOptions.Resolution.Y;
     graphics.ApplyChanges();
 }
コード例 #7
0
ファイル: TankAGame.cs プロジェクト: sinhpham/tanka
        public TankAGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 1000;
            graphics.PreferredBackBufferHeight = 750;
            graphics.ApplyChanges();

            this.IsFixedTimeStep = false;
            random = new Random();

            Content.RootDirectory = "Content";

            config = TankAConfig.Instance;
            config.LoadFromConfigFile();

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            // Active first screen
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);

            network = new NetworkManager(this);
            Components.Add(network);
            Services.AddService(typeof(INetworkManager), network);
            thisGame = this;
        }
コード例 #8
0
ファイル: Game.cs プロジェクト: GoodSky/Sim-U
        /// <summary>
        /// Game Constructor-
        /// set the game constants
        /// NOTE: at some point the constants should probably be read from a configuration file
        /// </summary>
        public Game()
        {
            // Load the game settings
            GameConfig = new Config(@"Configs\GameSettings.ini");

            // Set up logging
            if (GameConfig.GetBoolValue("DebugLogging", false))
            {
                string logPath = GameConfig.GetStringValue("DebugLoggingPath", null);
                int logsToKeep = GameConfig.GetIntValue("DebugLoggingToKeep", 3);
                if (logPath != null)
                {
                    Logger.Initialize(logPath, logsToKeep);
                }
            }

            // Set up the graphics device
            Graphics = new GraphicsDeviceManager(this);
            Graphics.PreferredBackBufferWidth = Constants.WINDOW_WIDTH;
            Graphics.PreferredBackBufferHeight = Constants.WINDOW_HEIGHT;
            Graphics.IsFullScreen = GameConfig.GetBoolValue("FullScreen", false);
            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            // Window Properties
            this.IsMouseVisible = true;
            this.Window.Title = "University Simulator 2014";
            this.Window.AllowUserResizing = false;
        }
コード例 #9
0
ファイル: Game1.cs プロジェクト: kotKompot/Borsch
        public Game1()
            : base()
        {
            graphics = new GraphicsDeviceManager(this);
            //Vector2 ScreenResolution = new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight);
            screenSize = new Vector2(1000,900); //HD+
            //screenSize = new Vector2(480,480);
            //screenSize = new Vector2(480, 700);
            //screenSize = new Vector2(1400, 900);
            graphics.PreferredBackBufferWidth = (int) screenSize.X;// 480; //ширина экрана
            graphics.PreferredBackBufferHeight = (int) screenSize.Y; //его высота

            if (screenSize.X > screenSize.Y) {  littleSide = screenSize.Y; }
            else {  littleSide = screenSize.X; }
            moveScale = new Vector2(littleSide / gameCoordinates.X, screenSize.Y / gameCoordinates.Y);
            scale = new Vector2((float)(0.5f * littleSide / gameCoordinates.X), (float)(0.5f * littleSide / gameCoordinates.Y));
            //graphics.IsFullScreen = true; //включаем полноэкранный режим
            //graphics.PreferredBackBufferWidth = (int)ScreenResolution.X;// 1366;// 1600;
            //graphics.PreferredBackBufferHeight = (int)ScreenResolution.Y;// 768; // 900;

            //graphics.IsFullScreen = true;

            Window.IsBorderless = true;
            graphics.ApplyChanges();

            graphics.PreferMultiSampling = false;

               // graphics.ToggleFullScreen();
            Content.RootDirectory = "Content";
        }
コード例 #10
0
ファイル: Game1.cs プロジェクト: icd-lab/d-flip-series
        public Game1(string[] args)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.PreferredBackBufferWidth = 1366;
            graphics.PreferredBackBufferHeight = 768;

            graphics.PreferMultiSampling = true;
            this.Window.Title = Title;
            this.Window.AllowUserResizing = true;
            this.IsMouseVisible = false;

            graphics.ApplyChanges();

            dflip.SystemParameter.clientBounds = new BoundingBox2D(new Vector2(Window.ClientBounds.Left, Window.ClientBounds.Top), new Vector2(Window.ClientBounds.Right, Window.ClientBounds.Bottom), 0f);
            dflip.SystemParameter.ClientHeight = (int)this.Window.ClientBounds.Height;
            dflip.SystemParameter.ClientWidth = (int)this.Window.ClientBounds.Width;
            dflip.SystemParameter.control = System.Windows.Forms.Control.FromHandle(this.Window.Handle);

            this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);

            mainProcess = new dflip.SystemParameter();
            if (args.Length > 0)
            {
                profilePath = args[0];
            }
            else profilePath = "profile.ini";
        }
コード例 #11
0
ファイル: Core.cs プロジェクト: jeffreese/JellyFish12000
        public static void Init(int width, int height)
        {
            m_Game = new Game();
            m_Content = m_Game.Content;
            m_Content.RootDirectory = "Content";

            m_Graphics = new GraphicsDeviceManager(m_Game);
            m_Graphics.PreferredBackBufferFormat = SurfaceFormat.Color;
            m_Graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
            m_Graphics.PreferredBackBufferWidth = width;
            m_Graphics.PreferredBackBufferHeight = height;
            m_Graphics.SynchronizeWithVerticalRetrace = false;
            m_Graphics.PreferMultiSampling = false;
            m_Graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(PreparingDeviceSettings);

            m_Graphics.ApplyChanges();

            if (!m_Graphics.SynchronizeWithVerticalRetrace)
                m_Game.IsFixedTimeStep = false;

            m_DeviceService = (IGraphicsDeviceService)m_Game.Services.GetService(typeof(IGraphicsDeviceService));

            // just to preload the asset. m_Content will return a cached copy later on
            Effect domeFX = m_Content.Load<Effect>("Dome");
            Texture2D texture = m_Content.Load<Texture2D>("Sprite");

            domeFX.Parameters["ParticleSize"].SetValue(2.5f);
            domeFX.Parameters["Texture"].SetValue(texture);
        }
コード例 #12
0
ファイル: AtlasGraphics.cs プロジェクト: Racura/AtlasEngine
        public AtlasGraphics(AtlasGlobal atlas, GraphicsDeviceManager _graphicsDeviceManager)
            : base(atlas)
        {
            _currentMode = AtlasGraphicsMode.None;

            _graphicsDevice = atlas.Game.GraphicsDevice;
            this._graphicsDeviceManager = _graphicsDeviceManager;

            _graphicsDeviceManager.PreferredBackBufferFormat = SurfaceFormat.Color;

            #if XNA
            _graphicsDeviceManager.PreferredBackBufferHeight = 768;
            _graphicsDeviceManager.PreferredBackBufferWidth = 1024;
            #endif
            ////_graphicsDeviceManager.IsFullScreen = true;
            _graphicsDeviceManager.ApplyChanges();

            _spriteBatch = new SpriteBatch(_graphicsDevice);

            _basicEffect = new BasicEffect(_graphicsDeviceManager.GraphicsDevice);

            batch = new VertexPositionColorTexture[32][];
            batchPrimitiveCount = new int[batch.Length];

            _viewPort = new Viewport(0, 0,
                _graphicsDeviceManager.PreferredBackBufferWidth,
                _graphicsDeviceManager.PreferredBackBufferHeight);
        }
コード例 #13
0
ファイル: App1.cs プロジェクト: Ryuzaki/RVTN
 /// <summary>
 /// Default constructor.
 /// </summary>
 public App1()
 {
     graphics = new GraphicsDeviceManager(this);
     graphics.PreferMultiSampling = true;
     graphics.ApplyChanges();
     Content.RootDirectory = "Content";
 }
コード例 #14
0
ファイル: Soar.cs プロジェクト: karrtmomil/HackingKinect
        public Soar()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //set window preferences
            graphics.PreferredBackBufferWidth = 900;
            graphics.PreferredBackBufferHeight = 900;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Resources.Instance.SetSpriteReader(new SpriteReader.SpriteReader(Content.RootDirectory + @"\", "BirdSprite.xml"));
            Resources.Instance.SetSpriteBlackReader(new SpriteReader.SpriteReader(Content.RootDirectory + @"\", "BlackBirdSprite.xml"));

            graphics.ApplyChanges();
        }
コード例 #15
0
ファイル: Engine.cs プロジェクト: nando29/snaker
        public Engine()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            this.IsMouseVisible = true;

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;
            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Components.Add(new GameLayer(this));

            bloom = new BloomComponent(this);
            bloom.Settings = BloomSettings.PresetSettings[0];
            bloom.Settings.MixValue = 0;
            bloom.DebugInput = true;
            Components.Add(bloom);

            //important: add fps after bloom, else it will be blurred
            FrameRateCounter fps = new FrameRateCounter(this);
            fps.Position = new Vector2(5, 5);
            Components.Add(fps);

            Components.Add(new MessageLayer(this));
        }
コード例 #16
0
        public MonkeyInvasionGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            //Changes the resolutin of the window
            graphics.PreferredBackBufferHeight = 720;
            graphics.PreferredBackBufferWidth = 1280;

            //Set this for fullscreen
            //graphics.IsFullScreen = true;

            IsMouseVisible = true;

            //this.Window.AllowUserResizing = true;
            //this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged);

            //Applys the changes
            graphics.ApplyChanges();

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);
        }
コード例 #17
0
ファイル: Game1.cs プロジェクト: initials/NinetyNineMoves
        //nothing much to see here, typical XNA initialization code
        public FlxFactory()
        {

            int div = 2;
            FlxG.zoom = 1;
#if DEBUGX2
            div = 2;
            FlxG.zoom = 2;
#endif

#if ! DEBUG
            FlxG.zoom = 2;
            div = 1;
            FlxG.fullscreen = true;

#endif
            FlxG.resolutionWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width / div;
            FlxG.resolutionHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / div;

            //set up the graphics device and the content manager
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            if (FlxG.fullscreen)
            {
                //resX = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                //resY = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                if (GraphicsAdapter.DefaultAdapter.IsWideScreen)
                {
                    //if user has it set to widescreen, let's make sure this
                    //is ACTUALLY a widescreen resolution.
                    if (((FlxG.resolutionWidth / 16) * 9) != FlxG.resolutionHeight)
                    {
                        FlxG.resolutionWidth = (FlxG.resolutionHeight / 9) * 16;
                    }
                }
            }

            //we don't need no new-fangled pixel processing
            //in our retro engine!
            _graphics.PreferMultiSampling = false;
            //set preferred screen resolution. This is NOT
            //the same thing as the game's actual resolution.
            _graphics.PreferredBackBufferWidth = FlxG.resolutionWidth;
            _graphics.PreferredBackBufferHeight = FlxG.resolutionHeight;
            //make sure we're actually running fullscreen if
            //fullscreen preference is set.
            if (FlxG.fullscreen && _graphics.IsFullScreen == false)
            {
                _graphics.ToggleFullScreen();
            }
            _graphics.ApplyChanges();

            Console.WriteLine("Running Game at Settings: {0}x{1}\nFullscreen?: {2}\nPreferrred: {3}x{4}", FlxG.resolutionWidth, FlxG.resolutionHeight, FlxG.fullscreen, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);

            FlxG.Game = this;
#if !WINDOWS_PHONE
            //Components.Add(new GamerServicesComponent(this));
#endif
        }
コード例 #18
0
ファイル: Game1.cs プロジェクト: globeus/worldcraft
        public Game1()
        {
            Content.RootDirectory = "Content";

            GraphicsDeviceManager = new GraphicsDeviceManager(this);

            GraphicsDeviceManager.PreferMultiSampling = true; // Turn on antialiasing
            GraphicsDeviceManager.SynchronizeWithVerticalRetrace = true; // Turn on VSync
            GraphicsDeviceManager.GraphicsProfile = GraphicsProfile.HiDef; // Turn on best graphic settings

            GraphicsDeviceManager.IsFullScreen = false;

            if (GraphicsDeviceManager.IsFullScreen) // fullscreen
            {
                GraphicsDeviceManager.PreferredBackBufferWidth = 1920;
                GraphicsDeviceManager.PreferredBackBufferHeight = 1200;

                Window.AllowUserResizing = false;
            }
            else // window mode
            {
                GraphicsDeviceManager.PreferredBackBufferWidth = 1280;
                GraphicsDeviceManager.PreferredBackBufferHeight = 720;

                Window.AllowUserResizing = true;
            }

            GraphicsDeviceManager.ApplyChanges();
        }
コード例 #19
0
        /// <summary>
        /// The main game constructor
        /// </summary>
        public MadLabGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 60f);

            // Setup window
            Window.Title = "MadLab";
            graphics.PreferredBackBufferWidth = GameConstants.X_RESOLUTION;
            graphics.PreferredBackBufferHeight = GameConstants.Y_RESOLUTION;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();

            // Create the screen factory and add it to the Services
            screenFactory = new ScreenFactory();
            Services.AddService(typeof(IScreenFactory), screenFactory);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            // component for screenManager
            Components.Add(screenManager);

            # if(XBOX)
            Components.Add(new GamerServicesComponent(this));
            #endif
        }
コード例 #20
0
        public PokeGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.ApplyChanges();

            Content.RootDirectory = "Content";
        }
コード例 #21
0
ファイル: Game1.cs プロジェクト: liwq-net/UIFactory
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            //#if MACOS
            //            Content.RootDirectory = "AngryNinjas/Content";
            //#else
            Content.RootDirectory = "Content";
            //#endif
            //
            //#if XBOX || OUYA
            //            graphics.IsFullScreen = true;
            //#else
            graphics.IsFullScreen = false;
            graphics.PreferMultiSampling = true;
            graphics.ApplyChanges();
            //#endif

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333 / 2);

            // Extend battery life under lock.
            //InactiveSleepTime = TimeSpan.FromSeconds(1);

            CCApplication application = new AppDelegate(this, graphics);
            Components.Add(application);
            //#if XBOX || OUYA
            //            CCDirector.SharedDirector.GamePadEnabled = true;
            //            application.GamePadButtonUpdate += new CCGamePadButtonDelegate(application_GamePadButtonUpdate);
            //#endif
        }
コード例 #22
0
ファイル: Main.cs プロジェクト: sp-alex-osou/TerrainLOD
        public Main()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.ApplyChanges();

            resolution = Settings.Default.WindowResolution;

            graphics.PreferredBackBufferWidth = resolution.X;
            graphics.PreferredBackBufferHeight = resolution.Y;

            Content.RootDirectory = "Content";

            camera = new FreeLookCamera(this);
            cameraHandler = new CameraHandler(this);
            fps = new FPS(this);
            hud = new HUD(this);

            Components.Add(camera);
            Components.Add(cameraHandler);
            Components.Add(fps);
            Components.Add(hud);

            Services.AddService(typeof(ICamera), camera);

            fakeViewFrustum = new BoundingFrustum(Matrix.Identity);
        }
コード例 #23
0
ファイル: Game1.cs プロジェクト: umutseven92/Romero.Windows
        public Game1()
        {
            if (!File.Exists(Path.Combine(_userConfigPath, "config.us")))
            {
                CreateUserConfig();
            }

            var config = XDocument.Load(Path.Combine(_userConfigPath, "config.us"));
            var username = config.Root.Element("Username");
            Global.PlayerName = username.Value;

            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height,
                PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width,
                IsFullScreen = Global.IsFullScreen
            };

            Graphics.ApplyChanges();
            Global.DeviceInUse = Graphics;
            Content.RootDirectory = "Content";
            Global.GameInProgress = this;
            var screenManager = new ScreenManager.ScreenManager(this);

            Components.Add(screenManager);
            MediaPlayer.IsMuted = true;

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new IntroScreen(), null);
        }
コード例 #24
0
ファイル: ExampleGame.cs プロジェクト: jpgdev/JPEngine
 public ExampleGame()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     graphics.IsFullScreen = true;
     graphics.ApplyChanges();
 }
コード例 #25
0
ファイル: Game.cs プロジェクト: Trinovantes/2D-Shooter
        //------------------------------------------------------------------------------------
        public Game()
        {
            GraphicsDeviceManager graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = 800;
            graphics.PreferredBackBufferWidth = 600;
            graphics.ApplyChanges();

            Settings.Viewport = new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height);

            IsMouseVisible = true;

            Content.RootDirectory = Settings.Content;

            // initialize accounts
            if (Directory.Exists(Settings.Accounts))
            {
                if (Account.DefaultAccountExist())
                {
                    currentAccount = new Account();
                }
                else
                {
                    Account.CreateDefaultAccount(ref currentAccount);
                }
            }
            else
            {
                Directory.CreateDirectory(Settings.Accounts);
                Account.CreateDefaultAccount(ref currentAccount);
            }
        }
コード例 #26
0
ファイル: Game1.cs プロジェクト: akaisuisei/umea-rana2
        public Game1()
        {
            //display
            displaymode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
            graphics = new GraphicsDeviceManager(this);
            height =  displaymode.Height;
            width = displaymode.Width;
            graphics.PreferredBackBufferHeight = height;
            graphics.PreferredBackBufferWidth = width;
            graphics.ApplyChanges();
            graphics.IsFullScreen = fullScreen ;

            //Content
            Content.RootDirectory = "Content";
            audio = new Audio(Content);
            //state
            _currentState = gameState.Initialisateur;
            StateManager = new Dictionary<gameState, GameState>();
            StateManager.Add(gameState.PlayingState, new PlayingState(this,graphics,Content));
            StateManager.Add(gameState.MainMenuState, new MainMenuState(this, graphics, Content));
            StateManager.Add(gameState.Level_select_state, new Level_select_state(this, graphics, Content));
            StateManager.Add(gameState.Level2, new Level2(this, graphics, Content));
            StateManager.Add(gameState.SEU, new Shoot_Em_Up(this, graphics, Content));
            StateManager.Add(gameState.Pause, new Pause(this, graphics, Content));
            StateManager.Add(gameState.Initialisateur, new Initialisateur(this, graphics, Content));
            StateManager.Add(gameState.Editeur_mapVV, new Editeur_MapVV(this, graphics, Content));
            StateManager.Add(gameState.leveleditor, new leveleditor(this, graphics, Content));
            StateManager.Add(gameState.level_Pselect, new Leveleditorselect (this,graphics ,Content ));
            StateManager.Add(gameState.win ,new GameWin(this,graphics,Content ));
        }
コード例 #27
0
        public Game1()
        {
            Content.RootDirectory = "Content";
            graphics = new GraphicsDeviceManager(this);

            //uncommenting this would change the default fram rate cycles to 50fps
            //this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 50f);

            #if WINDOWS_PHONE
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 480;
            #endif

            #if XBOX || WINDOWS
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            #endif
            graphics.PreferMultiSampling = true;
            parameters.MultiSampleCount = 16;
            graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
            graphics.ApplyChanges();

            Camera.ViewportWidth = graphics.PreferredBackBufferWidth;
            Camera.ViewportHeight = graphics.PreferredBackBufferHeight;
            Camera.SetScreenRectangle();

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);
        }
コード例 #28
0
ファイル: TrueCraftGame.cs プロジェクト: Khazarak/TrueCraft
        public TrueCraftGame(MultiplayerClient client, IPEndPoint endPoint)
        {
            Window.Title = "TrueCraft";
            Content.RootDirectory = "Content";
            Graphics = new GraphicsDeviceManager(this);
            Graphics.SynchronizeWithVerticalRetrace = false;
            Graphics.IsFullScreen = UserSettings.Local.IsFullscreen;
            Graphics.PreferredBackBufferWidth = UserSettings.Local.WindowResolution.Width;
            Graphics.PreferredBackBufferHeight = UserSettings.Local.WindowResolution.Height;
            Graphics.ApplyChanges();
            Window.ClientSizeChanged += Window_ClientSizeChanged;
            Client = client;
            EndPoint = endPoint;
            LastPhysicsUpdate = DateTime.MinValue;
            NextPhysicsUpdate = DateTime.MinValue;
            PendingMainThreadActions = new ConcurrentBag<Action>();
            MouseCaptured = true;
            Bobbing = 0;

            KeyboardComponent = new KeyboardHandler(this);
            Components.Add(KeyboardComponent);

            MouseComponent = new MouseHandler(this);
            Components.Add(MouseComponent);

            GamePadComponent = new GamePadHandler(this);
            Components.Add(GamePadComponent);
        }
コード例 #29
0
ファイル: Game1.cs プロジェクト: kulhajs/mtg_lifecounter
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 480;
            graphics.IsFullScreen = true;

            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;
            graphics.ApplyChanges();

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            // Extend battery life under lock.
            InactiveSleepTime = TimeSpan.FromSeconds(1);

            PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;

            using(ScoreDataContext db = new ScoreDataContext(ScoreDataContext.DBCoonnectionString))
            {
                if(db.DatabaseExists() == false)
                {
                    db.CreateDatabase();
                }
            }

            scoreDb = new ScoreDataContext(ScoreDataContext.DBCoonnectionString);
        }
コード例 #30
0
ファイル: DnK.cs プロジェクト: Noxalus/Danmaku-no-Kyojin
        public DnK()
        {
            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = Config.Resolution.X,
                PreferredBackBufferHeight = Config.Resolution.Y
            };

            ScreenRectangle = new Rectangle(0, 0, Config.Resolution.X, Config.Resolution.Y);
            IsMouseVisible = true;
            Graphics.IsFullScreen = Config.FullScreen;
            Graphics.SynchronizeWithVerticalRetrace = true;

            // Pass through the FPS capping (60 FPS)
            if (!Config.FpsCapping)
            {
                IsFixedTimeStep = false;
                Graphics.SynchronizeWithVerticalRetrace = false;
            }

            Graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            Pixel = new Texture2D(GraphicsDevice, 1, 1);
            Pixel.SetData(new [] { Color.White });
        }
コード例 #31
0
 public XNARenderSystemProvider()
 {
     _game      = new XNAGame();
     _gdManager = new XNA.GraphicsDeviceManager(_game);
     _gdManager.GraphicsProfile = XFG.GraphicsProfile.HiDef;
     _gdManager.ApplyChanges();
     _renderer = new XNARenderer(_gdManager.GraphicsDevice);
     _device   = _renderer.GraphicsDevice;
     _content  = new ContentManager(new EmbeddedResourceLocator(Tesla.Xna.DefaultContent.ResourceManager));
     _content.UseDefaultContent = false;
 }
コード例 #32
0
 public static void Initialize(GDM gdm, GD gd, CM cm, SB sb)
 {
     G.gdm = gdm;
     G.gd  = gd;
     G.cm  = cm;
     G.sb  = sb;
     w     = gdm.PreferredBackBufferWidth = 1024;
     h     = gdm.PreferredBackBufferHeight = 768;
     gdm.ApplyChanges();
     leftVp   = new Viewport(0, 0, G.w / 2, G.h);
     rightVp  = new Viewport(G.w / 2, 0, G.w / 2, G.h);
     screenVp = new Viewport(0, 0, G.w, G.h);
 }
コード例 #33
0
ファイル: App.cs プロジェクト: juherask/VRPGame
    private static void TryToSwitchAntialiasingOn()
    {
        // The GDM creates the graphicsdevices for windows to draw. Gain access to it.
        XNA_GDM gdm = UglyHackToGetGraphicsDeviceManagerWithReflection();

        gdm.PreferMultiSampling = true;
        gdm.ApplyChanges();

        // Ok, now lets switch the Jypeli.Game.Window before anyone noitices!
        XNA_Window gwin = UglyHackToGetXNAGAmeWindowWithReflection(VRPGame.Window);

        Jypeli.JypeliWindow antialiasedWindow = UglyHackToInstantiateJypeliWindow(gwin, gdm);

        UglyHackToSwitchJypeliWindowWithReflection(antialiasedWindow);

        // TODO: If everything else works do this e.g. with more reflection
        //  http://stackoverflow.com/questions/660480/determine-list-of-event-handlers-bound-to-event
        //Window.Resizing += new JypeliWindow.ResizeEvent( WindowResized );
        //Window.Resized += new JypeliWindow.ResizeEvent( WindowResized );
    }