示例#1
3
		protected override void DrawSelf(SpriteBatch spriteBatch)
		{
			String newString = GetInputText(currentString);
			if (!newString.Equals(currentString))
			{
				currentString = newString;
				OnTextChange(this, new EventArgs());
			}
			else
			{
				currentString = newString;
			}
			if (++textBlinkerCount >= 20)
			{
				textBlinkerState = (textBlinkerState + 1) % 2;
				textBlinkerCount = 0;
			}
			String displayString = currentString;
			if (this.textBlinkerState == 1)
			{
				displayString = displayString + "|";
			}
			CalculatedStyle space = base.GetDimensions();
			if (currentString.Length == 0)
			{
				Utils.DrawBorderString(spriteBatch, hintText, new Vector2(space.X, space.Y), Color.Gray, 1f);
			}
			else
			{
				Utils.DrawBorderString(spriteBatch, displayString, new Vector2(space.X, space.Y), Color.White, 1f);
			}
		}
 protected override void LoadContent()
 {
     _mouseIcon = Game.Content.Load<Texture2D>("mouse");
     //_spriteBatch = new SpriteBatch(GraphicsDevice);
     _spriteBatch = new SpriteBatch(GraphicsDevice);
     base.LoadContent();
 }
		public virtual void HandleLeftMouse(SpriteBatch sb, int slot) {
			if (!Main.mouseLeftRelease) return;
			
			bool blankMouse = IsBlankItem(Main.mouseItem);
			bool blankSlot = IsBlankItem(item);
			
			if (blankMouse && blankSlot) return;
			else if (blankMouse && !blankSlot) {
				Main.mouseItem = item.CloneItem();
				item = new Item();
			} else if (!blankMouse && blankSlot) {
				item = Main.mouseItem.CloneItem();
				Main.mouseItem = new Item();
			} else {
				if (item.IsTheSameAs(Main.mouseItem) && item.maxStack > 1) {
					int diff = Math.Min(item.maxStack-item.stack,Main.mouseItem.stack);
					item.stack += diff;
					Main.mouseItem.stack -= diff;
					if (Main.mouseItem.stack == 0) Main.mouseItem = new Item();
				} else {
					Item tmp = Main.mouseItem;
					Main.mouseItem = item.CloneItem();
					item = tmp.CloneItem();
				}
			}
		}
	public void DrawOnScreen(SpriteBatch sb, double layer) {
		Player player = Main.player[Main.myPlayer];
		
		if (resetChat) Main.chatMode = false;
		resetChat = false;
		
		if (!Settings.GetBool("toggle") && Main.playerInventory && !Main.craftingHide && (!Codable.RunGlobalMethod("ModWorld","PreDrawAvailableRecipes",sb) || (bool)Codable.customMethodReturn)) {
			if (Main.reforge || player.chest != -1 || Main.npcShop != 0 || player.talkNPC != -1 || Main.craftGuide || Main.ForceGuideMenu) return;
			if (Config.tileInterface == null && Config.npcInterface == null) {
				if (shouldInit) {
					GuiCraft.Init();
					shouldInit = false;
				}
				GuiCraft.Create();
			}
		}
		
		if (Config.tileInterface != null && Config.tileInterface.code is GuiCraft) {
			Config.tileInterface.SetLocation(new Vector2(player.position.X/16f,player.position.Y/16f));
			((GuiCraft)Config.tileInterface.code).PreDrawInterface(sb);
		}
		
		if (Main.playerInventory && Settings.GetBool("toggle") && (Config.tileInterface == null || Config.tileInterface.code is GuiCraft)) {
			Color c = Config.tileInterface != null && Config.tileInterface.code is ModWorld.GuiCraft ? Color.White : Color.Gray;
			sb.Draw(ModWorld.texShow,new Vector2(414,210),GetTexRectangle(texShow),c,0f,default(Vector2),1f,SpriteEffects.None,0f);
		}
	}
 internal void DrawDamageDots(SpriteBatch spriteBatch, Texture2D debugTex, Color color)
 {
     foreach (var dot in frames[currentFrameIndex].DamageDots)
     {
         spriteBatch.Draw(debugTex, dot, color);
     }
 }
示例#6
0
 public void Draw(SpriteBatch spriteBatch)
 {
     for (int i = 0; i < rooms.Count; i++)
     {
         rooms[i].Draw(spriteBatch);
     }
 }
		/// <summary>
		/// Draws
		/// </summary>
		/// <param name="batch"></param>
		public override void Draw(SpriteBatch batch)
		{
			base.Draw(batch);


			// Display message
			if (Hero == null)
			{
				batch.DrawString(GUI.MenuFont, new Point(26, 58), RectangleColor, Message);
			}
			else
			{
				//batch.DrawString(Camp.Font, new Point(16, 76), Color.White, "0 of 0 remaining.");
			}

			#region Draw heroes
			for (int y = 0; y < 3; y++)
			{
				for (int x = 0; x < 2; x++)
				{
					Hero hero = GameScreen.Team.Heroes[y * 2 + x];
					if (hero == null)
						continue;

					float col = (float)Math.Sin(1.0f);
					batch.DrawRectangle(new Rectangle(366 + x * 144, 2 + y * 104, 130, 104), Color.White);
					batch.DrawRectangle(new Rectangle(367 + x * 144, 4 + y * 104, 128, 101), Color.White);
				}
			}
			#endregion
		}
	public void DrawOnScreen(SpriteBatch sb, double layer) {
		sb.End();
		sb.Begin(SpriteSortMode.Immediate,BlendState.Additive);
		foreach (ModWorld.Effect e in ModWorld.effects) e.Draw(sb);
		sb.End();
		sb.Begin();
	}
示例#9
0
		new public void Draw(SpriteBatch batch) {
			if (base._visible) {
				pos = base.ConvertToWorldPos();
				scale = base.ConvertToWorldScale();
				rotation = base.ConvertToWorldRot();
				int size = _text.Length;
				if (this._type == LabelType.TEXT_ALIGNMENT_LEFT) {
					for (int i = 0; i < size; i++) {
						base._textureAtlas.Draw(i, batch, pos[0] + i
								* this._charWidth, pos[1], rotation, scale[0],
								scale[1], batch.GetColor());
					}
				} else if (this._type == LabelType.TEXT_ALIGNMENT_RIGHT) {
					for (int j = 0; j < size; j++) {
						base._textureAtlas.Draw(j, batch, pos[0]
								- (size * this._charWidth) + (j * this._charWidth),
								pos[1], rotation, scale[0], scale[1],
								batch.GetColor());
					}
				} else {
					for (int k = 0; k < size; k++) {
						base._textureAtlas.Draw(k, batch, pos[0]
								- ((size * this._charWidth) / 2)
								+ (k * this._charWidth), pos[1], rotation,
								scale[0], scale[1], batch.GetColor());
					}
				}
			}
		}
示例#10
0
        /// <summary>
        /// Initialize this instance.
        /// </summary>
        public override void Initialize()
        {
            this.game = new NormalMap.Game();
            this.game.Initialize(this);

            #region WAVE SOFTWARE LICENSE AGREEMENT
            this.backgroundSplashColor = new Color("#ebebeb");
            this.spriteBatch = new SpriteBatch(WaveServices.GraphicsDevice);

            var resourceNames = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
            string name = string.Empty;

            foreach (string item in resourceNames)
            {
                if (item.Contains("SplashScreen.wpk"))
                {
                    name = item;
                    break;
                }
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new InvalidProgramException("License terms not agreed.");
            }

            using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
            {
                this.splashScreen = WaveServices.Assets.Global.LoadAsset<Texture2D>(name, stream);
            }
            #endregion
        }
示例#11
0
 /// <summary>
 /// Draws the mob sprite and the healthbar above the mob
 /// </summary>
 /// <param name="batch">current spritebatch</param>
 public override void Draw(SpriteBatch batch)
 {
     double result = (currHealth/(double)maxHealth)*m_Texture.Width;
     batch.Draw(Game.anim2.GetTexture(),new Rectangle((int)Position.X, (int)Position.Y - 4, m_Texture.Width, m_Texture.Height),Color.White);
     batch.Draw(redHealth,new Rectangle((int)Position.X,(int)Position.Y - 20,m_Texture.Width,3), Color.Red);
     batch.Draw(greenHealth, new Rectangle((int)Position.X, (int)Position.Y - 20, (int)result, 3), Color.Green);
 }
	public override void Draw(SpriteBatch sb, Projectile p) {
		Vector2 pc = p.position+new Vector2(p.width/2f,p.height/2f);
		
		if (fired) {
			sb.End();
			sb.Begin(SpriteSortMode.Immediate,BlendState.Additive);
			
			foreach (Spark spark in sparks) spark.Draw(sb,p,this);
			for (int i = 0; i < sparks.Count; i++) if (sparks[i].dead) sparks.RemoveAt(i--);
			
			sb.End();
			sb.Begin();
			
			if (sparks.Count == 0) p.Kill();
		} else {
			fired = true;
			
			int r, g, b;
			Color c;
			float degrees;
			
			byte[] bytes = BitConverter.GetBytes(seed);
			Random rnd = new Random();
			
			degrees = (float)(rnd.NextDouble()*360d);
			HsvToRgb(bytes[0]*360f/255f,bytes[1]/255f,1f,out r,out g,out b);
			c = new Color(r,g,b);
			for (int i = 0; i < 20; i++) sparks.Add(new MySpark(pc,Util.Vector((float)(1.5f+rnd.NextDouble()*.75f),360f/20f*i+degrees),c,80+rnd.Next(40)));
			
			degrees = (float)(rnd.NextDouble()*360d);
			HsvToRgb(bytes[2]*360f/255f,bytes[3]/255f,1f,out r,out g,out b);
			c = new Color(r,g,b);
			for (int i = 0; i < 40; i++) sparks.Add(new MySpark(pc,Util.Vector((float)(3f+rnd.NextDouble()*1.5f),360f/40f*i+degrees),c,80+rnd.Next(40)));
		}
	}
