/// <summary> /// Initializes the display control. /// </summary> public void InitDisplay() { if (!DesignMode) { // Initialize the library. Gorgon.Initialize(); // Display the logo and frame stats. Gorgon.LogoVisible = false; Gorgon.FrameStatsVisible = false; Gorgon.AllowBackgroundRendering = true; // Set the video mode to match the form client area. Gorgon.SetMode(this); // Assign rendering event handler. Gorgon.Idle += new FrameEventHandler(Screen_OnFrameBegin); // Set the clear color to something ugly. Gorgon.Screen.BackgroundColor = Color.FromArgb(0, 0, 0); //Init Configuration and resource manager. MainForm.InitializeResourceManager(); /* * _particleImage = GorgonLibrary.Graphics.Image.FromFile("star1.png"); * _particleSprite = new Sprite("particlesprite", _particleImage); * _particleSprite.Axis = new Vector2(_particleSprite.Width/2, _particleSprite.Height/2);*/ _particleSprite = ResourceManager.GetSprite("star1"); var settings = ParticleConfigurator.ParticleSettings; _particleSystem = new ParticleSystem(_particleSprite, new Vector2(0, 0)); settings.ColorRange = new SS14.Shared.Utility.Range <Color>(Color.Blue, Color.Black); settings.EmitterPosition = new PointF(Gorgon.Screen.Width / 2, Gorgon.Screen.Height / 2); settings.EmissionRadiusRange = new PointF(10, 170); settings.EmitRate = 40; settings.Velocity = new Vector2(0, -20); settings.Acceleration = new Vector2(0, -30); settings.RadialAcceleration = 10; settings.TangentialAccelerationVariance = 0.2f; settings.TangentialVelocityVariance = 1; settings.RadialVelocityVariance = 1; //_particleSystem.TangentialAcceleration = 5; settings.Lifetime = 3; _particleSystem.Emit = true; settings.SpinVelocityVariance = 2; // Begin execution. Gorgon.Go(); } }
private void MainWindowLoad(object sender, EventArgs e) { _configurationManager = IoCManager.Resolve <IConfigurationManager>(); SetupGorgon(); SetupInput(); IoCManager.Resolve <IResourceManager>().LoadBaseResources(); IoCManager.Resolve <IResourceManager>().LoadLocalResources(); Gorgon.Go(); _networkManager = IoCManager.Resolve <INetworkManager>(); _netGrapher = IoCManager.Resolve <INetworkGrapher>(); _stateManager = IoCManager.Resolve <IStateManager>(); _userInterfaceManager = IoCManager.Resolve <IUserInterfaceManager>(); _stateManager.RequestStateChange <MainScreen>(); }
/// <summary> /// Handles the Load event of the MainForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void MainForm_Load(object sender, EventArgs e) { try { // Initialize the library. Gorgon.Initialize(); // Display the logo and frame stats. Gorgon.LogoVisible = false; Gorgon.FrameStatsVisible = false; // Set the video mode to match the form client area. Gorgon.SetMode(this); // Assign rendering event handler. Gorgon.Idle += new FrameEventHandler(Screen_OnFrameBegin); // Set the clear color to something ugly. Gorgon.Screen.BackgroundColor = Color.FromArgb(250, 245, 220); LoadFont(); txtspr = new TextSprite("txtspr", "Test", font, Color.Black); txtspr.SetPosition(1.0f, 1.0f); TextStatus(); RunMeasureLineTests(); // Begin execution. Gorgon.Go(); } catch (Exception ex) { UI.ErrorBox(this, "An unhandled error occured during execution, the program will now close.", ex.Message + "\n\n" + ex.StackTrace); Application.Exit(); } }
private void ApplyVideoMode() { Form owner = Gorgon.Screen.OwnerForm; Gorgon.Stop(); Gorgon.SetMode(owner, (int)ConfigurationManager.GetDisplayWidth(), (int)ConfigurationManager.GetDisplayHeight(), BackBufferFormats.BufferRGB888, !ConfigurationManager.GetFullscreen(), false, false, (int)ConfigurationManager.GetDisplayRefresh(), (ConfigurationManager.GetVsync() ? VSyncIntervals.IntervalOne : VSyncIntervals.IntervalNone)); if (!ConfigurationManager.GetFullscreen()) { //Gee thanks gorgon for changing this stuff only when switching TO fullscreen. owner.FormBorderStyle = FormBorderStyle.Sizable; owner.WindowState = FormWindowState.Normal; owner.ControlBox = true; owner.MaximizeBox = true; owner.MinimizeBox = true; } Gorgon.Go(); }
private void Form1_Load_1(object sender, EventArgs e) { SetupGorgon(); Gorgon.Go(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { List <DirectoryInfo> dataSets = new List <DirectoryInfo>(); try { //Check to see if there's data in program directory that's not copied to general application data folder DirectoryInfo di = new DirectoryInfo(Path.Combine(Application.StartupPath, "Data")); DirectoryInfo target = new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Beyond Beyaan")); if (!target.Exists) { target.Create(); } foreach (var directory in di.GetDirectories()) { CopyOrUpdateDirectory(directory, new DirectoryInfo(Path.Combine(target.FullName, directory.Name))); } //Get list of available datasets from general application data folder foreach (var directory in target.GetDirectories()) { //Sanity check to ensure that it's a valid dataset dataSets.Add(directory); } } catch (Exception exception) { MessageBox.Show(string.Format("Failed to copy directories. Error: {0}", exception.Message)); Close(); return; } if (dataSets.Count == 0) { MessageBox.Show(Resources.BeyondBeyaan_OnLoad_There_are_no_available_datasets_to_choose_from___Ensure_that_the_program_is_installed_correctly_); Close(); return; } dataSets.Sort((a, b) => String.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase)); Gorgon.Initialize(true, false); VideoMode videoMode; DirectoryInfo dataset; bool fullScreen; bool showTutorial; using (Configuration configuration = new Configuration()) { configuration.FillResolutionList(); configuration.FillDatasetList(dataSets); configuration.ShowDialog(this); if (configuration.DialogResult != DialogResult.OK) { Close(); return; } videoMode = configuration.VideoMode; fullScreen = configuration.FullScreen; dataset = dataSets[configuration.DataSetIndex]; showTutorial = configuration.ShowTutorial; } Gorgon.SetMode(this, videoMode.Width, videoMode.Height, BackBufferFormats.BufferRGB888, !fullScreen); Gorgon.Idle += new FrameEventHandler(Gorgon_Idle); Gorgon.FastResize = false; //Gorgon.FrameStatsVisible = true; input = Input.LoadInputPlugIn(Environment.CurrentDirectory + @"\GorgonInput.DLL", "Gorgon.RawInput"); input.Bind(this); keyboard = input.Keyboard; keyboard.Enabled = true; keyboard.Exclusive = false; keyboard.KeyDown += keyboard_KeyDown; string reason; FileInfo fileInfo = new FileInfo(Path.Combine(dataset.FullName, "configuration.xml")); if (!GameConfiguration.Initialize(fileInfo, out reason)) { MessageBox.Show(string.Format("Error loading configuration, reason: {0}", reason)); Close(); return; } gameMain = new GameMain(); if (!gameMain.Initalize(Gorgon.Screen.Width, Gorgon.Screen.Height, dataset, showTutorial, this, out reason)) { MessageBox.Show(string.Format("Error loading game resources, error message: {0}", reason)); Close(); return; } Gorgon.Go(); } catch (Exception exception) { HandleException(exception); } }