public AltitudeBox()
 {
     InitializeComponent();
     altitudeTimer.Tick += new EventHandler(AltitudeTimerTick);
     altitudeTimer.Start();
     Tolk.Load();
 } // End constructor.
示例#2
0
        public VerticalSpeedBox()
        {
            InitializeComponent();

            verticalSpeedTimer.Tick += new EventHandler(TimerTick);
            verticalSpeedTimer.Start();
            Tolk.Load();
        } // End constructor.
        public HeadingBox()
        {
            InitializeComponent();
            Tolk.Load();

            headingTimer.Tick += new EventHandler(TimerTick);
            headingTimer.Start();
        } // End constructor.
示例#4
0
 public MainWindow()
 {
     InitializeComponent();
     //This odd event handler is needed because the TextBox control eats that spacebar, so we have to intercept an already-handled event.
     //this.Console.AddHandler(TextBox.KeyDownEvent, new KeyEventHandler(Console_KeyDown), true);
     this.Console.AddHandler(TextBox.PreviewKeyDownEvent, new KeyEventHandler(Console_KeyDown), true);
     Tolk.Load();
     Tolk.TrySAPI(false);
     Tolk.DetectScreenReader();
     Tolk.Speak("Bem-vindo ao terminal 3270!", true);
     Tolk.Speak("Pressione Alt + E para conectar, ou Alt + Q para sair.");
 }
        public static void Init()
        {
            if (!loadedLibraries)
            {
                /*
                 * Since the above DLLs are native, they need to be loaded manually from the _Lib directory since DLLImport and LoadLibrary in
                 * Tolk.dll won't be able to find nvdaControllerClient64.dll inside the _Lib folder.
                 */
                foreach (var lib in libraries)
                {
                    NativeLibraryHelper.LoadLibrary("_Lib/" + lib);
                }
                loadedLibraries = true;
            }

            if (!isLoaded)
            {
                Tolk.Load();
            }
            isLoaded = Tolk.IsLoaded();
        }
示例#6
0
    public static void Main()
    {
        Console.WriteLine("Tolk -- C# Console App Example");

        Console.WriteLine("Initializing Tolk...");
        Tolk.Load();

        Console.WriteLine("Querying for the active screen reader driver...");
        string name = Tolk.DetectScreenReader();

        if (name != null)
        {
            Console.WriteLine("The active screen reader driver is: {0}", name);
        }
        else
        {
            Console.WriteLine("None of the supported screen readers is running");
        }

        if (Tolk.HasSpeech())
        {
            Console.WriteLine("This screen reader driver supports speech");
        }
        if (Tolk.HasBraille())
        {
            Console.WriteLine("This screen reader driver supports braille");
        }

        Console.WriteLine("Let's output some text...");
        if (!Tolk.Output("Hello, World!"))
        {
            Console.WriteLine("Failed to output text");
        }

        Console.WriteLine("Finalizing Tolk...");
        Tolk.Unload();

        Console.WriteLine("Done!");
    }
