当前位置: 首页>>代码示例>>C#>>正文


C# IGraphicsDeviceService类代码示例

本文整理汇总了C#中IGraphicsDeviceService的典型用法代码示例。如果您正苦于以下问题:C# IGraphicsDeviceService类的具体用法?C# IGraphicsDeviceService怎么用?C# IGraphicsDeviceService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IGraphicsDeviceService类属于命名空间,在下文中一共展示了IGraphicsDeviceService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        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);
        }
开发者ID:jeffreese,项目名称:JellyFish12000,代码行数:29,代码来源:Core.cs

示例2: Initialize

 public override void Initialize()
 {
     // Gets the graphics device service
     graphicsDeviceService = (IGraphicsDeviceService)base.Services.GetService(typeof(IGraphicsDeviceService));
     this.Visible = true;
     base.Initialize();
 }
开发者ID:TPDT,项目名称:TPDT.LogicGraph,代码行数:7,代码来源:DrawableComponent.cs

示例3: WindowManager

        internal WindowManager(IGraphicsDeviceService graphicsDeviceService)
        {
            if (graphicsDeviceService == null)
                throw new ArgumentNullException("graphicsDeviceService");

            GraphicsDeviceService = graphicsDeviceService;
        }
开发者ID:jpgdev,项目名称:JPEngine,代码行数:7,代码来源:WindowManager.cs

