本文整理汇总了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);
}
示例2: Initialize
public override void Initialize()
{
// Gets the graphics device service
graphicsDeviceService = (IGraphicsDeviceService)base.Services.GetService(typeof(IGraphicsDeviceService));
this.Visible = true;
base.Initialize();
}
示例3: WindowManager
internal WindowManager(IGraphicsDeviceService graphicsDeviceService)
{
if (graphicsDeviceService == null)
throw new ArgumentNullException("graphicsDeviceService");
GraphicsDeviceService = graphicsDeviceService;
}
示例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();
}
示例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();
}
示例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;
}
示例7: OpenTKWindowManager
internal OpenTKWindowManager(IGraphicsDeviceService graphicsDeviceService, GameWindow gameWindow)
: base(graphicsDeviceService)
{
if (gameWindow == null)
throw new ArgumentNullException("gameWindow");
_gameWindow = gameWindow;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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.");
}
示例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.");
}