本文整理汇总了C#中IntRect类的典型用法代码示例。如果您正苦于以下问题:C# IntRect类的具体用法?C# IntRect怎么用?C# IntRect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntRect类属于命名空间,在下文中一共展示了IntRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Teleporter
public Teleporter(Teleporter copy)
: base(copy)
{
MapName = copy.MapName;
WarpPointName = copy.WarpPointName;
Area = copy.Area == null ? null : new IntRect(copy.Area);
}
示例2: Frame
public Frame(int id, int nextFrameId, IntRect frame)
{
this.id = id;
this.nextFrameId = nextFrameId;
this.frame = frame;
}
示例3: Chatbox
public Chatbox(IResourceManager resourceManager, IUserInterfaceManager userInterfaceManager,
IKeyBindingManager keyBindingManager)
{
_resourceManager = resourceManager;
_userInterfaceManager = userInterfaceManager;
_keyBindingManager = keyBindingManager;
Position = new Vector2i((int)CluwneLib.CurrentClippingViewport.Width - (int)Size.X - 10, 10);
ClientArea = new IntRect(Position.X, Position.Y, (int) Size.X, (int) Size.Y);
_textInputLabel = new Label("", "CALIBRI", _resourceManager)
{
Text =
{
Size = new Vector2i(ClientArea.Width - 10, 12),
Color = new SFML.Graphics.Color(0, 128, 0)
}
};
_chatColors = new Dictionary<ChatChannel, SFML.Graphics.Color>
{
[ChatChannel.Default] = new SFML.Graphics.Color(128, 128, 128),
[ChatChannel.Damage ] = Color.Red,
[ChatChannel.Radio ] = new SFML.Graphics.Color(0, 100, 0),
[ChatChannel.Server ] = Color.Blue,
[ChatChannel.Player ] = new SFML.Graphics.Color(0, 128, 0),
[ChatChannel.Lobby ] = Color.White,
[ChatChannel.Ingame ] = new SFML.Graphics.Color(0, 128, 0),
[ChatChannel.OOC ] = Color.White,
[ChatChannel.Emote ] = Color.Cyan,
[ChatChannel.Visual ] = Color.Yellow,
};
}
示例4: Door
public Door(Door copy)
: base(copy)
{
Area = new IntRect(copy.Area);
OnStateChange += new StateEventHandler(Door_OnStateChange);
}
示例5: Union
public IntRect Union(IntRect r2)
{
var left = ArrayPoint.Min(offset, r2.offset);
var right = ArrayPoint.Max(RightEnd, r2.RightEnd);
return new IntRect(left, right - left);
}
示例6: Intersection
public IntRect Intersection(IntRect otherRect)
{
var left = ArrayPoint.Max(offset, otherRect.offset);
var right = ArrayPoint.Min(RightEnd, otherRect.RightEnd);
return new IntRect(left, right - left);
}
示例7: SetSetting
public void SetSetting(string mapName, string warpPointName, IntRect rect = null)
{
MapName = mapName;
WarpPointName = warpPointName;
SetArea(rect != null ? rect : new IntRect(0, 0, (int)Dimension.X, (int)Dimension.Y));
}
示例8: Intersection
public IntRect Intersection(IntRect r2)
{
var left = ArrayPoint.Max(offset, r2.offset);
var right = ArrayPoint.Min(RightEnd, r2.RightEnd);
return new IntRect(left, right - left).IncDimensions(new ArrayPoint(15, 15));
}
示例9: TriggerGiveItem
public TriggerGiveItem(int left, int top, int width, int height, int inAmount, string inDraw, string inItem)
{
name = "triggerGiveItem";
position = new Vector2f(left, top);
boundingbox = new IntRect(left, top, width, height);
visible = false;
solid = false;
trigger = true;
_amount = inAmount;
_item = inItem;
visible = Convert.ToBoolean(inDraw);
active = true;
/*switch (_item)
{
case "ItemGoldKey":
item = new Items.GoldKey();
break;
case "ItemSpectecBlaster":
item = new Items.SpectecBlaster();
break;
case "ItemSpectecChargeSabre":
item = new Items.SpectecChargeSabre();
break;
case "ItemInterCoin":
item = new Items.InterCoin();
break;
}
sprite = new Sprite(new Texture("./assets/" + item.tileName));*/
}
示例10: Draw
public void Draw(RenderManager renderMgr)
{
IntRect subImageRect = new IntRect(0, 0, (int) texture.Size.X, (int) texture.Size.Y);
Vector2f centerPos = new Vector2f(box.Left + box.Width * 0.5f, box.Top + box.Height * 0.5f);
renderMgr.DrawSprite(texture, subImageRect, centerPos, box.Width, box.Height, false, false, new Color(255, 255, 255, 255), 10000);
}
示例11: GetCenter
public static Vector2D GetCenter(IntRect hitbox)
{
int x = hitbox.Left + hitbox.Width / 2;
int y = hitbox.Top + hitbox.Height / 2;
return new Vector2D(x, y);
}
示例12: Intersects
////////////////////////////////////////////////////////////
/// <summary>
/// Check intersection between two rectangles
/// </summary>
/// <param name="rect"> Rectangle to test</param>
/// <param name="overlap">Rectangle to be filled with overlapping rect</param>
/// <returns>True if rectangles overlap</returns>
////////////////////////////////////////////////////////////
public bool Intersects(IntRect rect, out IntRect overlap)
{
// Compute the intersection boundaries
int left = Math.Max(Left, rect.Left);
int top = Math.Max(Top, rect.Top);
int right = Math.Min(Left + Width, rect.Left + rect.Width);
int bottom = Math.Min(Top + Height, rect.Top + rect.Height);
// If the intersection is valid (positive non zero area), then there is an intersection
if ((left < right) && (top < bottom))
{
overlap.Left = left;
overlap.Top = top;
overlap.Width = right - left;
overlap.Height = bottom - top;
return true;
}
else
{
overlap.Left = 0;
overlap.Top = 0;
overlap.Width = 0;
overlap.Height = 0;
return false;
}
}
示例13: Glyph
public Glyph(Vector2f location, float scale, GlyphConfig settings)
{
_config = settings;
_sprite = new Sprite(_texture)
{
Scale = new Vector2f(scale, scale),
Position = location,
};
_spriteOutline = new Sprite(_textureOutline)
{
Scale = new Vector2f(scale, scale),
Position = location,
};
var glyphAreaX = (GLYPH_WIDTH*scale);
_glyphArea = new IntRect(
(int) (location.X - 0.5f*glyphAreaX),
(int) location.Y,
(int) glyphAreaX,
(int) (GLYPH_HEIGHT*scale));
Index = GetRandom.Int(MAX_INDEX);
_twitch = new TwitchCalculator();
}
示例14: CluwneSprite
/// <summary>
/// Creates a new CluwneSprite with a specified portion of the Texture
/// </summary>
/// <param name="texture"> Texture to draw </param>
/// <param name="rectangle"> What part of the Texture to use </param>
public CluwneSprite(string key, Texture texture, IntRect rectangle)
: base(texture,rectangle)
{
Key = key;
Position = new Vector2(X, Y);
Size = new Vector2(Width, Height);
}
示例15: LayoutControl
/// <summary>
/// Set position and size of a GUI element using resolution-independant coordinates. Size of the screen in these coordinates is always 1280x720.
/// There are a lot of overloads of this method that allow you to use <see cref="Vector2i"/>/<see cref="Vector2u"/> for position and/or size.
/// </summary>
/// <param name="ctrl">Gui element to resize</param>
/// <param name="x">Distance from left of the window to left of ctrl</param>
/// <param name="y">Distance from top of the window to top of ctrl</param>
/// <param name="w">Width of ctrl</param>
/// <param name="h">Height of ctrl</param>
/// <param name="screenrect">Actual screen resolusion</param>
/// <seealso cref="LayoutSprite"/>
public static void LayoutControl(UI.Control ctrl, int x, int y, int w, int h, IntRect screenrect)
{
// x,y,w,h are relative to 1280x720
ctrl.X = (int)((x / 1280.0f) * screenrect.Width);
ctrl.Y = (int)((y / 720.0f) * screenrect.Height);
ctrl.Width = (int)((w / 1280.0f) * screenrect.Width);
ctrl.Height = (int)((h / 720.0f) * screenrect.Height);
}