WaitForInput() public method

Wait for the user to press a key.
public WaitForInput ( ) : CommandData
return Sharplike.Core.Input.CommandData
Example #1
0
        static Boolean RunGame(StepwiseGameLoop loop)
        {
            CommandData cmd = null;
            do
            {
                map.BroadcastMessage(cameraVector, new Vector3(5, 5, 1), "Ping");

                cache.ActiveLevel = cameraVector.z;
                cache.AssessCache();

                cmd = loop.WaitForInput();
                Console.WriteLine(cmd.ToString());
                //if (ent != null)
                //	ent.Wander();
                switch (cmd.Command)
                {
                    case "move_left":
                        cameraVector = new Vector3(cameraVector.x - 1,
                                            cameraVector.y, cameraVector.z);
                        cameraMoved = true;
                        break;
                    case "move_right":
                        cameraVector = new Vector3(cameraVector.x + 1,
                                            cameraVector.y, cameraVector.z);
                        cameraMoved = true;
                        break;
                    case "move_up":
                        cameraVector = new Vector3(cameraVector.x,
                                            cameraVector.y - 1, cameraVector.z);
                        cameraMoved = true;
                        break;
                    case "move_down":
                        cameraVector = new Vector3(cameraVector.x,
                                            cameraVector.y + 1, cameraVector.z);
                        cameraMoved = true;
                        break;
                    case "move_in":
                        cameraVector = new Vector3(cameraVector.x,
                                            cameraVector.y, cameraVector.z + 1);
                        cameraMoved = true;
                        break;
                    case "move_out":
                        cameraVector = new Vector3(cameraVector.x,
                                            cameraVector.y, cameraVector.z - 1);
                        cameraMoved = true;
                        break;
                    case "spacebar":
                        ent.Dispose();
                        ent = null;
                        break;
                }
            } while (cmd.Command != "quit");

            return false;
        }
Example #2
0
        static Boolean RunGame(StepwiseGameLoop loop)
        {
            CommandData cmd = null;
            do
            {
                cmd = loop.WaitForInput();
                Console.WriteLine(cmd.Command);
            } while (cmd.Command != "quit");

            return false;
        }