コード例 #1
0
        /// <summary>
        /// Constructor determines whether PC or Xbox 360 and initializes
        /// variables accordingly.
        /// 
        /// For PC, this means creating the controller and trying to get a
        /// storage device.
        /// 
        /// For the Xbox 360, we don't need to do much as we rely on update()
        /// logic to determine active controller and storage device.
        /// </summary>
        /// <param name="engine"></param>
        public EngineStateStart(Engine engine)
        {
            engine_ = engine;
            //logo_ = TextureMap.fetchTexture(@"Sprites\TitleScreen");
            //logo_ = new GameTexture(@"Sprites\TitleScreen", engine.spriteBatch_, engine.GraphicsDevice, engine.Content);
            logo_ = new GameTexture(@"Sprites\TitleScreen");

            #if !XBOX
            {
                Settings settings = Settings.getInstance();
                if (Settings.getInstance().IsUsingMouse_)
                {
                    engine_.Controls_ = new PCControllerInput(engine_);
                    settings.CurrentPlayer_ = PlayerIndex.One;
                    TEXT_MESSAGE = "Press " + engine_.Controls_.getControlName(InputsEnum.CONFIRM_BUTTON).ToUpper() + " to Continue";
                }
                else
                {
                    engine_.Controls_ = new X360ControllerInput(engine_, PlayerIndex.One);
                    settings.CurrentPlayer_ = PlayerIndex.One;
                    TEXT_MESSAGE = "Press " + engine_.Controls_.getControlName(InputsEnum.CONFIRM_BUTTON).ToUpper() + " to Continue";
                }
                prepareStorageDevice();
                returnFlag_ = true;
            }
            #else
            {
                engine_.Controls_ = null; // reset controls if they are coming back to this
                returnFlag_ = false;
            }
            #endif
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: apitman/projectquick
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     //TestHarness.WorldBuilder.test();
     using (Engine game = new Engine())
     {
         game.Run();
     }
 }
コード例 #3
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="engine">The engine using the controller.</param>
 public PCControllerInput(Engine engine)
 {
     engine_ = engine;
     inputs_ = InputSet.getInstance();
 }
コード例 #4
0
ファイル: UpdateThread.cs プロジェクト: BNHeadrick/Bros
 public UpdateThread(Engine engine, EngineStateInterface engineState)
 {
     currentEngineState_ = engineState;
     engine_ = engine;
     drawBuffer_ = DrawBuffer.getInstance();
 }
コード例 #5
0
 /// <summary>
 /// Constructor which allows specification of a player.
 /// </summary>
 /// <param name="engine">The engine using the controller.</param>
 /// <param name="player">The player whose input should be read.</param>
 public X360ControllerInput(Engine engine, PlayerIndex player)
 {
     engine_ = engine;
     player_ = player;
     inputs_ = InputSet.getInstance(player);
 }
コード例 #6
0
 /// <summary>
 /// Default constructor; assigns itself to Player One's input device.
 /// </summary>
 /// <param name="engine">The engine using the controller.</param>
 public X360ControllerInput(Engine engine)
 {
     engine_ = engine;
     player_ = PlayerIndex.One;
     inputs_ = InputSet.getInstance();
 }
コード例 #7
0
ファイル: EngineManager.cs プロジェクト: apitman/projectquick
 public static void initialize(Engine engine)
 {
     engine_ = engine;
     StateStack = new Stack<EngineStateInterface>();
 }
コード例 #8
0
 public EngineStateSplash(Engine engine)
 {
     engine_ = engine;
     //splash_ = new GameTexture(@"Sprites\splash", engine.spriteBatch_, engine.GraphicsDevice, engine_.Content);
     splash_ = new GameTexture(@"Sprites\splash");
 }
コード例 #9
0
ファイル: ManagedXml.cs プロジェクト: apitman/projectquick
 public ManagedXml(Engine engine)
     : base()
 {
     content_ = new ContentManager(engine.Services);
     content_.RootDirectory = "Content";
 }
コード例 #10
0
ファイル: GameFont.cs プロジェクト: apitman/projectquick
 /// <summary>
 /// This is the constructor that should almost always be used
 /// </summary>
 /// <param name="filepath">The path to the .spritefont file, without .spritefont at the end</param>
 /// <param name="spriteBatch">The spriteBatch to be used when drawing text</param>
 /// <param name="engine">The main Engine class</param>
 public GameFont(string filename, SpriteBatch spriteBatch, Engine engine)
 {
     spriteBatch_ = spriteBatch;
     font_ = engine.Content.Load<SpriteFont>(filename);
 }
コード例 #11
0
ファイル: TextureMap.cs プロジェクト: apitman/projectquick
        /// <summary>
        /// Load all the textures for the game.
        /// </summary>
        /// <param name="filepath">Filename of the texture document</param>
        /// <param name="spriteBatch">SpriteBatch for the game</param>
        /// <param name="graphics">GraphicsDevice for the game</param>
        public void loadTextures(string filename, Engine engine)
        {
            SpriteBatch spriteBatch = engine.spriteBatch_;
            GraphicsDevice graphics = engine.GraphicsDevice;

            using (ManagedXml manager = new ManagedXml(engine))
            {
                try
                {
                    XmlDocument document = manager.loadFromFile(filename);
                    XmlNodeList textureXMLs = document.GetElementsByTagName("texture");
                    foreach (XmlNode node in textureXMLs)
                    {
                        KeyValuePair<string, GameTexture> tempPair = GameTexture.loadTextureFromFile(node.InnerText, spriteBatch, graphics);
                        textures_.Add(tempPair.Key, tempPair.Value);
                    }
                    XmlNodeList images = document.GetElementsByTagName("image");
                    foreach (XmlNode node in images)
                    {
                        string key = "", image = "";
                        XmlNodeList children = node.ChildNodes;
                        foreach (XmlNode child in children)
                        {
                            if (child.LocalName == "key")
                            {
                                key = child.InnerText;
                            }
                            else if (child.LocalName == "handle")
                            {
                                image = child.InnerText;
                            }
                        }
                        textures_.Add(key, new GameTexture(image));
                    }
                }
                catch (Exception e)
                {
                    Console.Out.WriteLine("FATAL ERROR: Texture Map failed to load!");
                    throw e;
                }
            }
            // Don't collect here, because we will be reading in a lot of these XML docs
            //GC.Collect();
            //GC.WaitForPendingFinalizers();
        }
コード例 #12
0
 public EngineStateGameplay(Engine engine)
     : base(engine)
 {
     // Init logic here
     GameplayManager.initialize(this);
 }
コード例 #13
0
ファイル: UpdateThread.cs プロジェクト: apitman/projectquick
 public UpdateThread(Engine engine)
 {
     engine_ = engine;
     drawBuffer_ = DrawBuffer.getInstance();
 }