本文整理汇总了C#中IGraphicsDeviceService类的典型用法代码示例。如果您正苦于以下问题:C# IGraphicsDeviceService类的具体用法?C# IGraphicsDeviceService怎么用?C# IGraphicsDeviceService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IGraphicsDeviceService类属于命名空间,在下文中一共展示了IGraphicsDeviceService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: FpsComponent
/// <summary>Initializes a new frame rate tracking component</summary>
/// <param name="graphicsDeviceService">
/// Graphics device service the counter uses for rendering
/// </param>
public FpsComponent(
IGraphicsDeviceService graphicsDeviceService, string contentRootDirectory
)
: base(null)
{
this.graphicsDeviceService = graphicsDeviceService;
this.contentRoot = contentRootDirectory;
this.frameTimes = new Queue<long>();
Visible = true;
}
开发者ID:apeape,项目名称:GameClient,代码行数:15,代码来源:FpsComponent.cs
示例17: Create
public static WindowManager Create(IGraphicsDeviceService graphicsDeviceService, IntPtr windowHandle)
{
if (graphicsDeviceService is GraphicsDeviceManager)
throw new NotImplementedException("This is not implemented. You need to use the Game instead of the GameWindow.Handle.");
//Get a Windows.Form
var window = Control.FromHandle(windowHandle) as Form;
if (window == null)
throw new ArgumentException("The windowHandle is not a valid Windows.Form handle.");
return new FormWindowManager(graphicsDeviceService, window);
}
开发者ID:jpgdev,项目名称:JPEngine,代码行数:12,代码来源:WindowManagerFactory.cs
示例18: ElementRenderer
/// <summary>
/// Create an instance of an UI element renderer.
/// </summary>
/// <param name="services">The list of registered services</param>
public ElementRenderer(IServiceRegistry services)
{
Content = services.GetSafeServiceAs<IContentManager>();
GraphicsDeviceService = services.GetSafeServiceAs<IGraphicsDeviceService>();
UI = services.GetServiceAs<UISystem>();
if (UI == null)
{
UI = new UISystem(services);
var gameSystems = services.GetServiceAs<IGameSystemCollection>();
gameSystems?.Add(UI);
}
}
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:17,代码来源:ElementRenderer.cs
示例19: GraphicsContext
public GraphicsContext(IGraphicsDeviceService service, Device d3dDevice, DeviceContext d3dContext)
{
this.RenderContext = new RenderContext();
this.GraphicsService = service;
this.Device = service.GraphicsDevice;
this.D3D11Device = d3dDevice;
this.D3D11Context = d3dContext;
this.SpriteBatch = new SpriteBatch(service.GraphicsDevice);
this.GBuffer = new GeometryBuffer(this);
this.CurrentCamera = new PlanetCamera(6359.99);
}
开发者ID:ukitake,项目名称:Stratum,代码行数:14,代码来源:GraphicsContext.cs
示例20: ParticleSystemManager
/// <summary>Initializes a new particle system manager</summary>
/// <param name="graphicsDeviceService">
/// Graphics device service being used to render the particle systems
/// </param>
public ParticleSystemManager(IGraphicsDeviceService graphicsDeviceService) :
base(graphicsDeviceService) {
this.particleSystems = new Dictionary<object, IParticleSystemHolder>();
this.primitiveBatches = new Dictionary<Type, PrimitiveBatchHolder>();
this.pruneAsyncResult = new PruneAsyncResult(this);
this.updateAsyncResult = new UpdateAsyncResult(this);
this.particleSystemHolders = new IParticleSystemHolder[16];
this.primitiveBatchHolders = new PrimitiveBatchHolder[4];
this.holderArraysDirty = true;
}
开发者ID:pr0gramm3r1,项目名称:AngryTanks,代码行数:18,代码来源:ParticleSystemManager.cs
注:本文中的IGraphicsDeviceService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论