Esempio n. 1
0
        public MainMenu(Atom a, int layer)
            : base(a, layer, "Atomic Engine Example Game")
        {
            AddSlidingMenuItem("Start", delegate(MenuState menu)
            {
                a.stateManager.EndState(this);

                TestRoom room = new TestRoom((Engine)a, 0);
                a.stateManager.StartState(new FadeTransition(a, 1, room));
            });

            AddSlidingMenuItem("Options", delegate(MenuState menu)
            {
                a.stateManager.StartState(new OptionsMenu(a, 1));
            });

            AddSlidingMenuItem("Exit", delegate(MenuState menu)
            {
                a.Exit();
            });

            guiManager.Add(new InputField(new Vector2(500, 500), new Vector2(150, 25)));
            guiManager.Add(new InputField(new Vector2(500, 530), new Vector2(150, 25), true));
            guiManager[0].tab = guiManager[1];
            guiManager[1].tab = guiManager[0];
        }
Esempio n. 2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Atom game = new Atom())
     {
         game.Run();
     }
 }
Esempio n. 3
0
 public FadeTransition(Atom a, int layer, float animationSpeed, bool skipFadeOut, State nextState)
     : base(a, layer)
 {
     this.animationSpeed = animationSpeed;
     this.skipFadeOut = skipFadeOut;
     this.midAction = delegate() { a.stateManager.AddState(nextState); };
     this.endAction = delegate() { a.stateManager.AddFocus(nextState); };
 }
Esempio n. 4
0
 public FadeTransition(Atom a, int layer, float animationSpeed, bool skipFadeOut, TransitionAction midAction, TransitionAction endAction = null)
     : base(a, layer)
 {
     this.animationSpeed = animationSpeed;
     this.skipFadeOut = skipFadeOut;
     this.midAction = midAction;
     this.endAction = endAction;
 }
Esempio n. 5
0
 public OptionsMenu(Atom a, int layer)
     : base(a, layer, "")
 {
     AddSlidingMenuItem("Back", delegate(MenuState menu)
     {
         a.stateManager.EndState(this);
     },
     300);
 }
Esempio n. 6
0
        public PolygonCol(Atom a, Vector2 point1, Vector2 point2)
            : base(a, point1)
        {
            edges = new List<Edge>();
            points = new List<Vector2>();

            points.Add(point1);
            points.Add(point2);
            edges.Add(new Edge(point1, point2));
        }
Esempio n. 7
0
 public GameObject(Atom a, Vector2 position)
 {
     this.a = a;
     this.position = position;
 }
Esempio n. 8
0
 public FPSCounterState(Atom a, int layer)
     : base(a, layer)
 {
 }
Esempio n. 9
0
 public RectangleCol(Atom a, Vector2 position, Vector2 size)
     : base(a, position)
 {
     this.size = size;
 }
Esempio n. 10
0
        public ConsoleState(Atom a, int layer)
            : base(a, layer)
        {
            for (int i = 0; i < 20; i++)
            {
                lines[i] = "";
                colors[i] = Color.Green;
            }
            AddLine("-----ATOMIC CONSOLE-----");
            AddLine("Type 'help' for a list of available commands.");
            AddLine("Press '~' or type 'close' to close console.");
            AddLine("");

            SetVariable("true", "1");
            SetVariable("True", "1");
            SetVariable("false", "0");
            SetVariable("False", "0");

            AddCommand("help", delegate(ConsoleState cl, string[] args)
            {
                DisplayHelp();
            },
            "Display this help file."
            );

            AddCommand("close", delegate(ConsoleState cl, string[] args)
            {
                a.stateManager.DropFocus();
            },
            "Closes the console window."
            );

            AddCommand("exit", delegate(ConsoleState cl, string[] args)
            {
                a.Exit();
            },
            "Forces an exit of the game."
            );

            AddCommand("echo", delegate(ConsoleState cl, string[] args)
            {
                int repeat = 1;
                if (args[1] != null)
                {
                    if (!int.TryParse(args[1], out repeat))
                    {
                        AddLine("'" + args[1] + "' is not a valid integer value.");
                    }
                }
                for (int i = 0; i < repeat; i++)
                {
                    AddLine(args[0]);
                }
            },
            "Prints the value of arg0 to the console window."
            );

            AddCommand("resolution", delegate(ConsoleState cl, string[] args)
            {
                int x, y;
                if (int.TryParse(args[0], out x) && int.TryParse(args[1], out y))
                {
                    a.ApplyResolution(x, y, a.fullscreen);
                }
                else
                {
                    AddLine("Dimensions must be integer values.");
                }
            },
            "Sets the resolution of the window to (arg0, arg1)"
            );

            AddCommand("fullscreen", delegate(ConsoleState cl, string[] args)
            {
                if (args[0] == "0" || args[0] == "1")
                {
                    a.ApplyResolution((int)a.resolution.X, (int)a.resolution.Y, args[0] == "1");
                }
                else
                {
                    AddLine("Must specify a boolean value");
                }
            },
            "Sets the window to fullscreen if arg0 is true, or a window if false."
            );

            AddCommand("clear", delegate(ConsoleState cl, string[] args)
            {
                if (args[0] == "#help" || args[0] == null)
                {
                    AddLine("Usage: clear <option>");
                    AddLine("Options: #help    Show this help text.");
                    AddLine("         #history   Clear the command history.");
                    AddLine("         #output    Clear the console output window.");
                }
                else if (args[0] == "#history")
                {
                    history.Clear();
                    history_i = 0;
                }
                else if (args[0] == "#output")
                {
                    for (int i = 0; i < 20; i++)
                    {
                        lines[i] = "";
                        colors[i] = Color.Green;
                    }
                }
            },
            "Clears a variety of things. Use clear #help for more info."
            );

            AddCommand("sleep", delegate(ConsoleState cl, string[] args)
            {
                if (Int32.TryParse(args[0], out sleepCount))
                {
                    sleepCom = "true";
                }
                else
                {
                    AddLine("Could not sleep. Cycle count must be a valid integer.", Color.Red);
                }

            },
            "Stops execution of the console window for the amount given amount of cycles in arg0."
            );

            AddCommand("fps", delegate(ConsoleState cl, string[] args)
            {
                if (args[0] == "0")
                    a.stateManager.EndState(fpsCount);
                else
                {
                    fpsCount = new FPSCounterState(a, layer + 1);
                    a.stateManager.AddState(fpsCount);
                }
            },
            "Shows or hides the on-screen FPS counter."
            );
        }
Esempio n. 11
0
 public WorldState(Atom a, int layer)
     : base(a, layer)
 {
 }
Esempio n. 12
0
 public FadeTransition(Atom a, int layer, State nextState)
     : this(a, layer, 0.05f, false, nextState)
 {
 }
Esempio n. 13
0
 public Player(Atom a, Vector2 position)
     : base(a, position, position + new Vector2(32, 0))
 {
     AddPoint(position + new Vector2(32, 32));
     Close();
 }
Esempio n. 14
0
 public MenuState(Atom a, int layer, string title)
     : base(a, layer)
 {
     this.title = title;
 }
Esempio n. 15
0
 static void Main()
 {
     game = new Atom ();
     game.Run ();
 }
Esempio n. 16
0
 public Block(Atom a, Vector2 position, Vector2 size)
     : base(a, position, position + new Vector2(size.X, 0))
 {
     AddPoint(position + size);
     Close();
 }
Esempio n. 17
0
 protected State(Atom a, int layer)
 {
     this.a = a;
     this.layer = layer;
     this.enabled = true;
 }