com.watabou.noosa.BitmapText.Font Java Examples
The following examples show how to use
com.watabou.noosa.BitmapText.Font.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PixelScene.java From YetAnotherPixelDungeon with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); GameScene.scene = null; float minWidth, minHeight; if (YetAnotherPixelDungeon.landscape()) { minWidth = MIN_WIDTH_L; minHeight = MIN_HEIGHT_L; } else { minWidth = MIN_WIDTH_P; minHeight = MIN_HEIGHT_P; } defaultZoom = (int)Math.ceil( Game.density * 2.5 ); while (( Game.width / defaultZoom < minWidth || Game.height / defaultZoom < minHeight ) && defaultZoom > 1) { defaultZoom--; } if (YetAnotherPixelDungeon.scaleUp()) { while ( Game.width / (defaultZoom + 1) >= minWidth && Game.height / (defaultZoom + 1) >= minHeight) { defaultZoom++; } } minZoom = 1; maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); float uiZoom = defaultZoom; uiCamera = Camera.createFullscreen( uiZoom ); Camera.add( uiCamera ); if (font1x == null) { // 3x5 (6) font1x = Font.colorMarked( BitmapCache.get( Assets.FONTS1X ), 0x00000000, BitmapText.Font.LATIN_FULL ); font1x.baseLine = 6; font1x.tracking = -1; // 5x8 (10) font15x = Font.colorMarked( BitmapCache.get( Assets.FONTS15X ), 12, 0x00000000, BitmapText.Font.LATIN_FULL ); font15x.baseLine = 9; font15x.tracking = -1; // 6x10 (12) font2x = Font.colorMarked( BitmapCache.get( Assets.FONTS2X ), 14, 0x00000000, BitmapText.Font.LATIN_FULL ); font2x.baseLine = 11; font2x.tracking = -1; // 7x12 (15) font25x = Font.colorMarked( BitmapCache.get( Assets.FONTS25X ), 17, 0x00000000, BitmapText.Font.LATIN_FULL ); font25x.baseLine = 13; font25x.tracking = -1; // 9x15 (18) font3x = Font.colorMarked( BitmapCache.get( Assets.FONTS3X ), 22, 0x00000000, BitmapText.Font.LATIN_FULL ); font3x.baseLine = 17; font3x.tracking = -2; } }
Example #2
Source File: PixelScene.java From unleashed-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); GameScene.scene = null; float minWidth, minHeight; if (ShatteredPixelDungeon.landscape()) { minWidth = MIN_WIDTH_L; minHeight = MIN_HEIGHT_L; } else { minWidth = MIN_WIDTH_P; minHeight = MIN_HEIGHT_P; } defaultZoom = (int)Math.ceil( Game.density * 2.5 ); while (( Game.width / defaultZoom < minWidth || Game.height / defaultZoom < minHeight ) && defaultZoom > 1) { defaultZoom--; } while ( Game.width / (defaultZoom + 1) >= minWidth && Game.height / (defaultZoom + 1) >= minHeight) { defaultZoom++; } minZoom = 1; maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); float uiZoom = defaultZoom; uiCamera = Camera.createFullscreen( uiZoom ); Camera.add( uiCamera ); if (font1x == null) { // 3x5 (6) font1x = Font.colorMarked( BitmapCache.get( Assets.FONTS1X ), 0x00000000, BitmapText.Font.LATIN_FULL ); font1x.baseLine = 6; font1x.tracking = -1; // 5x8 (10) font15x = Font.colorMarked( BitmapCache.get( Assets.FONTS15X ), 12, 0x00000000, BitmapText.Font.LATIN_FULL ); font15x.baseLine = 9; font15x.tracking = -1; // 6x10 (12) font2x = Font.colorMarked( BitmapCache.get( Assets.FONTS2X ), 14, 0x00000000, BitmapText.Font.LATIN_FULL ); font2x.baseLine = 11; font2x.tracking = -1; // 7x12 (15) font25x = Font.colorMarked( BitmapCache.get( Assets.FONTS25X ), 17, 0x00000000, BitmapText.Font.LATIN_FULL ); font25x.baseLine = 13; font25x.tracking = -1; // 9x15 (18) font3x = Font.colorMarked( BitmapCache.get( Assets.FONTS3X ), 22, 0x00000000, BitmapText.Font.LATIN_FULL ); font3x.baseLine = 17; font3x.tracking = -2; } }
Example #3
Source File: PixelScene.java From pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); GameScene.scene = null; float minWidth, minHeight; if (PixelDungeon.landscape()) { minWidth = MIN_WIDTH_L; minHeight = MIN_HEIGHT_L; } else { minWidth = MIN_WIDTH_P; minHeight = MIN_HEIGHT_P; } defaultZoom = (int)Math.ceil( Game.density * 2.5 ); while (( Game.width / defaultZoom < minWidth || Game.height / defaultZoom < minHeight ) && defaultZoom > 1) { defaultZoom--; } if (PixelDungeon.scaleUp()) { while ( Game.width / (defaultZoom + 1) >= minWidth && Game.height / (defaultZoom + 1) >= minHeight) { defaultZoom++; } } minZoom = 1; maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); float uiZoom = defaultZoom; uiCamera = Camera.createFullscreen( uiZoom ); Camera.add( uiCamera ); if (font1x == null) { // 3x5 (6) font1x = Font.colorMarked( BitmapCache.get( Assets.FONTS1X ), 0x00000000, BitmapText.Font.LATIN_FULL ); font1x.baseLine = 6; font1x.tracking = -1; // 5x8 (10) font15x = Font.colorMarked( BitmapCache.get( Assets.FONTS15X ), 12, 0x00000000, BitmapText.Font.LATIN_FULL ); font15x.baseLine = 9; font15x.tracking = -1; // 6x10 (12) font2x = Font.colorMarked( BitmapCache.get( Assets.FONTS2X ), 14, 0x00000000, BitmapText.Font.LATIN_FULL ); font2x.baseLine = 11; font2x.tracking = -1; // 7x12 (15) font25x = Font.colorMarked( BitmapCache.get( Assets.FONTS25X ), 17, 0x00000000, BitmapText.Font.LATIN_FULL ); font25x.baseLine = 13; font25x.tracking = -1; // 9x15 (18) font3x = Font.colorMarked( BitmapCache.get( Assets.FONTS3X ), 22, 0x00000000, BitmapText.Font.LATIN_FULL ); font3x.baseLine = 17; font3x.tracking = -2; } }
Example #4
Source File: PixelScene.java From shattered-pixel-dungeon with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); GameScene.scene = null; float minWidth, minHeight; if (landscape()) { minWidth = MIN_WIDTH_L; minHeight = MIN_HEIGHT_L; } else { minWidth = MIN_WIDTH_P; minHeight = MIN_HEIGHT_P; } maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight); maxScreenZoom = (int)Math.min(Game.dispWidth/minWidth, Game.dispHeight/minHeight); defaultZoom = SPDSettings.scale(); if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){ defaultZoom = (int)Math.ceil( Game.density * 2.5 ); while (( Game.width / defaultZoom < minWidth || Game.height / defaultZoom < minHeight ) && defaultZoom > 1) { defaultZoom--; } } minZoom = 1; maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); float uiZoom = defaultZoom; uiCamera = Camera.createFullscreen( uiZoom ); Camera.add( uiCamera ); if (pixelFont == null) { // 3x5 (6) pixelFont = Font.colorMarked( BitmapCache.get( Assets.Fonts.PIXELFONT), 0x00000000, BitmapText.Font.LATIN_FULL ); pixelFont.baseLine = 6; pixelFont.tracking = -1; } //set up the texture size which rendered text will use for any new glyphs. int renderedTextPageSize; if (defaultZoom <= 3){ renderedTextPageSize = 256; } else if (defaultZoom <= 8){ renderedTextPageSize = 512; } else { renderedTextPageSize = 1024; } //asian languages have many more unique characters, so increase texture size to anticipate that if (Messages.lang() == Languages.KOREAN || Messages.lang() == Languages.CHINESE || Messages.lang() == Languages.JAPANESE){ renderedTextPageSize *= 2; } Game.platform.setupFontGenerators(renderedTextPageSize, SPDSettings.systemFont()); }
Example #5
Source File: PixelScene.java From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 | 4 votes |
@Override public void create() { super.create(); GameScene.scene = null; float minWidth, minHeight; if (SPDSettings.landscape()) { minWidth = MIN_WIDTH_L; minHeight = MIN_HEIGHT_L; } else { minWidth = MIN_WIDTH_P; minHeight = MIN_HEIGHT_P; } maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight); defaultZoom = SPDSettings.scale(); if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){ defaultZoom = (int)Math.round((Math.ceil( Game.density * 2 ) + maxDefaultZoom)/2); while (( Game.width / defaultZoom < minWidth || Game.height / defaultZoom < minHeight ) && defaultZoom > 1) { defaultZoom--; } } minZoom = 1; maxZoom = defaultZoom * 2; Camera.reset( new PixelCamera( defaultZoom ) ); float uiZoom = defaultZoom; uiCamera = Camera.createFullscreen( uiZoom ); Camera.add( uiCamera ); if (pixelFont == null) { // 3x5 (6) pixelFont = Font.colorMarked( BitmapCache.get( Assets.PIXELFONT), 0x00000000, BitmapText.Font.LATIN_FULL ); pixelFont.baseLine = 6; pixelFont.tracking = -1; } }