當前位置: 首頁>>代碼示例>>C#>>正文


C# Framework.GraphicsDeviceManager類代碼示例

本文整理匯總了C#中Microsoft.Xna.Framework.GraphicsDeviceManager的典型用法代碼示例。如果您正苦於以下問題:C# GraphicsDeviceManager類的具體用法?C# GraphicsDeviceManager怎麽用?C# GraphicsDeviceManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GraphicsDeviceManager類屬於Microsoft.Xna.Framework命名空間,在下文中一共展示了GraphicsDeviceManager類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Alligator

        public Alligator(Game game, GraphicsDeviceManager graphics, Vector2 location)
            : base(game, graphics, "content/alligator", true)
        {
            this.mLocation = location;


        }
開發者ID:IainCargill,項目名稱:froggerxna,代碼行數:7,代碼來源:Alligator.cs

示例2: GameBase

        public GameBase(Orientation orientation)
            : base()
        {
            _instance = this;

            GraphicsDeviceManager graphics = new GraphicsDeviceManager(this);

            if (orientation == Orientation.Portrait)
            {
                graphics.SupportedOrientations = DisplayOrientation.Portrait | DisplayOrientation.PortraitDown;
            }
            else
            {
                graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
            }

            graphics.IsFullScreen = true;

            Content.RootDirectory = "Content";

            GlobalTimerController.ClearInstance();
            TouchProcessor.ClearInstance();

            _scenes = new Dictionary<Type, Scene>();
            _currentScene = null;
            _tombstoneFileName = DefaultTombstoneFileName;
            _sceneTransitionCrossFadeTextureName = "";

            PurchaseManager = new External_APIS.iOS.InAppPurchaseManager();
        }
開發者ID:Ben-P-Leda,項目名稱:Bopscotch-IOS,代碼行數:30,代碼來源:GameBase.cs

示例3: FarseerPhysicsGame

        public FarseerPhysicsGame()
        {
            Window.Title = "Farseer Samples Framework";
            _graphics = new GraphicsDeviceManager(this);
            _graphics.PreferMultiSampling = true;
            #if WINDOWS || XBOX
            _graphics.PreferredBackBufferWidth = 1280;
            _graphics.PreferredBackBufferHeight = 720;
            ConvertUnits.SetDisplayUnitToSimUnitRatio(24f);
            IsFixedTimeStep = true;
            #elif WINDOWS_PHONE
            _graphics.PreferredBackBufferWidth = 800;
            _graphics.PreferredBackBufferHeight = 480;
            ConvertUnits.SetDisplayUnitToSimUnitRatio(16f);
            IsFixedTimeStep = false;
            #endif
            #if WINDOWS
            _graphics.IsFullScreen = false;
            #elif XBOX || WINDOWS_PHONE
            _graphics.IsFullScreen = true;
            #endif

            Content.RootDirectory = "Content";

            //new-up components and add to Game.Components
            ScreenManager = new ScreenManager(this);
            Components.Add(ScreenManager);

            FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager);
            frameRateCounter.DrawOrder = 101;
            Components.Add(frameRateCounter);
        }
開發者ID:AdamNThompson,項目名稱:Farseer-MonoGame-WinGL,代碼行數:32,代碼來源:FarseerPhysicsGame.cs

示例4: WizardryGameServer

        /// <summary>
        /// Default constructor for the WizardryGameServer class.
        /// </summary>
        public WizardryGameServer()
        {
            graphics = new GraphicsDeviceManager( this );
            Content.RootDirectory = "Content";
            textureProvider = new TextureProvider( Content );

            // Windows Settings for the XNA window
            Window.Title = "Wizardry Server";
            graphics.PreferredBackBufferWidth = 200;
            graphics.PreferredBackBufferHeight = 1;

            // Set up the lobbies list
            lobbies = new GameLobby[GameSettings.MAX_LOBBIES];
            for ( int i = 0; i < GameSettings.MAX_LOBBIES; ++i )
            {
                lobbies[i] = null;
            }

            playerLobbies = new ConcurrentDictionary<long, int>();

            // Setup the server configuration
            NetPeerConfiguration config = new NetPeerConfiguration( GameSettings.APP_NAME );
            config.Port = GameSettings.SERVER_PORT_NUM;
            config.EnableMessageType( NetIncomingMessageType.DiscoveryRequest );

            // Start the server
            server = new NetServer( config );
            server.Start();
            WriteConsoleMessage( "Server starting!" );

            // Start the Packet Receiver thread
            Thread packets = new Thread( new ThreadStart( this.PacketProcessor ) );
            packets.Start();
        }
