git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1202 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -74,7 +74,7 @@ namespace OpenRa.Game
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PointF scrollPos, oldPos;
|
PointF scrollPos;
|
||||||
int x1,y1;
|
int x1,y1;
|
||||||
|
|
||||||
protected override void OnMouseDown(MouseEventArgs e)
|
protected override void OnMouseDown(MouseEventArgs e)
|
||||||
@@ -83,7 +83,6 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
x1 = e.X;
|
x1 = e.X;
|
||||||
y1 = e.Y;
|
y1 = e.Y;
|
||||||
oldPos = scrollPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseMove(MouseEventArgs e)
|
protected override void OnMouseMove(MouseEventArgs e)
|
||||||
@@ -92,9 +91,14 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
if (e.Button != 0)
|
if (e.Button != 0)
|
||||||
{
|
{
|
||||||
scrollPos = oldPos;
|
|
||||||
scrollPos.X += x1 - e.X;
|
scrollPos.X += x1 - e.X;
|
||||||
scrollPos.Y += y1 - e.Y;
|
scrollPos.Y += y1 - e.Y;
|
||||||
|
|
||||||
|
x1 = e.X;
|
||||||
|
y1 = e.Y;
|
||||||
|
|
||||||
|
scrollPos.X = Util.Constrain( scrollPos.X, new Range<float>(0, map.Width * 24 - ClientSize.Width));
|
||||||
|
scrollPos.Y = Util.Constrain(scrollPos.Y, new Range<float>(0, map.Height * 24 - ClientSize.Height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace OpenRa.Game
|
|||||||
public void BeginFrame( PointF r1, PointF r2, PointF scroll )
|
public void BeginFrame( PointF r1, PointF r2, PointF scroll )
|
||||||
{
|
{
|
||||||
device.Begin();
|
device.Begin();
|
||||||
device.Clear(0, Surfaces.Color);
|
//device.Clear(0, Surfaces.Color);
|
||||||
|
|
||||||
shader.SetValue(scrollHandle, scroll);
|
shader.SetValue(scrollHandle, scroll);
|
||||||
shader.SetValue(r1Handle, r1);
|
shader.SetValue(r1Handle, r1);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenRa.FileFormats;
|
using OpenRa.FileFormats;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using BluntDirectX.Direct3D;
|
||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
{
|
{
|
||||||
@@ -24,6 +25,11 @@ namespace OpenRa.Game
|
|||||||
return (v > 0) ? v1 : v0;
|
return (v > 0) ? v1 : v0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float Constrain(float x, Range<float> range)
|
||||||
|
{
|
||||||
|
return x < range.Start ? range.Start : x > range.End ? range.End : x;
|
||||||
|
}
|
||||||
|
|
||||||
static PointF EncodeVertexAttributes(TextureChannel channel, int paletteLine)
|
static PointF EncodeVertexAttributes(TextureChannel channel, int paletteLine)
|
||||||
{
|
{
|
||||||
Converter<TextureChannel, float> channelEncoder = delegate(TextureChannel c)
|
Converter<TextureChannel, float> channelEncoder = delegate(TextureChannel c)
|
||||||
|
|||||||
Reference in New Issue
Block a user