/// <summary> /// Builds the constituant components. /// </summary> private void BuildComponents() { frame = new Frame(Width, Height, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Center, 0, 0), DrawLayer, Color.Black); FontGraphics nameFontGraphics = new FontGraphics(unit.Name, Width, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Top, 0, 10), DrawLayer, TextFormat.Shrink, Color.White, Resources.Textures.Debug); frame.Components.Add(nameFontGraphics); //Health bar Color healthColour = unit.CurrentHealth == 0 ? Color.Transparent : Color.Green; FontGraphics healthFontGraphics = new FontGraphics(string.Format(ResourceText, unit.CurrentHealth, unit.MaxHealth), Width, PositionProfileFactory.BuildCenteredRelative(), DrawLayer, TextFormat.Shrink, Color.White, Resources.Textures.Debug); Frame healthFrame = new Frame(Width, 50, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Top, 0, 50), DrawLayer, Color.Black); Frame health = new Frame(ZeroAdjustedWidth(unit.CurrentHealth, unit.MaxHealth), 50, new RelativePositionProfile(HorizontalAlign.Left, VerticalAlign.Center, 0, 0), DrawLayer, healthColour); healthFrame.Components.Add(health); healthFrame.Components.Add(healthFontGraphics); frame.Components.Add(healthFrame); //Energy bar Color energyColour = unit.CurrentEnergy == 0 ? Color.Transparent : Color.RoyalBlue; FontGraphics energyFontGraphics = new FontGraphics(string.Format(ResourceText, unit.CurrentEnergy, unit.MaxEnergy), Width, PositionProfileFactory.BuildCenteredRelative(), DrawLayer, TextFormat.Shrink, Color.White, Resources.Textures.Debug); Frame energyFrame = new Frame(Width, 50, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Top, 0, 100), DrawLayer, Color.Black); Frame energy = new Frame(ZeroAdjustedWidth(unit.CurrentEnergy, unit.MaxEnergy), 50, new RelativePositionProfile(HorizontalAlign.Left, VerticalAlign.Center, 0, 0), DrawLayer, energyColour); energyFrame.Components.Add(energy); energyFrame.Components.Add(energyFontGraphics); frame.Components.Add(energyFrame); }
private void BuildComponents() { // default textures defaultFrame = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), BackgroundColour); defaultFontGraphics = new FontGraphics(Text, Width, 20, PositionProfileFactory.BuildCenteredRelative(), FontFlow.Shrink, TextColour, Textures.ButtonFont); defaultFrame.Components.Add(defaultFontGraphics); defaultFrame.Initialise(this.GetBounds()); // hover textures hoverFrame = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), HoverBackgroundColour); hoverFontGraphics = new FontGraphics(Text, Width, 20, PositionProfileFactory.BuildCenteredRelative(), FontFlow.Shrink, HoverTextColour, Textures.ButtonFont); hoverFrame.Components.Add(hoverFontGraphics); hoverFrame.Initialise(this.GetBounds()); //focus textures focusFrame = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), FocusBackgroundColour); focusFontGraphics = new FontGraphics(Text, Width, 20, PositionProfileFactory.BuildCenteredRelative(), FontFlow.Shrink, FocusTextColour, Textures.ButtonFont); focusFrame.Components.Add(focusFontGraphics); focusFrame.Initialise(this.GetBounds()); this.frame = this.Focus ? this.focusFrame : this.defaultFrame; }
public RpgGame(GameWindow window, ContentManager contentManager) : base(window, contentManager) { FontGraphics.LoadContent(contentManager); RpgGraphics.LoadContent(contentManager); var startScreen = new StartScreen(); NextLevel(startScreen); }
private void BuildComponents() { defaultFontGraphics = new FontGraphics(Text, Width, 0, PositionProfile, FontFlow.Shrink, TextColour, Textures.HeadingFont); defaultFontGraphics.Initialise(this.GetBounds()); hoverFontGraphics = new FontGraphics(Text, Width, 0, PositionProfile, FontFlow.Shrink, HoverTextColour, Textures.HeadingFont); hoverFontGraphics.Initialise(this.GetBounds()); this.fontGraphics = this.defaultFontGraphics; }
public SurfingGame(GameWindow window, ContentManager contentManager) : base(window, contentManager) { FontGraphics.LoadContent(contentManager); CommonGraphics.LoadContent(contentManager); SurfingGraphics.LoadContent(contentManager); var level = new SurfLevel(); NextLevel(level); }
public TopDown(GameWindow window, ContentManager contentManager) : base(window, contentManager) { FontGraphics.LoadContent(contentManager); SpaceGraphics.LoadSpaceContent(contentManager); SpaceSounds.LoadSpaceSounds(contentManager); var level = new StartScreen(); NextLevel(level); }
/// <summary> /// Builds the constituant components. /// </summary> private void BuildComponents(Color defaultBackgroundColour, Color defaultTextColour, Color hoverBackgroundColour, Color hoverTextColour) { FontGraphics defaultFontGraphics = new FontGraphics(text, Width, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Center, 0, 0), DrawLayer, TextFormat.Shrink, defaultTextColour, Resources.Textures.Debug); defaultFrame = new Frame(Width, Height, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Center, 0, 0), DrawLayer, defaultBackgroundColour); defaultFrame.Components.Add(defaultFontGraphics); FontGraphics hoverFontGraphics = new FontGraphics(text, Width, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Center, 0, 0), DrawLayer, TextFormat.Shrink, hoverTextColour, Resources.Textures.Debug); hoverFrame = new Frame(Width, Height, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Center, 0, 0), DrawLayer, hoverBackgroundColour); hoverFrame.Components.Add(hoverFontGraphics); frame = defaultFrame; }
private void BuildComponents() { frame = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), BackgroundColour); fontGraphics = new FontGraphics(Text, Width, Gutter, PositionProfileFactory.BuildTopLeftRelative(), FontFlow.Wrap, TextColour, Textures.TooltipFont); frame.Components.Add(fontGraphics); frame.Initialise(this.GetBounds()); //TO-DO Fix this f*****g shit /* * Now that the dimensions are assigned for the fontGraphics, * assign the known height to Tooltip and rebuild the frame * using it. */ int adjustedHeight = fontGraphics.Height + (Gutter * 2); this.Height = adjustedHeight; frame.Height = adjustedHeight; frame.Initialise(this.GetBounds()); }
protected override void HoverLeaveDetail() { this.fontGraphics = this.defaultFontGraphics; }
protected override void HoverDetail() { this.fontGraphics = this.hoverFontGraphics; }