Exemplo n.º 1
0
 /// <summary>
 /// Prepares the engine for use. This must be the first method you call on the engine, then call <see cref="Run"/> to start SadConsole.
 /// </summary>
 /// <param name="font">The font to load as the <see cref="DefaultFont"/>.</param>
 /// <param name="consoleWidth">The width of the default root console (and game window).</param>
 /// <param name="consoleHeight">The height of the default root console (and game window).</param>
 /// <param name="ctorCallback">Optional callback from the MonoGame Game class constructor.</param>
 /// <returns>The default active console.</returns>
 public static void Initialize(string font, int consoleWidth, int consoleHeight, Action <SadConsoleGame> ctorCallback = null)
 {
     MonoGameInstance          = new SadConsoleGame(font, consoleWidth, consoleHeight, ctorCallback);
     MonoGameInstance.Exiting += (s, e) => EngineShutdown?.Invoke(null, new ShutdownEventArgs()
     {
     });
 }
Exemplo n.º 2
0
        /// <summary>
        /// Prepares the engine for use by creating a window. This must be the first method you call on the engine.
        /// </summary>
        /// <param name="font">The font to load as the <see cref="DefaultFont"/>.</param>
        /// <param name="consoleWidth">The width of the default root console (and game window).</param>
        /// <param name="consoleHeight">The height of the default root console (and game window).</param>
        /// <param name="frameLimit">Defaults to 60 fps. Use 0 to indicate unlimited.</param>
        /// <returns>The default active console.</returns>
        public static Consoles.Console Initialize(string font, int consoleWidth, int consoleHeight, int frameLimit = 60)
        {
            SetupFontAndEffects(font);

            var window = new RenderWindow(new SFML.Window.VideoMode((uint)(DefaultFont.Size.X * consoleWidth), (uint)(DefaultFont.Size.Y * consoleHeight)), "SadConsole Game", SFML.Window.Styles.Titlebar | SFML.Window.Styles.Close);

            WindowWidth  = (int)window.Size.X;
            WindowHeight = (int)window.Size.Y;

            window.Closed += (o, e) =>
            {
                ShutdownEventArgs args = new ShutdownEventArgs();
                EngineShutdown?.Invoke(null, args);
                if (!args.BlockShutdown)
                {
                    ((SFML.Window.Window)o).Close();
                }
            };

            if (frameLimit != 0)
            {
                window.SetFramerateLimit((uint)frameLimit);
            }

            Device = window;

            SetupInputsAndTimers();

            // Create the default console.
            return(SetupStartingConsole(consoleWidth, consoleHeight));
        }
Exemplo n.º 3
0
        public override string ToString()
        {
            string str = "";

            str += Signals.ToString() + ",";
            str += LookingAtMirrors.ToString() + ",";
            str += Parking.ToString() + ",";
            str += ParkingInReverse.ToString() + ",";
            str += KeepDistance.ToString() + ",";
            str += Speed.ToString() + ",";
            str += Bypassing.ToString() + ",";
            str += DriveInTheRightLane.ToString() + ",";
            str += PreemptiveRight.ToString() + ",";
            str += Stopping.ToString() + ",";
            str += ObedienceToTrafficSigns.ToString() + ",";
            str += AddressingPedestrians.ToString() + ",";
            str += ALeapInTheRise.ToString() + ",";
            str += ChangeGears.ToString() + ",";
            str += EngineShutdown.ToString() + ",";
            str += IntegrationIntoMovement.ToString() + ",";
            str += SkillForVehicleOperation.ToString() + ",";
            str += AeactionTime.ToString() + ",";
            return(str);
        }