public override void Initialize(bool addToManagers) { base.Initialize(addToManagers); screenTitle = new Text(); screenTitle.DisplayText = "Main Menu"; Vector2 titlePosition = PositionHelper.percentToCoordSprite(0.0f, 50.0f); screenTitle.Y = titlePosition.Y; screenTitle.HorizontalAlignment = HorizontalAlignment.Center; TextManager.AddText(screenTitle); GuiManager.IsUIEnabled = true; menuList = GuiManager.AddListBox(); menuList.ScaleX = 10; menuList.ScaleY = 10; menuList.ScrollBarVisible = false; Vector2 menuPosition = PositionHelper.percentToCoordGUI(50.0f, 50.0f); menuList.Y = menuPosition.Y; menuList.AddItem("Single Player", GameState.SongSelection); menuList.AddItem("Options", GameState.Options); menuList.AddItem("Quit", GameState.QuitGame); menuList.HighlightItem("Single Player"); menuList.CallClick(); if (addToManagers) { AddToManagers(); } }
public override void Initialize(bool addToManagers) { base.Initialize(addToManagers); screenTitle = new Text(); screenTitle.DisplayText = "Options"; Vector2 titlePosition = PositionHelper.percentToCoordSprite(0.0f, 50.0f); screenTitle.Y = titlePosition.Y; screenTitle.HorizontalAlignment = HorizontalAlignment.Center; TextManager.AddText(screenTitle); GuiManager.IsUIEnabled = true; listBox = GuiManager.AddListBox(); listBox.ScaleX = 20; listBox.ScaleY = 12; // The first argument to AddItem is the text to show for the item // The second argument is the object that the Item will store. // The second argment is optional, but we'll use it to reference // the background color that we want to use. listBox.AddItem("Red", Color.Red); listBox.AddItem("Blue", Color.Blue); listBox.AddItem("Yellow", Color.Yellow); for (int i = 0; i < 200; i++) { listBox.AddItem("BLAAA" + i); } if (addToManagers) { AddToManagers(); } }
public static Text CreateText() { Text text = TextManager.AddText("Text"); text.X = Camera.X; text.Y = Camera.Y; text.Name = "Text"; mScene.Texts.Add(text); // If the view is orthogonal, then we're going to assume that it's a pixel-perfect // screen. if (SpriteManager.Camera.Orthogonal) { text.Scale = .5f * text.Font.LineHeightInPixels / 1;// camera.PixelsPerUnitAt(ref this.Position); text.Spacing = text.Scale; text.NewLineDistance = (float)System.Math.Round(text.Scale * 1.5f); text.DisplayText = text.DisplayText; // refresh what's viewable } StringFunctions.MakeNameUnique <Text>(text, mScene.Texts); return(text); }
public Hero(string name, HeroClass heroClass) { Collect = false; Online = TimeSpan.Zero; Target = Position; AcceptArrows = true; zLastPosition = Position; Netid = 0; Name = name; Class = heroClass; Position.Z = ZLayer.Npc; WalkingSpeed = 10; SpriteManager.AddPositionedObject(this); Collider = ShapeManager.AddCircle(); Collider.AttachTo(this, false); Collider.Visible = false; Sprite = LoadSprite(); Sprite.AttachTo(this, false); Sprite.Resize(4); Sprite.AnimationSpeed = 0.1f; Label = TextManager.AddText(name, Globals.Font); Label.AttachTo(this, false); Label.HorizontalAlignment = HorizontalAlignment.Center; Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z); InitStats(); }
public override void Initialize(bool addToManagers) { base.Initialize(addToManagers); screenTitle = new Text(); screenTitle.DisplayText = "Song Selection"; Vector2 titlePosition = PositionHelper.percentToCoordSprite(0.0f, 80.0f); screenTitle.Y = titlePosition.Y; screenTitle.HorizontalAlignment = HorizontalAlignment.Center; TextManager.AddText(screenTitle); GuiManager.IsUIEnabled = true; listBox = GuiManager.AddListBox(); listBox.ScaleX = 10; listBox.ScaleY = 20; for (int i = 0; i < 200; i++) { listBox.AddItem("Song " + i); } if (addToManagers) { AddToManagers(); } }
private void InitLabel() { Label = TextManager.AddText(Name, Globals.Font); Label.AttachTo(this, false); Label.HorizontalAlignment = HorizontalAlignment.Center; Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z); }
public void CopyCurrentObjects() { // for now ignore attachments - just copy whatever's selected. foreach (Sprite sprite in mCurrentSprites) { Sprite newSprite = sprite.Clone(); StringFunctions.MakeNameUnique <Sprite>(newSprite, EditorData.BlockingScene.Sprites); EditorData.BlockingScene.Sprites.Add(newSprite); SpriteManager.AddSprite(newSprite); } foreach (SpriteFrame spriteFrame in mCurrentSpriteFrames) { SpriteFrame newSpriteFrame = spriteFrame.Clone(); StringFunctions.MakeNameUnique <SpriteFrame>(newSpriteFrame, EditorData.BlockingScene.SpriteFrames); EditorData.BlockingScene.SpriteFrames.Add(newSpriteFrame); SpriteManager.AddSpriteFrame(newSpriteFrame); } foreach (PositionedModel positionedModel in mCurrentPositionedModels) { PositionedModel newPositionedModel = positionedModel.Clone(EditorData.ContentManagerName); StringFunctions.MakeNameUnique <PositionedModel>(newPositionedModel, EditorData.BlockingScene.PositionedModels); EditorData.BlockingScene.PositionedModels.Add(newPositionedModel); ModelManager.AddModel(newPositionedModel); } foreach (Text text in mCurrentTexts) { Text newText = text.Clone(); StringFunctions.MakeNameUnique <Text>(newText, EditorData.BlockingScene.Texts); EditorData.BlockingScene.Texts.Add(newText); TextManager.AddText(newText); } }
/// <summary> /// Initialize all manangers and informations. /// </summary> protected override void Initialize() { // Creates debug font debugFont = FontManager.CreateFont("DebugFont", "Font/SmallArial"); // Initialize input manager InputManager.Initialize(); // Initialize viewer Viewer.Initialize(); // Initialize text manager TextManager.Initialize(); // Initialize FPS counter FpsCounter.Initialize(); // Add FPS info Vector2 pos = new Vector2(0, 0); pos = ClampSafeArea(pos); textFPS = TextManager.AddText(debugFont, string.Format("FPS : {0}", FrameworkCore.FpsCounter.Fps.ToString()), (int)pos.X, (int)pos.Y, Color.White); #if DEBUG textFPS.Visible = true; #else textFPS.Visible = false; #endif base.Initialize(); System.Diagnostics.Debug.WriteLine("Framework Initialize OK..."); }
public void Activity() { if (isTimed == true) { if (isActive == true) { timeLeft = endTime - TimeManager.CurrentTime; TextManager.RemoveText(counter); counter = TextManager.AddText("" + (int)(timeLeft)); counter.Spacing = 2f; counter.Scale = 2.5f; counter.X = this.X; counter.Y = this.Y + 5; if (timeLeft < 0) { TextManager.RemoveText(counter); ShapeManager.Remove(frbCollision); } if (timeLeft < -8) { endTime = -1; timeLeft = 999; isActive = false; CreateCollision(); } } } }
static VGPChoice GetChoiceNode(string line, VGPBlock parent, ref TextManager tm) { var m = choice_re.Match(line); if (!m.Success) { throw new Exception("Invalid Choice!"); } var tag = m.Groups[1].Value; var text = UnescapeTextString(m.Groups[2].Value); var condition = m.Groups[3].Value; var to_interpolate = IsToInterpolate(text, line, ref tm); var hash = tm.AddText(parent.Label, text); if (string.IsNullOrEmpty(m.Groups[1].Value)) { return(new VGPChoice.VGPAnonymousChoice(hash, parent, to_interpolate, condition)); } else { return(new VGPChoice.VGPNamedChoice(tag, hash, parent, to_interpolate, condition)); } }
public override void Initialize() { //Create background sprite Sprite Background = SpriteManager.AddSprite(Global.STORY_BG, FlatRedBallServices.GlobalContentManager, m_Layer); //Resize sprite Background.ScaleX = Background.Texture.Width / SpriteManager.Camera.PixelsPerUnitAt(0) / 2.0f; Background.ScaleY = Background.Texture.Height / SpriteManager.Camera.PixelsPerUnitAt(0) / 2.0f; //Create story Text Story = TextManager.AddText(m_Text, m_Layer); Story.HorizontalAlignment = HorizontalAlignment.Center; //Set story's font Story.Font = new BitmapFont( Global.CONTENT_FOLDER + Global.FONT_FOLDER + Global.STORY_FONT + ".tga", Global.CONTENT_FOLDER + Global.FONT_FOLDER + Global.STORY_FONT + ".fnt", FlatRedBallServices.GlobalContentManager); //Set position Story.Y = Global.STORY_Y; Story.Z = Global.STORY_Z; Story.RotationX = Global.STORY_ANGLE; Story.ZVelocity = -Global.STORY_SPEED; Story.YVelocity = Global.STORY_SPEED; }
public static void AddText() { Text text = TextManager.AddText("Text"); mBlockingScene.Texts.Add(text); text.Name = "Text"; StringFunctions.MakeNameUnique <Text>(text, mBlockingScene.Texts); }
public override void SetSkin(GuiSkin guiSkin) { //base.SetSkin(guiSkin); if (mTextObject == null) { mTextObject = TextManager.AddText(mText); GuiManagerDrawn = false; } }
public EditingLogic() { mNewConnectionLine = new Line(); mCurrentNodesReadOnly = new ReadOnlyCollection <PositionedNode>(mCurrentNodes); mDebugText = TextManager.AddText(""); mReactiveHud = new ReactiveHud(); }
public void AddToManagers(Layer layer) { CurrentSelectableState = SelectableState.NotSelected; SpriteManager.AddSpriteFrame(_backgroundSprite); GuiManager.AddWindow(this); TextManager.AddText(_label); TextManager.AddToLayer(_label, layer); Layer = layer; }
static void CreateTextIfNecessary() { if (mText == null) { mText = TextManager.AddText(""); mLayer = SpriteManager.TopLayer; TextManager.AddToLayer(mText, mLayer); mText.AttachTo(SpriteManager.Camera, false); mText.VerticalAlignment = VerticalAlignment.Top; mText.AdjustPositionForPixelPerfectDrawing = true; } }
public static Text CopyTextHierarchy(Text textToCopy, Text parentText, float pixelSize) { Text newText = textToCopy.Clone(); TextManager.AddText(newText); newText.Name = textToCopy.Name; StringFunctions.MakeNameUnique <Text>(newText, Scene.Texts); Scene.Texts.Add(newText); return(newText); }
// Generated AddToManagers public override void AddToManagers() { TextManager.AddText(TextInstance); if (TextInstance.Font != null) { TextInstance.SetPixelPerfectScale(SpriteManager.Camera); } if (TextInstance.Font != null) { TextInstance.SetPixelPerfectScale(mLayer); } base.AddToManagers(); AddToManagersBottomUp(); CustomInitialize(); }
protected bool Collect; //used to signal running events that this window has been destroyed public Window(Window owner = null, bool modal = false, string sprite = "") { if (owner != null && modal) { throw new ArgumentException("Child cannot be modal"); } Collect = false; Immovable = false; zEventEscape = null; zModal = modal; Name = string.Empty; zOrigin = new Vector2(0, 0); if (sprite == "") { zSprite = SpriteManager.AddSprite(Path.Make(Path.Misc, "pixel.bmp")); } else { zSprite = SpriteManager.AddSprite(sprite); } zSprite.ColorOperation = ColorOperation.ColorTextureAlpha; Color = Color.White; zVisible = true; OnClick = delegate() { }; Hover = delegate() { }; HoverMousedown = delegate() { }; MouseLeave = delegate() { }; MouseEnter = delegate() { }; zParent = owner; zChildren = new List <Window>(); zText = TextManager.AddText(string.Empty, Globals.Font); zText.ColorOperation = ColorOperation.ColorTextureAlpha; zText.AttachTo(zSprite, false); Size = new Vector2(1, 1); if (owner == null) { InitializeAsTopLevel(); } else { InitializeAsChild(); } SpriteManager.AddToLayer(zSprite, zLayer); TextManager.AddToLayer(zText, zLayer); zSprite.AttachTo(Camera.Main, true); }
public Button(GuiSkin guiSkin, Cursor cursor) : base(guiSkin, cursor) { mUpSkin = guiSkin.ButtonSkin; mDownSkin = guiSkin.ButtonDownSkin; mTextObject = TextManager.AddText(this.Text, guiSkin.ButtonSkin.Font); mTextObject.HorizontalAlignment = HorizontalAlignment.Center; mTextObject.VerticalAlignment = VerticalAlignment.Center; mTextObject.AttachTo(SpriteFrame, false); mTextObject.RelativeZ = -.001f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z; SetTexturePropertiesFromSkin(mUpSkin); ScaleX = 1; ScaleY = 1; }
public ReactiveHud() { mCameraBounds = new CameraBounds(EditorData.BoundsCamera); mCurrentAxisAlignedRectangleHighlight = ShapeManager.AddAxisAlignedRectangle(); mCurrentAxisAlignedRectangleHighlight.Visible = false; mCurrentAxisAlignedCubeHighlight = ShapeManager.AddAxisAlignedRectangle(); mCurrentAxisAlignedCubeHighlight.Visible = false; mCurrentCircleHighlight = ShapeManager.AddAxisAlignedRectangle(); mCurrentCircleHighlight.Visible = false; mCurrentSphereHighlight = ShapeManager.AddAxisAlignedRectangle(); mCurrentSphereHighlight.Visible = false; mCrossHair = new Crosshair(); mCrossHair.Visible = false; float screensize = 5f; Vector3 forwardVector = MathFunctions.ForwardVector3; Matrix rotationMatrix = SpriteManager.Camera.RotationMatrix; MathFunctions.TransformVector(ref forwardVector, ref rotationMatrix); float planeDistance = Vector3.Dot(forwardVector, -SpriteManager.Camera.Position); float planeScreenHeight = 2f * planeDistance * (float)Math.Tan((double)SpriteManager.Camera.FieldOfView); float planeScreenWidth = planeScreenHeight / SpriteManager.Camera.FieldOfView; float width = screensize * planeScreenWidth / (float)SpriteManager.Camera.DestinationRectangle.Width; float height = screensize * planeScreenHeight / (float)SpriteManager.Camera.DestinationRectangle.Height; mNewPointPolygon = Polygon.CreateEquilateral(3, Math.Min(width, height), 0); //.3f, 0); mNewPointPolygon.Color = EditorProperties.NewPointPolygonColor; mPointText = TextManager.AddText(""); NewPointPolygonScale = 10 / SpriteManager.Camera.PixelsPerUnitAt(mNewPointPolygon.Z); }
static VGPDialogueLine GetLineLeaf(string line, string label, ref TextManager tm) { var m = line_re.Match(line); if (!m.Success) { throw new Exception(string.Format("Invalid Line '{0}'!", line)); } var tag = m.Groups[1].Value; var text = UnescapeTextString(m.Groups[2].Value); // String interpolation validation (string aliases must be defined) var to_interpolate = IsToInterpolate(text, line, ref tm); // Extract text and get its hash var hash = tm.AddText(label, text); return(new VGPDialogueLine(label, hash, tag, to_interpolate)); }
public Ball(int number) { this.sprite = SpriteManager.AddSprite("yarnball.png"); this.sprite.ScaleX = this.sprite.ScaleX * 2; this.sprite.ScaleY = this.sprite.ScaleY * 2; this.sprite.RotationZVelocity = 1; this.positionText = null; this.resetPosition(); this.startBall(); AxisAlignedRectangle rectangle = new AxisAlignedRectangle(this.sprite.ScaleX, this.sprite.ScaleY); this.sprite.SetCollision(rectangle); if (showPositions) { this.positionText = TextManager.AddText(this.sprite.X.ToString() + "," + this.sprite.Y.ToString()); this.positionText.X = this.sprite.X; this.positionText.Y = this.sprite.Y; } }
// Generated AddToManagers public override void AddToManagers() { BulletFactory.Initialize(BulletList, ContentManagerName); EnemyBulletFactory.Initialize(EnemyBulletList, ContentManagerName); TiledMap.AddToManagers(); TileCollisionShapes.AddToManagers(); PlayerInstance.AddToManagers(mLayer); EntityCollisionShapes.AddToManagers(); EnemyCollisionGround.AddToManagers(); TextManager.AddText(TheEndText); if (TheEndText.Font != null) { TheEndText.SetPixelPerfectScale(SpriteManager.Camera); } if (TheEndText.Font != null) { TheEndText.SetPixelPerfectScale(mLayer); } base.AddToManagers(); AddToManagersBottomUp(); CustomInitialize(); }
private void UpdateDistanceDisplay() { int numberOfLinks = mNodeGrabbed.Links.Count; while (mDistanceDisplay.Count < numberOfLinks) { mDistanceDisplay.Add(TextManager.AddText("")); } for (int i = 0; i < numberOfLinks; i++) { #if FRB_MDX mDistanceDisplay[i].Position = Vector3.Scale((mNodeGrabbed.Position + mNodeGrabbed.Links[i].NodeLinkingTo.Position), .5f); #else mDistanceDisplay[i].Position = (mNodeGrabbed.Position + mNodeGrabbed.Links[i].NodeLinkingTo.Position) * .5f; #endif mDistanceDisplay[i].DisplayText = (mNodeGrabbed.Position - mNodeGrabbed.Links[i].NodeLinkingTo.Position).Length().ToString(); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { InputState.UpdateInput(this); // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } // TODO: Add your update logic here if (mainMenu.Enabled == false) { } if (InputState.IsKeyPressed(Keys.PrintScreen)) { //SaveScreenshot(); textManager.AddText(new AODText(this, "Screenshot Saved", 1, Color.White, new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height) / 2 , FadeOutState.Normal, new Vector2(0, -40), true)); } textManager.Update(gameTime); base.Update(gameTime); }
public void ShowPath(List <PositionedNode> path) { if (path.Count == 0) { return; } Text text; for (int i = 0; i < path.Count - 1; i++) { Line line = new Line(); line.Visible = true; line.RelativePoint1.X = 0; line.RelativePoint1.Y = 0; line.Position = path[i].Position; line.RelativePoint2.X = path[i + 1].X - line.Position.X; line.RelativePoint2.Y = path[i + 1].Y - line.Position.Y; line.Color = Color.Yellow; mPath.Add(line); text = TextManager.AddText(path[i].CostToGetHere.ToString()); text.Position = path[i].Position; text.X += .5f; text.Y += .5f; mCosts.Add(text); } text = TextManager.AddText(path[path.Count - 1].CostToGetHere.ToString()); text.Position = path[path.Count - 1].Position; text.X += .5f; text.Y += .5f; mCosts.Add(text); }
public override void Activity(bool firstTimeCalled) { base.Activity(firstTimeCalled); TextManager.RemoveText(title); title = TextManager.AddText("You fell!"); title.Spacing = 5f; title.NewLineDistance = 10f; title.Scale = 5f; title.Alpha = 0.75f; title.X = -35; title.Y = 10; TextManager.RemoveText(instruction); instruction = TextManager.AddText("Press Enter to restart"); instruction.Spacing = 3f; instruction.NewLineDistance = 10f; instruction.Scale = 3f; instruction.Alpha = 0.5f; instruction.X = -25; instruction.Y = -5; if ((InputManager.Keyboard.KeyPushed(Keys.Enter))) { MoveToScreen(typeof(KamiClimber.Screens.GameScreen).FullName); } // TouchCollection touchLocations = TouchPanel.GetState(); // // foreach (TouchLocation tl in touchLocations) // { // if (tl.State == TouchLocationState.Pressed || tl.State == TouchLocationState.Moved) // { // MoveToScreen(typeof(KamiClimberPhone.Screens.GameScreen).FullName); // } // } }
public static void Initialize(ShapeCollection shapeCollectionEditing) { //ColorDisplay colorDisplay = new ColorDisplay(GuiManager.Cursor); //GuiManager.AddWindow(colorDisplay); ShapeManager.ShapeDrawingOrder = ShapeDrawingOrder.OverEverything; ShapeManager.UseZTestingWhenDrawing = false; //Increase the number of particles available SpriteManager.AutoIncrementParticleCountValue = 500; SpriteManager.MaxParticleCount = 5000; if (shapeCollectionEditing == null) { mShapeCollection = new ShapeCollection(); } mSceneCamera = new Camera(FlatRedBallServices.GlobalContentManager); mEditingLogic = new EditingLogic(); mDebugText = TextManager.AddText("Hello"); mDebugText.Visible = false; }
public HierarchyNode(VisibleRepresentationType visibleRepresentationType) { SpriteManager.AddPositionedObject(this); if (visibleRepresentationType == VisibleRepresentationType.Circle) { mCircleVisibleRepresentation = ShapeManager.AddCircle(); } else { mSpriteVisibleRepresentation = SpriteManager.AddSprite((Texture2D)null); #if FRB_MDX mSpriteVisibleRepresentation.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.SelectArg2; #else mSpriteVisibleRepresentation.ColorOperation = ColorOperation.Color; #endif mSpriteVisibleRepresentation.Red = 1; mSpriteVisibleRepresentation.Green = 1; mSpriteVisibleRepresentation.Blue = 1; } mParentLine = ShapeManager.AddLine(); mParentLine.Visible = false; mParentAttachmentPoint = ShapeManager.AddCircle(); mParentAttachmentPoint.Visible = false; mParentAttachmentPoint.Radius = .2f; mText = TextManager.AddText(""); mText.Blue = 1; mText.Green = 1; mText.Red = 0; mText.HorizontalAlignment = HorizontalAlignment.Center; }