Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Drawing;
- using Microsoft.DirectX.Direct3D;
- using MapleLib.WzLib.WzProperties;
- using Microsoft.DirectX.DirectInput;
- using System.Windows.Forms;
- namespace WzExplorer.Mapping
- {
- class MapLink
- {
- private string toolTip, linkMap;
- private Bitmap linkImage;
- private Texture texture;
- private Point Spot = new Point(0, 0);
- public Microsoft.DirectX.DirectInput.Device Mouse;
- public bool canDraw = false;
- private WzVectorProperty ori;
- private Point _position = Point.Empty;
- public void Update()
- {
- //still invalid mouse pos
- _position = Mapper.obj.pos;
- Mapper.obj.Text = "Pos: " + _position.X + "/ " + _position.Y;
- byte[] buttons = Mouse.CurrentMouseState.GetMouseButtons();
- if (0 != buttons[0])
- {
- if (canDraw == true)
- {
- Mapper.obj.test.Text = linkMap;
- Mapper.obj.change = true;
- }
- }
- else
- {
- }
- //checks the mouse pos agenst the bounding box
- if (_position.X >= Spot.X && _position.X <= Spot.X + linkImage.Width)
- {
- if (_position.Y >= Spot.Y && _position.Y <= Spot.Y + linkImage.Height)
- {
- canDraw = true;
- return;
- }
- }
- canDraw = false;
- }
- public MapLink(Microsoft.DirectX.Direct3D.Device DxDevice, Microsoft.DirectX.DirectInput.Device mouse, string tooltip, string linkMap, Bitmap linkimg, WzVectorProperty baseOrigin, WzVectorProperty origin)
- {
- this.toolTip = tooltip;
- this.linkMap = linkMap;
- this.linkImage = linkimg;
- this.texture = Texture.FromBitmap(DxDevice, linkImage, Usage.Dynamic, Pool.Default);
- this.Spot = calPOS(baseOrigin,origin);
- this.Mouse = mouse;
- this.ori = origin;
- }
- private Point calPOS(WzVectorProperty baseOrigin, WzVectorProperty imageOrigin)
- {
- Point fix = new Point(baseOrigin.X.ToInt() - imageOrigin.X.ToInt(), baseOrigin.Y.ToInt() - imageOrigin.Y.ToInt());
- return fix;
- }
- public void StaticDraw()
- {
- Mapper.sprite.Draw2D(texture, new Point(0, 0), 0f, new Point(Spot.X, Spot.Y), Color.White);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement