Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Content;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- namespace ZombieSmackUpd
- {
- class MouseControlFire : Stuff
- {
- Effect PointSpritesEffect;
- VertexPositionColor[] Sprite;
- public MouseControlFire(string effect, string texture)
- {
- PointSpritesEffect = Content.Load<Effect>(effect);
- PointSpritesEffect.Parameters["SpriteTexture"].SetValue(Content.Load<Texture2D>(texture));
- Sprite = new VertexPositionColor[1];
- Sprite[0].Position = new Vector3(0f, 200f, 60f);
- Sprite[0].Color = Color.TransparentBlack;
- }
- public void MouseInput()
- {
- MouseState mouseState = Mouse.GetState();
- Sprite[0].Position.X = mouseState.X;
- Sprite[0].Position.Y = mouseState.Y;
- Sprite[0].Position.Z = 60f;
- }
- public void DrawSprite()
- {
- // Drawing code here.
- device.RenderState.PointSpriteEnable = true;
- device.RenderState.PointSize = 128.0f;
- device.RenderState.AlphaBlendEnable = true;
- device.RenderState.SourceBlend = Blend.SourceAlpha;
- device.RenderState.DestinationBlend = Blend.One;
- device.RenderState.DepthBufferWriteEnable = false;
- device.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
- Matrix WVPMatrix = Matrix.Identity * viewMatrix * projectionMatrix;
- PointSpritesEffect.Parameters["WVPMatrix"].SetValue(WVPMatrix);
- PointSpritesEffect.Begin();
- foreach (EffectPass pass in PointSpritesEffect.CurrentTechnique.Passes)
- {
- pass.Begin();
- device.DrawUserPrimitives<VertexPositionColor>(
- PrimitiveType.PointList,
- Sprite,
- 0, 1);
- pass.End();
- }
- PointSpritesEffect.End();
- device.RenderState.PointSpriteEnable = false;
- device.RenderState.DepthBufferWriteEnable = true;
- device.RenderState.SourceBlend = Blend.SourceAlpha;
- device.RenderState.DestinationBlend = Blend.InverseSourceAlpha;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement