public MainApp() { WinForm_ = new Form { ClientSize = new Size(Width, Height), StartPosition = FormStartPosition.CenterScreen, MaximizeBox = false, FormBorderStyle = FormBorderStyle.FixedSingle, Text = "Orz App", KeyPreview = true, }; Surface_ = new PictureBox { Location = Point.Empty, ClientSize = WinForm_.ClientSize, }; WinForm_.Controls.Add(Surface_); WinForm_.KeyDown += OnKeyDown; WinForm_.KeyUp += OnKeyUp; Surface_.MouseDown += OnMouseDown; Surface_.MouseUp += OnMouseUp; Surface_.MouseMove += OnMouseMove; TextFont_ = new Font("Arial", 10); FileHelper.AddSearchPath(Application.StartupPath + "/../../Res/"); FileHelper.AddSearchPath(Application.StartupPath + "/../../../Res/"); Device_ = RasterizerEngine.CreateDevice(WinForm_.Handle, Width, Height); Obj_ = new TestObject(Device_); }
internal DemoManager(LGuiVec2 WinSize) { this.WinSize = WinSize; TextFont_ = new Font("Arial", 10); WinConvert.Register(); Executor_ = new GdiCommandExecutor(); LGui.SetCommandExecutor(Executor_); var IO = LGui.GetIO(); IO.DisplaySize = new LGuiVec2(960, 540); FileHelper.AddSearchPath($"{AppContext.BaseDirectory}..\\..\\Res\\"); var Mapper = new LGuiMapper(); Input.OnKeyEvent += (Key, IsKeyDown) => { IO.SetKeyState(Mapper.ToLGuiKey(Key), IsKeyDown); }; Input.OnMouseEvent += (Btn, X, Y, IsMouseDown, IsMouseMove) => { IO.SetMouseState(Mapper.ToLGuiMouseBtn(Btn), X, Y, IsMouseDown, IsMouseMove); }; }