public bool Initialize() { displayWindow = new DisplayWindow(); displayWindow.Width = 400; displayWindow.Height = 400; displayWindow.Initialize(); displayWindow.Show(); EventProcessor.OnSubscribtion += EventProcessor_OnSubscribtion; EventProcessor.OnTipRecieved += EventProcessor_OnTipRecieved; EventProcessor.OnFollow += EventProcessor_OnFollow; if (!File.Exists(settingsFile)) { Settings defaultSettings = Settings.DefaultSettings(); string json = JsonConvert.SerializeObject(defaultSettings, Formatting.Indented); File.WriteAllText(settingsFile, json); } string fileJson = File.ReadAllText(settingsFile); settings = JsonConvert.DeserializeObject <Settings>(fileJson); return(true); }
public HallOfFameBrowser() : base(Constants.WINDOW_ID_HALLOFFAMEBROWSER, FinalFrontier.Config.GetHallOfFameWindowTitle()) { styleKerbalButton = new GUIStyle(HighLogic.Skin.button); styleKerbalButton.fixedWidth = kButtonWidth; styleKerbalButton.clipping = TextClipping.Clip; styleKerbalStatus = new GUIStyle(HighLogic.Skin.button); styleKerbalStatus.fixedWidth = 20; styleKerbalArea = new GUIStyle(HighLogic.Skin.box); styleKerbalArea.fixedWidth = kAreaWidth; styleKerbalArea.fixedHeight = kAreaHeight; styleKerbalArea.clipping = TextClipping.Clip; styleKerbalAreaExpanded = new GUIStyle(HighLogic.Skin.box); styleKerbalAreaExpanded.fixedWidth = kAreaWidth; styleKerbalAreaExpanded.stretchHeight = true; styleKerbalAreaExpanded.clipping = TextClipping.Clip; styleKerbalInfo = new GUIStyle(HighLogic.Skin.label); styleRibbonArea = new GUIStyle(HighLogic.Skin.label); styleRibbonArea.stretchHeight = true; styleRibbonArea.stretchWidth = true; styleRibbonArea.padding = new RectOffset(10, 10, 2, 2); textureAvailable = ImageLoader.GetTexture(FinalFrontier.ResourcePath + "active"); textureAssigned = ImageLoader.GetTexture(FinalFrontier.ResourcePath + "assigned"); textureKilled = ImageLoader.GetTexture(FinalFrontier.ResourcePath + "killed"); ribbonBrowser = new RibbonBrowser(); display = new DisplayWindow(); about = new AboutWindow(); configWindow = new ConfigWindow(); }
public void Main(string[] args) { using (AgateSetup setup = new AgateSetup(args)) { setup.AskUser = true; setup.Initialize(true, false, false); if (setup.WasCanceled) { return; } frm = new PixelBufferForm(); frm.Show(); DisplayWindow wind = new DisplayWindow(CreateWindowParams.FromControl(frm.panel1)); image = new Surface("9ball.png"); buffer = image.ReadPixels(PixelFormat.RGBA8888); Mouse.MouseDown += new InputEventHandler(Mouse_MouseDown); Mouse.MouseMove += new InputEventHandler(Mouse_MouseMove); while (wind.IsClosed == false) { Display.BeginFrame(); Display.Clear(); image.Draw(imageLocation); Display.EndFrame(); Core.KeepAlive(); } } }
private void InitDisplayWindows(TableLayoutPanel table, int number) { _displayWindows.Clear(); table.Controls.Clear(); table.RowStyles.Clear(); table.ColumnStyles.Clear(); number = Math.Max(1, number); table.RowCount = Convert.ToInt32(Math.Round(Math.Sqrt(number))); table.ColumnCount = Convert.ToInt32(Math.Ceiling(Math.Sqrt(number))); for (int count = 0; count < table.RowCount; ++count) { table.RowStyles.Add(new RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); } for (int count = 0; count < table.ColumnCount; ++count) { table.ColumnStyles.Add(new ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); } for (int index = 0; index < number; ++index) { DisplayWindow widget = new DisplayWindow(); widget.Dock = DockStyle.Fill; widget.Margin = new System.Windows.Forms.Padding(1); _displayWindows.Add(widget); table.Controls.Add(widget, index % number, index / number); } return; }
void handHistoryParser_RoundHasTerminated() { Trace.WriteLine("Round has terminated"); /* 1. Perform last statistics calculations * 2. Clear the statistics information relative to a single round * 3. Any player that hasn't played last round should be flagged as non-playing (and the hud window, removed) * 4. Set every player's HasPlayedLastRound flag to false, as to identify who will get eliminated * in future rounds * 5. Clear hand information from display window */ for (int i = 0; i < PlayerList.Count; i++) { Player p = PlayerList[i]; p.CalculateEndOfRoundStatistics(); p.PrepareStatisticsForNewRound(); if (!p.HasPlayedLastRound) { p.DisposeHud(); p.IsPlaying = false; } p.HasPlayedLastRound = false; } /* Clear the table statistics relative to a single round */ statistics.PrepareStatisticsForNewRound(); if (DisplayWindow != null) { DisplayWindow.ClearHandInformation(); } }
public void Main(string [] args) { var tgz = new TgzFileProvider("Data/dogs.tar.gz"); using (AgateSetup setup = new AgateSetup()) { setup.AskUser = true; setup.Initialize(true, false, false); if (setup.WasCanceled) { return; } DisplayWindow wind = DisplayWindow.CreateWindowed( "TgzFileProvider Tester", 800, 600, false); Surface surf = new Surface(tgz, "dogs.png"); Surface surf2 = new Surface(tgz, "bigpaddle.png"); PixelBuffer pix = surf.ReadPixels(); while (wind.IsClosed == false) { Display.BeginFrame(); Display.Clear(Color.Blue); surf.Draw(); surf2.Draw(10, 490); Display.EndFrame(); Core.KeepAlive(); } } }
void Awake() { if (instance == null) instance = this; else if (instance != this) Destroy (this); }
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; }
private void DrawMousePointer(DisplayWindow targetWindow, Surface mousePointerSurface) { if (mouseWindow == targetWindow) { mousePointerSurface.Draw(mousePosition.X, mousePosition.Y); } }
public HallOfFameBrowser() : base(Constants.WINDOW_ID_HALLOFFAMEBROWSER, FinalFrontier.configuration.GetHallOfFameWindowTitle()) { STYLE_KERBAL_BUTTON = new GUIStyle(HighLogic.Skin.button); STYLE_KERBAL_BUTTON.fixedWidth = KERBAL_BUTTON_WIDTH; STYLE_KERBAL_BUTTON.clipping = TextClipping.Clip; STYLE_KERBAL_STATUS = new GUIStyle(HighLogic.Skin.button); STYLE_KERBAL_STATUS.fixedWidth = 20; STYLE_KERBAL_AREA = new GUIStyle(HighLogic.Skin.box); STYLE_KERBAL_AREA.fixedWidth = KERBAL_AREA_WIDTH; STYLE_KERBAL_AREA.fixedHeight = KERBAL_AREA_HEIGHT; STYLE_KERBAL_AREA.clipping = TextClipping.Clip; STYLE_KERBAL_AREA_EXPANDED = new GUIStyle(HighLogic.Skin.box); STYLE_KERBAL_AREA_EXPANDED.fixedWidth = KERBAL_AREA_WIDTH; STYLE_KERBAL_AREA_EXPANDED.stretchHeight = true; STYLE_KERBAL_AREA_EXPANDED.clipping = TextClipping.Clip; STYLE_KERBAL_INFO = new GUIStyle(HighLogic.Skin.label); STYLE_RIBBON_AREA = new GUIStyle(HighLogic.Skin.label); STYLE_RIBBON_AREA.stretchHeight = true; STYLE_RIBBON_AREA.stretchWidth = true; STYLE_RIBBON_AREA.padding = new RectOffset(10, 10, 2, 2); TEXTURE_AVAILABLE = ImageLoader.GetTexture(FinalFrontier.RESOURCE_PATH + "active"); TEXTURE_ASSIGNED = ImageLoader.GetTexture(FinalFrontier.RESOURCE_PATH + "assigned"); TEXTURE_KILLED = ImageLoader.GetTexture(FinalFrontier.RESOURCE_PATH + "killed"); ribbonBrowser = new RibbonBrowser(); display = new DisplayWindow(); about = new AboutWindow(); configWindow = new ConfigWindow(); }
private void CreateFakeWindow() { mFakeWindow = new System.Windows.Forms.Form(); mFakeDisplayWindow = DisplayWindow.CreateFromControl(mFakeWindow); mFakeWindow.Visible = false; }
static void Main(string[] args) { using (AgateSetup setup = new AgateSetup(args)) { // initialize AgateLib. setup.InitializeAll(); // if something bad happened, bail out. if (setup.WasCanceled) { return; } // Create a window with resolution 640x480 and title "Hello World" DisplayWindow wind = DisplayWindow.CreateWindowed("Hello World", 640, 480); // Run the program while the window is open. while (Display.CurrentWindow.IsClosed == false) { // Display.BeginFrame must be called at the start of every frame, // before rendering takes place. Display.BeginFrame(); // Clears the display to a nice color. Display.Clear(Color.DarkGreen); // End frame must be called after all drawing is finished. Display.EndFrame(); // KeepAlive processes events. Core.KeepAlive(); } } }
private static string ConstructKerningText(DisplayWindow wind, FontSurface font) { return("THIS IMPLEMENTATION NEEDS FIXING"); // var bmp = font.Impl as AgateLib.DisplayLib.BitmapFont.BitmapFontImpl; // FontMetrics metrics = bmp.FontMetrics.Clone(); // StringBuilder text = new StringBuilder(); // int count = 0; // int maxLine = wind.Width / font.FontHeight(); // foreach (char first in metrics.Keys) // { // foreach (var kern in metrics[first].KerningPairs) // { // text.Append(first); // text.Append(kern.Key); // text.Append(" "); // count += 2; // if (count > maxLine) // { // text.AppendLine(); // count = 0; // } // } // } // string displayText = text.ToString(); // return displayText; }
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(); } } }
public static void GifNotification(DisplayWindow window, int displayTime, string imagineFile, string soundFile, int textheight, string content) { int oWidth = window.Width; int oHeight = window.Height; ImagineRequest imagineRender = new ImagineRequest() { x = 0, y = 0, width = oWidth, height = oHeight - (textheight * 2), }; imagineRender.SetFromFile(imagineFile); TextRequest textRender = new TextRequest() { x = 5, y = oHeight - (textheight * 2), width = oWidth - 5, height = textheight, autoResize = true, text = content, }; SoundRequest soundRequest = new SoundRequest() { file = soundFile }; RenderRequest request = new RenderRequest(displayTime, soundRequest, imagineRender, textRender); window.EnqueueRenders(request); }
static void Main(string[] args) { //using (var w = new GameWindow()) //{ // w.Open(); //} var bm = Bitmap32.Load(File.ReadAllBytes("..\\..\\Sample3.png")); var random = new Random(); //var bm = new Bitmap32(640, 480); var rd = new BasicRenderer32(bm); //rd.Clear(new Color32(0x20, 0x20, 0x20, 0xFF)); rd.FillColor = new Color32(0xFF, 0x00, 0x00, 0x30); for (int i = 0; i < 100; i++) { var r = random.Next(50) + 10; var x = random.Next(bm.Width - r * 2) + r; var y = random.Next(bm.Height - r * 2) + r; rd.SolidElipse( x, y, r, r ); } //File.WriteAllBytes("out.png", bm.Save()); DisplayWindow.Show(bm); //bm.Save("out.png"); //new Bitmap32(bm, 0, 0, 128, 128).Save("out2.png"); }
public RenderRequest(int displayTime, params IRenderable[] _irenderables) { targetWindow = null; this.displayTime = displayTime; _renders = new List <IRenderable>(); _renders.AddRange(_irenderables); }
public frmRenderStateTest() { InitializeComponent(); wind = DisplayWindow.CreateFromControl(agateRenderTarget1); propertyGrid1.SelectedObject = Display.RenderState; }
public AgateUnitTest() { platform = new AgateUnitTestPlatform().Initialize(); window = new DisplayWindowBuilder() .BackbufferSize(1920, 1080) .Build(); }
public frmTileTester() { InitializeComponent(); CreateControl(); DisplayWindow wind = DisplayWindow.CreateFromControl(agateRenderTarget1); }
private void ChangeDisplayWindow(IResolution resolution) { currentResolution = resolution; wind?.Dispose(); wind = DisplayWindow.CreateFullScreen(Name, resolution); Display.RenderTarget = wind.FrameBuffer; }
public AgateFormMixtureForm() { InitializeComponent(); window = new DisplayWindowBuilder() .RenderToControl(renderTarget) .AutoResizeBackBuffer() .Build(); }
private void OpenWindow() { _window = new DisplayWindow(); _window.DataContext = new GazeViewModel(_observer); _window.Closed += Window_Closed; _window.Show(); State = ControlServiceState.Running; }
public void Main(string[] args) { using (AgateSetup setup = new AgateSetup(args)) { setup.Initialize(true, false, false); if (setup.WasCanceled) { return; } DisplayWindow wind = DisplayWindow.CreateWindowed("Rotating sprite", 300, 300); Sprite sp = new Sprite("spike.png", 16, 16); sp.RotationCenter = OriginAlignment.Center; sp.DisplayAlignment = OriginAlignment.Center; sp.RotationAngleDegrees = 90; sp.SetScale(2, 2); Point location = new Point(150, 100); while (wind.IsClosed == false) { Display.BeginFrame(); Display.Clear(Color.DarkRed); sp.RotationAngleDegrees += 180 * Display.DeltaTime / 1000.0; sp.Draw(location); Display.DrawRect(location.X, location.Y, 1, 1, Color.YellowGreen); Display.EndFrame(); Core.KeepAlive(); if (Keyboard.Keys[KeyCode.F5]) { if (wind.IsFullScreen) { wind.SetWindowed(); wind.Size = new Size(500, 500); } else { wind.SetFullScreen(800, 600, 32); } Keyboard.ReleaseKey(KeyCode.F5); } if (Keyboard.Keys[KeyCode.Escape]) { return; } } } }
/* Visual Recognition Manager handlers */ public void PlayerHandRecognized(CardList playerCards) { Globals.Director.RunFromGUIThread((Action) delegate() { if (DisplayWindow != null) { DisplayWindow.DisplayPlayerHand(playerCards); } }, true); }
public void HideTableDisplayWindow() { Globals.Director.RunFromGUIThread((Action) delegate() { if (DisplayWindow != null) { DisplayWindow.Hide(); } }, false); }
public frmTileTester() { InitializeComponent(); CreateControl(); DisplayWindow wind = DisplayWindow.CreateFromControl(agateRenderTarget1); chkVSync.Checked = Display.RenderState.WaitForVerticalBlank; }
public void Main(string[] args) { Core.Initialize(); List <AgateDriverInfo> drivers = Registrar.DisplayDrivers; frmPerformanceTester frm = new frmPerformanceTester(); frm.Show(); Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); List <TestMethod> tests = new List <TestMethod>(); tests.Add(FilledRectTest); tests.Add(DrawRectTest); tests.Add(DrawSurfaceTestColored); tests.Add(DrawSurfaceTestPlain); tests.Add(StretchTestColored); tests.Add(StretchTestPlain); foreach (AgateDriverInfo info in drivers) { Trace.WriteLine(string.Format("Starting driver {0}...", info.FriendlyName)); Trace.Indent(); double fps; Display.Initialize((DisplayTypeID)info.DriverTypeID); Display.VSync = false; DisplayWindow wind = DisplayWindow.CreateWindowed("Performance Test", 300, 300); font = new FontSurface("Arial", 11); for (int i = 0; i < tests.Count; i++) { TestResult r = Execute(tests[i]); r.Driver = info.FriendlyName; frm.AddTestResult(r); } if (Display.CurrentWindow.IsClosed) { Display.Dispose(); frm.Dispose(); return; } Display.Dispose(); } frm.Visible = false; frm.ShowDialog(); }
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); }
/* Visual Recognition Manager handlers */ public void PlayerHandRecognized(CardList playerCards) { Globals.Director.RunFromGUIThread((Action) delegate() { Globals.Director.WriteDebug(WRITE_DEBUG, "\n\t ~~~ PlayerHandRecognized " + playerCards.ToString()); if (DisplayWindow != null) { DisplayWindow.DisplayPlayerHand(playerCards); } }, true); //TODO - update the state of the Table }
public void Main(string[] args) { using (AgateSetup setup = new AgateSetup()) { setup.AskUser = true; setup.Initialize(true, false, false); if (setup.WasCanceled) { return; } DisplayWindow wind = DisplayWindow.CreateWindowed("Hello", 800, 600); Surface someSurface = new Surface("wallpaper.png"); Surface captureSurface = new Surface(1600, 1200); bool capturing = false; while (wind.IsClosed == false) { if (Keyboard.Keys[KeyCode.C]) { capturing = true; Keyboard.ReleaseKey(KeyCode.C); } if (capturing) { Display.RenderTarget = captureSurface; someSurface.SetScale(2, 2); } Display.BeginFrame(); Display.Clear(Color.White); someSurface.Draw(); Display.EndFrame(); if (capturing) { captureSurface.SaveTo("CapturedImage.png", ImageFileFormat.Png); Display.RenderTarget = wind; someSurface.SetScale(1, 1); capturing = false; Debug.Print("Captured image to CapturedImage.png"); } Core.KeepAlive(); System.Threading.Thread.Sleep(10); } } }
public void createWindows() { myInputWindow = new InputWindow(); myInputWindow.manager = this; myPenToText = new convertToText(myDynamicDisplay); myDataStuff = new dataStuff(this); blockingData = new BlockingCollection<mPoint>(); addingData = Task.Factory.StartNew(() => myPenToText.getData(blockingData)); myDisplayWindow = new DisplayWindow(myDynamicDisplay); myPenToText.setDisplayActive(true); myDisplayWindow.manager = this; myDisplayWindow.Visibility = Visibility.Visible; myDisplayWindow.Owner = myInputWindow; myDataDisplay = new DataDisplay(myDataStuff); myDataDisplay.Visibility = Visibility.Visible; myDataDisplay.Owner = myInputWindow; myInputWindow.Top = System.Windows.SystemParameters.WorkArea.Top; myInputWindow.Left = System.Windows.SystemParameters.WorkArea.Left; myDataDisplay.Top = myInputWindow.Top+ myInputWindow.Height; myDataDisplay.Left = myInputWindow.Left; myDataDisplay.Width = System.Windows.SystemParameters.WorkArea.Width - myDisplayWindow.Width; myDataDisplay.Height = System.Windows.SystemParameters.WorkArea.Height - myDataDisplay.Top; myDisplayWindow.Top = System.Windows.SystemParameters.WorkArea.Top; myDisplayWindow.Left = System.Windows.SystemParameters.WorkArea.Width - myDisplayWindow.Width; resized(); //toggleDataDisplayWindow(); }
public void toggleDisplayWindow() { if (myPenToText.getDisplayActive()) { myDisplayWindow.Close(); } else { myDisplayWindow = new DisplayWindow(myDynamicDisplay); myPenToText.setDisplayActive(true); myDisplayWindow.manager = this; myDisplayWindow.Visibility = Visibility.Visible; myDisplayWindow.Top = myInputWindow.Top; myDisplayWindow.Left = myInputWindow.Left + myInputWindow.ActualWidth; myDisplayWindow.Owner = myInputWindow; } }
/// <summary> /// Constructs a new GridDisplay instance /// </summary> /// <param name="aLevel">The Level instance to which a /// reference is stored, and which is used to retrieve /// row and palette data.</param> public GridDisplay(Level aLevel) { mLevel = aLevel; DoubleBuffered = true; InitializeComponent(); AutoScrollMinSize = ContentSize; mLevel.Grid.GridChanged += new Grid.GridChangedEventHandler(GridChangedHandler); AutoScrollMinSize = ContentSize; mWindow = new DisplayWindow(this); mOldHeight = this.Height; mWindow.Reset(); }
public GridDisplay() { mLevel = new Level(); GridRow row = new GridRow(); row[0].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); row[0].Tile = false; row[1].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); row[1].Tile = false; row[2].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); row[2].Tile = false; row[3].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); DoubleBuffered = true; InitializeComponent(); AutoScrollMinSize = ContentSize; mLevel.Grid.GridChanged += new Grid.GridChangedEventHandler(GridChangedHandler); AutoScrollMinSize = ContentSize; mWindow = new DisplayWindow(this); mOldHeight = this.Height; }
/// <summary> /// Updates the display status of the input operation. /// </summary> /// <param name="displayWindow"> /// The display window. /// </param> /// <param name="cursorPosition"> /// The cursor position. /// </param> internal void UpdateDisplayStatus(DisplayWindow displayWindow, DisplayPosition cursorPosition) { this.window = displayWindow; this.cursor = cursorPosition; }