git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1226 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -2,18 +2,26 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using BluntDirectX.Direct3D;
|
||||
|
||||
namespace OpenRa.Game
|
||||
{
|
||||
class Viewport
|
||||
{
|
||||
readonly Size clientSize;
|
||||
readonly float2 mapSize;
|
||||
PointF scrollPosition;
|
||||
|
||||
public PointF ScrollPosition
|
||||
{
|
||||
get { return scrollPosition; }
|
||||
set { scrollPosition = value; }
|
||||
}
|
||||
|
||||
public void Scroll(float2 delta)
|
||||
{
|
||||
float2 scrollPos = new float2(ScrollPosition) + delta;
|
||||
scrollPos = scrollPos.Constrain(new Range<float2>(float2.Zero, mapSize));
|
||||
scrollPosition = scrollPos.ToPointF();
|
||||
}
|
||||
|
||||
public Size ClientSize
|
||||
@@ -21,9 +29,10 @@ namespace OpenRa.Game
|
||||
get { return clientSize; }
|
||||
}
|
||||
|
||||
public Viewport(Size clientSize)
|
||||
public Viewport(Size clientSize, float2 mapSize)
|
||||
{
|
||||
this.clientSize = clientSize;
|
||||
this.mapSize = 24 * mapSize - Size + new float2(128, 0);
|
||||
}
|
||||
|
||||
public float2 Size { get { return new float2(clientSize); } }
|
||||
|
||||
Reference in New Issue
Block a user