public void Run(string[] args) { using (frm = new PixelBufferForm()) { frm.Show(); DisplayWindow wind = DisplayWindow.CreateFromControl(frm.panel1); image = new Surface("9ball.png"); buffer = image.ReadPixels(PixelFormat.Any); Input.Unhandled.MouseDown += Mouse_MouseDown; Input.Unhandled.MouseMove += Mouse_MouseMove; Input.Unhandled.MouseUp += (sender, e) => mouseDown = false; while (AgateApp.IsAlive && frm.IsDisposed == false) { Display.BeginFrame(); Display.Clear(); image.Draw(imageLocation); Display.EndFrame(); AgateApp.KeepAlive(); } } }
private void CreateFakeWindow() { mFakeWindow = new System.Windows.Forms.Form(); mFakeDisplayWindow = DisplayWindow.CreateFromControl(mFakeWindow); mFakeWindow.Visible = false; }
public frmInputTester() { InitializeComponent(); InputLib.Input.Unhandled.KeyDown += Keyboard_KeyDown; InputLib.Input.Unhandled.KeyUp += Keyboard_KeyUp; InputLib.Input.Unhandled.MouseWheel += Mouse_MouseWheel; InputLib.Input.Unhandled.MouseMove += Mouse_MouseMove; InputLib.Input.Unhandled.MouseDown += Mouse_MouseDown; InputLib.Input.Unhandled.MouseUp += Mouse_MouseUp; InputLib.Input.Unhandled.MouseDoubleClick += Mouse_MouseDoubleClickEvent; InputLib.Input.Unhandled.JoystickAxisChanged += Joystick_AxisChanged; InputLib.Input.Unhandled.JoystickButtonPressed += Joystick_ButtonPressed; InputLib.Input.Unhandled.JoystickButtonReleased += Joystick_ButtonReleased; InputLib.Input.Unhandled.JoystickHatChanged += Joystick_HatChanged; DisplayWindow.CreateFromControl(agateRenderTarget1); joystickLabels[0] = lblJoystick1; joystickLabels[1] = lblJoystick2; joystickLabels[2] = lblJoystick3; joystickLabels[3] = lblJoystick4; }
public frmTileTester() { InitializeComponent(); CreateControl(); DisplayWindow wind = DisplayWindow.CreateFromControl(agateRenderTarget1); }
public frmRenderStateTest() { InitializeComponent(); wind = DisplayWindow.CreateFromControl(agateRenderTarget1); propertyGrid1.SelectedObject = Display.RenderState; }
public frmTileTester() { InitializeComponent(); CreateControl(); DisplayWindow wind = DisplayWindow.CreateFromControl(agateRenderTarget1); chkVSync.Checked = Display.RenderState.WaitForVerticalBlank; }
private void InitDisplay() { // This will create a display "window" that renders to the graphics // control on this form DisplayWindow wind = DisplayWindow.CreateFromControl(pctGraphics); // load an image string fileName = @"Images/jellybean.png"; mSurface = new Surface(fileName); }
private bool InitDisplay() { // This will create a display "window" that renders to the graphics // control on this form // It doesn't matter if this goes out of scope, because a reference // will be maintained by the Display object. wind = DisplayWindow.CreateFromControl(pctGraphics); //srcSurf = new Surface(); SetSprite(new Sprite("Images/attacke.png", 96, 96)); Display.PackAllSurfaces(); return(true); }
public void SetRenderTarget(object render, object zoomRender) { mRenderTarget = render; mZoomRenderTarget = zoomRender; if (wind != null) { wind.Dispose(); zoomWind.Dispose(); bgDark.Dispose(); bgLight.Dispose(); } zoomWind = DisplayWindow.CreateFromControl(zoomRender); wind = DisplayWindow.CreateFromControl(render); bgDark = new Surface("bgdark.png"); bgLight = new Surface("bglight.png"); DisplayColor = Color.White; }
static void Main(string[] args) { using (AgateSetup setup = new AgateSetup(args)) { setup.AskUser = true; setup.Initialize(true, false, false); if (setup.WasCanceled) { return; } MultipleRenderTargetExample myForm = new MultipleRenderTargetExample(); myForm.Show(); // create three display windows DisplayWindow wnd_1 = DisplayWindow.CreateFromControl(myForm.pictureBox1); DisplayWindow wnd_2 = DisplayWindow.CreateFromControl(myForm.pictureBox2); DisplayWindow wnd_3 = DisplayWindow.CreateFromControl(myForm.pictureBox3); //DisplayWindow wnd_4 = new DisplayWindow(myForm.pictureBox4); // create a surface for drawing surf = new Surface(200, 150); // this is the code that will be called when the button is pressed myForm.btnDraw.Click += new EventHandler(btnDraw_Click); myForm.btnClearSurface.Click += new EventHandler(btnClear_Click); while (myForm.Visible) { // Render targets must be set before the call to BeginFrame, // and may not be changed between BeginFrame and EndFrame. Display.RenderTarget = wnd_1; Display.BeginFrame(); Display.Clear(Color.Red); Display.FillRect(new Rectangle(20, 20, 40, 30), Color.Blue); Display.EndFrame(); // now do the second window. Display.RenderTarget = wnd_2; Display.BeginFrame(); Display.Clear(Color.Green); Display.FillRect(new Rectangle(20, 20, 40, 30), Color.Yellow); Display.EndFrame(); // draw the third window from the surface Display.RenderTarget = wnd_3; Display.BeginFrame(); Display.Clear(Color.Black); surf.Draw(0, 0); Display.EndFrame(); //Display.RenderTarget = wnd_4; //Display.BeginFrame(); //Display.EndFrame(); Core.KeepAlive(); //System.Threading.Thread.Sleep(250); } } }
private void Form1_Load(object sender, EventArgs e) { wind = DisplayWindow.CreateFromControl(artGuiTest); }
public void Main(string[] args) { using (AgateSetup setup = new AgateSetup(args)) { // create a random number generation object // so that we can make pretty colors. Random rand = new Random(); // initialize the display, asking the user what display driver to use. setup.AskUser = true; setup.Initialize(true, false, false); // normally, the display should initialize fine, and goahead will be true. // However, here we are asking the user what display mode they want to pick, // and they may push the cancel button. If they do, then exit the program. if (setup.WasCanceled) { return; } frm = new DrawingTester(); frm.btnClear.Click += new EventHandler(btnClear_Click); frm.btnDrawLine.Click += new EventHandler(btnDrawLine_Click); frm.btnDrawRect.Click += new EventHandler(btnDrawRect_Click); frm.btnFillRect.Click += new EventHandler(btnFillRect_Click); frm.btnDrawCircle.Click += new EventHandler(btnDrawCircle_Click); frm.Show(); // This creates the window that we will be drawing in. // 640x480 are the dimensions of the screen area that we will write to DisplayWindow wind = DisplayWindow.CreateFromControl(frm.panel1); while (wind.IsClosed == false) { // Display.BeginFrame must be called before any rendering takes place. Display.BeginFrame(); // Clear back buffer Display.Clear(); // draw shapes foreach (Shape s in shapes) { s.Draw(); } // Display.EndFrame must be called after rendering is done // in order to actually update the display. Display.EndFrame(); // Core.KeepAlive is where we play nice window the OS, // allowing events to be processed and such. // This is also required to process events that happen in our OWN // code (ie. user input), so be sure to call this once a frame. Core.KeepAlive(); // This gives a nice 1 second delay between each frame. // Using the Sleep() call causes this application to // relinquish CPU time. System.Threading.Thread.Sleep(10); } } }