/** * Creates a new <code>FlxText</code> object at the specified position. * * @param X The X position of the text. * @param Y The Y position of the text. * @param Width The width of the text object (height is determined automatically). * @param Text The actual text you would like to display initially. * @param EmbeddedFont Whether this text field uses embedded fonts or not. */ public FlxText(float X, float Y, int Width, String Text, boolean EmbeddedFont) { super(X, Y); if (Text == null) Text = ""; width = frameWidth = Width; _text = Text; allowCollisions = NONE; moves = false; setFormat("org/flixel/data/font/nokiafc22.ttf", 8, 0xFFFFFF, "left", 0, 1f, 1f); }
@Override public void create() { FlxG.setBgColor(Breath.bgcolor); frame_buffer = new FrameBuffer(Pixmap.Format.RGBA8888, FlxG.width, FlxG.height, true); title_text = new FlxText(4, 24, 290, "\"I Can Hold My Breath Forever\"\nUse arrow keys to move."); title_text.setFormat(GardeniaFont, 8, 0xffffffff); PlayState.world_darkness = new FlxSprite(0, 0); world_darkness.scrollFactor.x = world_darkness.scrollFactor.y = 0; world_darkness.setPixels( new AtlasRegion( frame_buffer.getColorBufferTexture(), 0, 0, frame_buffer.getWidth(), frame_buffer.getHeight())); world_darkness.framePixels.flip(false, true); world_darkness.blend = "multiply"; world_darkness.setAlpha(0); world_darkness.visible = false; frame_buffer_fill = new FlxSprite(0, 0); frame_buffer_fill.makeGraphic(FlxG.width, FlxG.height, darkness_color); frame_buffer_fill.scrollFactor.x = frame_buffer_fill.scrollFactor.y = 0; world = new World(); background = new FlxSprite(0, 0, BackgroundImage); // Add restore point sprites notes = new FlxGroup(); for (RestorePoint note : world.airbubble_restore_points.values()) { if (note.note) { notes.add(note); } } player = new Player(4 * World.TILE_SIZE, 9 * World.TILE_SIZE, world_darkness); darkness = new FlxSprite(0, 0); darkness.makeGraphic(FlxG.width, FlxG.height, 0xff000000); darkness.scrollFactor.x = darkness.scrollFactor.y = 0; darkness.setAlpha(0.0f); oxygen_timer_display = new FlxText(0, 0, FlxG.width, "10"); oxygen_timer_display.setFormat(null, 160, 0xffffff, "center"); oxygen_timer_display.setAlpha(0.0f); oxygen_timer_display.scrollFactor.x = oxygen_timer_display.scrollFactor.y = 0; story_overlay = new StoryOverlay(8, 2); world.walls_map.follow(); // FlxG.followAdjust(0.5, 0.5); // FlxG.follow(player, 2.5); FlxG.camera.follow(player); // this.add(world.walls_map); // this.add(world.water_map); this.add(background); this.add(world.firefish_group); this.add(world.octopus); this.add(notes); this.add(player); this.add(world_darkness); this.add(darkness); this.add(oxygen_timer_display); this.add(story_overlay); this.add(title_text); }
/** The font used for this text. */ public void setFont(String Font) { if (Font == _font) return; setFormat(Font, _size, _color, getAlignment(), _shadow, _shadowX, _shadowY); }
/** The size of the text being displayed. */ public void setSize(float Size) { if (Size == _size) return; setFormat(_font, Size, _color, getAlignment(), _shadow, _shadowX, _shadowY); }