示例4: Initialize

        public override void Initialize()
        {
            base.Initialize();

            isInitialized = true;

            // Get graphics device service
            graphicsDeviceService = Services.GetSafeServiceAs<IGraphicsDeviceService>();

#if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
            Enabled = true;
            directoryWatcher = new DirectoryWatcher("*.xksl");
            directoryWatcher.Modified += FileModifiedEvent;
            // TODO: xkfx too
#endif

            // Setup shader compiler settings from a compilation mode. 
            // TODO: We might want to provide overrides on the GameSettings to specify debug and/or optim level specifically.
            if (Game != null && (((Game)Game).Settings != null))
            {
                effectCompilerParameters.ApplyCompilationMode(((Game)Game).Settings.CompilationMode);
            }

            // Make sure default compiler is created (local if possible otherwise none) if nothing else was explicitely set/requested (i.e. by GameSettings)
            if (Compiler == null)
                Compiler = CreateEffectCompiler();
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:27,代码来源:EffectSystem.cs

示例5: Initialize

        public override void Initialize()
        {
            // A reference to the graphics service is mandatory since we need to get the graphics device after it's destroyed
            graphicsService = Game.Services.GetService(typeof(IGraphicsDeviceService)) as IGraphicsDeviceService;
            graphicsDevice = graphicsService.GraphicsDevice;

            // Those three events are necessary to keep a "fresh" state, see individual methods
            graphicsService.DeviceCreated += delegate { OnDeviceCreated(); };
            graphicsService.DeviceResetting += delegate { OnDeviceResetting(); };
            graphicsService.DeviceReset += delegate { OnDeviceReset(); };

            // Here's the trick... We know it's a form, so let's cast it as a form!
            // No need to say that this won't work on the Xbox 360...
            windowsGameForm = Control.FromHandle(Game.Window.Handle) as Form;

            // After, we add up our own components to it
            InitializeComponent();
            Game.Window.Title = "nu";

            // We can then map events to the components like in a normal Windows Forms context
            //someButton.Click += new EventHandler(someButton_Click);
            //quitMenuItem.Click += delegate { Game.Exit(); };

            // And force a reset so that we set the right target to begin with
            graphicsDevice.Reset();

            base.Initialize();
        }
开发者ID:codler,项目名称:RuneCrafter,代码行数:28,代码来源:WindowsFormsControls.cs

示例6: GameComponent

 protected GameComponent( IGraphicsDeviceService graphicsDeviceService, IEventAggregator eventAggregator )
 {
     this._eventAggregator = eventAggregator;
     this._graphicsDeviceService = graphicsDeviceService.NotNull();
     this._graphicsDeviceService.DeviceCreated += this.DeviceCreated;
     this._graphicsDeviceService.DeviceDisposing += this.DeviceDisposing;
 }
开发者ID:Klakier,项目名称:Road-Traffic-Simualator,代码行数:7,代码来源:GameComponent.cs

示例7: OpenTKWindowManager

        internal OpenTKWindowManager(IGraphicsDeviceService graphicsDeviceService, GameWindow gameWindow)
            : base(graphicsDeviceService)
        {
            if (gameWindow == null)
                throw new ArgumentNullException("gameWindow");

            _gameWindow = gameWindow;
        }
开发者ID:jpgdev,项目名称:JPEngine,代码行数:8,代码来源:OpenTKWindowManager.cs

示例8: Core

 public Core(Game game)
     : base(game)
 {
     svc = (IGraphicsDeviceService)game.Services.GetService(typeof(IGraphicsDeviceService));
     graphics =  (GraphicsDeviceManager)svc;
     //remember wich level we are playing
     this.game = game;
 }
开发者ID:unsign3d,项目名称:SpaceCore,代码行数:8,代码来源:Core.cs

示例9: ScreenManager

 public ScreenManager( Game game )
     : base(game)
 {
     graphicsDeviceService = (IGraphicsDeviceService)game.Services.GetService(
                                                 typeof( IGraphicsDeviceService ) );
     content = new ContentManager( game.Services );
     content.RootDirectory = "Content";
     current_game = game;
 }
开发者ID:mumumumu,项目名称:SpeedUp,代码行数:9,代码来源:speedup-ScreenManager.cs

示例10: VertexPositionTextureDrawer

        public VertexPositionTextureDrawer( Camera3D camera3D, IGraphicsDeviceService graphicsDeviceService )
        {
            this._graphicsDeviceService = graphicsDeviceService;
            this._camera = camera3D.NotNull();
            this._camera.Changed += this.UpdateBasicEffect;

            this._graphicsDeviceService.DeviceCreated += this.RecreateBassicEffect;
            this.CreateBasicEffect();
        }
开发者ID:Klakier,项目名称:Road-Traffic-Simualator,代码行数:9,代码来源:VertexPositionTextureDrawer.cs

示例11: RenderCoordinator

        /// <summary>
        /// Constructs a render coordinator. A render manager and synchronous draw methods are automatically provided for you.
        /// </summary>
        /// <param name="deviceService"></param>
        public RenderCoordinator(IGraphicsDeviceService deviceService)
        {
            Manager = new RenderManager(deviceService.GraphicsDevice);

            _SyncBeginDraw = DefaultBeginDraw;
            _SyncEndDraw = DefaultEndDraw;

            CoreInitialize();
        }
开发者ID:pakoito,项目名称:Fracture,代码行数:13,代码来源:ThreadedRenderCoordinator.cs

示例12: VertexPositionColorDrawer

        public VertexPositionColorDrawer( IGraphicsDeviceService deviceService, Camera3D camera3D )
        {
            this._camera = camera3D.NotNull();
            this._camera.Changed += this.UpdateBasicEffect;
            this._graphicsDeviceService = deviceService;
            this._graphicsDeviceService.DeviceCreated += this.RecreateBassicEffect;
            this.CreateBasicEffect();

            this.CreateBasicEffect();
        }
开发者ID:Klakier,项目名称:Road-Traffic-Simualator,代码行数:10,代码来源:VertexPositionColorDrawer.cs

示例13: DXControlLite

        public DXControlLite(IGraphicsDeviceService deviceService)
        {
            InitializeComponent();

            this.deviceService = deviceService;
            this.Loaded += DXControlLite_Loaded;

            this.deviceService.DeviceCreated += deviceService_DeviceCreated;
            this.deviceService.DeviceLost += deviceService_DeviceLost;
            this.deviceService.DeviceDisposing += deviceService_DeviceDisposing;
        }
开发者ID:ukitake,项目名称:Stratum,代码行数:11,代码来源:DXControlLite.xaml.cs

示例14: ScreenManager

        /// <summary>
        /// Constructs a new screen manager component.
        /// </summary>
        public ScreenManager(Game game)
            : base(game)
        {
            content = new ContentManager(game.Services, "Content");

            graphicsDeviceService = (IGraphicsDeviceService)game.Services.GetService(
                                                        typeof(IGraphicsDeviceService));

            if (graphicsDeviceService == null)
                throw new InvalidOperationException("No graphics device service.");
        }
开发者ID:robotButler,项目名称:battlelines,代码行数:14,代码来源:ScreenManager.cs

示例15: ScreenManager

        /// <summary>
        /// Constructs a new screen manager component.
        /// </summary>
        /// <exception cref="InvalidOperationException">No graphics device service.</exception>
        public ScreenManager(Game game)
            : base(game)
        {
            ContentManager = new ContentManager(game.Services);
            _graphicsDeviceService = (IGraphicsDeviceService) game.Services.GetService(
                                                                  typeof (IGraphicsDeviceService));
            game.Exiting += Game_Exiting;

            if (_graphicsDeviceService == null)
                throw new InvalidOperationException("No graphics device service.");
        }
开发者ID:rpwjanzen,项目名称:2HourGame,代码行数:15,代码来源:ScreenManager.cs


注:本文中的IGraphicsDeviceService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。