示例#13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CustomCompositor"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="window">The window with which this compositor is associated.</param>
        public CustomCompositor(UltravioletContext uv, IUltravioletWindow window)
            : base(uv, window)
        {
            rtScene = RenderTarget2D.Create(BufferWidth, BufferHeight);

            rtSceneColor = RenderBuffer2D.Create(RenderBufferFormat.Color, BufferWidth, BufferHeight);
            rtScene.Attach(rtSceneColor);

            rtSceneDepthStencil = RenderBuffer2D.Create(RenderBufferFormat.Depth24Stencil8, BufferWidth, BufferHeight);
            rtScene.Attach(rtSceneDepthStencil);

            rtInterface = RenderTarget2D.Create(BufferWidth, BufferHeight);

            rtInterfaceColor = RenderBuffer2D.Create(RenderBufferFormat.Color, BufferWidth, BufferHeight);
            rtInterface.Attach(rtInterfaceColor);

            rtInterfaceDepthStencil = RenderBuffer2D.Create(RenderBufferFormat.Depth24Stencil8, BufferWidth, BufferHeight);
            rtInterface.Attach(rtInterfaceDepthStencil);

            rtComposition = RenderTarget2D.Create(BufferWidth, BufferHeight, RenderTargetUsage.PreserveContents);

            rtCompositionColor = RenderBuffer2D.Create(RenderBufferFormat.Color, BufferWidth, BufferHeight);
            rtComposition.Attach(rtCompositionColor);

            rtCompositionDepthStencil = RenderBuffer2D.Create(RenderBufferFormat.Depth24Stencil8, BufferWidth, BufferHeight);
            rtComposition.Attach(rtCompositionDepthStencil);

            spriteBatch = SpriteBatch.Create();
        }
示例#14
0
        protected override void OnDrawContent(SpriteBatch batch, Rectangle contentArea, GameTime gameTime, float alpha)
        {
            if (!assets.Ready)
                return;

            batch.Draw(Texture, contentArea, Color * Transparency);
        }
示例#15
0
		/// <summary>
		/// Load content
		/// </summary>
		public override void LoadContent()
		{
			Trace.WriteLine("[MainMenu] LoadContent()");

			Batch = new SpriteBatch();
	
			Tileset = ResourceManager.CreateAsset<TileSet>("Main Menu");

			Font = ResourceManager.CreateSharedAsset<BitmapFont>("intro", "intro");

			StringTable = ResourceManager.CreateAsset<StringTable>("main");

			Buttons.Add(new ScreenButton("", new Rectangle(156, 324, 340, 14)));
			Buttons[0].Selected += new EventHandler(LoadGameEvent);

			Buttons.Add(new ScreenButton("", new Rectangle(156, 342, 340, 14)));
			Buttons[1].Selected += new EventHandler(StartNewGameEvent);

			Buttons.Add(new ScreenButton("", new Rectangle(156, 360, 340, 14)));
			Buttons[2].Selected += new EventHandler(OptionEvent);

			Buttons.Add(new ScreenButton("", new Rectangle(156, 378, 340, 14)));
			Buttons[3].Selected += new EventHandler(QuitEvent);

			Theme = new AudioStream();
			Theme.LoadOgg("main.ogg");
			Theme.Loop = true;
			//Theme.Play();


		}
示例#16
0
	public void Draw(SpriteBatch sb, int xx, ref int yy, int ww) {
		if (!Visible()) return;
		
		if (Main.mouseLeft && Main.mouseLeftRelease && ModWorld.GuiAchievements.MouseIn(sb.GraphicsDevice.ScissorRectangle,new Rectangle(xx,yy,ww,42))) {
			toggled = !toggled;
			if (toggled) GuiAchievements.setScroll = yy+GuiAchievements.scroll-120;
		}
		
		Color white = new Color(255,255,255,191);
		Color limish = new Color(136,255,0,191);
		bool achieved = Achieved();
		sb.Draw(ModWorld.Notifier.frame1,new Rectangle(xx+1,yy,ww-2,42),achieved ? limish : white);
		sb.Draw(ModWorld.Notifier.frame2,new Rectangle(xx,yy,1,42),achieved ? limish : white);
		sb.Draw(ModWorld.Notifier.frame2,new Rectangle(xx+ww-1,yy,1,42),achieved ? limish : white);
		
		ModWorld.DrawStringShadowed(sb,Main.fontMouseText,title,new Vector2(xx+8,yy+10),Color.White,Color.Black);
		string value = ""+Value(true)+"/"+Value(false);
		ModWorld.DrawStringShadowed(sb,Main.fontMouseText,value,new Vector2(xx+ww-12-Main.fontMouseText.MeasureString(value).X,yy+10),Color.White,Color.Black);
		
		yy += 42;
		
		if (toggled) {
			for (int i = 0; i < categories.Count; i++) categories[i].Draw(sb,xx+24,ref yy,ww-48);
			for (int i = 0; i < achievements.Count; i++) achievements[i].Draw(sb,xx+24,ref yy,ww-48);
		}
	}
