public SfmlVisualizer() { // init sprites background = Sprites.Background_Union(); // init fonts var courierFontFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "cour.ttf"); if (!File.Exists(courierFontFileName)) { courierFontFileName = Path.Combine(Settings.Default.ResourcesDir, "cour.ttf"); if (!File.Exists(courierFontFileName)) { MessageBox.Show($"cour.ttf could not be found, please copy it into the folder '{Settings.Default.ResourcesDir}'"); } } courier = new Font(courierFontFileName); // init window var contextSettings = new ContextSettings(); WindowSizeW = Settings.Default.WindowSizeW; WindowSizeH = Settings.Default.WindowSizeH; window = new RenderWindow(new VideoMode(WindowSizeW, WindowSizeH), "AI Cup 2016 Visualizer", Styles.Resize | Styles.Close, contextSettings); window.SetVerticalSyncEnabled(false); window.Closed += OnClose; // window.Resized += OnResized; window.MouseWheelScrolled += WindowOnMouseWheelScrolled; window.KeyPressed += WindowOnKeyPressed; window.MouseButtonReleased += WindowOnMouseButtonReleased; window.MouseMoved += WindowOnMouseMoved; // generate background random tiles tmpTexture = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y); tmpTexture.Draw(background); DrawGroundRandomTiles(tmpTexture); tmpTexture.Display(); background = new Sprite(tmpTexture.Texture); // background.Texture.CopyToImage().SaveToFile(Path.Combine(Settings.Default.ResourcesDir, "1.bmp")); // init views defaultView = window.DefaultView; worldView = new View(new FloatRect(0, 0, mapSize.X, mapSize.Y)); worldTexture = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y); visibleAreaTexture = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y); minimapTexture = new RenderTexture((uint)mapSize.X, (uint)mapSize.Y); minimapView = new View(new FloatRect(0, 0, mapSize.X, mapSize.Y)); // init other stuff clock = new Clock(); observeTarget = Settings.Default.ObserveTarget; showDebugInfo = false; showHealth = false; showMinimap = Settings.Default.ShowMinimap; ForceSmooth = false; showWayPoints = false; Audios.EnabledAudio = Settings.Default.EnableAudio; }