示例#7
0
        static void Main(string[] args)
        {
            Tolk.TrySAPI(true);
            Tolk.Load();

            //Console.WriteLine("Querying for the active screen reader driver...");
            //string name = Tolk.DetectScreenReader();
            //if (name != null) {
            //  Console.WriteLine("The active screen reader driver is: {0}", name);
            //}
            //else {
            //  Console.WriteLine("None of the supported screen readers is running");
            //}

            //if (Tolk.HasSpeech()) {
            //  Console.WriteLine("This screen reader driver supports speech");
            //}
            //if (Tolk.HasBraille()) {
            //  Console.WriteLine("This screen reader driver supports braille");
            //}

            //Console.WriteLine("Let's output some text...");
            //if (!Tolk.Output("Hello, World!")) {
            //  Console.WriteLine("Failed to output text");
            //}

            //Console.WriteLine("Finalizing Tolk...");
            //Tolk.Unload();

            //Console.WriteLine("Done!");
            var  G    = new AtlasWarriorsGame.Game();
            bool quit = false;

            displayMode = DisplayMode.ROOM;
            bool skipDraw = false;

            while (!quit)
            {
                // If not skipping draw, draw map. If so - reset skipDraw to draw map next time.
                if (!skipDraw)
                {
                    if (displayMode != DisplayMode.REFRESH_ONLY)
                    {
                        DrawMap(G.CurrentDungeon);
                    }
                }
                else
                {
                    skipDraw = false;
                }
                Console.Write($"\nHP {G.Player.CurrentHealth} ({G.Player.MaxHealth})");
                Console.Write("\n>");
                var input = Console.ReadKey();
                switch (input.Key)
                {
                case ConsoleKey.H:
                case ConsoleKey.LeftArrow:
                case ConsoleKey.NumPad4:
                    G.Player.NextMove = Player.Instruction.MOVE_W;
                    break;

                case ConsoleKey.K:
                case ConsoleKey.UpArrow:
                case ConsoleKey.NumPad8:
                    G.Player.NextMove = Player.Instruction.MOVE_N;
                    break;

                case ConsoleKey.L:
                case ConsoleKey.RightArrow:
                case ConsoleKey.NumPad6:
                    G.Player.NextMove = Player.Instruction.MOVE_E;
                    break;

                case ConsoleKey.J:
                case ConsoleKey.DownArrow:
                case ConsoleKey.NumPad2:
                    G.Player.NextMove = Player.Instruction.MOVE_S;
                    break;

                case ConsoleKey.Y:
                case ConsoleKey.NumPad7:
                    G.Player.NextMove = Player.Instruction.MOVE_NW;
                    break;

                case ConsoleKey.U:
                case ConsoleKey.NumPad9:
                    G.Player.NextMove = Player.Instruction.MOVE_NE;
                    break;

                case ConsoleKey.B:
                case ConsoleKey.NumPad1:
                    G.Player.NextMove = Player.Instruction.MOVE_SW;
                    break;

                case ConsoleKey.N:
                case ConsoleKey.NumPad3:
                    G.Player.NextMove = Player.Instruction.MOVE_SE;
                    break;

                // Non move options
                // Refresh screen
                case ConsoleKey.Spacebar:
                    DrawMap(G.CurrentDungeon, true);
                    skipDraw = true;
                    break;

                // Change draw mode - F1, F2, F3
                case ConsoleKey.F1:
                    displayMode = DisplayMode.ALL;
                    Console.Write("Display mode set to show all");
                    break;

                case ConsoleKey.F2:
                    displayMode = DisplayMode.ROOM;
                    Console.Write("Display mode set to show current visible area only");
                    break;

                case ConsoleKey.F3:
                    displayMode = DisplayMode.REFRESH_ONLY;
                    Console.Write("Display mode set to only show on refresh (Space)");
                    break;
                }
                G.DoTurn();
            }
        }
        public VerticalSpeedBox()
        {
            InitializeComponent();

            Tolk.Load();
        } // End constructor.
示例#9
0
        internal static void StartLoopEx(formMain.MainDialogResult result)
        {
            Program.Sounds.Initialize(Program.CurrentHost, Interface.CurrentOptions.SoundRange);
            Tolk.Load();
            string name = Tolk.DetectScreenReader();

            if (!string.IsNullOrEmpty(name))
            {
                Interface.CurrentOptions.ScreenReaderAvailable = true;
                Program.FileSystem.AppendToLogFile("Supported screen reader driver " + name + " initialised.");
            }
            else
            {
                Program.FileSystem.AppendToLogFile("No supported screen reader found.");
            }
            //Process extra command line arguments supplied
            if (result.InitialStation != null)
            {
                //We have supplied a station name or index to the loader
                Program.CurrentRoute.InitialStationName = result.InitialStation;
            }
            if (result.StartTime != default(double))
            {
                Program.CurrentRoute.InitialStationTime = result.StartTime;
            }

            Game.InitialAIDriver        = result.AIDriver;
            Game.InitialReversedConsist = result.ReverseConsist;
            if (result.FullScreen)
            {
                Interface.CurrentOptions.FullscreenMode = true;
            }
            if (result.Width != default(double) && result.Height != default(double))
            {
                if (Interface.CurrentOptions.FullscreenMode)
                {
                    Interface.CurrentOptions.FullscreenWidth  = result.Width;
                    Interface.CurrentOptions.FullscreenHeight = result.Height;
                }
                else
                {
                    Interface.CurrentOptions.WindowWidth  = result.Width;
                    Interface.CurrentOptions.WindowHeight = result.Height;
                }
            }
            if (Interface.CurrentOptions.IsUseNewRenderer)
            {
                Program.FileSystem.AppendToLogFile("Using openGL 3.0 (new) renderer");
            }
            else
            {
                Program.FileSystem.AppendToLogFile("Using openGL 1.2 (old) renderer");
            }
            if (Interface.CurrentOptions.FullscreenMode)
            {
                Program.FileSystem.AppendToLogFile("Initialising full-screen game window of size " + Interface.CurrentOptions.FullscreenWidth + " x " + Interface.CurrentOptions.FullscreenHeight);
            }
            else
            {
                Program.FileSystem.AppendToLogFile("Initialising game window of size " + Interface.CurrentOptions.WindowWidth + " x " + Interface.CurrentOptions.WindowHeight);
            }
            Screen.Initialize();
            currentResult = result;
            Program.currentGameWindow.Closing += OpenTKQuit;
            Program.currentGameWindow.Run();
        }
 public AltitudeBox()
 {
     InitializeComponent();
     Tolk.Load();
 } // End constructor.
 public HeadingBox()
 {
     InitializeComponent();
     Tolk.Load();
 }                        // End constructor.
示例#12
0
 private void TalkString(string text)
 {
     Tolk.Load();
     Tolk.Output(text, true);
     Tolk.Unload();
 }
示例#13
0
        static void Main(string[] args)
        {
            Tolk.TrySAPI(true);
            Tolk.Load();

            string introText =
                @"Atlas Warriors - Screen Reader Edition
Lachlan Kingsford

Welcome to Atlas Warriors. This screen reader edition provides screen-reader specific functionality:
F1: Screen mode - whole map
F2: Screen mode - current room only
F3: Screen mode - no refresh
Space: Draw whole screen

Move with Vim keys, arrows or numeric keypad.

Push any key to continue";

            Console.WriteLine(introText);
            Tolk.Output(introText);

            Console.ReadKey();

            var  G    = new AtlasWarriorsGame.Game();
            bool quit = false;

            displayMode = DisplayMode.ROOM;
            bool skipDraw = false;

            while (!quit)
            {
                // Interrupt reader at start of turn
                Tolk.Output("", true);

                // If not skipping draw, draw map. If so - reset skipDraw to draw map next time.
                if (!skipDraw)
                {
                    if (displayMode != DisplayMode.REFRESH_ONLY)
                    {
                        DrawMap(G.CurrentDungeon);
                    }
                }
                else
                {
                    skipDraw = false;
                }
                Console.Write($"\nHP {G.Player.CurrentHealth} ({G.Player.MaxHealth})");
                Tolk.Output($"{G.Player.CurrentHealth} of {G.Player.MaxHealth}");
                Console.Write("\n>");
                var input = Console.ReadKey();
                switch (input.Key)
                {
                case ConsoleKey.H:
                case ConsoleKey.LeftArrow:
                case ConsoleKey.NumPad4:
                    G.Player.NextMove = Player.Instruction.MOVE_W;
                    break;

                case ConsoleKey.K:
                case ConsoleKey.UpArrow:
                case ConsoleKey.NumPad8:
                    G.Player.NextMove = Player.Instruction.MOVE_N;
                    break;

                case ConsoleKey.L:
                case ConsoleKey.RightArrow:
                case ConsoleKey.NumPad6:
                    G.Player.NextMove = Player.Instruction.MOVE_E;
                    break;

                case ConsoleKey.J:
                case ConsoleKey.DownArrow:
                case ConsoleKey.NumPad2:
                    G.Player.NextMove = Player.Instruction.MOVE_S;
                    break;

                case ConsoleKey.Y:
                case ConsoleKey.NumPad7:
                    G.Player.NextMove = Player.Instruction.MOVE_NW;
                    break;

                case ConsoleKey.U:
                case ConsoleKey.NumPad9:
                    G.Player.NextMove = Player.Instruction.MOVE_NE;
                    break;

                case ConsoleKey.B:
                case ConsoleKey.NumPad1:
                    G.Player.NextMove = Player.Instruction.MOVE_SW;
                    break;

                case ConsoleKey.N:
                case ConsoleKey.NumPad3:
                    G.Player.NextMove = Player.Instruction.MOVE_SE;
                    break;

                // Non move options
                // Refresh screen
                case ConsoleKey.Spacebar:
                    DrawMap(G.CurrentDungeon, true);
                    skipDraw = true;
                    break;

                // Change draw mode - F1, F2, F3
                case ConsoleKey.F1:
                    displayMode = DisplayMode.ALL;
                    Console.Write("Display mode set to show all");
                    break;

                case ConsoleKey.F2:
                    displayMode = DisplayMode.ROOM;
                    Console.Write("Display mode set to show current visible area only");
                    break;

                case ConsoleKey.F3:
                    displayMode = DisplayMode.REFRESH_ONLY;
                    Console.Write("Display mode set to only show on refresh (Space)");
                    break;
                }
                G.DoTurn();

                if (G.GameOver)
                {
                    Console.WriteLine(G.EndGameTitle);
                    Tolk.Output(G.EndGameTitle, true);
                    Console.WriteLine(G.EndGameText);
                    Tolk.Output(G.EndGameText, false);
                    Console.WriteLine("(Press any key to quit)");
                    Tolk.Output("Press any key to quit");
                    Console.ReadKey();
                    quit = true;
                }
            }
        }
示例#14
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     Tolk.Load();
     base.Initialize();
 }