当前位置: 首页>>代码示例>>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;未经允许,请勿转载。