private void mouse_down(object o, MouseEventArgs e) { if (MouseButtons.Left == e.Button) { for (int index = 0; index < animations.Count; ++index) { actions_animation animation = animations[index]; wzvector location = locations[index]; Point point = new Point(e.X - location.x - animation.x, e.Y - location.y - animation.y); if (new Rectangle(Point.Empty, animation.frame.Size).Contains(point)) { if (0 != animation.frame.GetPixel(point.X, point.Y).A) { current = index; origin = new Point(e.X, e.Y); } } } if (-1 != current) { (Parent as momiji_host).scene_selected(animations[current]); } } }
protected virtual StringBuilder Vector(string name, wzvector vec) { StringBuilder sb = new StringBuilder("<vector name=\""); sb.Append(name); sb.Append("\" x=\""); sb.Append(vec.x); sb.Append("\" y=\""); sb.Append(vec.y); sb.Append("\"/>"); return(sb); }
public static wzvector operator -(wzvector a, wzvector b) { if (null == a) { a = new wzvector(0, 0); } if (null == b) { b = new wzvector(0, 0); } return(new wzvector(a.x - b.x, a.y - b.y)); }
private void mouse_move(object o, MouseEventArgs e) { if (-1 != current) { wzvector location = locations[current]; locations[current] = new wzvector(location.x + e.X - origin.X, location.y + e.Y - origin.Y); origin = new Point(e.X, e.Y); Refresh(); } }
internal void move_animation(int index, int delta) { int position = index + delta; if (0 <= position && animations.Count > position) { actions_animation animation = animations[index]; wzvector location = locations[index]; animations.RemoveAt(index); locations.RemoveAt(index); animations.Insert(position, animation); locations.Insert(position, location); Refresh(); } }
private void paint(object o, PaintEventArgs e) { Brush brush = new SolidBrush(BackColor); e.Graphics.FillRectangle(brush, ClientRectangle); brush.Dispose(); for (int index = 0; index < animations.Count; ++index) { actions_animation animation = animations[index]; if (null != animation.animation) { wzvector location = locations[index]; e.Graphics.DrawImage(animation.frame, location.x + animation.x, location.y + animation.y); } } }
//vec2(int x, int y) //{ // this.x = x; // this.y = y; //} public vec2(wzvector vec) { this.x = vec.x; this.y = vec.y; }