public Game1() { graphics = new GraphicsDeviceManager(this); graphics.DeviceCreated += new EventHandler<EventArgs>(graphics_DeviceCreated); // graphics.ApplyChanges(); Content.RootDirectory = "Content"; // if (graphics.GraphicsDevice == null) // { // CCLog.Log("FOO"); // } graphics.IsFullScreen = false; // Frame rate is 30 fps by default for Windows Phone. // Divide by 2 to make it 60 fps TargetElapsedTime = TimeSpan.FromTicks(333333 / 2); IsFixedTimeStep = true; IsMouseVisible = true; // Extend battery life under lock. //InactiveSleepTime = TimeSpan.FromSeconds(1); CCApplication application = new AppDelegate(this, graphics); Components.Add(application); #if !WINDOWS_PHONE && !XBOX && !WINDOWS GamerServicesComponent component = new GamerServicesComponent(this); this.Components.Add(component); #endif }
SpriteBatch spriteBatch; // this is for FPS counter #endregion Fields #region Constructors public GameMain() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "main"; #if XBOX // Create Gamer Service Component SignedInGamer.SignedOut += new EventHandler<SignedOutEventArgs>(SignedInGamer_SignedOut); GamerServicesComponent gamerServiceComp = new GamerServicesComponent(this); Components.Add(gamerServiceComp); #if DEBUG Guide.SimulateTrialMode = true; #endif #endif // Create the screen factory and add it to the Services screenFactory = new ScreenFactory(); Services.AddService(typeof(IScreenFactory), screenFactory); // Create the screen manager component. screenManager = new ScreenManager(this); Components.Add(screenManager); // On Windows and Xbox we just add the initial screens AddInitialScreens(); }
public Main() { gamerServices = new GamerServicesComponent(this); graphics = new GraphicsDeviceManager(this); //graphics.IsFullScreen = true; graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; Content.RootDirectory = "Content"; contentPool = new ContentPool(Content); objectPool = new ObjectPool(contentPool); gameCore = new GameCore(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, contentPool, objectPool, graphics, this); }
public Silhouetta() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.graphics.PreferredBackBufferWidth = 1920; this.graphics.PreferredBackBufferHeight = 1280; screenManager = new ScreenManager(this); gamerServicesComponent = new GamerServicesComponent(this); Components.Add(screenManager); Components.Add(gamerServicesComponent); screenManager.AddScreen(new StartScreen(), null); }
protected override void Update(GameTime gameTime) { if (gamerServices != null) { try { gamerServices.Update(gameTime); } catch { gamerServices = null; } } gameCore.Update(gameTime); base.Update(gameTime); }
public LbKStudiosGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //apparently for 1080p this.graphics.PreferredBackBufferWidth = 1920; this.graphics.PreferredBackBufferHeight = 1080; screenManager = new ScreenManager(this); gamerServicesComponent = new GamerServicesComponent(this); Components.Add(screenManager); Components.Add(gamerServicesComponent); screenManager.AddScreen(new Credits(), null); }
// The main game constructor. public MeatieroidsGame() { Content.RootDirectory = "Content"; graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; // Register required components with the game - ScreenManager and Networking // Gamer services for live integration gamerServices = new GamerServicesComponent(this); Components.Add(gamerServices); // Create the screen manager component. screenManager = new ScreenManager(this); Components.Add(screenManager); // add the background and main menu screens to start the game screenManager.AddScreen(new BackgroundScreen()); screenManager.AddScreen(new SplashScreen()); }
/// <summary> /// The main game constructor. /// </summary> public GameStateManagementGame() { Content.RootDirectory = "Content"; graphics = new GraphicsDeviceManager(this); //TargetElapsedTime = TimeSpan.FromTicks(333333); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; graphics.PreferMultiSampling = true; #if !DEBUG graphics.IsFullScreen = true; #endif // Create the screen factory and add it to the Services screenFactory = new ScreenFactory(); Services.AddService(typeof(IScreenFactory), screenFactory); // Create the screen manager component. screenManager = new ScreenManager(this); Components.Add(screenManager); GamerServicesComponent gamer = new GamerServicesComponent(this); Components.Add(gamer); #if DEBUG // Add the frame rate monitor // Components.Add(new FrameRateMonitor(this)); Components.Add(new FrameRateMonitor(this, false)); // don’t wait for display #endif Components.Add(new TextFader(this)); // On Windows and Xbox we just add the initial screens AddInitialScreens(); }
public Silhouetta() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //apparently for 1280p //this.graphics.PreferredBackBufferWidth = 1920; //this.graphics.PreferredBackBufferHeight = 1280; this.graphics.PreferredBackBufferWidth = 1280; this.graphics.PreferredBackBufferHeight = 720; //graphics.ToggleFullScreen(); screenManager = new ScreenManager(this); gamerServicesComponent = new GamerServicesComponent(this); emitterSystem = new ParticleSystem(this, "EmitterSettings") { DrawOrder = ParticleSystem.AlphaBlendDrawOrder }; Components.Add(emitterSystem); Components.Add(screenManager); Components.Add(gamerServicesComponent); screenManager.AddScreen(new StartScreen(emitterSystem), null); }
public override void LoadContent() { base.LoadContent (); if (content == null) content = new ContentManager (ScreenManager.Game.Services, "Content"); logo = content.Load<Texture2D>("facetroids" + (Util.IsIpad ? "-ipad" : "")); var center = new GamerServicesComponent (Util.MainGame); if (Util.CanUseGameCenter) { Guide.ShowSignIn (1, false); Util.SubmitScores (); } }
/// <summary> /// Create base game /// </summary> /// <param name="setWindowsTitle">Set windows title</param> protected BaseGame(string setWindowsTitle) { ToggleFormVisibility(false); gamerServicesComponent = new GamerServicesComponent(this); base.Components.Add(gamerServicesComponent); // Set graphics graphicsManager = new GraphicsDeviceManager(this); graphicsManager.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>( graphics_PrepareDevice); #if DEBUG // Disable vertical retrace to get highest framerates possible for // testing performance. graphicsManager.SynchronizeWithVerticalRetrace = false; #endif // Update as fast as possible, do not use fixed time steps. // The whole game is designed this way, if you remove this line // the car will not behave normal anymore! this.IsFixedTimeStep = false; // Init content manager BaseGame.content = base.Content; base.Content.RootDirectory = String.Empty; // Update windows title (used for unit testing) this.Window.Title = setWindowsTitle; remWindowsTitle = setWindowsTitle; }
/// <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 base.Initialize(); initializeScreen(); Settings.initialize(this); #if XBOX Settings.getInstance().IsUsingMouse_ = false; #else if (GamePad.GetState(PlayerIndex.One).IsConnected) { Settings.getInstance().IsUsingMouse_ = false; } else { Settings.getInstance().IsUsingMouse_ = true; } #endif try { // Debugging - Uncomment this line to try PC version as if it // were running with the Redistributable runtime in which // GamerServices is not available // Note that this is not a truly accurate test, as there could // be lurking calls to GamerServices outside of a block which // tests Settings.IsGamerServicesAllowed_ prior to using // throw new Exception(); GamerServicesComponent gsc = new GamerServicesComponent(this); gsc.Initialize(); this.Components.Add(gsc); Settings.getInstance().IsGamerServicesAllowed_ = true; } catch { Settings.getInstance().IsGamerServicesAllowed_ = false; } // creating EngineStateStart must come AFTER setting the // IsGamerServicesAllowed_ member of Settings this.engineState_ = new EngineStateSplash(this); int tiles = (int)((GraphicsDevice.Viewport.Height / 15) * (GraphicsDevice.Viewport.Width / 15) * 1.2); tiles += 350; DrawBuffer.initialize(tiles, spriteBatch_); DrawBuffer_ = DrawBuffer.getInstance(); UpdateThread_ = new UpdateThread(this, engineState_); RenderThread_ = new RenderThread(); UpdateThread_.Controls_ = Controls_; UpdateThread_.startThread(); }
public override void Initialize () { #if XBOX _Component = new GamerServicesComponent(Game); _Component.Initialize(); #endif }
/// <summary> /// Constructs a new screen manager component. /// </summary> public ScreenManager(Game game) : base(game) { gamerServicesComponent = new GamerServicesComponent(Game); Game.Components.Add(gamerServicesComponent); }
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(); }
/// <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 base.Initialize(); REngine.Instance._graphics = graphics; //REngine.Instance._resourceContent = new ResourceContentManager(Services, Resources.ResourceManager); #if !XBOX //REngine.Instance._systemfont = REngine.Instance._resourceContent.Load<SpriteFont>("Arial"); #else //REngine.Instance._systemfont = REngine.Instance._resourceContent.Load<SpriteFont>("Tahoma1"); #endif game.Init(); #if XBOX services = new GamerServicesComponent(this); services.Initialize(); this.Components.Add(services); #endif //pmv = new pmv1(this, graphics); //pmv.Initialize(); //Components.Add(pmv); #if !XBOX //this.TargetElapsedTime = TimeSpan.FromMilliseconds(1.0); //this.InactiveSleepTime = TimeSpan.FromMilliseconds(1.0); //this.IsFixedTimeStep = false; #endif //graphics.PreferredBackBufferFormat = SurfaceFormat.Color; //graphics.PreferredDepthStencilFormat = DepthFormat.Depth32; #if !XBOX this.graphics.SynchronizeWithVerticalRetrace = true; this.graphics.PreferMultiSampling = false; #else this.graphics.SynchronizeWithVerticalRetrace = true; this.graphics.PreferMultiSampling = false; #endif this.graphics.ApplyChanges(); #if !XBOX || !XBOX360 //this.graphics.MinimumPixelShaderProfile = ShaderProfile.PS_3_0; //this.graphics.MinimumVertexShaderProfile = ShaderProfile.VS_3_0; #endif game.Load(); }
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 }
public Shorewood() { graphics = new GraphicsDeviceManager(this); threadPool = new ThreadPoolComponent(this); inputHandler = new InputHandler(this); inputHandler.AddEvent(Buttons.Back, new EventHandler<ButtonFireEventArgs>(OnPause)); inputHandler.AddEvent(Buttons.Start, new EventHandler<ButtonFireEventArgs>(OnPause)); storageScreen = new StorageScreen(this); foundWordAnimator = new FoundWordAnimationRenderer(this); constantBackground = new ConstantBackground(this); fluidSolver = new FluidSolverComponent(this); scoreBox = new ScoreBox(this); particleSystem = new UniversalParticleSystem(this); constantBackground.Enabled = false; constantBackground.Visible = false; foundWordAnimator.Enabled = false; foundWordAnimator.Visible = false; graphics.PreferredBackBufferWidth = PlatformDisplaySettings.width; graphics.PreferredBackBufferHeight = PlatformDisplaySettings.height; fluidSolver.Differences = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); IsFixedTimeStep = false; Shorewood.Content = base.Content; Content.RootDirectory = "Content"; scale = graphics.PreferredBackBufferHeight / 1000.0f; soundTrack = new SoundTrack(this); ninthPlanetGames = new NinthPlanetGames.SplashScreen(this); ninthPlanetGames.Visible = true; ninthPlanetGames.Enabled = true; bloom = new BloomComponent(this); loadingPosition = (new Vector2(PlatformDisplaySettings.width / 2, PlatformDisplaySettings.height / 2)); graphics.PreparingDeviceSettings += OnPreparingDeviceSettings; ShorewoodPool.InitalizePools(); physicsEngine = new PhysicsSimulator(new Vector2(0, 100)); #if XBOX services = new GamerServicesComponent(this); Components.Add(services); #endif Components.Add(threadPool); storage = new StorageHandler(); Components.Add(inputHandler); Components.Add(storage.sharedSaveDevice); Components.Add(soundTrack); Components.Add(fluidSolver); Components.Add(ninthPlanetGames); avatar2DAnimation = new Avatar2DAnimation(this); Components.Add(avatar2DAnimation); //Components.Add(ietGames); }