public MainMenuScreen(Game Game) : base(Game, GeneralManager.ScreenX, GeneralManager.ScreenY) { NewGameButton = new Button(GeneralManager.GetPartialRect(0, 0.4f, 0.2f, 0.1f), " New Game ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]); NewGameButton.Action = NewGameButtonClick; NewGameButton.TextOffset = new Vector2(0, 10); LoadGameButton = new Button(GeneralManager.GetPartialRect(0, 0.5f, 0.2f, 0.1f), " Load Game ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]); LoadGameButton.Action = NewGameButtonClick; LoadGameButton.TextOffset = new Vector2(0, 10); OptionsButton = new Button(GeneralManager.GetPartialRect(0, 0.6f, 0.2f, 0.1f), " Options ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]); OptionsButton.Action = NewGameButtonClick; OptionsButton.TextOffset = new Vector2(0, 10); CreditsButton = new Button(GeneralManager.GetPartialRect(0, 0.7f, 0.2f, 0.1f), " Credits ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]); CreditsButton.Action = NewGameButtonClick; CreditsButton.TextOffset = new Vector2(0, 10); ExitButton = new Button(GeneralManager.GetPartialRect(0, 0.8f, 0.2f, 0.1f), " Exit ", GeneralManager.Textures["GUI/MainMenuGraphics/Button"], Color.Gray, Color.White, GeneralManager.Fonts["Fonts/28DaysLater"]); ExitButton.Action = ExitGameButtonClick; ExitButton.TextOffset = new Vector2(0, 10); this.AddGUI(NewGameButton); this.AddGUI(LoadGameButton); this.AddGUI(OptionsButton); this.AddGUI(CreditsButton); this.AddGUI(ExitButton); BSS = new BlackScreenSwitch(); BSS.SwitchState = SceneSwitchEffect.State.SwitchOn; Renderer.AddPostProcess(BSS, "Switch"); m = SoundEngine.PlayLooped("Content/Sounds/Ambient/menu_theme.mp3"); }
public Chest(Rectangle r, Map m) : base(m) { Body BodyDec = new Body(m.PhysicalWorld); BodyDec.BodyType = BodyType.Static; PolygonShape S = new PolygonShape(1f); S.SetAsBox(r.Width / 2, r.Height / 2); Fixture = BodyDec.CreateFixture(S); Fixture.Restitution = 1f; Fixture.Friction = 10f; Position = r; SetName("Chest"); items = new List <Item>(); ChestWindow = new Window(GeneralManager.GetPartialRect(0.4f, 0.2f, 0.2f, 0.6f)); ChestWindow.BgTex = GeneralManager.Textures["GUI/InGameGUI/ChestMenuBg"]; ChestWindow.Visible = false; CloseButton = new Button(new Rectangle(ChestWindow.Position.Width - 32, 8, 24, 24), "", GeneralManager.Textures["GUI/InGameGUI/CloseButton"], Color.Gray, Color.White, null); CloseButton.Action = CloseChestWindow; ChestWindow.AddGUI(CloseButton); list = new ListBox(new Rectangle(16, 16, ChestWindow.Position.Width - 24, ChestWindow.Position.Height - 32)); ChestWindow.AddGUI(list); Map.Parent.AddGUI(ChestWindow); }
public WorldScreen(Game Game) : base(Game, GeneralManager.ScreenX, GeneralManager.ScreenY) { GeneralManager.LoadAnimation("TestAnim", Vector2.One * 64, 6, 80); GeneralManager.LoadAnimation("PlayerIdle", Vector2.One * 64, 1, 10000); DebugWindow.Visible = false; DebugWindow.AddGUI(FarseerDebugCheck, DebugWindow); AddGUI(DebugWindow); LE = new LightingEngine(); Color a = new Color(ambient, ambient, ambient); LE.SetAmbient(a, a); //LE.SetAmbient(Color.Gray, Color.Gray); Renderer.AddRendererEffect(LE, "LightingEngine"); LoadContent(); Map = new Map(this, tileSize, mapSize); //Renderer.AddPostProcess(new BlurEffect(), "Blur"); SE = new BlurSwitchEffect(); SE.MaxTime = 1f; SE.TurnOffAction = delegate() { Renderer.RemovePostProcess("Switch"); }; Renderer.AddPostProcess(SE, "Switch"); Camera.Init(GeneralManager.GetPartialRect(0, 0, 1, 1), new Rectangle(0, 0, tileSize * mapSize, tileSize * mapSize)); PlayerLight = new SpotLight() { IsEnabled = true, Color = new Vector4(0.9f, .7f, .7f, 1f), Power = .6f, LightDecay = 600, Position = new Vector3(500, 400, 20), SpotAngle = 1.5f, SpotDecayExponent = 3, Direction = new Vector3(0.244402379f, 0.969673932f, 0) }; LE.AddLight(PlayerLight); Debug = new FarseerPhysics.DebugViews.DebugViewXNA(Map.PhysicalWorld); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Shape); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.AABB); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.PerformanceGraph); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Joint); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.ContactPoints); Debug.DefaultShapeColor = Color.White; Debug.SleepingShapeColor = Color.LightGray; Debug.LoadContent(Parent.GraphicsDevice, Parent.Content); //Weapon w = new Weapon("test", "Gun", 100, 10, Hands.One, 10, 600, 10, 10, 10); //Serializer.Serialize<Weapon>("weapon.xml", w); }
public override void EndEffect() { Renderer.SpriteBatch.Begin(); if (SwitchState == State.SwitchOff) { Renderer.SpriteBatch.Draw(BlackTex, GeneralManager.GetPartialRect(0, 0, 1, 1), new Color(1f, 1f, 1f, 1f - Time / MaxTime)); } else { Renderer.SpriteBatch.Draw(BlackTex, GeneralManager.GetPartialRect(0, 0, 1, 1), new Color(1f, 1f, 1f, Time / MaxTime)); } Renderer.SpriteBatch.End(); }
public override void Draw(GameTime GameTime) { Renderer.Draw(GeneralManager.Textures["GUI/MainMenuGraphics/CloudLayer"], GeneralManager.GetPartialRect(CloudsOffset + MouseOffset / 30f + 0.05f, 0, 1.1f, 1)); Renderer.Draw(GeneralManager.Textures["GUI/MainMenuGraphics/CloudLayer"], GeneralManager.GetPartialRect(CloudsOffset - 1 + MouseOffset / 30f - 0.05f, 0, 1.1f, 1)); Renderer.Draw(GeneralManager.Textures["GUI/MainMenuGraphics/CityMainLayer"], GeneralManager.GetPartialRect(MouseOffset / 150f - 0.05f, 0, 1.1f, 1)); Renderer.Draw(GeneralManager.Textures["GUI/MainMenuGraphics/CitySecondaryLayer"], GeneralManager.GetPartialRect(-MouseOffset / 100f - 0.05f, 0, 1.1f, 1)); Rectangle FogPos = GeneralManager.GetPartialRect(FogOffset - 1 - MouseOffset / 30f - 0.05f, 0, 1.1f, 1); Renderer.Draw(GeneralManager.Textures["GUI/MainMenuGraphics/FogLayer"], FogPos); Renderer.Draw(GeneralManager.Textures["GUI/MainMenuGraphics/FogLayer"], new Rectangle(FogPos.X + (int)(GeneralManager.ScreenX * 1.1f), FogPos.Y, FogPos.Width, FogPos.Height)); base.Draw(GameTime); }