示例#17
0
文件: App.cs 项目: jaumefc/arkanoid
        public override void Initialize()
        {
            this.game = new AntinoidProject.Game ();
            this.game.Initialize (this);

            #region WAVE SOFTWARE LICENSE AGREEMENT
            this.backgroundSplashColor = new Color (32, 32, 32, 255);
            this.spriteBatch = new SpriteBatch (WaveServices.GraphicsDevice);

            var resourceNames = Assembly.GetExecutingAssembly ().GetManifestResourceNames ();
            string name = string.Empty;

            foreach (string item in resourceNames) {
                if (item.Contains ("SplashScreen.wpk")) {
                    name = item;
                    break;
                }
            }

            if (string.IsNullOrWhiteSpace (name)) {
                throw new InvalidProgramException ("License terms not agreed.");
            }

            using (Stream stream = Assembly.GetExecutingAssembly ().GetManifestResourceStream (name)) {
                this.splashScreen = WaveServices.Assets.Global.LoadAsset<Texture2D> (name, stream);
            }

            position = new Vector2 ();
            position.X = (this.Width / 2.0f) - (this.splashScreen.Width / 2.0f);
            position.Y = (this.Height / 2.0f) - (this.splashScreen.Height / 2.0f);
            #endregion
        }
示例#18
0
 static HWSurfaceInstance()
 {
     _atlas = new RenderTexture(_aw, _ah);
     _atlastex = _atlas.Texture;
     _batch = new SpriteBatch(_atlas);
     _batch.SetBlendMode(BlendMode.None);
 }
        public void DrawAndUpdate(SpriteBatch spriteBatch, TimeSpan elapsedTime, Texture2D spriteSheet, float timescale, Texture2D grid)
        {
            if (timescale != 0)
            {
                currentFrameTimer -= TimeSpan.FromMilliseconds(elapsedTime.TotalMilliseconds * timescale);
                if (currentFrameTimer <= TimeSpan.Zero)
                {
                    AdvanceFrameAndReset();
                }
            }

            //threading issue
            if (currentFrameIndex >= frames.Count)
            {
                currentFrameIndex = 0;
            }

            if (frames.Count != 0)
            {
                spriteBatch.Draw(spriteSheet, frames[currentFrameIndex].DrawRectangle, frames[currentFrameIndex].SourceRectangle, Color.White);

                spriteBatch.Draw(grid, frames[currentFrameIndex].DrawRectangle, Color.Red);
                spriteBatch.Draw(grid, frames[currentFrameIndex].SourceRectangle, Color.Blue);
            }
        }
	public static void Register() {
		style = Settings.GetChoice("style");
		OnScreenInterface.Register(new OSIBossHPBar(),OnScreenInterface.LAYER_INTERFACE_SCREEN);
		
		if (style == "circular_bottomleft") {
			dss1 = new DepthStencilState {
				StencilEnable = true,
				StencilFunction = CompareFunction.Equal,
				StencilPass = StencilOperation.Increment,
				ReferenceStencil = 0,
				DepthBufferEnable = false,
			};
			bs1 = new BlendState();
			bs1.ColorWriteChannels = ColorWriteChannels.None;
			
			dss2 = new DepthStencilState {
				StencilEnable = true,
				StencilFunction = CompareFunction.NotEqual,
				StencilPass = StencilOperation.Keep,
				ReferenceStencil = 0,
				DepthBufferEnable = false,
			};
			
			rt = new RenderTarget2D(
				Config.mainInstance.graphics.GraphicsDevice,
				1920,
				96,
				false,Config.mainInstance.graphics.GraphicsDevice.DisplayMode.Format,DepthFormat.Depth24Stencil8
			);
			sb = new SpriteBatch(Config.mainInstance.graphics.GraphicsDevice);
		}
	}
