<commit_before>using System;
using System.Windows.Forms;
using FriceEngine;
using FriceEngine.Animation;
using FriceEngine.Object;
using FriceEngine.Resource;
using FriceEngine.Utils.Graphics;
using FriceEngine.Utils.Message;
using FriceEngine.Utils.Time;

namespace FriceEngineTest
{
	public static class Program
	{
		[STAThread]
		public static void Main(string[] args)
		{
			// ReSharper disable once ObjectCreationAsStatement

			//Application.Run(new Test());
			new Test2();
		}
	}

	public class Test : Game
	{
		private ImageResource _file;
		private FTimer _timer;
		private ImageObject _b;

		public override void OnInit()
		{
			_timer = new FTimer(10);
			_file = ImageResource.FromFile(@"C:\frice.png");
			SetBounds(300, 300, 800, 600);

			SetTitle("Fuck the world");

			_b = ImageObject.FromFile(@"C:\frice.png", 300, 400, 50, 50);
			_b.AddAnims(new SimpleMove(-10, -10));
			AddObject(_b);
			AddObject(new TextObject(ColorResource.高坂穗乃果, "Hello World", 30, 10, 10));
		}

		private void Add()
		{
			var a = new ImageObject(_file.Bmp, Mouse.X - 50, Mouse.Y - 50)
			{
				Width = 100,
				Height = 100
			};
			;
			AddObject(a);
		}

		public override void OnClick(EventArgs eventArgs, FPoint mousePosition)
		{
			FLog.D("On click called.");
			Add();
			base.OnClick(eventArgs, mousePosition);
		}

		public override void OnRefresh()
		{
			if (_timer.Ended())
				Add();
			base.OnRefresh();
		}
	}

	public class Test2 : WpfGame
	{
		ImageObject _x = ImageObject.FromWeb("https://avatars1.githubusercontent.com/u/21008243", 0, 0, 100, 100);
		private TextObject _t = new TextObject(ColorResource.Black, "Click", 30, 300, 200);
		Random r = new Random();
		private ButtonObject _b;

		public override void OnInit()
		{
			Height = 500;
			Width = 1280;
			TextObject t = new TextObject(ColorResource.Black, "Press any Key (keyboard or mouse)", 30, 400, 200);
			AddObjects(t, _t);
			_b = new ButtonObject(null, "Button1", 100, 100, 50, 50,
				ColorResource.Black, ColorResource.Red,
				new ImageResource(_x.Bitmap), i =>
				{
					MessageBox.Show($"{i} clicked!");
					_b.Width *= 1.5;
					_b.Height *= 1.5;
				});
			AddObjects(_b);
		}


		public override void OnClick(double x, double y, int b)
		{
			FObject a;
			switch (b)
			{
				case 0:
					a = _x.Clone();
					break;
				case 2:
					a = ImageObject.FromFile(@"C:\frice.png", 0, 0, 50, 50);
					break;
				default:
					a = new ShapeObject(ColorResource.Black, new FCircle(50.0), 0, 0);
					break;
			}
			a.X = x;
			a.Y = y;
			a.AddAnims(new SimpleMove(30, -500));
			a.AddAnims(new AccelerateMove(0, 800));
			AddObjects(a);
		}

		public override void OnMouseMove(double x, double y)
		{
			_t.X = x + 30;
			_t.Y = y;
			_t.Text = $"位置： {x}, {y}";
		}

		public override void OnKeyDown(string key)
		{
			var t = new TextObject(ColorResource.赤羽业, "", 50, r.Next(0, 1000), 20) {Text = key};
			t.AddAnims(new AccelerateMove(0, 300));
			AddObjects(t);
			if (key.ToLower().Contains("x"))
			{
				var s = GetScreenCut();
				var o = new ImageObject(s, 200, 200);
				AddObjects(o);<commit_msg>把射出来的Object位置改到鼠标中间了<commit_after>using System;
using System.Windows.Forms;
using FriceEngine;
using FriceEngine.Animation;
using FriceEngine.Object;
using FriceEngine.Resource;
using FriceEngine.Utils.Graphics;
using FriceEngine.Utils.Message;
using FriceEngine.Utils.Time;

namespace FriceEngineTest
{
	public static class Program
	{
		[STAThread]
		public static void Main(string[] args)
		{
			// ReSharper disable once ObjectCreationAsStatement

			//Application.Run(new Test());
			new Test2();
		}
	}

	public class Test : Game
	{
		private ImageResource _file;
		private FTimer _timer;
		private ImageObject _b;

		public override void OnInit()
		{
			_timer = new FTimer(10);
			_file = ImageResource.FromFile(@"C:\frice.png");
			SetBounds(300, 300, 800, 600);

			SetTitle("Fuck the world");

			_b = ImageObject.FromFile(@"C:\frice.png", 300, 400, 50, 50);
			_b.AddAnims(new SimpleMove(-10, -10));
			AddObject(_b);
			AddObject(new TextObject(ColorResource.高坂穗乃果, "Hello World", 30, 10, 10));
		}

		private void Add()
		{
			var a = new ImageObject(_file.Bmp, Mouse.X - 50, Mouse.Y - 50)
			{
				Width = 100,
				Height = 100
			};
			;
			AddObject(a);
		}

		public override void OnClick(EventArgs eventArgs, FPoint mousePosition)
		{
			FLog.D("On click called.");
			Add();
			base.OnClick(eventArgs, mousePosition);
		}

		public override void OnRefresh()
		{
			if (_timer.Ended())
				Add();
			base.OnRefresh();
		}
	}

	public class Test2 : WpfGame
	{
		ImageObject _x = ImageObject.FromWeb("https://avatars1.githubusercontent.com/u/21008243", 0, 0, 100, 100);
		private TextObject _t = new TextObject(ColorResource.Black, "Click", 30, 300, 200);
		Random r = new Random();
		private ButtonObject _b;

		public override void OnInit()
		{
			Height = 500;
			Width = 1280;
			TextObject t = new TextObject(ColorResource.Black, "Press any Key (keyboard or mouse)", 30, 400, 200);
			AddObjects(t, _t);
			_b = new ButtonObject(null, "Button1", 100, 100, 50, 50,
				ColorResource.Black, ColorResource.Red,
				new ImageResource(_x.Bitmap), i =>
				{
					MessageBox.Show($"{i} clicked!");
					_b.Width *= 1.5;
					_b.Height *= 1.5;
				});
			AddObjects(_b);
		}


		public override void OnClick(double x, double y, int b)
		{
			FObject a;
			switch (b)
			{
				case 0:
					a = _x.Clone();
					break;
				case 2:
					a = ImageObject.FromFile(@"C:\frice.png", 0, 0, 50, 50);
					break;
				default:
					a = new ShapeObject(ColorResource.Black, new FCircle(50.0), 0, 0);
					break;
			}
			a.X = x - a.Width / 2;
			a.Y = y - a.Height / 2;
			a.AddAnims(new SimpleMove(30, -500));
			a.AddAnims(new AccelerateMove(0, 800));
			AddObjects(a);
		}

		public override void OnMouseMove(double x, double y)
		{
			_t.X = x + 30;
			_t.Y = y;
			_t.Text = $"位置： {x}, {y}";
		}

		public override void OnKeyDown(string key)
		{
			var t = new TextObject(ColorResource.赤羽业, "", 50, r.Next(0, 1000), 20) {Text = key};
			t.AddAnims(new AccelerateMove(0, 300));
			AddObjects(t);
			if (key.ToLower().Contains("x"))
			{
				var s = GetScreenCut();
				var o = new ImageObject(s, 200, 200);
				AddObjects(o);
{'fraction_non_alphanumeric': 0.14262769033087055, 'fraction_numerical': 0.04657886283327979, 'mean_word_length': 3.154102735156771, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5800214', 'n_tokens_mistral': 2935, 'n_tokens_neox': 2258, 'n_words': 573}