Skip to content

Commit

Permalink
Adding screen icons and converting to ES6, see phetsims/fractions-com…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanolson committed Dec 26, 2018
1 parent 26abc55 commit 7bc94cb
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 96 deletions.
18 changes: 9 additions & 9 deletions js/build-a-fraction-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var BuildAFractionScreen = require( 'BUILD_A_FRACTION/view/BuildAFractionScreen' );
var LabScreen = require( 'BUILD_A_FRACTION/view/LabScreen' );
var MixedNumbersScreen = require( 'BUILD_A_FRACTION/view/MixedNumbersScreen' );
var Sim = require( 'JOIST/Sim' );
var SimLauncher = require( 'JOIST/SimLauncher' );
const BuildAFractionScreen = require( 'BUILD_A_FRACTION/view/BuildAFractionScreen' );
const LabScreen = require( 'BUILD_A_FRACTION/view/LabScreen' );
const MixedNumbersScreen = require( 'BUILD_A_FRACTION/view/MixedNumbersScreen' );
const Sim = require( 'JOIST/Sim' );
const SimLauncher = require( 'JOIST/SimLauncher' );

// strings
var buildAFractionTitleString = require( 'string!BUILD_A_FRACTION/build-a-fraction.title' );
const buildAFractionTitleString = require( 'string!BUILD_A_FRACTION/build-a-fraction.title' );