示例#21
0
        private void HandleDraw(SpriteBatch spriteBatch, Vector2 position, Color4 color, float rotation, float scale, Vector2 origin)
        {
            Animation2DFrame currentFrame = animation[frameIndex];

            Vector2 totalScale = new Vector2(currentFrame.Scale * scale);
            float totalRotation = rotation + currentFrame.Rotation;
            spriteBatch.DrawTexture(currentFrame.Texture, position - TextureOffset, color, totalRotation, totalScale, origin);
        }
 public void Draw(SpriteBatch SP)
 {
     Texture2D TEX = Main.goreTexture[Config.goreID["Observing eye"]];
     Vector2 NC = N.position+new Vector2(N.width,N.height)/2f - Main.screenPosition;
     Vector2 TC = new Vector2(TEX.Width,TEX.Height)/2f;
     SP.Draw(TEX,NC-TC*s1+Pos,new Rectangle(0,0,TEX.Width,TEX.Height),c1,0f,default(Vector2),s1,SpriteEffects.None,0f);
     SP.Draw(TEX,NC-TC*s2+Pos-Pos2,new Rectangle(0,0,TEX.Width,TEX.Height),c2,0f,default(Vector2),s2,SpriteEffects.None,0f);
 }
示例#23
0
 public override void Draw(SpriteBatch spriteBatch, GameTime time)
 {
     if (!Visible) return;
     var tex = (IsChecked) ? Textures[0] : Textures[1];
     tex = (Enabled) ? tex : (IsChecked) ? Textures[2] : Textures[3];
     spriteBatch.DrawTexture(tex, new Rectangle(Position.X, Position.Y, Size.Width, Size.Height), Color.White);
     spriteBatch.DrawString(Text, Font, new Vector2(Position.X + 35, Position.Y + 5), Color);
 }
示例#24
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            spriteBatch = new SpriteBatch(GraphicsDevice);
            sphere = Asset.Load<Texture>("Sphere");
            rotatedImages = Asset.Load<SpriteSheet>("RotatedImages");
        }
示例#25
0
 /// <summary>
 /// Create a batch manager for drawing text and sprite
 /// </summary>
 /// <param name="device">Device pointer</param>
 /// <param name="filename">Path of the font file</param>
 public SharpBatch(SharpDevice device, string filename)
 {
     Device = device;
     GraphicsDevice = GraphicsDevice.New(Device.Device);
     GraphicsDevice.SetViewports(Device.DeviceContext.Rasterizer.GetViewports()[0]);
     Batch = new SpriteBatch(GraphicsDevice);
     Font = SpriteFont.Load(GraphicsDevice, filename);
 }
 public void Draw(SpriteBatch SP,int phase,Color special = default(Color))
 {
     if(special == default(Color))DrawLine(SP,pos[phase],pos[phase+1],tex,1f,col,2);
     else DrawLine(SP,pos[phase],pos[phase+1],tex,0.2f,special,1);
     //DrawLine(SP,pos[phase],pos[phase+1],tex,0.67f,col,8);
     //Texture2D TEX = Main.goreTexture[Config.goreID["Rosemaw CEnd"]];
     //SP.Draw(TEX,pos[phase+1]-Main.screenPosition,null,Color.White,0f,new Vector2(),0.5f,SpriteEffects.None,0f);
 }
示例#27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OutOfBandRenderer"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        public OutOfBandRenderer(UltravioletContext uv)
            : base(uv)
        {
            this.spriteBatch = SpriteBatch.Create();

            this.drawingContext = new DrawingContext();
            this.drawingContext.SpriteBatch = spriteBatch;
        }
示例#28
0
 public override void Draw(SpriteBatch batch)
 {
     base.Draw(batch);
     if (Alive)
     {
         batch.Draw(m_Texture, new Microsoft.Xna.Framework.Rectangle((int)Position.X, (int)Position.Y, (int)(m_FrameSize * Scale.X), (int)(m_FrameSize * Scale.Y)), new Microsoft.Xna.Framework.Rectangle((m_Frame * m_FrameSize), 0, m_FrameSize, m_FrameSize), Color.White);
     }
 }
示例#29
0
        public void RemoveBatch(SpriteBatch spriteBatch)
        {
            if (!spriteBatchBufferList.ContainsKey(spriteBatch))
                throw new Exception("Batch not present!");

            spriteBatchBufferList[spriteBatch].Dispose();
            spriteBatchBufferList.Remove(spriteBatch);
        }
示例#30
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            spriteUv = Asset.Load<SpriteSheet>("SpriteUV");
            spriteSphere = Asset.Load<SpriteSheet>("SpriteSphere");
            spriteBatch = new SpriteBatch(GraphicsDevice);
        }
示例#31
0
 public void Draw(SpriteBatch spriteBatch)
 {
     //draw the sprite with rotation
     spriteBatch.Draw(_texture, _position, null, Color.White, _angle, _center, 1, SpriteEffects.None, 0);
 }
