DrawLine part of RenderHelper

This commit is contained in:
2012-10-05 12:11:32 +02:00
parent b1f723580d
commit e89a657740
4 changed files with 237 additions and 211 deletions
+15 -9
View File
@@ -16,7 +16,7 @@ namespace DepthsBelow
/// </summary> /// </summary>
public class Core : Microsoft.Xna.Framework.Game public class Core : Microsoft.Xna.Framework.Game
{ {
GraphicsDeviceManager graphics; public static GraphicsDeviceManager GraphicsDeviceManager;
SpriteBatch spriteBatch; SpriteBatch spriteBatch;
public Camera Camera; public Camera Camera;
@@ -24,20 +24,22 @@ namespace DepthsBelow
public static MouseInput MouseInput; public static MouseInput MouseInput;
public List<Soldier> Squad; public List<Soldier> Squad;
public List<SmallEnemy> Swarm; public List<SmallEnemy> Swarm;
public static Map Map; public static Map Map;
public SmallEnemy TestMonster;
public Core() public Core()
{ {
graphics = new GraphicsDeviceManager(this); GraphicsDeviceManager = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content"; Content.RootDirectory = "Content";
graphics.PreferredBackBufferWidth = 1280; GraphicsDeviceManager.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720; GraphicsDeviceManager.PreferredBackBufferHeight = 720;
graphics.IsFullScreen = false; GraphicsDeviceManager.IsFullScreen = false;
//graphics.SynchronizeWithVerticalRetrace = false; //graphics.SynchronizeWithVerticalRetrace = false;
this.IsFixedTimeStep = false; this.IsFixedTimeStep = false;
graphics.ApplyChanges(); GraphicsDeviceManager.ApplyChanges();
this.IsMouseVisible = true; this.IsMouseVisible = true;
} }
@@ -53,7 +55,9 @@ namespace DepthsBelow
// TODO: Add your initialization logic here // TODO: Add your initialization logic here
Camera = new Camera(this); Camera = new Camera(this);
Squad = new List<Soldier>(); Squad = new List<Soldier>();
Swarm = new List<SmallEnemy>(); Swarm = new List<SmallEnemy>();
TestMonster = new SmallEnemy(this, ref Swarm);
base.Initialize(); base.Initialize();
} }
@@ -142,7 +146,9 @@ namespace DepthsBelow
} }
// Draw mouse input visuals // Draw mouse input visuals
MouseInput.Draw(spriteBatch); MouseInput.Draw(spriteBatch);
TestMonster.GetComponent<Component.SpriteRenderer>().Draw(spriteBatch);
spriteBatch.End(); spriteBatch.End();
+190 -189
View File
@@ -1,191 +1,192 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectGuid>{94683C5B-052D-4143-96D8-35C67E831000}</ProjectGuid> <ProjectGuid>{94683C5B-052D-4143-96D8-35C67E831000}</ProjectGuid>
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DepthsBelow</RootNamespace> <RootNamespace>DepthsBelow</RootNamespace>
<AssemblyName>DepthsBelow</AssemblyName> <AssemblyName>DepthsBelow</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile> <TargetFrameworkProfile>Client</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion> <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<XnaPlatform>Windows</XnaPlatform> <XnaPlatform>Windows</XnaPlatform>
<XnaProfile>HiDef</XnaProfile> <XnaProfile>HiDef</XnaProfile>
<XnaCrossPlatformGroupID>faa0577e-a03e-43cf-89c7-0a03f4c22717</XnaCrossPlatformGroupID> <XnaCrossPlatformGroupID>faa0577e-a03e-43cf-89c7-0a03f4c22717</XnaCrossPlatformGroupID>
<XnaOutputType>Game</XnaOutputType> <XnaOutputType>Game</XnaOutputType>
<ApplicationIcon>Game.ico</ApplicationIcon> <ApplicationIcon>Game.ico</ApplicationIcon>
<Thumbnail>GameThumbnail.png</Thumbnail> <Thumbnail>GameThumbnail.png</Thumbnail>
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl> <PublishUrl>publish\</PublishUrl>
<Install>true</Install> <Install>true</Install>
<InstallFrom>Disk</InstallFrom> <InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled> <UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode> <UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval> <UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision> <ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\x86\Debug</OutputPath> <OutputPath>bin\x86\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants> <DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib> <NoStdLib>true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<XnaCompressContent>false</XnaCompressContent> <XnaCompressContent>false</XnaCompressContent>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\x86\Release</OutputPath> <OutputPath>bin\x86\Release</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants> <DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib> <NoStdLib>true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess> <UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<XnaCompressContent>true</XnaCompressContent> <XnaCompressContent>true</XnaCompressContent>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ManifestCertificateThumbprint>ECE66DEF071576E8D2F7D57232C0569623E3E2DF</ManifestCertificateThumbprint> <ManifestCertificateThumbprint>ECE66DEF071576E8D2F7D57232C0569623E3E2DF</ManifestCertificateThumbprint>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ManifestKeyFile>DepthsBelow_TemporaryKey.pfx</ManifestKeyFile> <ManifestKeyFile>DepthsBelow_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<GenerateManifests>true</GenerateManifests> <GenerateManifests>true</GenerateManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignManifests>true</SignManifests> <SignManifests>true</SignManifests>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Video, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Video, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Avatar, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Avatar, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> <Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="mscorlib"> <Reference Include="mscorlib">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System"> <Reference Include="System">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Xml"> <Reference Include="System.Xml">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Core"> <Reference Include="System.Core">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Xml.Linq"> <Reference Include="System.Xml.Linq">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="System.Net"> <Reference Include="System.Net">
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Camera.cs" /> <Compile Include="Camera.cs" />
<Compile Include="Component\PathFinder.cs" /> <Compile Include="Component\PathFinder.cs" />
<Compile Include="Component\Transform.cs" /> <Compile Include="Component\Transform.cs" />
<Compile Include="Grid.cs" /> <Compile Include="Grid.cs" />
<Compile Include="Component\Collision.cs" /> <Compile Include="Component\Collision.cs" />
<Compile Include="Component\Component.cs" /> <Compile Include="Component\Component.cs" />
<Compile Include="Component\GridTransform.cs" /> <Compile Include="Component\GridTransform.cs" />
<Compile Include="Core.cs" /> <Compile Include="Core.cs" />
<Compile Include="Entity.cs" /> <Compile Include="Entity.cs" />
<Compile Include="Map.cs" /> <Compile Include="Map.cs" />
<Compile Include="MouseInput.cs" /> <Compile Include="MouseInput.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Component\SpriteRenderer.cs" /> <Compile Include="Component\SpriteRenderer.cs" />
<Compile Include="SmallEnemy.cs" /> <Compile Include="RenderHelpers.cs" />
<Compile Include="Soldier.cs" /> <Compile Include="SmallEnemy.cs" />
<Compile Include="Component\PixelTransform.cs" /> <Compile Include="Soldier.cs" />
</ItemGroup> <Compile Include="Component\PixelTransform.cs" />
<ItemGroup> </ItemGroup>
<Content Include="Game.ico" /> <ItemGroup>
<Content Include="GameThumbnail.png" /> <Content Include="Game.ico" />
</ItemGroup> <Content Include="GameThumbnail.png" />
<ItemGroup> </ItemGroup>
<ProjectReference Include="..\..\AStar\AStar.csproj"> <ItemGroup>
<Project>{CD3F949D-54AA-4D38-99DB-92905A375D84}</Project> <ProjectReference Include="..\..\AStar\AStar.csproj">
<Name>AStar</Name> <Project>{CD3F949D-54AA-4D38-99DB-92905A375D84}</Project>
</ProjectReference> <Name>AStar</Name>
<ProjectReference Include="..\DepthsBelowContent\DepthsBelowContent.contentproj"> </ProjectReference>
<Name>DepthsBelowContent %28Content%29</Name> <ProjectReference Include="..\DepthsBelowContent\DepthsBelowContent.contentproj">
<XnaReferenceType>Content</XnaReferenceType> <Name>DepthsBelowContent %28Content%29</Name>
<Project>{433A77A2-DE52-4875-A4EF-232CF59C2DD3}</Project> <XnaReferenceType>Content</XnaReferenceType>
</ProjectReference> <Project>{433A77A2-DE52-4875-A4EF-232CF59C2DD3}</Project>
</ItemGroup> </ProjectReference>
<ItemGroup> </ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client"> <ItemGroup>
<Visible>False</Visible> <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName> <Visible>False</Visible>
<Install>true</Install> <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
</BootstrapperPackage> <Install>true</Install>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5"> </BootstrapperPackage>
<Visible>False</Visible> <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> <Visible>False</Visible>
<Install>false</Install> <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
</BootstrapperPackage> <Install>false</Install>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> </BootstrapperPackage>
<Visible>False</Visible> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<ProductName>.NET Framework 3.5 SP1</ProductName> <Visible>False</Visible>
<Install>false</Install> <ProductName>.NET Framework 3.5 SP1</ProductName>
</BootstrapperPackage> <Install>false</Install>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> </BootstrapperPackage>
<Visible>False</Visible> <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<ProductName>Windows Installer 3.1</ProductName> <Visible>False</Visible>
<Install>true</Install> <ProductName>Windows Installer 3.1</ProductName>
</BootstrapperPackage> <Install>true</Install>
<BootstrapperPackage Include="Microsoft.Xna.Framework.4.0"> </BootstrapperPackage>
<Visible>False</Visible> <BootstrapperPackage Include="Microsoft.Xna.Framework.4.0">
<ProductName>Microsoft XNA Framework Redistributable 4.0</ProductName> <Visible>False</Visible>
<Install>true</Install> <ProductName>Microsoft XNA Framework Redistributable 4.0</ProductName>
</BootstrapperPackage> <Install>true</Install>
</ItemGroup> </BootstrapperPackage>
<ItemGroup> </ItemGroup>
<None Include="DepthsBelow_TemporaryKey.pfx" /> <ItemGroup>
</ItemGroup> <None Include="DepthsBelow_TemporaryKey.pfx" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!-- <!--
To modify your build process, add your task inside one of the targets below and uncomment it. To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
@@ -193,5 +194,5 @@
</Target> </Target>
<Target Name="AfterBuild"> <Target Name="AfterBuild">
</Target> </Target>
--> -->
</Project> </Project>
+2 -13
View File
@@ -144,7 +144,7 @@ namespace DepthsBelow
} }
else else
{ {
*/unit.GetComponent<Component.Transform>().World.Rotation = (float)Math.Atan2(mouseWorldPos.Y - unit.Transform.World.Y, mouseWorldPos.X - unit.Transform.World.X);/* */unit.GetComponent<Component.Transform>().World.Rotation = (float)Math.Atan2(mouseWorldPos.Y - unit.Transform.World.Y - unit.Transform.World.Origin.Y, mouseWorldPos.X - unit.Transform.World.X - unit.Transform.World.Origin.X);/*
}*/ }*/
//Console.WriteLine(angle); //Console.WriteLine(angle);
//unit.GetComponent<Component.Transform>().World.Rotation = angle; //unit.GetComponent<Component.Transform>().World.Rotation = angle;
@@ -170,21 +170,10 @@ namespace DepthsBelow
if (checkingDirection == true) if (checkingDirection == true)
{ {
Texture2D blank = new Texture2D(core.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); RenderHelpers.DrawLine(spriteBatch, Color.White, 2, directionStart, directionNow);
blank.SetData(new[] { Color.White });
DrawLine(spriteBatch, blank, 2, Color.White, directionStart, directionNow);
} }
} }
void DrawLine(SpriteBatch batch, Texture2D blank, float width, Color color, Vector2 point1, Vector2 point2)
{
float angle = (float)Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);
float length = Vector2.Distance(point1, point2);
batch.Draw(blank, point1, null, color,
angle, Vector2.Zero, new Vector2(length, width),
SpriteEffects.None, 0);
}
} }
} }
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace DepthsBelow
{
static class RenderHelpers
{
static Texture2D blank;
public static void DrawLine(SpriteBatch batch, Color color, float width, Vector2 start, Vector2 end)
{
if (blank == null)
{
blank = new Texture2D(Core.GraphicsDeviceManager.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
blank.SetData(new[] { color });
}
float angle = (float)Math.Atan2(end.Y - start.Y, end.X - start.X);
float length = Vector2.Distance(start, end);
batch.Draw(blank, start, null, color,
angle, Vector2.Zero, new Vector2(length, width),
SpriteEffects.None, 0);
}
}
}