1
1
/*
2
2
This is rot.js, the ROguelike Toolkit in JavaScript.
3
- Version 0.4~dev, generated on Sun Jan 27 21:08:49 CET 2013.
3
+ Version 0.4~dev, generated on Mon Jan 28 14:18:21 CET 2013.
4
4
*/
5
5
6
6
/**
@@ -714,10 +714,10 @@ ROT.Display.Backend.prototype.compute = function(options) {
714
714
ROT . Display . Backend . prototype . draw = function ( data , clearBefore ) {
715
715
}
716
716
717
- ROT . Display . Backend . prototype . computeSize = function ( availWidth , availHeight , options ) {
717
+ ROT . Display . Backend . prototype . computeSize = function ( availWidth , availHeight ) {
718
718
}
719
719
720
- ROT . Display . Backend . prototype . computeFontSize = function ( availWidth , availHeight , options ) {
720
+ ROT . Display . Backend . prototype . computeFontSize = function ( availWidth , availHeight ) {
721
721
}
722
722
/**
723
723
* @class Rectangular backend
@@ -729,13 +729,15 @@ ROT.Display.Rect = function(context) {
729
729
this . _spacingX = 0 ;
730
730
this . _spacingY = 0 ;
731
731
this . _canvasCache = { } ;
732
+ this . _options = { } ;
732
733
}
733
734
ROT . Display . Rect . extend ( ROT . Display . Backend ) ;
734
735
735
736
ROT . Display . Rect . cache = false ;
736
737
737
738
ROT . Display . Rect . prototype . compute = function ( options ) {
738
739
this . _canvasCache = { } ;
740
+ this . _options = options ;
739
741
740
742
var charWidth = Math . ceil ( this . _context . measureText ( "W" ) . width ) ;
741
743
this . _spacingX = Math . ceil ( options . spacing * charWidth ) ;
@@ -801,19 +803,19 @@ ROT.Display.Rect.prototype._drawNoCache = function(data, clearBefore) {
801
803
this . _context . fillText ( ch , ( x + 0.5 ) * this . _spacingX , ( y + 0.5 ) * this . _spacingY ) ;
802
804
}
803
805
804
- ROT . Display . Rect . prototype . computeSize = function ( availWidth , availHeight , options ) {
806
+ ROT . Display . Rect . prototype . computeSize = function ( availWidth , availHeight ) {
805
807
var width = Math . floor ( availWidth / this . _spacingX ) ;
806
808
var height = Math . floor ( availHeight / this . _spacingY ) ;
807
- return [ width , height ]
809
+ return [ width , height ] ;
808
810
}
809
811
810
- ROT . Display . Rect . prototype . computeFontSize = function ( availWidth , availHeight , options ) {
811
- var boxWidth = Math . floor ( availWidth / options . width ) ;
812
- var boxHeight = Math . floor ( availHeight / options . height ) ;
812
+ ROT . Display . Rect . prototype . computeFontSize = function ( availWidth , availHeight ) {
813
+ var boxWidth = Math . floor ( availWidth / this . _options . width ) ;
814
+ var boxHeight = Math . floor ( availHeight / this . _options . height ) ;
813
815
814
816
/* compute char ratio */
815
817
var oldFont = this . _context . font ;
816
- this . _context . font = "100px " + options . fontFamily ;
818
+ this . _context . font = "100px " + this . _options . fontFamily ;
817
819
var width = Math . ceil ( this . _context . measureText ( "W" ) . width ) ;
818
820
this . _context . font = oldFont ;
819
821
var ratio = width / 100 ;
@@ -822,7 +824,7 @@ ROT.Display.Rect.prototype.computeFontSize = function(availWidth, availHeight, o
822
824
if ( widthFraction > 1 ) { /* too wide with current aspect ratio */
823
825
boxHeight = Math . floor ( boxHeight / widthFraction ) ;
824
826
}
825
- return Math . floor ( boxHeight / options . spacing ) ;
827
+ return Math . floor ( boxHeight / this . _options . spacing ) ;
826
828
}
827
829
/**
828
830
* @class Hexagonal backend
@@ -868,11 +870,11 @@ ROT.Display.Hex.prototype.draw = function(data, clearBefore) {
868
870
}
869
871
870
872
871
- ROT . Display . Hex . prototype . computeSize = function ( availWidth , availHeight , options ) {
873
+ ROT . Display . Hex . prototype . computeSize = function ( availWidth , availHeight ) {
872
874
/* FIXME */
873
875
}
874
876
875
- ROT . Display . Hex . prototype . computeFontSize = function ( availWidth , availHeight , options ) {
877
+ ROT . Display . Hex . prototype . computeFontSize = function ( availWidth , availHeight ) {
876
878
/* FIXME */
877
879
}
878
880
0 commit comments