示例#32
0
 public void Draw(SpriteBatch sprites)
 {
     if (dir == 0)
     {
         if (!esquerda)
         {
             if (direi && cima)
             {
                 sprites.Draw(imagem4, posicao, Color.White);
                 cima = false;
             }
             else
             {
                 if (direi && baixo)
                 {
                     sprites.Draw(imagem4, new Vector2(posicao.X, posicao.Y), retangulo, Color.White,
                                  0, Vector2.Zero, Vector2.One, SpriteEffects.FlipVertically, 0);
                     baixo = false;
                 }
                 else
                 {
                     sprites.Draw(imagem1, posicao, Color.White);
                 }
             }
         }
         else
         {
             if (cima && esquerda)
             {
                 sprites.Draw(imagem3, posicao, Color.White);
                 cima = false;
             }
             else
             {
                 if (esquerda && baixo)
                 {
                     sprites.Draw(imagem3, new Vector2(posicao.X, posicao.Y), retangulo, Color.White,
                                  0, Vector2.Zero, Vector2.One, SpriteEffects.FlipVertically, 0);
                     baixo = false;
                 }
                 else
                 {
                     sprites.Draw(imagem1, new Vector2(posicao.X, posicao.Y), retangulo, Color.White,
                                  0, Vector2.Zero, Vector2.One, SpriteEffects.FlipHorizontally, 0);
                 }
             }
         }
     }
     else
     {
         if (!cima)
         {
             sprites.Draw(imagem2, new Vector2(posicao.X, posicao.Y), retangulo, Color.White,
                          0, Vector2.Zero, Vector2.One, SpriteEffects.FlipVertically, 0);
         }
         else
         {
             sprites.Draw(imagem2, posicao, Color.White);
         }
     }
 }
示例#33
0
 public void drawBoxFilled(SpriteBatch sb, Rectangle r, Color c)
 {
     sb.Draw(pixel, r, c);
 }
示例#34
0
 public void drawCircleFilled(SpriteBatch sb, Vector2 position, float radius, Color c)
 {
     sb.Draw(circle, position, null, c, 0, new Vector2(circleTextureRadius, circleTextureRadius), radius / circleTextureRadius, SpriteEffects.None, 0);
 }
示例#35
0
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(font, text, location, Color.Black);
 }
 /// <summary>
 /// Draws a filled rectangle
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="location">Where to draw</param>
 /// <param name="size">The size of the rectangle</param>
 /// <param name="color">The color to draw the rectangle in</param>
 public static void FillRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color)
 {
     FillRectangle(spriteBatch, location, size, color, 0.0f);
 }
示例#37
0
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Begin();
     spriteBatch.Draw(_bulletText, _bulletPos, null, Microsoft.Xna.Framework.Color.White, _bulletRot, new Vector2(_bulletText.Width, _bulletText.Height), scale, SpriteEffects.None, 0);
     spriteBatch.End();
 }
 /// <summary>
 /// Draws a rectangle with the thickness provided
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="location">Where to draw</param>
 /// <param name="size">The size of the rectangle</param>
 /// <param name="color">The color to draw the rectangle in</param>
 public static void DrawRectangle(this SpriteBatch spriteBatch, Vector2 location, Vector2 size, Color color)
 {
     DrawRectangle(spriteBatch, new Rectangle((int)location.X, (int)location.Y, (int)size.X, (int)size.Y), color, 1.0f);
 }
示例#39
0
 public void drawPixel(SpriteBatch sb, int x, int y, Color c)
 {
     sb.Draw(pixel, new Vector2(x, y), c);
 }
 /// <summary>
 /// Draws a rectangle with the thickness provided
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="rect">The rectangle to draw</param>
 /// <param name="color">The color to draw the rectangle in</param>
 public static void DrawRectangle(this SpriteBatch spriteBatch, Rectangle rect, Color color)
 {
     DrawRectangle(spriteBatch, rect, color, 1.0f);
 }
 /// <summary>
 /// Draws a filled rectangle
 /// </summary>
 /// <param name="spriteBatch">The destination drawing surface</param>
 /// <param name="x">The X coord of the left side</param>
 /// <param name="y">The Y coord of the upper side</param>
 /// <param name="w">Width</param>
 /// <param name="h">Height</param>
 /// <param name="color">The color to draw the rectangle in</param>
 /// <param name="angle">The angle of the rectangle in radians</param>
 public static void FillRectangle(this SpriteBatch spriteBatch, float x, float y, float w, float h, Color color, float angle)
 {
     FillRectangle(spriteBatch, new Vector2(x, y), new Vector2(w, h), color, angle);
 }
示例#42
0
 public void drawBoxFilled(SpriteBatch sb, float x, float y, float w, float h, Color c)
 {
     sb.Draw(pixel, new Rectangle((int)x, (int)y, (int)w, (int)h), c);
 }
示例#43
0
        public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, string text, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, float maxWidth = -1f, bool ignoreColors = false)
        {
            Vector2 vector = position;
            Vector2 result = vector;

            string[] array = text.Split('\n');
            float    x     = font.MeasureString(" ").X;
            Color    color = baseColor;
            float    num   = 1f;
            float    num2  = 0f;

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string[] array3 = array2[i].Split(':');
                foreach (string text2 in array3)
                {
                    if (text2.StartsWith("sss"))
                    {
                        if (text2.StartsWith("sss1"))
                        {
                            if (!ignoreColors)
                            {
                                color = Color.Red;
                            }
                        }
                        else if (text2.StartsWith("sss2"))
                        {
                            if (!ignoreColors)
                            {
                                color = Color.Blue;
                            }
                        }
                        else if (text2.StartsWith("sssr") && !ignoreColors)
                        {
                            color = Color.White;
                        }
                        continue;
                    }
                    string[] array4 = text2.Split(' ');
                    for (int k = 0; k < array4.Length; k++)
                    {
                        if (k != 0)
                        {
                            vector.X += x * baseScale.X * num;
                        }
                        if (maxWidth > 0f)
                        {
                            float num3 = font.MeasureString(array4[k]).X *baseScale.X *num;
                            if (vector.X - position.X + num3 > maxWidth)
                            {
                                vector.X  = position.X;
                                vector.Y += (float)font.get_LineSpacing() * num2 * baseScale.Y;
                                result.Y  = Math.Max(result.Y, vector.Y);
                                num2      = 0f;
                            }
                        }
                        if (num2 < num)
                        {
                            num2 = num;
                        }
                        DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, font, array4[k], vector, color, rotation, origin, baseScale * num, SpriteEffects.None, 0f);
                        vector.X += font.MeasureString(array4[k]).X *baseScale.X *num;
                        result.X  = Math.Max(result.X, vector.X);
                    }
                }
                vector.X  = position.X;
                vector.Y += (float)font.get_LineSpacing() * num2 * baseScale.Y;
                result.Y  = Math.Max(result.Y, vector.Y);
                num2      = 0f;
            }
            return(result);
        }
示例#44
0
 public void drawPolygon(SpriteBatch sb, Vector2[] points, Color c, int linewidth)
 {
     drawPath(sb, points, c, linewidth);
     drawLine(sb, points[points.Length - 1], points[0], c, linewidth);
 }
示例#45
0
 public static Vector2 DrawColorCodedStringWithShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, float rotation, Color color, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth = -1f, float spread = 2f)
 {
     DrawColorCodedStringShadow(spriteBatch, font, snippets, position, Color.Black, rotation, origin, baseScale, maxWidth, spread);
     return(DrawColorCodedString(spriteBatch, font, snippets, position, color, rotation, origin, baseScale, out hoveredSnippet, maxWidth, ignoreColors: true));
 }
示例#46
0
 public void drawRope(SpriteBatch sb, Vector2[] points, Color c, int linewidth)
 {
     drawPath(sb, points, c, linewidth);
 }
示例#47
0
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Draw(Resource.ResManager.Instance.Cursor, mouseRect, Color.White);
 }
示例#48
0
 public void drawLine(SpriteBatch sb, Vector2 startpos, Vector2 endpos, Color c, int linewidth)
 {
     drawLine(sb, startpos.X, startpos.Y, endpos.X, endpos.Y, c, linewidth);
 }
示例#49
0
        public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors = false)
        {
            int     num    = -1;
            Vector2 vec    = new Vector2(Main.mouseX, Main.mouseY);
            Vector2 vector = position;
            Vector2 result = vector;
            float   x      = font.MeasureString(" ").X;
            Color   color  = baseColor;
            float   num2   = 1f;
            float   num3   = 0f;

            for (int i = 0; i < snippets.Length; i++)
            {
                TextSnippet textSnippet = snippets[i];
                textSnippet.Update();
                if (!ignoreColors)
                {
                    color = textSnippet.GetVisibleColor();
                }
                num2 = textSnippet.Scale;
                if (textSnippet.UniqueDraw(justCheckingString: false, out Vector2 size, spriteBatch, vector, color, num2))
                {
                    if (vec.Between(vector, vector + size))
                    {
                        num = i;
                    }
                    vector.X += size.X * baseScale.X * num2;
                    result.X  = Math.Max(result.X, vector.X);
                    continue;
                }
                string[] array = textSnippet.Text.Split('\n');
                array = Regex.Split(textSnippet.Text, "(\n)");
                bool flag = true;
                foreach (string text in array)
                {
                    string[] array2 = Regex.Split(text, "( )");
                    array2 = text.Split(' ');
                    if (text == "\n")
                    {
                        vector.Y += (float)font.get_LineSpacing() * num3 * baseScale.Y;
                        vector.X  = position.X;
                        result.Y  = Math.Max(result.Y, vector.Y);
                        num3      = 0f;
                        flag      = false;
                        continue;
                    }
                    for (int k = 0; k < array2.Length; k++)
                    {
                        if (k != 0)
                        {
                            vector.X += x * baseScale.X * num2;
                        }
                        if (maxWidth > 0f)
                        {
                            float num4 = font.MeasureString(array2[k]).X *baseScale.X *num2;
                            if (vector.X - position.X + num4 > maxWidth)
                            {
                                vector.X  = position.X;
                                vector.Y += (float)font.get_LineSpacing() * num3 * baseScale.Y;
                                result.Y  = Math.Max(result.Y, vector.Y);
                                num3      = 0f;
                            }
                        }
                        if (num3 < num2)
                        {
                            num3 = num2;
                        }
                        DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, font, array2[k], vector, color, rotation, origin, baseScale * textSnippet.Scale * num2, SpriteEffects.None, 0f);
                        Vector2 value = font.MeasureString(array2[k]);
                        if (vec.Between(vector, vector + value))
                        {
                            num = i;
                        }
                        vector.X += value.X * baseScale.X * num2;
                        result.X  = Math.Max(result.X, vector.X);
                    }
                    if (array.Length > 1 && flag)
                    {
                        vector.Y += (float)font.get_LineSpacing() * num3 * baseScale.Y;
                        vector.X  = position.X;
                        result.Y  = Math.Max(result.Y, vector.Y);
                        num3      = 0f;
                    }
                    flag = true;
                }
            }
            hoveredSnippet = num;
            return(result);
        }
