public GridScreen( IApplicationManager appManager) { this.appManager = appManager; this.screenSize = new Vector2f(appManager.GetWindowSize().X, appManager.GetWindowSize().Y); this.position = new Vector2f(0, 0); this.AutoScale = true; this.grid = new IMenuItem[1, 1]; }
public DigitRecognitionScreen( IApplicationManager appManager, IEventService eventService) { this.appManager = appManager; var currentDirectory = Directory.GetCurrentDirectory(); var imagePath = Path.Combine(currentDirectory, "Resources", "train-images.idx3-ubyte"); var labelPath = Path.Combine(currentDirectory, "Resources", "train-labels.idx1-ubyte"); if (!File.Exists(imagePath)) { this.ExtractImagesFromZip(); } // Extract the training data imageExtraction = new ImageExtraction( imagePath, labelPath, ImageWidth, ImageHeight); imageExtraction.LoadImages(); imageCanvas = GetImageCanvas(); feedbackText = new Text("Training Network...", new Font("Resources\\font.ttf")); feedbackText.Position = new Vector2f(appManager.GetWindowSize().X * 0.55f, appManager.GetWindowSize().Y / 2); feedbackText.FillColor = Color.Black; Task.Run(() => { this.TrainNetwork(); feedbackText.DisplayedString = "Ready to go"; }); eventService.RegisterKeyboardCallback( Id, new KeyPressCallbackEventArgs(Keyboard.Key.Right), NextImage); eventService.RegisterKeyboardCallback( Id, new KeyPressCallbackEventArgs(Keyboard.Key.Left), PreviousImage); }
public CameraCaptreScreen(IApplicationManager appManager) { var windowSize = appManager.GetWindowSize(); var size = new Vector2f(windowSize.X, windowSize.Y); capture = new VideoCapture(0); sprite = new RectangleShape { Position = size / 2, Origin = size / 2, Size = size, FillColor = Color.Blue }; tempImagePath = $"{Path.GetTempFileName()}.png"; }
public ORToolsDemoScreen( IApplicationManager appManager) { graph = new CartesianGraph(appManager.GetWindowSize(), new Vector2u(20, 10) * 2); graph.SetAxisCentred(true); var(p1, p2, p3) = this.GetVertices(); graph.DrawTriangle(p1, p2, p3); graph.DrawLine(1, 2, 14); graph.DrawLine(3, -1, 0); graph.DrawLine(1, -1, 2); var result = this.SolveLinearInequalities(); graph.DrawCircle(result); }
private RectangleShape[,] GetImageCanvas() { var canvas = new RectangleShape[ImageWidth, ImageHeight]; var canvasSize = PixelSize * ImageHeight; var remainingSpace = appManager.GetWindowSize().Y - canvasSize; var offset = new Vector2f(remainingSpace / 2, remainingSpace / 2); var pixelSize = new Vector2f(PixelSize, PixelSize); for (int x = 0; x < ImageWidth; x++) { for (int y = 0; y < ImageWidth; y++) { var pixel = new RectangleShape(pixelSize); pixel.Position = new Vector2f(x * PixelSize, y * PixelSize) + offset; pixel.FillColor = Color.Black; canvas[x, y] = pixel; } } return(canvas); }
public ApplicationDashboard( List <ApplicationInstanceVisual> applications, IApplicationManager applicationManager) { defaultFont = new Font("Resources\\font.ttf"); selectedIconSize = new Vector2u(300, 300); nonSelectedIconSize = new Vector2u(220, 220); this.applications = applications; this.applicationManager = applicationManager; this.size = applicationManager.GetWindowSize(); this.UpdateSizingAndSpacing(); Texture blueprint = new Texture(CreateBlueprint(size.X, size.Y)); background = new Sprite(blueprint); IsActive = true; selectedVisual = new RectangleShape(new Vector2f(selectedIconSize.X, selectedIconSize.Y)); leftVisual = new RectangleShape(new Vector2f(nonSelectedIconSize.X, nonSelectedIconSize.Y)); rightVisual = new RectangleShape(new Vector2f(nonSelectedIconSize.X, nonSelectedIconSize.Y)); }
public MapMakerHudScreen( IApplicationManager appManager, IEventService eventService, INotificationService notificationService, MapMakerDataContainer sharedContainer) { this.appManager = appManager; this.notificationService = notificationService; this.sharedContainer = sharedContainer; this.buttons = new List <Button>(); eventService.RegisterMouseClickCallback( this.Id, new MouseClickCallbackEventArgs(Mouse.Button.Left), OnMousePress); buttons.Add(new Button("Draw", new Vector2f(20, 20), () => { SetState(MapEditState.DrawingLines); notificationService.ShowToast( ToastType.Info, "Drawing Lines Enabled"); }, HorizontalAlignment.Left)); buttons.Add(new Button("Move", new Vector2f(20, 70), () => { SetState(MapEditState.MovingPoints); notificationService.ShowToast( ToastType.Info, "Moving Points Enabled"); }, HorizontalAlignment.Left)); buttons.Add(new Button("Delete", new Vector2f(20, 120), () => { SetState(MapEditState.Deletion); notificationService.ShowToast( ToastType.Warning, "Deletion Enabled"); }, HorizontalAlignment.Left)); buttons.Add(new Button("Checkpoints", new Vector2f(20, 170), () => { SetState(MapEditState.Checkpoint); notificationService.ShowToast( ToastType.Info, "Checkpoint Mode Enabled"); }, HorizontalAlignment.Left)); buttons.Add(new Button("Start", new Vector2f(20, 225), () => { SetState(MapEditState.StartPosition); notificationService.ShowToast( ToastType.Info, "Set Start Position"); }, HorizontalAlignment.Left)); var exportTextPosition = new Vector2f(20, appManager.GetWindowSize().Y - 60); buttons.Add(new Button("Export", exportTextPosition, () => ExportTrack(), HorizontalAlignment.Left)); }