本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.SpriteBatch.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# SpriteBatch.GetType方法的具体用法?C# SpriteBatch.GetType怎么用?C# SpriteBatch.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.SpriteBatch
的用法示例。
在下文中一共展示了SpriteBatch.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
if (Services.GetService(spriteBatch.GetType()) == null)
{
Services.AddService(typeof(SpriteBatch), spriteBatch);
}
contentContainer.LoadContent();
if(screenManager.isInitialize == false)
screenManager.Initialize();
base.LoadContent();
}
示例2: RaySample
public RaySample()
{
ppm = new PostProcessingManager(Hgl.Game);
rays = new CrepuscularRays(Hgl.Game, Vector2.One * .5f, "Textures/flare", 1, .97f, .97f, .5f, .25f);
ppm.AddEffect(rays);
_renderer = Add(new DrawComponent(Draw));
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(Render.Device);
Hgl.Game.Services.AddService(spriteBatch.GetType(), spriteBatch);
rays.lightSource = rayStartingPos;
scene = new RenderTarget2D(Render.Device, Render.Device.Viewport.Width, Render.Device.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None);
AddBackground("Textures/Backgrounds/BGForeGround_1_1", 2f);
AddBackground("Textures/Backgrounds/BGForeGround_1_2", 3f);
AddBackground("Textures/Backgrounds/BGForeGround_1_3", 4f);
}
示例3: LoadContent
//.........这里部分代码省略.........
#region "physicssetup"
// create and configure the debug view
_debugView = new DebugViewXNA(world);
_debugView.AppendFlags(DebugViewFlags.DebugPanel);
_debugView.DefaultShapeColor = Color.White;
_debugView.SleepingShapeColor = Color.LightGray;
_debugView.LoadContent(GraphicsDevice, Content);
Vector2 characterPosition = new Vector2(152.9f, 120);
characterBody = CreateCapsule(world, 14f / scale, 7f / scale, 1f, null);
characterBody.Position = characterPosition;
characterBody.Mass = 10000;
characterBody.SleepingAllowed = false;
characterBody.IsStatic = false;
characterBody.Restitution = 0.0f;
characterBody.Friction = 0.0f;
characterBody.FixedRotation = true;
characterBody.OnCollision += CharacterOnCollision;
characterBody.OnSeparation += CharacterOnSeparation;
////// arm stuff
/*armBody = BodyFactory.CreateRectangle(world, 6f / scale, 29f / scale, 1f, characterPosition+new Vector2(0/scale,-14/scale));
armBody.Mass = 1;
armBody.IsStatic = false;
armBody.IgnoreCollisionWith(characterBody);
_joint = new RevoluteJoint(armBody, characterBody, armBody.GetLocalPoint(characterBody.Position), new Vector2(4 / scale, -4 / scale));
world.AddJoint(_joint);
//_joint.MotorSpeed = 1.0f * Settings.Pi;
_joint.MaxMotorTorque = 1.0f;
_joint.MotorEnabled = false;
_joint.CollideConnected = false;*/
characterBody.Mass = 1;
//armBody.Mass = 0;
/* Circle */
// Convert screen center from pixels to meters
Vector2 circlePosition = (_screenCenter / scale) + new Vector2(0, -40.5f);
// Create the circle fixture
circleBody = BodyFactory.CreateCircle(world, 96f / (2f * scale), 1f, circlePosition);
circleBody.BodyType = BodyType.Dynamic;
// Give it some bounce and friction
circleBody.Restitution = 0.3f;
circleBody.Friction = 0.5f;
/* Ground */
Vector2 groundPosition = (_screenCenter / scale) + new Vector2(0, -24.25f);
// Create the ground fixture
groundBody = BodyFactory.CreateRectangle(world, 512f / scale, 64f / scale, 1f, groundPosition);
groundBody.IsStatic = true;
groundBody.Restitution = 0.3f;
groundBody.Friction = 0.5f;
// create and configure the debug view
_debugView = new DebugViewXNA(world);
_debugView.AppendFlags(DebugViewFlags.DebugPanel);
_debugView.DefaultShapeColor = Color.White;
_debugView.SleepingShapeColor = Color.LightGray;
_debugView.LoadContent(GraphicsDevice, Content);
#endregion
#region "blur"
gaussianBlur = new GaussianBlur(this);
gaussianBlur.ComputeKernel(BLUR_RADIUS, BLUR_AMOUNT);
renderTargetWidth = 16;
renderTargetHeight = 16;
renderTarget1 = new RenderTarget2D(GraphicsDevice,
renderTargetWidth, renderTargetHeight, false,
GraphicsDevice.PresentationParameters.BackBufferFormat,
DepthFormat.None);
renderTarget2 = new RenderTarget2D(GraphicsDevice,
renderTargetWidth, renderTargetHeight, false,
GraphicsDevice.PresentationParameters.BackBufferFormat,
DepthFormat.None);
gaussianBlur.ComputeOffsets(renderTargetWidth, renderTargetHeight);
#endregion
#region "rays"
Services.AddService(batch.GetType(), batch);
rays.lightSource = rayStartingPos;
rays.Exposure -= .15f;
rays.LightSourceSize -= .5f;
scene = new RenderTarget2D(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None);
sceneReg = new RenderTarget2D(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None);
sceneRegB = new RenderTarget2D(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None);
sceneRegPre = new RenderTarget2D(graphics.GraphicsDevice, graphics.GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None);
#endregion
}