Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Input;
- using System;
- using ScreenManager = LoveLace.Screens.ScreenManager;
- using StateManager = LoveLace.GameStates.StateManager;
- using Splash = LoveLace.GameStates.Load.Splash;
- using Engine = LoveLace.UX.Engine;
- using Microsoft.Xna.Framework.Audio;
- namespace LoveLace
- {
- public class Game : SadConsole.Game
- {
- //SpriteBatch spriteBatch;
- public static Game MyGame;
- public static Random ORandom = new Random();
- public const int ProgramWidth = 100; // * 8 = 800
- public const int ProgramHeight = 38; // * 16 = 608
- public SoundEffect AudioClick;
- public Game() : base("IBM.font", ProgramWidth, ProgramHeight, null)
- {
- Content.RootDirectory = "Content";
- }
- /// <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()
- {
- // Generally you don't want to hide the mouse from the user
- IsMouseVisible = true;
- // Finish the initialization of SadConsole
- base.Initialize();
- // Initialize LoveLace, this order of initialization is not arbitrary
- // 0 - Initialize states, this mostly consists of initializing consoles, but not exclusively
- // 0.a - Initializes Splash Console
- // 0.b - Initializes Menu Consoles, and Context Objects, and Config Options
- // 0.c - For now, it Initializes Engine Consoles... TODO Consoles for other aspects of Root State
- // 1 - Now that the consoles are available, Initialize screens, so that we can display them to the user
- // 2 - Initialize User Array in Registrar
- // 3 - Initialize the individual components of the UX Engine, Such as Inspector & Store
- MyGame = this;
- StateManager.Initialize.States(); // 0
- ScreenManager.Initialize.Screens(); // 1
- Registrar.Initialize.Users(); // 2
- Engine.Initialize.Components(); // 3
- PromptInstallationStatus(true);
- }
- /// <summary>
- /// LoadContent will be called once per game and is the place to load
- /// all of your content.
- /// </summary>
- protected override void LoadContent()
- {
- // Create a new SpriteBatch, which can be used to draw textures.
- //spriteBatch = new SpriteBatch(GraphicsDevice);
- // TODO: use this.Content to load your game content here
- this.AudioClick = Content.Load<SoundEffect>("click");
- }
- /// <summary>
- /// UnloadContent will be called once per game and is the place to unload
- /// game-specific content.
- /// </summary>
- protected override void UnloadContent()
- {
- // TODO: Unload any non ContentManager content here
- }
- protected override void Update(GameTime gameTime)
- {
- if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
- Exit();
- if (IO.IOController.State != IO.IOController.States.Idle)
- {
- switch (IO.IOController.State)
- {
- case IO.IOController.States.LoadUsers:
- IO.IOController.LoadUsers();
- break;
- case IO.IOController.States.LoadSession:
- IO.IOController.LoadSession();
- break;
- }
- }
- else if (Registrar.Global.SessionIsActive())
- {
- UX.Engine.Update(gameTime.ElapsedGameTime.TotalSeconds);
- }
- // the else if prevents updates from happening while the io.controller is loading data?
- // Todo - clean this shit up
- base.Update(gameTime);
- }
- void PromptInstallationStatus(bool forceInstallation = false)
- {
- GameStates.StateManager.SelectState(0);
- if (forceInstallation)
- {
- Splash.Display.PrintInstallPrompt();
- }
- else
- {
- if (IO.Install.Parity.ConfirmInstallationExists())
- {
- Splash.PrintUsrLoadBar(0);
- IO.IOController.Boot();
- }
- else
- {
- Splash.Display.PrintInstallPrompt();
- }
- }
- }
- }
- }
- /// I dont think I need this part of monogame?
- ///// <summary>
- ///// This is called when the game should draw itself.
- ///// </summary>
- ///// <param name="gameTime">Provides a snapshot of timing values.</param>
- //protected override void Draw(GameTime gameTime)
- //{
- // GraphicsDevice.Clear(Color.CornflowerBlue);
- // // TODO: Add your drawing code here
- // base.Draw(gameTime);
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement