Renamed Phaser.BitmapFont to Phaser.RetroFont because I believe it will cause confusion otherwise. Also tidied up the asset fonts folder.
@@ -145,7 +145,7 @@ module.exports = function (grunt) {
|
||||
'src/gameobjects/Graphics.js',
|
||||
'src/gameobjects/RenderTexture.js',
|
||||
'src/gameobjects/SpriteBatch.js',
|
||||
'src/gameobjects/BitmapFont.js',
|
||||
'src/gameobjects/RetroFont.js',
|
||||
|
||||
'src/system/Canvas.js',
|
||||
'src/system/Device.js',
|
||||
|
||||
@@ -109,7 +109,7 @@ New features:
|
||||
* BitmapText now uses the new XML parser which should work under CocoonJS without clashes.
|
||||
* BitmapText signature changed so you can support fonts with spaces in their names.
|
||||
* Loader.bitmapFont now has 2 extra parameters: xSpacing and ySpacing. These allow you to add extra spacing to each letter or line of the font.
|
||||
* Added the new BitmapFont class. This is for rendering retro style fixed-width bitmap fonts into an Image object. It's a texture you can apply to a Sprite/Image.
|
||||
* Added the new RetroFont class. This is for rendering fixed-width bitmap fonts into an Image object. It's a texture you can apply to a Sprite/Image.
|
||||
* Added Cache.updateFrameData which is really useful for swapping FrameData blocks in the cache.
|
||||
* Loader.physics now lets you load Lime + Corona JSON Physics data, which can be used with Body.loadPolygon and Body.loadData.
|
||||
* Cache.addPhysicsData and Cache.getPhysicsData allow you to store parsed JSON physics data in the cache, for sharing between Bodies.
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<script src="$path/src/gameobjects/Graphics.js"></script>
|
||||
<script src="$path/src/gameobjects/RenderTexture.js"></script>
|
||||
<script src="$path/src/gameobjects/SpriteBatch.js"></script>
|
||||
<script src="$path/src/gameobjects/BitmapFont.js"></script>
|
||||
<script src="$path/src/gameobjects/RetroFont.js"></script>
|
||||
|
||||
<script src="$path/src/system/Canvas.js"></script>
|
||||
<script src="$path/src/system/Device.js"></script>
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<script src="../src/gameobjects/Graphics.js"></script>
|
||||
<script src="../src/gameobjects/RenderTexture.js"></script>
|
||||
<script src="../src/gameobjects/SpriteBatch.js"></script>
|
||||
<script src="../src/gameobjects/BitmapFont.js"></script>
|
||||
<script src="../src/gameobjects/RetroFont.js"></script>
|
||||
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/system/Device.js"></script>
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
<script src="../src/gameobjects/Graphics.js"></script>
|
||||
<script src="../src/gameobjects/RenderTexture.js"></script>
|
||||
<script src="../src/gameobjects/SpriteBatch.js"></script>
|
||||
<script src="../src/gameobjects/BitmapFont.js"></script>
|
||||
<script src="../src/gameobjects/RetroFont.js"></script>
|
||||
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/system/Device.js"></script>
|
||||
|
||||
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 274 KiB After Width: | Height: | Size: 274 KiB |
|
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 303 KiB |
@@ -0,0 +1,90 @@
|
||||
<font>
|
||||
<info face="Short Stack" size="50" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/>
|
||||
<common lineHeight="62" base="47" scaleW="248" scaleH="512" pages="1" packed="0"/>
|
||||
<pages>
|
||||
<page id="0" file="shortStack.png"/>
|
||||
</pages>
|
||||
<chars count="80">
|
||||
<char id="97" x="2" y="2" width="40" height="33" xoffset="0" yoffset="14" xadvance="37" page="0" chnl="15"/>
|
||||
<char id="98" x="2" y="37" width="31" height="42" xoffset="1" yoffset="5" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="99" x="2" y="81" width="30" height="33" xoffset="0" yoffset="14" xadvance="31" page="0" chnl="15"/>
|
||||
<char id="100" x="2" y="116" width="34" height="42" xoffset="0" yoffset="5" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="101" x="34" y="81" width="33" height="33" xoffset="0" yoffset="14" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="102" x="44" y="2" width="32" height="44" xoffset="-1" yoffset="3" xadvance="27" page="0" chnl="15"/>
|
||||
<char id="103" x="2" y="160" width="32" height="47" xoffset="0" yoffset="14" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="104" x="2" y="209" width="33" height="43" xoffset="1" yoffset="5" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="105" x="36" y="160" width="12" height="44" xoffset="2" yoffset="3" xadvance="15" page="0" chnl="15"/>
|
||||
<char id="106" x="2" y="254" width="25" height="57" xoffset="-11" yoffset="3" xadvance="15" page="0" chnl="15"/>
|
||||
<char id="107" x="2" y="313" width="29" height="46" xoffset="1" yoffset="4" xadvance="30" page="0" chnl="15"/>
|
||||
<char id="108" x="38" y="116" width="17" height="42" xoffset="2" yoffset="5" xadvance="17" page="0" chnl="15"/>
|
||||
<char id="109" x="29" y="254" width="49" height="34" xoffset="1" yoffset="14" xadvance="51" page="0" chnl="15"/>
|
||||
<char id="110" x="37" y="206" width="33" height="34" xoffset="1" yoffset="14" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="111" x="50" y="160" width="33" height="33" xoffset="0" yoffset="14" xadvance="34" page="0" chnl="15"/>
|
||||
<char id="112" x="72" y="195" width="32" height="45" xoffset="2" yoffset="15" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="113" x="69" y="48" width="32" height="45" xoffset="0" yoffset="14" xadvance="34" page="0" chnl="15"/>
|
||||
<char id="114" x="57" y="116" width="29" height="33" xoffset="1" yoffset="14" xadvance="28" page="0" chnl="15"/>
|
||||
<char id="115" x="85" y="151" width="30" height="34" xoffset="1" yoffset="13" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="116" x="78" y="2" width="31" height="40" xoffset="-2" yoffset="7" xadvance="28" page="0" chnl="15"/>
|
||||
<char id="117" x="88" y="95" width="31" height="34" xoffset="1" yoffset="14" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="118" x="103" y="44" width="34" height="34" xoffset="-1" yoffset="13" xadvance="32" page="0" chnl="15"/>
|
||||
<char id="119" x="111" y="2" width="47" height="37" xoffset="1" yoffset="11" xadvance="48" page="0" chnl="15"/>
|
||||
<char id="120" x="2" y="361" width="29" height="35" xoffset="1" yoffset="14" xadvance="29" page="0" chnl="15"/>
|
||||
<char id="121" x="2" y="398" width="34" height="46" xoffset="-1" yoffset="14" xadvance="30" page="0" chnl="15"/>
|
||||
<char id="122" x="2" y="446" width="30" height="33" xoffset="-2" yoffset="14" xadvance="27" page="0" chnl="15"/>
|
||||
<char id="65" x="34" y="446" width="40" height="42" xoffset="0" yoffset="7" xadvance="39" page="0" chnl="15"/>
|
||||
<char id="66" x="33" y="290" width="32" height="40" xoffset="2" yoffset="7" xadvance="34" page="0" chnl="15"/>
|
||||
<char id="67" x="33" y="332" width="36" height="40" xoffset="1" yoffset="7" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="68" x="67" y="290" width="36" height="40" xoffset="2" yoffset="7" xadvance="38" page="0" chnl="15"/>
|
||||
<char id="69" x="80" y="242" width="33" height="40" xoffset="2" yoffset="8" xadvance="32" page="0" chnl="15"/>
|
||||
<char id="70" x="106" y="187" width="32" height="39" xoffset="2" yoffset="7" xadvance="32" page="0" chnl="15"/>
|
||||
<char id="71" x="117" y="131" width="35" height="40" xoffset="1" yoffset="7" xadvance="36" page="0" chnl="15"/>
|
||||
<char id="72" x="121" y="80" width="33" height="39" xoffset="2" yoffset="7" xadvance="36" page="0" chnl="15"/>
|
||||
<char id="73" x="38" y="374" width="23" height="40" xoffset="1" yoffset="7" xadvance="22" page="0" chnl="15"/>
|
||||
<char id="74" x="63" y="374" width="26" height="40" xoffset="-1" yoffset="7" xadvance="26" page="0" chnl="15"/>
|
||||
<char id="75" x="76" y="416" width="32" height="43" xoffset="2" yoffset="7" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="76" x="71" y="332" width="30" height="40" xoffset="2" yoffset="7" xadvance="29" page="0" chnl="15"/>
|
||||
<char id="77" x="91" y="374" width="39" height="40" xoffset="2" yoffset="7" xadvance="41" page="0" chnl="15"/>
|
||||
<char id="78" x="76" y="461" width="32" height="43" xoffset="2" yoffset="5" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="79" x="105" y="284" width="40" height="41" xoffset="0" yoffset="7" xadvance="40" page="0" chnl="15"/>
|
||||
<char id="80" x="103" y="332" width="31" height="40" xoffset="2" yoffset="7" xadvance="32" page="0" chnl="15"/>
|
||||
<char id="81" x="115" y="228" width="41" height="42" xoffset="0" yoffset="7" xadvance="41" page="0" chnl="15"/>
|
||||
<char id="82" x="140" y="173" width="33" height="41" xoffset="2" yoffset="7" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="83" x="154" y="121" width="31" height="40" xoffset="0" yoffset="7" xadvance="31" page="0" chnl="15"/>
|
||||
<char id="84" x="156" y="41" width="32" height="40" xoffset="-1" yoffset="7" xadvance="30" page="0" chnl="15"/>
|
||||
<char id="85" x="110" y="416" width="32" height="40" xoffset="1" yoffset="8" xadvance="34" page="0" chnl="15"/>
|
||||
<char id="86" x="132" y="374" width="36" height="40" xoffset="0" yoffset="7" xadvance="34" page="0" chnl="15"/>
|
||||
<char id="87" x="136" y="327" width="46" height="44" xoffset="0" yoffset="4" xadvance="43" page="0" chnl="15"/>
|
||||
<char id="88" x="110" y="458" width="27" height="44" xoffset="0" yoffset="4" xadvance="26" page="0" chnl="15"/>
|
||||
<char id="89" x="139" y="458" width="34" height="42" xoffset="-2" yoffset="7" xadvance="28" page="0" chnl="15"/>
|
||||
<char id="90" x="144" y="416" width="36" height="39" xoffset="-1" yoffset="8" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="33" x="175" y="457" width="13" height="43" xoffset="2" yoffset="4" xadvance="18" page="0" chnl="15"/>
|
||||
<char id="8470" x="147" y="272" width="49" height="52" xoffset="1" yoffset="0" xadvance="51" page="0" chnl="15"/>
|
||||
<char id="59" x="139" y="41" width="15" height="32" xoffset="-1" yoffset="20" xadvance="14" page="0" chnl="15"/>
|
||||
<char id="37" x="158" y="216" width="42" height="47" xoffset="1" yoffset="3" xadvance="45" page="0" chnl="15"/>
|
||||
<char id="58" x="38" y="416" width="12" height="26" xoffset="1" yoffset="19" xadvance="14" page="0" chnl="15"/>
|
||||
<char id="63" x="175" y="163" width="27" height="44" xoffset="2" yoffset="4" xadvance="28" page="0" chnl="15"/>
|
||||
<char id="42" x="2" y="481" width="29" height="29" xoffset="0" yoffset="6" xadvance="30" page="0" chnl="15"/>
|
||||
<char id="40" x="187" y="83" width="18" height="47" xoffset="2" yoffset="5" xadvance="20" page="0" chnl="15"/>
|
||||
<char id="41" x="190" y="2" width="18" height="46" xoffset="-1" yoffset="5" xadvance="19" page="0" chnl="15"/>
|
||||
<char id="95" x="37" y="242" width="41" height="9" xoffset="-5" yoffset="44" xadvance="32" page="0" chnl="15"/>
|
||||
<char id="43" x="156" y="83" width="29" height="29" xoffset="1" yoffset="15" xadvance="32" page="0" chnl="15"/>
|
||||
<char id="45" x="88" y="131" width="23" height="11" xoffset="1" yoffset="24" xadvance="26" page="0" chnl="15"/>
|
||||
<char id="61" x="33" y="490" width="25" height="20" xoffset="2" yoffset="17" xadvance="29" page="0" chnl="15"/>
|
||||
<char id="46" x="117" y="173" width="13" height="12" xoffset="1" yoffset="36" xadvance="14" page="0" chnl="15"/>
|
||||
<char id="44" x="52" y="416" width="17" height="20" xoffset="-2" yoffset="35" xadvance="16" page="0" chnl="15"/>
|
||||
<char id="47" x="182" y="373" width="23" height="52" xoffset="1" yoffset="0" xadvance="22" page="0" chnl="15"/>
|
||||
<char id="124" x="190" y="427" width="11" height="59" xoffset="5" yoffset="0" xadvance="22" page="0" chnl="15"/>
|
||||
<char id="34" x="190" y="488" width="20" height="21" xoffset="2" yoffset="5" xadvance="23" page="0" chnl="15"/>
|
||||
<char id="39" x="187" y="132" width="11" height="21" xoffset="1" yoffset="6" xadvance="13" page="0" chnl="15"/>
|
||||
<char id="64" x="184" y="326" width="45" height="43" xoffset="1" yoffset="10" xadvance="48" page="0" chnl="15"/>
|
||||
<char id="35" x="203" y="427" width="40" height="42" xoffset="0" yoffset="4" xadvance="43" page="0" chnl="15"/>
|
||||
<char id="36" x="207" y="371" width="31" height="47" xoffset="2" yoffset="4" xadvance="35" page="0" chnl="15"/>
|
||||
<char id="94" x="200" y="132" width="31" height="29" xoffset="0" yoffset="9" xadvance="31" page="0" chnl="15"/>
|
||||
<char id="38" x="212" y="471" width="29" height="34" xoffset="2" yoffset="13" xadvance="33" page="0" chnl="15"/>
|
||||
<char id="123" x="198" y="265" width="21" height="47" xoffset="0" yoffset="5" xadvance="22" page="0" chnl="15"/>
|
||||
<char id="125" x="202" y="209" width="21" height="47" xoffset="1" yoffset="5" xadvance="22" page="0" chnl="15"/>
|
||||
<char id="91" x="221" y="258" width="15" height="47" xoffset="2" yoffset="5" xadvance="19" page="0" chnl="15"/>
|
||||
<char id="93" x="231" y="307" width="15" height="47" xoffset="1" yoffset="5" xadvance="18" page="0" chnl="15"/>
|
||||
<char id="32" x="0" y="0" width="0" height="0" xoffset="1" yoffset="5" xadvance="18" page="0" chnl="15"/>
|
||||
</chars>
|
||||
</font>
|
||||
|
After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 268 B |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 72 KiB |
@@ -3,7 +3,7 @@ var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: p
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml');
|
||||
game.load.bitmapFont('desyrel', 'assets/fonts/bitmapFonts/desyrel.png', 'assets/fonts/bitmapFonts/desyrel.xml');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,9 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { create:
|
||||
|
||||
function create() {
|
||||
|
||||
var text = "- phaser -\nwith a sprinkle of\npixi dust";
|
||||
var style = { font: "65px Arial", fill: "#ff0044", align: "center" };
|
||||
var style = { font: "65px Arial", fill: "#ff0044", align: "center" };
|
||||
var text = game.add.text(game.world.centerX, game.world.centerY, "- phaser -\nwith a sprinkle of\npixi dust", style);
|
||||
|
||||
var t = game.add.text(game.world.centerX, game.world.centerY, text, style);
|
||||
|
||||
t.anchor.setTo(0.5, 0.5);
|
||||
text.anchor.set(0.5);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.bitmapFont('shortStack', 'assets/fonts/bitmapFonts/shortStack.png', 'assets/fonts/bitmapFonts/shortStack.fnt');
|
||||
|
||||
}
|
||||
|
||||
var text;
|
||||
|
||||
function create() {
|
||||
|
||||
text = game.add.bitmapText(100, 100, 'shortStack', 'Bitmap Fonts\nfrom Littera', 64);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
}
|
||||
@@ -3,8 +3,8 @@ var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: p
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.bitmapFont('desyrel', 'assets/fonts/desyrel.png', 'assets/fonts/desyrel.xml', null, 0, -32);
|
||||
game.load.bitmapFont('carrier', 'assets/fonts/carrier_command.png', 'assets/fonts/carrier_command.xml', null, 0, 24);
|
||||
game.load.bitmapFont('desyrel', 'assets/fonts/bitmapFonts/desyrel.png', 'assets/fonts/desyrel.xml', null, 0, -32);
|
||||
game.load.bitmapFont('carrier', 'assets/fonts/bitmapFonts/carrier_command.png', 'assets/fonts/carrier_command.xml', null, 0, 24);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: p
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('goldFont', 'assets/fonts/gold_font.png');
|
||||
game.load.image('bluePink', 'assets/fonts/bluepink_font.png');
|
||||
game.load.image('goldFont', 'assets/fonts/retroFonts/gold_font.png');
|
||||
game.load.image('bluePink', 'assets/fonts/retroFonts/bluepink_font.png');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: p
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('knightHawks', 'assets/fonts/KNIGHT3.png');
|
||||
game.load.image('knightHawks', 'assets/fonts/retroFonts/KNIGHT3.png');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -230,12 +230,15 @@ Phaser.GameObjectCreator.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all,
|
||||
* i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.
|
||||
* Create a new RetroFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* A RetroFont uses a bitmap which contains fixed with characters for the font set. You use character spacing to define the set.
|
||||
* If you need variable width character support then use a BitmapText object instead. The main difference between a RetroFont and a BitmapText
|
||||
* is that a RetroFont creates a single texture that you can apply to a game object, where-as a BitmapText creates one Sprite object per letter of text.
|
||||
* The texture can be asssigned or one or multiple images/sprites, but note that the text the RetroFont uses will be shared across them all,
|
||||
* i.e. if you need each Image to have different text in it, then you need to create multiple RetroFont objects.
|
||||
*
|
||||
* @method Phaser.GameObjectCreator#bitmapFont
|
||||
* @param {string} font - The key of the image in the Game.Cache that the BitmapFont will use.
|
||||
* @method Phaser.GameObjectCreator#retroFont
|
||||
* @param {string} font - The key of the image in the Game.Cache that the RetroFont will use.
|
||||
* @param {number} characterWidth - The width of each character in the font set.
|
||||
* @param {number} characterHeight - The height of each character in the font set.
|
||||
* @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
|
||||
@@ -244,11 +247,11 @@ Phaser.GameObjectCreator.prototype = {
|
||||
* @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here.
|
||||
* @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
|
||||
* @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
|
||||
* @return {Phaser.BitmapFont} The newly created BitmapFont texture which can be applied to an Image or Sprite.
|
||||
* @return {Phaser.RetroFont} The newly created RetroFont texture which can be applied to an Image or Sprite.
|
||||
*/
|
||||
bitmapFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||
retroFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||
|
||||
return new Phaser.BitmapFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
|
||||
return new Phaser.RetroFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -258,12 +258,15 @@ Phaser.GameObjectFactory.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all,
|
||||
* i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.
|
||||
* Create a new RetroFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache.
|
||||
* A RetroFont uses a bitmap which contains fixed with characters for the font set. You use character spacing to define the set.
|
||||
* If you need variable width character support then use a BitmapText object instead. The main difference between a RetroFont and a BitmapText
|
||||
* is that a RetroFont creates a single texture that you can apply to a game object, where-as a BitmapText creates one Sprite object per letter of text.
|
||||
* The texture can be asssigned or one or multiple images/sprites, but note that the text the RetroFont uses will be shared across them all,
|
||||
* i.e. if you need each Image to have different text in it, then you need to create multiple RetroFont objects.
|
||||
*
|
||||
* @method Phaser.GameObjectFactory#bitmapFont
|
||||
* @param {string} font - The key of the image in the Game.Cache that the BitmapFont will use.
|
||||
* @method Phaser.GameObjectFactory#retroFont
|
||||
* @param {string} font - The key of the image in the Game.Cache that the RetroFont will use.
|
||||
* @param {number} characterWidth - The width of each character in the font set.
|
||||
* @param {number} characterHeight - The height of each character in the font set.
|
||||
* @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
|
||||
@@ -272,11 +275,11 @@ Phaser.GameObjectFactory.prototype = {
|
||||
* @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here.
|
||||
* @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
|
||||
* @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
|
||||
* @return {Phaser.BitmapFont} The newly created BitmapFont texture which can be applied to an Image or Sprite.
|
||||
* @return {Phaser.RetroFont} The newly created RetroFont texture which can be applied to an Image or Sprite.
|
||||
*/
|
||||
bitmapFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||
retroFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||
|
||||
return new Phaser.BitmapFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
|
||||
return new Phaser.RetroFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset);
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class Phaser.BitmapFont
|
||||
* @class Phaser.RetroFont
|
||||
* @extends Phaser.RenderTexture
|
||||
* @constructor
|
||||
* @param {Phaser.Game} game - Current game instance.
|
||||
@@ -19,7 +19,7 @@
|
||||
* @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
|
||||
* @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
|
||||
*/
|
||||
Phaser.BitmapFont = function (game, key, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||
Phaser.RetroFont = function (game, key, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
|
||||
|
||||
/**
|
||||
* @property {number} characterWidth - The width of each character in the font set.
|
||||
@@ -57,7 +57,7 @@ Phaser.BitmapFont = function (game, key, characterWidth, characterHeight, chars,
|
||||
this.offsetY = yOffset || 0;
|
||||
|
||||
/**
|
||||
* @property {string} align - Alignment of the text when multiLine = true or a fixedWidth is set. Set to BitmapFont.ALIGN_LEFT (default), BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.
|
||||
* @property {string} align - Alignment of the text when multiLine = true or a fixedWidth is set. Set to RetroFont.ALIGN_LEFT (default), RetroFont.ALIGN_RIGHT or RetroFont.ALIGN_CENTER.
|
||||
*/
|
||||
this.align = "left";
|
||||
|
||||
@@ -86,7 +86,7 @@ Phaser.BitmapFont = function (game, key, characterWidth, characterHeight, chars,
|
||||
this.customSpacingY = 0;
|
||||
|
||||
/**
|
||||
* If you need this BitmapFont image to have a fixed width you can set the width in this value.
|
||||
* If you need this RetroFont image to have a fixed width you can set the width in this value.
|
||||
* If text is wider than the width specified it will be cropped off.
|
||||
* @property {number} fixedWidth
|
||||
*/
|
||||
@@ -157,117 +157,117 @@ Phaser.BitmapFont = function (game, key, characterWidth, characterHeight, chars,
|
||||
|
||||
};
|
||||
|
||||
Phaser.BitmapFont.prototype = Object.create(Phaser.RenderTexture.prototype);
|
||||
Phaser.BitmapFont.prototype.constructor = Phaser.BitmapFont;
|
||||
Phaser.RetroFont.prototype = Object.create(Phaser.RenderTexture.prototype);
|
||||
Phaser.RetroFont.prototype.constructor = Phaser.RetroFont;
|
||||
|
||||
/**
|
||||
* Align each line of multi-line text to the left.
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.ALIGN_LEFT = "left";
|
||||
Phaser.RetroFont.ALIGN_LEFT = "left";
|
||||
|
||||
/**
|
||||
* Align each line of multi-line text to the right.
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.ALIGN_RIGHT = "right";
|
||||
Phaser.RetroFont.ALIGN_RIGHT = "right";
|
||||
|
||||
/**
|
||||
* Align each line of multi-line text in the center.
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.ALIGN_CENTER = "center";
|
||||
Phaser.RetroFont.ALIGN_CENTER = "center";
|
||||
|
||||
/**
|
||||
* Text Set 1 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
|
||||
Phaser.RetroFont.TEXT_SET1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
|
||||
|
||||
/**
|
||||
* Text Set 2 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET2 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
Phaser.RetroFont.TEXT_SET2 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
/**
|
||||
* Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
|
||||
Phaser.RetroFont.TEXT_SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
|
||||
|
||||
/**
|
||||
* Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
|
||||
Phaser.RetroFont.TEXT_SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
|
||||
|
||||
/**
|
||||
* Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789";
|
||||
Phaser.RetroFont.TEXT_SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789";
|
||||
|
||||
/**
|
||||
* Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.'
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ";
|
||||
Phaser.RetroFont.TEXT_SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ";
|
||||
|
||||
/**
|
||||
* Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET7 = "AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39";
|
||||
Phaser.RetroFont.TEXT_SET7 = "AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39";
|
||||
|
||||
/**
|
||||
* Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET8 = "0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
Phaser.RetroFont.TEXT_SET8 = "0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
/**
|
||||
* Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!";
|
||||
Phaser.RetroFont.TEXT_SET9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!";
|
||||
|
||||
/**
|
||||
* Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET10 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
Phaser.RetroFont.TEXT_SET10 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
/**
|
||||
* Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
Phaser.BitmapFont.TEXT_SET11 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789";
|
||||
Phaser.RetroFont.TEXT_SET11 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789";
|
||||
|
||||
/**
|
||||
* If you need this FlxSprite to have a fixed width and custom alignment you can set the width here.<br>
|
||||
* If text is wider than the width specified it will be cropped off.
|
||||
*
|
||||
* @method Phaser.BitmapFont#setFixedWidth
|
||||
* @memberof Phaser.BitmapFont
|
||||
* @param {number} width - Width in pixels of this BitmapFont. Set to zero to disable and re-enable automatic resizing.
|
||||
* @param {string} [lineAlignment='left'] - Align the text within this width. Set to BitmapFont.ALIGN_LEFT (default), BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.
|
||||
* @method Phaser.RetroFont#setFixedWidth
|
||||
* @memberof Phaser.RetroFont
|
||||
* @param {number} width - Width in pixels of this RetroFont. Set to zero to disable and re-enable automatic resizing.
|
||||
* @param {string} [lineAlignment='left'] - Align the text within this width. Set to RetroFont.ALIGN_LEFT (default), RetroFont.ALIGN_RIGHT or RetroFont.ALIGN_CENTER.
|
||||
*/
|
||||
Phaser.BitmapFont.prototype.setFixedWidth = function (width, lineAlignment) {
|
||||
Phaser.RetroFont.prototype.setFixedWidth = function (width, lineAlignment) {
|
||||
|
||||
if (typeof lineAlignment === 'undefined') { lineAlignment = 'left'; }
|
||||
|
||||
@@ -279,16 +279,16 @@ Phaser.BitmapFont.prototype.setFixedWidth = function (width, lineAlignment) {
|
||||
/**
|
||||
* A helper function that quickly sets lots of variables at once, and then updates the text.
|
||||
*
|
||||
* @method Phaser.BitmapFont#setText
|
||||
* @memberof Phaser.BitmapFont
|
||||
* @method Phaser.RetroFont#setText
|
||||
* @memberof Phaser.RetroFont
|
||||
* @param {string} content - The text of this sprite.
|
||||
* @param {boolean} [multiLine=false] - Set to true if you want to support carriage-returns in the text and create a multi-line sprite instead of a single line.
|
||||
* @param {number} [characterSpacing=0] - To add horizontal spacing between each character specify the amount in pixels.
|
||||
* @param {number} [lineSpacing=0] - To add vertical spacing between each line of text, set the amount in pixels.
|
||||
* @param {string} [lineAlignment='left'] - Align each line of multi-line text. Set to BitmapFont.ALIGN_LEFT, BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.
|
||||
* @param {string} [lineAlignment='left'] - Align each line of multi-line text. Set to RetroFont.ALIGN_LEFT, RetroFont.ALIGN_RIGHT or RetroFont.ALIGN_CENTER.
|
||||
* @param {boolean} [allowLowerCase=false] - Lots of bitmap font sets only include upper-case characters, if yours needs to support lower case then set this to true.
|
||||
*/
|
||||
Phaser.BitmapFont.prototype.setText = function (content, multiLine, characterSpacing, lineSpacing, lineAlignment, allowLowerCase) {
|
||||
Phaser.RetroFont.prototype.setText = function (content, multiLine, characterSpacing, lineSpacing, lineAlignment, allowLowerCase) {
|
||||
|
||||
this.multiLine = multiLine || false;
|
||||
this.customSpacingX = characterSpacing || 0;
|
||||
@@ -314,10 +314,10 @@ Phaser.BitmapFont.prototype.setText = function (content, multiLine, characterSpa
|
||||
/**
|
||||
* Over rides the default PIXI.RenderTexture resize event as we need our baseTexture resized as well.
|
||||
*
|
||||
* @method Phaser.BitmapFont#resize
|
||||
* @memberof Phaser.BitmapFont
|
||||
* @method Phaser.RetroFont#resize
|
||||
* @memberof Phaser.RetroFont
|
||||
*/
|
||||
Phaser.BitmapFont.prototype.resize = function (width, height) {
|
||||
Phaser.RetroFont.prototype.resize = function (width, height) {
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
@@ -349,10 +349,10 @@ Phaser.BitmapFont.prototype.resize = function (width, height) {
|
||||
/**
|
||||
* Updates the BitmapData of the Sprite with the text
|
||||
*
|
||||
* @method Phaser.BitmapFont#buildBitmapFontText
|
||||
* @memberof Phaser.BitmapFont
|
||||
* @method Phaser.RetroFont#buildRetroFontText
|
||||
* @memberof Phaser.RetroFont
|
||||
*/
|
||||
Phaser.BitmapFont.prototype.buildBitmapFontText = function () {
|
||||
Phaser.RetroFont.prototype.buildRetroFontText = function () {
|
||||
|
||||
var cx = 0;
|
||||
var cy = 0;
|
||||
@@ -378,15 +378,15 @@ Phaser.BitmapFont.prototype.buildBitmapFontText = function () {
|
||||
// This line of text is held in lines[i] - need to work out the alignment
|
||||
switch (this.align)
|
||||
{
|
||||
case Phaser.BitmapFont.ALIGN_LEFT:
|
||||
case Phaser.RetroFont.ALIGN_LEFT:
|
||||
cx = 0;
|
||||
break;
|
||||
|
||||
case Phaser.BitmapFont.ALIGN_RIGHT:
|
||||
case Phaser.RetroFont.ALIGN_RIGHT:
|
||||
cx = this.width - (lines[i].length * (this.characterWidth + this.customSpacingX));
|
||||
break;
|
||||
|
||||
case Phaser.BitmapFont.ALIGN_CENTER:
|
||||
case Phaser.RetroFont.ALIGN_CENTER:
|
||||
cx = (this.width / 2) - ((lines[i].length * (this.characterWidth + this.customSpacingX)) / 2);
|
||||
cx += this.customSpacingX / 2;
|
||||
break;
|
||||
@@ -418,15 +418,15 @@ Phaser.BitmapFont.prototype.buildBitmapFontText = function () {
|
||||
|
||||
switch (this.align)
|
||||
{
|
||||
case Phaser.BitmapFont.ALIGN_LEFT:
|
||||
case Phaser.RetroFont.ALIGN_LEFT:
|
||||
cx = 0;
|
||||
break;
|
||||
|
||||
case Phaser.BitmapFont.ALIGN_RIGHT:
|
||||
case Phaser.RetroFont.ALIGN_RIGHT:
|
||||
cx = this.width - (this._text.length * (this.characterWidth + this.customSpacingX));
|
||||
break;
|
||||
|
||||
case Phaser.BitmapFont.ALIGN_CENTER:
|
||||
case Phaser.RetroFont.ALIGN_CENTER:
|
||||
cx = (this.width / 2) - ((this._text.length * (this.characterWidth + this.customSpacingX)) / 2);
|
||||
cx += this.customSpacingX / 2;
|
||||
break;
|
||||
@@ -441,14 +441,14 @@ Phaser.BitmapFont.prototype.buildBitmapFontText = function () {
|
||||
* Internal function that takes a single line of text (2nd parameter) and pastes it into the BitmapData at the given coordinates.
|
||||
* Used by getLine and getMultiLine
|
||||
*
|
||||
* @method Phaser.BitmapFont#buildBitmapFontText
|
||||
* @memberof Phaser.BitmapFont
|
||||
* @method Phaser.RetroFont#buildRetroFontText
|
||||
* @memberof Phaser.RetroFont
|
||||
* @param {string} line - The single line of text to paste.
|
||||
* @param {number} x - The x coordinate.
|
||||
* @param {number} y - The y coordinate.
|
||||
* @param {number} customSpacingX - Custom X spacing.
|
||||
*/
|
||||
Phaser.BitmapFont.prototype.pasteLine = function (line, x, y, customSpacingX) {
|
||||
Phaser.RetroFont.prototype.pasteLine = function (line, x, y, customSpacingX) {
|
||||
|
||||
var p = new Phaser.Point();
|
||||
|
||||
@@ -482,11 +482,11 @@ Phaser.BitmapFont.prototype.pasteLine = function (line, x, y, customSpacingX) {
|
||||
/**
|
||||
* Works out the longest line of text in _text and returns its length
|
||||
*
|
||||
* @method Phaser.BitmapFont#getLongestLine
|
||||
* @memberof Phaser.BitmapFont
|
||||
* @method Phaser.RetroFont#getLongestLine
|
||||
* @memberof Phaser.RetroFont
|
||||
* @return {number} The length of the longest line of text.
|
||||
*/
|
||||
Phaser.BitmapFont.prototype.getLongestLine = function () {
|
||||
Phaser.RetroFont.prototype.getLongestLine = function () {
|
||||
|
||||
var longestLine = 0;
|
||||
|
||||
@@ -509,13 +509,13 @@ Phaser.BitmapFont.prototype.getLongestLine = function () {
|
||||
/**
|
||||
* Internal helper function that removes all unsupported characters from the _text String, leaving only characters contained in the font set.
|
||||
*
|
||||
* @method Phaser.BitmapFont#removeUnsupportedCharacters
|
||||
* @memberof Phaser.BitmapFont
|
||||
* @method Phaser.RetroFont#removeUnsupportedCharacters
|
||||
* @memberof Phaser.RetroFont
|
||||
* @protected
|
||||
* @param {boolean} [stripCR=true] - Should it strip carriage returns as well?
|
||||
* @return {string} A clean version of the string.
|
||||
*/
|
||||
Phaser.BitmapFont.prototype.removeUnsupportedCharacters = function (stripCR) {
|
||||
Phaser.RetroFont.prototype.removeUnsupportedCharacters = function (stripCR) {
|
||||
|
||||
var newString = "";
|
||||
|
||||
@@ -537,7 +537,7 @@ Phaser.BitmapFont.prototype.removeUnsupportedCharacters = function (stripCR) {
|
||||
* @name Phaser.BitmapText#text
|
||||
* @property {string} text - Set this value to update the text in this sprite. Carriage returns are automatically stripped out if multiLine is false. Text is converted to upper case if autoUpperCase is true.
|
||||
*/
|
||||
Object.defineProperty(Phaser.BitmapFont.prototype, "text", {
|
||||
Object.defineProperty(Phaser.RetroFont.prototype, "text", {
|
||||
|
||||
get: function () {
|
||||
|
||||
@@ -564,7 +564,7 @@ Object.defineProperty(Phaser.BitmapFont.prototype, "text", {
|
||||
|
||||
this.removeUnsupportedCharacters(this.multiLine);
|
||||
|
||||
this.buildBitmapFontText();
|
||||
this.buildRetroFontText();
|
||||
}
|
||||
|
||||
}
|
||||