/// <summary> /// Initializes a new instance of the Game1 class. /// </summary> public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; #if WINDOWS graphics.PreferredBackBufferWidth = 1024; graphics.PreferredBackBufferHeight = 576; #else var curDisplayMode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode; graphics.PreferredBackBufferWidth = curDisplayMode.Width; graphics.PreferredBackBufferHeight = curDisplayMode.Height; #endif var gamerService = new GamerServicesComponent(this); Components.Add(gamerService); storageService = new StorageService(this, "Bnoerj Storage Sample"); Components.Add(storageService); activeGamePadState = new ActiveGamePadState(); previousGamePadStates = new GamePadState[] { new GamePadState(), new GamePadState(), new GamePadState(), new GamePadState(), }; text = new StringBuilder(); statusText = new StringBuilder(); }
public TechCraftGame() : base() { ShowDebugInfo = false; _graphics = new GraphicsDeviceManager(this); _graphics.IsFullScreen = false; _graphics.PreferredBackBufferWidth = 800; _graphics.PreferredBackBufferHeight = 600; // _graphics.PreferredBackBufferWidth = 160; // _graphics.PreferredBackBufferHeight = 100; _graphics.PreparingDeviceSettings += PrepareDeviceSettings; //those two will be changed when pressing F3 for debug / profiling _graphics.SynchronizeWithVerticalRetrace = true; IsFixedTimeStep = true; _graphics.PreferMultiSampling = false; _gamerServices = new GamerServicesComponent(this); this.Components.Add(_gamerServices); Content.RootDirectory = "Content"; _threads = new List <Thread>(); _stateManager = new StateManager(this); _inputState = new InputState(); }
public override void Initialize() { #if XBOX _Component = new GamerServicesComponent(Game); _Component.Initialize(); #endif }
/// <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 scheduler = new CleverRake.XnaUtils.CoopMultiTasking.Sys.Scheduler(); menuEnvironment = new CleverRake.XnaUtils.CoopMultiTasking.Sys.Environment(scheduler); screenManager = new CleverRake.XnaUtils.Application.ScreenManager(this, this); #if XBOX360 scheduler.AddTask(CleverRake.StolpSkott.Menus.mainTask(menuEnvironment, screenManager)); #else scheduler.AddTask(CleverRake.StolpSkott.Menus.quickTask(menuEnvironment)); #endif this.Components.Add(screenManager); var gamerServices = new GamerServicesComponent(this); this.Components.Add(gamerServices); CleverRake.StolpSkott.Menus.registerStartGame(playerIndex => { screenManager.Enabled = false; screenManager.Visible = false; gameplay = new CleverRake.StolpSkott.Gameplay.MatchGameplay(this, this.Content, PlayerIndex.One, CleverRake.StolpSkott.Team.TeamSide.TeamA); gameplay.MatchOver += (src, score) => { this.Components.Remove(gameplay); screenManager.Enabled = true; screenManager.Visible = true; scheduler.AddTask(CleverRake.StolpSkott.Menus.afterMatch(menuEnvironment, screenManager, playerIndex, score.Item1, score.Item2)); }; this.Components.Add(gameplay); }); base.Initialize(); }
//* ────────────-_______________________* //* constructor & destructor ───────────────────────* //* -----------------------------------------------------------------------* /// <summary>コンストラクタ。</summary> /// /// <param name="game">ゲーム コンポーネントをアタッチするゲーム。</param> public CGuideWrapper(Game game) { if (instance != null) { throw new InvalidOperationException( string.Format(Resources.CLASS_ERR_SINGLETON, typeof(CGuideWrapper).FullName)); } instance = this; this.game = game; try { gsc = new GamerServicesComponent(game); game.Components.Add(gsc); isAvaliableUseGamerService = true; } catch (Exception e) { CLogger.add(Resources.LIVE_WARN_FAILED); CLogger.add(e); removeGamerServiceComponent(); } #if WINDOWS iconset[(int)MessageBoxIcon.None] = System.Windows.Forms.MessageBoxIcon.None; iconset[(int)MessageBoxIcon.Error] = System.Windows.Forms.MessageBoxIcon.Exclamation; iconset[(int)MessageBoxIcon.Warning] = System.Windows.Forms.MessageBoxIcon.Information; iconset[(int)MessageBoxIcon.Alert] = System.Windows.Forms.MessageBoxIcon.Stop; #endif }
/// <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() { //Guide.SimulateTrialMode = true; // TODO: Add your initialization logic here GameAudio.audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs"); GameAudio.waveBank = new WaveBank(GameAudio.audioEngine, @"Content\Audio\Wave Bank.xwb"); GameAudio.soundBank = new SoundBank(GameAudio.audioEngine, @"Content\Audio\Sound Bank.xsb"); GameAudio.Initialize(); spriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(typeof(SpriteBatch), spriteBatch); // Create a new SpriteBatch, which can be used to draw textures. gameEngine = new GameEngine(this); gameEngine.LoadGameComponents(this, levelNumber); gameEngine.Enabled = false; gameEngine.Visible = false; Components.Add(gameEngine); gameMenu = new GameMenu(this); gameMenu.Initialize(); gameMenu.Enabled = true; gameMenu.Visible = true; Components.Add(gameMenu); gamerServiceComponent = new GamerServicesComponent(this); Components.Add(gamerServiceComponent); base.Initialize(); }
/// <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 gamerServices = new GamerServicesComponent(this); Components.Add(gamerServices); // Components.Add(new GamerServicesComponent(this)); base.Initialize(); }
public void Init(ApplicationDesc desc) { #if XNA graphics = new GraphicsDeviceManager(this); graphics.PreparingDeviceSettings += graphics_PreparingDeviceSettings; graphics.SynchronizeWithVerticalRetrace = true; if (desc.DepthBit == -1) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth24; } else if (desc.DepthBit == 24 && desc.StencilBit == 8) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; } else if (desc.DepthBit == 24 && desc.StencilBit == 0) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth24; } else if (desc.DepthBit == 16) { graphics.PreferredDepthStencilFormat = DepthFormat.Depth16; } else if (desc.DepthBit == 0) { graphics.PreferredDepthStencilFormat = DepthFormat.None; } else { Debug.ThrowError("XNAApplication", string.Format("Unsuported DepthBit: {0} or StencilBit: {1}", desc.DepthBit, desc.StencilBit)); } var frame = desc.FrameSize; #if XBOX360 if (frame.Width == 0 || frame.Height == 0) { var display = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode; frame = new Size2(display.Width, display.Height); } graphics.PreferredBackBufferWidth = frame.Width; graphics.PreferredBackBufferHeight = frame.Height; #else if (frame.Width == 0 || frame.Height == 0) { frame = (OS.ScreenSize.ToVector2() / 1.5f).ToSize2(); } graphics.PreferredBackBufferWidth = frame.Width; graphics.PreferredBackBufferHeight = frame.Height; #endif var gsc = new GamerServicesComponent(this); Components.Add(gsc); Content.RootDirectory = ""; #endif }
/// <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 screenManager = new ScreenManager(this, (IUiContentProvider)this); mainComponent = new Main.Main <Game1>(this, screenManager, Main.SignedInRequirement.MustSignIn); base.Components.Add(screenManager); base.Components.Add(mainComponent); gamerServices = new GamerServicesComponent(this); base.Components.Add(gamerServices); base.Initialize(); }
static SharedResources() { Game = null; SpriteBatch = null; FontManager = null; AudioEngine = null; WaveBank = null; SoundBank = null; GraphicsDeviceReady = true; GraphicsDeviceResetting = false; StorageDevice = null; GamerServices = null; }
/// <summary> /// Creates a new execption debug game. /// </summary> /// <param name="exception">The exception to display.</param> public ExceptionDebugGame(Exception exception) { Exception = exception; FontName = "Fonts/TextSmall"; new GraphicsDeviceManager(this) { PreferredBackBufferWidth = 1280, PreferredBackBufferHeight = 720 }; // do not add this as a component because we do not want it to be // reinitialized if the faulting game has already initialized it; // instead we only want to call Update on it _services = new GamerServicesComponent(this); Content.RootDirectory = "Content"; }
protected override void Initialize() { JavaLibGame.GSC = new GamerServicesComponent((Game)this); this.Components.Add((IGameComponent)JavaLibGame.GSC); try { base.Initialize(); } //catch (GameUpdateRequiredException ex) //{ // XNAConnect.PromptForUpdate(); //} catch (Exception ex) { } this.loadThread = new System.Threading.Thread(new ThreadStart(this.MyCallbackFunction)); this.loadThread.Start(); }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = GlobalGameConstants.GameResolutionWidth; graphics.PreferredBackBufferHeight = GlobalGameConstants.GameResolutionHeight; #if PROFILE //this.IsFixedTimeStep = false; //graphics.SynchronizeWithVerticalRetrace = false; //graphics.ApplyChanges(); #endif // for onscreen keyboard and profiles GamerServicesComponent GSC = new GamerServicesComponent(this); Components.Add(GSC); exitGame = false; Content.RootDirectory = "Content"; }
public override void Initialize() { base.Initialize(); // look for gamer services, if present foreach (GameComponent gc in Game.Components) { if (typeof(GamerServicesComponent).IsAssignableFrom(gc.GetType())) { GamerServices = (GamerServicesComponent)gc; break; } } // if not present, add my own if (GamerServices == null) { GamerServices = new GamerServicesComponent(Game); GameInstance.Components.Add(GamerServices); ownsServices = true; } }
public TechCraftGame() : base() { _graphics = new GraphicsDeviceManager(this); _graphics.IsFullScreen = false; _graphics.PreferredBackBufferWidth = 800; _graphics.PreferredBackBufferHeight = 600; // _graphics.PreferredBackBufferWidth = 160; // _graphics.PreferredBackBufferHeight = 100; _graphics.PreparingDeviceSettings += PrepareDeviceSettings; _graphics.SynchronizeWithVerticalRetrace = true; _graphics.PreferMultiSampling = false; _gamerServices = new GamerServicesComponent(this); this.Components.Add(_gamerServices); Content.RootDirectory = "Content"; _threads = new List <Thread>(); _stateManager = new StateManager(this); _inputState = new InputState(); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { ScallyWagsApp game = null; GameModule gameModule = new GameModule(); WinScreenModule winScreenModule = new WinScreenModule(); LooseScreenModule loseModule = new LooseScreenModule(); GamerServicesComponent services = new GamerServicesComponent(null); if (Settings.START_GAME_MODULE) { try { game = new ScallyWagsApp(gameModule); //game.AddModule(new MenuModule()); game.AddModule(winScreenModule); game.Run(); } catch (Exception ex) { Error.Trace("Error: " + ex.Message); Error.Trace("Stack Trace: \n\n" + ex.StackTrace); } } else { game = new ScallyWagsApp(new SplashModule()); game.AddModule(new MenuModule()); game.AddModule(gameModule); game.AddModule(winScreenModule); game.AddModule(loseModule); //game.AddModule(new CreditsModule()); game.Run(); } }
protected override void Initialize() { // Set the game to a 1080 × 720 window graphics.PreferredBackBufferWidth = 1080; graphics.PreferredBackBufferHeight = 720; graphics.IsFullScreen = false; graphics.ApplyChanges(); this.Assets = new Functions.AssetHolder(this.Content); //Load models. this.Assets.SaveAsset <Model>("tree", "Models/Model/three 3"); this.Assets.SaveAsset <Model>("coal", "Models/Coal v4"); this.Assets.SaveAsset <Model>("meteor", "Models/Model/meteor"); this.Assets.SaveAsset <Model>("star", "Models/Model/star"); this.Assets.SaveAsset <Model>("stone", "Models/Model/stoneObstacle"); this.Assets.SaveAsset <Model>("eyes", "Models/Model/eyes"); this.Assets.SaveAsset <Model>("skysphere", "Models/meteoriet"); //Load textures. #region Backgrounds //Backgrounds. this.Assets.SaveAsset <Texture2D>("credits", "Textures/Menu/credits"); this.Assets.SaveAsset <Texture2D>("gameover", "Textures/Menu/gameover"); this.Assets.SaveAsset <Texture2D>("spacebackground", "Textures/Menu/spacebackground"); this.Assets.SaveAsset <Texture2D>("greenhills", "Textures/Menu/greenhills"); #endregion #region Menu level buttons //Menu level buttons. this.Assets.SaveAsset <Texture2D>("one", "Textures/Menu/greenhillsbutton"); this.Assets.SaveAsset <Texture2D>("onesel", "Textures/Menu/greenhillsbuttonselected"); this.Assets.SaveAsset <Texture2D>("two", "Textures/Menu/firststeps"); this.Assets.SaveAsset <Texture2D>("twosel", "Textures/Menu/firststepsselected"); this.Assets.SaveAsset <Texture2D>("three", "Textures/Menu/forestfire"); this.Assets.SaveAsset <Texture2D>("threesel", "Textures/Menu/forestfireselected"); this.Assets.SaveAsset <Texture2D>("four", "Textures/Menu/readyfortakeoff"); this.Assets.SaveAsset <Texture2D>("foursel", "Textures/Menu/readyfortakeoffselected"); this.Assets.SaveAsset <Texture2D>("five", "Textures/Menu/finale"); this.Assets.SaveAsset <Texture2D>("fivesel", "Textures/Menu/finaleselected"); #endregion #region GUI //GUI. this.Assets.SaveAsset <Texture2D>("lightbeam", "GUI/LightBeam"); this.Assets.SaveAsset <Texture2D>("circletree", "GUI/CircleTree"); this.Assets.SaveAsset <Texture2D>("circle", "GUI/Circle"); #endregion #region Water //Water. this.Assets.SaveAsset <Texture2D>("wave", "Textures/Water/waves"); this.Assets.SaveAsset <Texture2D>("water", "Textures/Water/baseWater"); #endregion #region Terrain textures //Terrain textures. this.Assets.SaveAsset <Texture2D>("ash", "Textures/Ground/rock"); //Terrain ash. this.Assets.SaveAsset <Texture2D>("sand", "Textures/Ground/detailsand"); //Terrain sand. this.Assets.SaveAsset <Texture2D>("grass", "Textures/Ground/simplewetgrass"); //Terrain grass. this.Assets.SaveAsset <Texture2D>("drygrass", "Textures/Ground/simplegrass"); //Terrain drygrass. this.Assets.SaveAsset <Texture2D>("rock", "Textures/Ground/rock"); //Terrain rock. this.Assets.SaveAsset <Texture2D>("mud", "Textures/Ground/mud"); //Terrain mud. this.Assets.SaveAsset <Texture2D>("flowers", "Textures/Ground/wetflowers"); //Terrain flowers. this.Assets.SaveAsset <Texture2D>("drygrassflowers", "Textures/Ground/flowers"); //Terrain drygrassflowers. #endregion #region Height-, Texture and Modelmaps //Height-, Texture- and Modelmaps. //Tutorial. this.Assets.SaveAsset <Texture2D>("MMtutorial", "Textures/Modelmaps/MMTutorial"); this.Assets.SaveAsset <Texture2D>("HMtutorial", "Textures/Heightmaps/HMTutorial"); this.Assets.SaveAsset <Texture2D>("TMtutorial", "Textures/Texturemaps/TMTutorial"); this.Assets.SaveAsset <Texture2D>("SMtutorial", "Textures/ScoreMaps/SMTutorial"); //LevelZero. this.Assets.SaveAsset <Texture2D>("MMzero", "Textures/Modelmaps/MMLevelZero"); this.Assets.SaveAsset <Texture2D>("HMzero", "Textures/Heightmaps/HMLevelZero"); this.Assets.SaveAsset <Texture2D>("TMzero", "Textures/Texturemaps/TMLevelZero"); this.Assets.SaveAsset <Texture2D>("SMzero", "Textures/ScoreMaps/SMLevelZero"); //LevelOne. this.Assets.SaveAsset <Texture2D>("MMone", "Textures/Modelmaps/MMLevelOne"); this.Assets.SaveAsset <Texture2D>("HMone", "Textures/Heightmaps/HMLevelOne"); this.Assets.SaveAsset <Texture2D>("TMone", "Textures/Texturemaps/TMLevelOne"); this.Assets.SaveAsset <Texture2D>("SMone", "Textures/ScoreMaps/SMLevelOne"); //LevelTwo. this.Assets.SaveAsset <Texture2D>("MMtwo", "Textures/Modelmaps/MMLevelTwo"); this.Assets.SaveAsset <Texture2D>("HMtwo", "Textures/Heightmaps/HMLevelTwo"); this.Assets.SaveAsset <Texture2D>("TMtwo", "Textures/Texturemaps/TMLevelTwo"); this.Assets.SaveAsset <Texture2D>("SMtwo", "Textures/ScoreMaps/SMLevelTwo"); //LevelThree. this.Assets.SaveAsset <Texture2D>("MMthree", "Textures/Modelmaps/MMLevelThree"); this.Assets.SaveAsset <Texture2D>("HMthree", "Textures/Heightmaps/HMLevelThree"); this.Assets.SaveAsset <Texture2D>("TMthree", "Textures/Texturemaps/TMLevelThree"); this.Assets.SaveAsset <Texture2D>("SMthree", "Textures/ScoreMaps/SMLevelThree"); #endregion #region Controller spritesheets //Controller spritesheets. this.Assets.SaveAsset <Texture2D>("tutleftstick", "GUI/ControllerLeftStick"); this.Assets.SaveAsset <Texture2D>("tutrightstick", "GUI/ControllerRightStick"); #endregion #region Particles //Particles. this.Assets.SaveAsset <Texture2D>("fireparticle", "Textures/Particles/fire"); this.Assets.SaveAsset <Texture2D>("meteorparticle", "Textures/Particles/meteor"); this.Assets.SaveAsset <Texture2D>("sparkparticle", "Textures/Particles/spark"); this.Assets.SaveAsset <Texture2D>("spreadparticle", "Textures/Particles/flamespread"); #endregion #region Player hud //Player hud. this.Assets.SaveAsset <Texture2D>("healthbar", "Textures/healthbar"); this.Assets.SaveAsset <Texture2D>("lockedmeteorhud", "Textures/Hud/lockedMeteorHud"); this.Assets.SaveAsset <Texture2D>("meteorhud", "Textures/Hud/meteorHud"); #endregion //Load songs. this.Assets.SaveAsset <Song>("story", "Music/story"); this.Assets.SaveAsset <Song>("credits", "Music/credits"); this.Assets.SaveAsset <Song>("flamesmall", "Music/flame2v1"); this.Assets.SaveAsset <Song>("flamemedium", "Music/flame2v2"); this.Assets.SaveAsset <Song>("flamebig", "Music/flame on! grass"); //Load soundeffects. this.Assets.SaveAsset <SoundEffect>("collectmeteor", "Music/Soundeffects/collect meteor"); this.Assets.SaveAsset <SoundEffect>("treefall", "Music/Soundeffects/tree fall"); this.Assets.SaveAsset <SoundEffect>("watersplash", "Music/Soundeffects/water-splash-3"); this.Assets.SaveAsset <SoundEffect>("burnsomething", "Music/Soundeffects/matches-1"); this.Assets.SaveAsset <SoundEffect>("collectstar", "Music/Soundeffects/collect star"); //Load effects. this.Assets.SaveAsset <Effect>("bbeffect", "Effects/bbEffect"); this.Assets.SaveAsset <Effect>("sky", "Effects/SkyEffect"); this.Assets.SaveAsset <Effect>("particle", "Effects/ParticleEffect"); this.Assets.SaveAsset <Effect>("effect", "Effects/Effect"); this.Assets.SaveAsset <Effect>("terrain", "Effects/TerrainEffect"); this.Assets.SaveAsset <Effect>("water", "Effects/waterEffect"); this.Assets.SaveAsset <Effect>("wave", "Effects/waterEffect"); //Load texturecubes. this.Assets.SaveAsset <TextureCube>("sky", "Textures/skybox/greenhillscubemap"); //Load spritefonts. this.Assets.SaveAsset <SpriteFont>("font", "SpriteFont1"); Window.Title = "Little Flame"; #if XBOX gamerService = new GamerServicesComponent(this); Components.Add(gamerService); #endif base.Initialize(); }