示例#50
0
 public abstract void Draw(SpriteBatch spriteBatch);
示例#51
0
 public override void drawWhenHeld(SpriteBatch spriteBatch, Vector2 objectPosition, Farmer f)
 {
     spriteBatch.Draw(this.Data.GetTexture().Texture, objectPosition - new Vector2(0f, 0), this.Data.GetTexture().Rect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, (float)(f.getStandingY() + 1) / 10000f);
 }
示例#52
0
 public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
 {
     OrchidHelper.DrawSimpleItemGlowmaskInWorld(item, spriteBatch, ModContent.GetTexture("OrchidMod/Glowmasks/AbyssalGreaves_Glowmask"), Color.White, rotation, scale);
 }
示例#53
0
 public virtual void Draw(SpriteBatch spriteBatch)
 {
     
 }
 public void Show(SpriteBatch spritebatch)
 {
     state = State.SHOW;
     spritebatch.Draw(instructpic, instructpos, null, Color.White, 0, offset, 1.0f, SpriteEffects.None, 0); // draw the intro screen
 }
示例#55
0
 public void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.Draw(buttonImage, location, (overLapping) ? Color.White : Color.Black);
     spriteBatch.DrawString(font, text, textLocation, (overLapping) ? Color.Black : Color.White);
 }
示例#56
0
 public void drawCircle(SpriteBatch sb, Vector2 position, float radius, Color c, int linewidth)
 {
     drawPolygon(sb, makeCircle(position, radius, 32), c, linewidth);
 }
示例#57
0
文件: Game1.cs 项目: dwragge/rpgsim
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
 }
示例#58
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            font   = Content.Load <SpriteFont>("Font");
            teapot = Content.Load <Model>("Teapot");
            batch  = new SpriteBatch(GraphicsDevice);

            BuildUI();

            spriteComponent = new SpriteComponent {
                SpriteProvider = new SpriteFromSheet {
                    Sheet = Content.Load <SpriteSheet>("SpriteSheet")
                }
            };
            modelComponent = new ModelComponent {
                Model = teapot
            };
            modelComponent2 = new ModelComponent {
                Model = teapot
            };
            modelComponent3 = new ModelComponent {
                Model = teapot
            };
            entity = new Entity {
                spriteComponent, modelComponent
            };
            entity2 = new Entity {
                modelComponent2
            };
            entity3 = new Entity {
                modelComponent3
            };
            SceneSystem.SceneInstance.RootScene.Entities.Add(entity);
            SceneSystem.SceneInstance.RootScene.Entities.Add(entity2);
            SceneSystem.SceneInstance.RootScene.Entities.Add(entity3);

            if (Input.Accelerometer != null)
            {
                Input.Accelerometer.IsEnabled = true;
            }

            if (Input.Compass != null)
            {
                Input.Compass.IsEnabled = true;
            }

            if (Input.Gyroscope != null)
            {
                Input.Gyroscope.IsEnabled = true;
            }

            if (Input.UserAcceleration != null)
            {
                Input.UserAcceleration.IsEnabled = true;
            }

            if (Input.Gravity != null)
            {
                Input.Gravity.IsEnabled = true;
            }

            if (Input.Orientation != null)
            {
                Input.Orientation.IsEnabled = true;
            }

            ChangeScene(0);
        }
 private static void CreateThePixel(SpriteBatch spriteBatch)
 {
     pixel = new Texture2D(spriteBatch.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
     pixel.SetData(new[] { Color.White });
 }
示例#60
0
        public void drawBoxFilled(SpriteBatch sb, Vector2 upperLeft, Vector2 lowerRight, Color c)
        {
            Rectangle r = Extensions.RectangleFromVectors(upperLeft, lowerRight);

            sb.Draw(pixel, r, c);
        }