var simOptions = {
const simOptions = {
credits: {
//TODO fill in proper credits, all of these fields are optional, see joist.AboutDialog
leadDesign: '',
Expand All @@ -31,7 +31,7 @@ define( function( require ) {
};

SimLauncher.launch( function() {
var sim = new Sim( buildAFractionTitleString, [
const sim = new Sim( buildAFractionTitleString, [
new BuildAFractionScreen(),
new MixedNumbersScreen(),
new LabScreen()
Expand Down
4 changes: 2 additions & 2 deletions js/buildAFraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var Namespace = require( 'PHET_CORE/Namespace' );
const Namespace = require( 'PHET_CORE/Namespace' );

return new Namespace( 'buildAFraction' );
} );
52 changes: 23 additions & 29 deletions js/view/BuildAFractionScreen.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
// Copyright 2018, University of Colorado Boulder

/**
* TODO: doc
* The non-mixed-numbers game screen for Build a Fraction
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var buildAFraction = require( 'BUILD_A_FRACTION/buildAFraction' );
var BuildingGameModel = require( 'FRACTIONS_COMMON/game/model/BuildingGameModel' );
var BuildingGameScreenView = require( 'FRACTIONS_COMMON/game/view/BuildingGameScreenView' );
var FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
var inherit = require( 'PHET_CORE/inherit' );
var Screen = require( 'JOIST/Screen' );
const buildAFraction = require( 'BUILD_A_FRACTION/buildAFraction' );
const BuildingGameModel = require( 'FRACTIONS_COMMON/game/model/BuildingGameModel' );
const BuildingGameScreenView = require( 'FRACTIONS_COMMON/game/view/BuildingGameScreenView' );
const FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
const Screen = require( 'JOIST/Screen' );

// strings
var screenBuildAFractionString = require( 'string!BUILD_A_FRACTION/screen.buildAFraction' );

/**
* @constructor
*/
function BuildAFractionScreen() {

var options = {
name: screenBuildAFractionString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty
};

Screen.call( this,
function() { return new BuildingGameModel( false ); },
function( model ) { return new BuildingGameScreenView( model ); },
options
);
const screenBuildAFractionString = require( 'string!BUILD_A_FRACTION/screen.buildAFraction' );

class BuildAFractionScreen extends Screen {
constructor() {
super(
() => new BuildingGameModel( false ),
model => new BuildingGameScreenView( model ),
{
name: screenBuildAFractionString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty,
homeScreenIcon: BuildingGameScreenView.createUnmixedScreenIcon()
}
);
}
}

buildAFraction.register( 'BuildAFractionScreen', BuildAFractionScreen );

return inherit( Screen, BuildAFractionScreen );

return buildAFraction.register( 'BuildAFractionScreen', BuildAFractionScreen );
} );
49 changes: 21 additions & 28 deletions js/view/LabScreen.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
// Copyright 2018, University of Colorado Boulder

/**
* TODO: doc
* The "Lab" screen for Build a Fraction
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var buildAFraction = require( 'BUILD_A_FRACTION/buildAFraction' );
var BuildingLabModel = require( 'FRACTIONS_COMMON/lab/model/BuildingLabModel' );
var BuildingLabScreenView = require( 'FRACTIONS_COMMON/lab/view/BuildingLabScreenView' );
var FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
var inherit = require( 'PHET_CORE/inherit' );
var Screen = require( 'JOIST/Screen' );
const buildAFraction = require( 'BUILD_A_FRACTION/buildAFraction' );
const BuildingLabModel = require( 'FRACTIONS_COMMON/lab/model/BuildingLabModel' );
const BuildingLabScreenView = require( 'FRACTIONS_COMMON/lab/view/BuildingLabScreenView' );
const FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
const Screen = require( 'JOIST/Screen' );

// strings
var screenLabString = require( 'string!BUILD_A_FRACTION/screen.lab' );

/**
* @constructor
*/
function LabScreen() {

var options = {
name: screenLabString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty
};

Screen.call( this,
function() { return new BuildingLabModel( true ); },
function( model ) { return new BuildingLabScreenView( model ); },
options
);
const screenLabString = require( 'string!BUILD_A_FRACTION/screen.lab' );

class LabScreen extends Screen {
constructor() {
super(
() => new BuildingLabModel( true ),
model => new BuildingLabScreenView( model ),
{
name: screenLabString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty
}
);
}
}

buildAFraction.register( 'LabScreen', LabScreen );

return inherit( Screen, LabScreen );
return buildAFraction.register( 'LabScreen', LabScreen );
} );
50 changes: 22 additions & 28 deletions js/view/MixedNumbersScreen.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
// Copyright 2018, University of Colorado Boulder

/**
* TODO: doc
* The mixed-numbers game screen for Build a Fraction
*
* @author Jonathan Olson <[email protected]>
*/
define( function( require ) {
define( require => {
'use strict';

// modules
var buildAFraction = require( 'BUILD_A_FRACTION/buildAFraction' );
var BuildingGameModel = require( 'FRACTIONS_COMMON/game/model/BuildingGameModel' );
var BuildingGameScreenView = require( 'FRACTIONS_COMMON/game/view/BuildingGameScreenView' );
var FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
var inherit = require( 'PHET_CORE/inherit' );
var Screen = require( 'JOIST/Screen' );
const buildAFraction = require( 'BUILD_A_FRACTION/buildAFraction' );
const BuildingGameModel = require( 'FRACTIONS_COMMON/game/model/BuildingGameModel' );
const BuildingGameScreenView = require( 'FRACTIONS_COMMON/game/view/BuildingGameScreenView' );
const FractionsCommonColorProfile = require( 'FRACTIONS_COMMON/common/view/FractionsCommonColorProfile' );
const Screen = require( 'JOIST/Screen' );

// strings
var screenMixedNumbersString = require( 'string!BUILD_A_FRACTION/screen.mixedNumbers' );

/**
* @constructor
*/
function MixedNumbersScreen() {

var options = {
name: screenMixedNumbersString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty
};

Screen.call( this,
function() { return new BuildingGameModel( true ); },
function( model ) { return new BuildingGameScreenView( model ); },
options
);
const screenMixedNumbersString = require( 'string!BUILD_A_FRACTION/screen.mixedNumbers' );

class MixedNumbersScreen extends Screen {
constructor() {
super(
() => new BuildingGameModel( true ),
model => new BuildingGameScreenView( model ),
{
name: screenMixedNumbersString,
backgroundColorProperty: FractionsCommonColorProfile.otherScreenBackgroundProperty,
homeScreenIcon: BuildingGameScreenView.createMixedScreenIcon()
}
);
}
}

buildAFraction.register( 'MixedNumbersScreen', MixedNumbersScreen );

return inherit( Screen, MixedNumbersScreen );
return buildAFraction.register( 'MixedNumbersScreen', MixedNumbersScreen );
} );

0 comments on commit 7bc94cb

Please sign in to comment.