開發者ID:nezek6,項目名稱:Wizardry,代碼行數:37,代碼來源:WizardryGameServer.cs

示例5: ResetScreenScale

 public Vector3 ResetScreenScale(GraphicsDeviceManager graphics, Vector2 screenScale)
 {
     var scaleX = (float)graphics.GraphicsDevice.Viewport.Width / screenScale.X;
     var scaleY = (float)graphics.GraphicsDevice.Viewport.Height / screenScale.Y;
     Scale = new Vector3(scaleX, scaleY, 1.0f);
     return Scale;
 }
開發者ID:AGDGMintDev,項目名稱:ECSRogue,代碼行數:7,代碼來源:Camera.cs

示例6: AppDelegate

 public AppDelegate(Game game, GraphicsDeviceManager graphics)
     : base(game, graphics)
 {
     this.game = game;
     CCApplication.sm_pSharedApplication = this;
     this.setOrientation(Orientation.kOrientationLandscapeLeft);
 }
開發者ID:hj458377603,項目名稱:FlappyBird,代碼行數:7,代碼來源:AppDelegate.cs

示例7: MonoSAMGame

		protected MonoSAMGame()
		{
			CurrentTime = new GameTime();

			Graphics = new GraphicsDeviceManager(this);
			Content.RootDirectory = "Content";
		}
開發者ID:Mikescher,項目名稱:GridDominance,代碼行數:7,代碼來源:MonoSAMGame.cs

示例8: Initialize

 public static void Initialize(Game game, GraphicsDeviceManager graphics)
 {
     GlobalContent.game = game;
     GlobalContent.graphics = graphics;
     GlobalContent.content = game.Content;
     GlobalContent.Initialized = true;
 }
開發者ID:oconnerj,項目名稱:TyrantsQuest,代碼行數:7,代碼來源:GlobalContent.cs

示例9: Camera2D

 public Camera2D(GraphicsDeviceManager graphics, Vector2 lookAt, float zoomLevel)
 {
     screenCenter = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2.0f, graphics.GraphicsDevice.Viewport.Height / 2.0f);
     this.lookAt = lookAt;
     this.zoomLevel = zoomLevel;
     this.zoomOrigin = screenCenter;
 }
開發者ID:AnyKey,項目名稱:tojam4,代碼行數:7,代碼來源:Camera2D.cs

示例10: State

 public State(ContentManager content, GraphicsDeviceManager graphics, Player player)
 {
     _content = content;
     _graphics = graphics;
     _player = player;
     _firstFrame = true;
 }
開發者ID:anxkha,項目名稱:Mortuum,代碼行數:7,代碼來源:State.cs

示例11: MonoGameImpl

 public MonoGameImpl()
 {
     _graphics = new GraphicsDeviceManager(this);
     _graphics.PreferredBackBufferWidth = 1280;
     _graphics.PreferredBackBufferHeight = 720;
     Content.RootDirectory = "Content";
 }
開發者ID:srakowski,項目名稱:coldsteel,代碼行數:7,代碼來源:MonoGameImpl.cs

示例12: BallerburgGame

        /// <summary>
        /// Initializes a new instance of the BallerburgGame class
        /// </summary>
        public BallerburgGame()
        {
            Instance = this;
              gameSettings = new GameSettings();
              playerSettings = new PlayerSettings[4];

              applicationSettings = new ApplicationSettings();

              graphics = new GraphicsDeviceManager(this)
                     {
                       PreferredBackBufferWidth = 640,
                       PreferredBackBufferHeight = 480
                     };

              graphicsManager = new BallerburgGraphicsManager();
              contentManager = new ContentManager();
              shaderManager = new ShaderManager();
              audioManager = new AudioManager(applicationSettings, contentManager);
              gameObjectManager = new GameObjectManager(contentManager, this.audioManager, this.graphicsManager);

              MousePointer = new MousePointer(this)
                         {
                           DrawOrder = 1000,
                           RestrictZone = new Rectangle(0, 0, 640, 480)
                         };
              Components.Add(MousePointer);

              // Create the screen manager component.
              screenManager = new ScreenManager(graphicsManager, contentManager, gameObjectManager, applicationSettings, gameSettings, shaderManager, audioManager, playerSettings)
                          {
                            GameMousePointer = MousePointer
                          };
        }
