mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-21 01:39:32 +00:00
got the sprite code compiling and i can see the stump
This commit is contained in:
@@ -47,10 +47,11 @@
|
||||
<Compile Include="Content\ContentLoader.cs" />
|
||||
<Compile Include="Content\ContentManagerExtensions.cs" />
|
||||
<Compile Include="Camera2D.cs" />
|
||||
<Compile Include="Sprites\SpriteBatchExtensions.cs" />
|
||||
<Compile Include="TextureAtlases\SpriteBatchExtensions.cs" />
|
||||
<Compile Include="TextureAtlases\TextureRegion2D.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Sprites\Sprite.cs" /> </ItemGroup>
|
||||
<Compile Include="Sprites\Sprite.cs" />
|
||||
<Compile Include="Maps\Tiled\TiledImageLayer.cs" />
|
||||
<Compile Include="Maps\Tiled\TiledLayer.cs" />
|
||||
<Compile Include="Maps\Tiled\TiledTileLayer.cs" />
|
||||
@@ -86,4 +87,4 @@
|
||||
<<<<<<< HEAD
|
||||
-->
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -1,16 +1,12 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using MonoGame.Extended.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MonoGame.Extended.TextureAtlases;
|
||||
|
||||
namespace MonoGame.Extended.Sprites
|
||||
{
|
||||
public class Sprite
|
||||
{
|
||||
public TextureRegion2D TextureRegion;
|
||||
public TextureRegion2D TextureRegion { get; set; }
|
||||
public Color Color { get; set; }
|
||||
public bool IsVisible { get; set; }
|
||||
|
||||
@@ -23,6 +19,7 @@ namespace MonoGame.Extended.Sprites
|
||||
{
|
||||
TextureRegion = new TextureRegion2D(texture);
|
||||
Scale = Vector2.One;
|
||||
Color = Color.White;
|
||||
IsVisible = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace MonoGame.Extended.Sprites
|
||||
{
|
||||
public static class SpriteBatchExtensions
|
||||
{
|
||||
public static void Draw(this SpriteBatch spriteBatch, Sprite sprite)
|
||||
{
|
||||
if (sprite.IsVisible)
|
||||
spriteBatch.Draw(sprite.TextureRegion.Texture, null, sprite.GetBoundingRectangle(), sprite.TextureRegion.Bounds, sprite.Origin, sprite.Rotation, sprite.Scale, sprite.Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using MonoGame.Extended;
|
||||
using MonoGame.Extended.BitmapFonts;
|
||||
<<<<<<< HEAD
|
||||
using MonoGame.Extended.Graphics;
|
||||
using MonoGame.Extended.Sprites;
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using MonoGame.Extended.Maps.Tiled;
|
||||
using MonoGame.Extended.Sprites;
|
||||
using MonoGame.Extended.ViewportAdapters;
|
||||
|
||||
namespace Sandbox
|
||||
@@ -140,18 +137,18 @@ namespace Sandbox
|
||||
//_spriteBatch.Draw(_backgroundTexture, new Rectangle(0, 0, _tiledMap.WidthInPixels, _tiledMap.HeightInPixels), Color.White);
|
||||
//_spriteBatch.End();
|
||||
|
||||
_tiledMap.Draw(_camera);
|
||||
//_tiledMap.Draw(_camera);
|
||||
|
||||
_spriteBatch.Begin();
|
||||
_spriteBatch.DrawString(_bitmapFont, "This is MonoGame.Extended", new Vector2(50, 50), new Color(Color.Black, 0.5f));
|
||||
_spriteBatch.DrawString(_bitmapFont, string.Format("Camera: {0}", _camera.Position), new Vector2(50, 100), Color.Black);
|
||||
//_spriteBatch.DrawString(_bitmapFont,
|
||||
// "Contrary to popular belief, Lorem Ipsum is not simply random text.\n\n" +
|
||||
// "It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard " +
|
||||
// "McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin " +
|
||||
// "words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, " +
|
||||
// "discovered the undoubtable source.", new Vector2(50, 100), new Color(Color.Black, 0.5f), _viewportAdapter.VirtualWidth - 50);
|
||||
_spriteBatch.End();
|
||||
//_spriteBatch.Begin();
|
||||
//_spriteBatch.DrawString(_bitmapFont, "This is MonoGame.Extended", new Vector2(50, 50), new Color(Color.Black, 0.5f));
|
||||
//_spriteBatch.DrawString(_bitmapFont, string.Format("Camera: {0}", _camera.Position), new Vector2(50, 100), Color.Black);
|
||||
////_spriteBatch.DrawString(_bitmapFont,
|
||||
//// "Contrary to popular belief, Lorem Ipsum is not simply random text.\n\n" +
|
||||
//// "It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard " +
|
||||
//// "McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin " +
|
||||
//// "words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, " +
|
||||
//// "discovered the undoubtable source.", new Vector2(50, 100), new Color(Color.Black, 0.5f), _viewportAdapter.VirtualWidth - 50);
|
||||
//_spriteBatch.End();
|
||||
|
||||
_spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix());
|
||||
//Console.WriteLine(_stumpSprite.Position);
|
||||
|
||||
Reference in New Issue
Block a user