開發者ID:urmuelle,項目名稱:MonoGameBallerburg,代碼行數:36,代碼來源:BallerburgGame.cs

示例13: GameStateManagementGame

        public GameStateManagementGame()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);
            //TargetElapsedTime = TimeSpan.FromTicks(333333);
            TargetElapsedTime = TimeSpan.FromTicks(333);

            #if WINDOWS_PHONE
            graphics.IsFullScreen = true;
            InitializeLandscapeGraphics();
            #endif

            screenFactory = new ScreenFactory();
            Services.AddService(typeof(IScreenFactory), screenFactory);
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            #if WINDOWS_PHONE
            // hook
            Microsoft.Phone.Shell.PhoneApplicationService.Current.Launching +=
                new EventHandler<Microsoft.Phone.Shell.LaunchingEventArgs>(GameLaunching);
            Microsoft.Phone.Shell.PhoneApplicationService.Current.Activated +=
                new EventHandler<Microsoft.Phone.Shell.ActivatedEventArgs>(GameActivated);
            Microsoft.Phone.Shell.PhoneApplicationService.Current.Deactivated +=
                new EventHandler<Microsoft.Phone.Shell.DeactivatedEventArgs>(GameDeactivated);
            #else
            AddInitialScreens();
            #endif
            gameMusic = Content.Load<SoundEffect>("sounds/GamePlayHalfBit");
            gameMusicI = gameMusic.CreateInstance();
            gameMusicI.IsLooped = true;
            gameMusicI.Play();
        }
開發者ID:alexcoco,項目名稱:trace_racer,代碼行數:34,代碼來源:Celestial.cs

示例14: Initialize

        /// <summary>
        /// Initializes game & graphics based on config.
        /// </summary>
        /// <param name="game"></param>
        /// <param name="graphicsDeviceManager"></param>
        public void Initialize(Game game, GraphicsDeviceManager graphicsDeviceManager)
        {
            this.Game = game;
            this.GraphicsDeviceManager = graphicsDeviceManager;

            // set custom resolution if required
            if (this.Config.Screen.Width != 0 && this.Config.Screen.Height != 0)
            {
                this.GraphicsDeviceManager.PreferredBackBufferWidth = this.Config.Screen.Width;
                this.GraphicsDeviceManager.PreferredBackBufferHeight = this.Config.Screen.Height;
            }

            // set full screen mode.
            this.GraphicsDeviceManager.IsFullScreen = this.Config.Screen.IsFullScreen;

            // set vsync.
            this.Game.IsFixedTimeStep = this.Config.Graphics.IsFixedTimeStep;
            this.GraphicsDeviceManager.SynchronizeWithVerticalRetrace = this.Config.Graphics.IsVsyncEnabled;

            // set mouse mode.
            this.Game.IsMouseVisible = this.Config.Input.IsMouseVisible;

            // set orientation.
            this.GraphicsDeviceManager.SupportedOrientations = this.Config.Screen.SupportedOrientations;

            this.Initialize();

            this.GraphicsDeviceManager.ApplyChanges();
        }
開發者ID:Cyberbanan,項目名稱:voxeliq,代碼行數:34,代碼來源:PlatformHandler.cs

示例15: Game1

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.DeviceCreated += new EventHandler<EventArgs>(graphics_DeviceCreated);
            // graphics.ApplyChanges();
            Content.RootDirectory = "Content";

//            if (graphics.GraphicsDevice == null)
//            {
//                CCLog.Log("FOO");
//            }

            graphics.IsFullScreen = false;

            // Frame rate is 30 fps by default for Windows Phone.
            // Divide by 2 to make it 60 fps
            TargetElapsedTime = TimeSpan.FromTicks(333333 / 2);
            IsFixedTimeStep = true;

            IsMouseVisible = true;

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

            CCApplication application = new AppDelegate(this, graphics);
            Components.Add(application);

#if !WINDOWS_PHONE && !XBOX && !WINDOWS
            GamerServicesComponent component = new GamerServicesComponent(this);
            this.Components.Add(component);
#endif
        }
開發者ID:huaqiangs,項目名稱:cocos2d-xna,代碼行數:32,代碼來源:Game1.cs


注:本文中的Microsoft.Xna.Framework.GraphicsDeviceManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。