Skip to content

Commit

Permalink
Add game screen and update placeholder images, see #2
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisklus committed Nov 7, 2019
1 parent cd62e25 commit 023657e
Show file tree
Hide file tree
Showing 9 changed files with 146 additions and 0 deletions.
Binary file modified images/compare_screen_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/game_screen_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/game_screen_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/lab_screen_placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions js/game/GameScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2019, University of Colorado Boulder

/**
* The 'Game' screen.
*
* @author Chris Klusendorf (PhET Interactive Simulations)
*/
define( require => {
'use strict';

// modules
const GameModel = require( 'NUMBER_PLAY/game/model/GameModel' );
const GameScreenView = require( 'NUMBER_PLAY/game/view/GameScreenView' );
const Image = require( 'SCENERY/nodes/Image' );
const numberPlay = require( 'NUMBER_PLAY/numberPlay' );
const Property = require( 'AXON/Property' );
const Screen = require( 'JOIST/Screen' );

// strings
const screenGameString = require( 'string!NUMBER_PLAY/screen.game' );

// images
const gameScreenIconImage = require( 'image!NUMBER_PLAY/game_screen_icon.png' );

class GameScreen extends Screen {

/**
* @param {Tandem} tandem
*/
constructor( tandem ) {

const options = {
name: screenGameString,
backgroundColorProperty: new Property( 'white' ),
homeScreenIcon: new Image( gameScreenIconImage ),
tandem: tandem
};

super(
() => new GameModel( tandem.createTandem( 'model' ) ),
model => new GameScreenView( model, tandem.createTandem( 'view' ) ),
options
);
}
}

return numberPlay.register( 'GameScreen', GameScreen );
} );
42 changes: 42 additions & 0 deletions js/game/model/GameModel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2019, University of Colorado Boulder

/**
* Model class for the 'Game' screen.
*
* @author Chris Klusendorf (PhET Interactive Simulations)
*/
define( require => {
'use strict';

// modules
const numberPlay = require( 'NUMBER_PLAY/numberPlay' );

class GameModel {

/**
* @param {Tandem} tandem
*/
constructor( tandem ) {
//TODO
}

/**
* Resets the model.
* @public
*/
reset() {
//TODO
}

/**
* Steps the model.
* @param {number} dt - time step, in seconds
* @public
*/
step( dt ) {
//TODO
}
}

return numberPlay.register( 'GameModel', GameModel );
} );
51 changes: 51 additions & 0 deletions js/game/view/GameScreenView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2019, University of Colorado Boulder

/**
* ScreenView for the 'Game' screen.
*
* @author Chris Klusendorf (PhET Interactive Simulations)
*/
define( require => {
'use strict';

// modules
const Image = require( 'SCENERY/nodes/Image' );
const numberPlay = require( 'NUMBER_PLAY/numberPlay' );
const ScreenView = require( 'JOIST/ScreenView' );

// images
const gameScreenPlaceholderImage = require( 'image!NUMBER_PLAY/game_screen_placeholder.png' );

class GameScreenView extends ScreenView {

/**
* @param {GameModel} model
* @param {Tandem} tandem
*/
constructor( model, tandem ) {

super( {
tandem: tandem
} );

// add the screen's placeholder image
const gameScreenPlaceholderImageNode = new Image( gameScreenPlaceholderImage, {
maxWidth: this.layoutBounds.width,
maxHeight: this.layoutBounds.height,
cursor: 'pointer'
} );
gameScreenPlaceholderImageNode.center = this.layoutBounds.center;
this.addChild( gameScreenPlaceholderImageNode );
}

/**
* Resets the view.
* @public
*/
reset() {
//TODO
}
}

return numberPlay.register( 'GameScreenView', GameScreenView );
} );
2 changes: 2 additions & 0 deletions js/number-play-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ define( require => {

// modules
const CompareScreen = require( 'NUMBER_PLAY/compare/CompareScreen' );
const GameScreen = require( 'NUMBER_PLAY/game/GameScreen' );
const LabScreen = require( 'NUMBER_PLAY/lab/LabScreen' );
const Sim = require( 'JOIST/Sim' );
const SimLauncher = require( 'JOIST/SimLauncher' );
Expand Down Expand Up @@ -40,6 +41,7 @@ define( require => {
new TenScreen( Tandem.rootTandem.createTandem( 'tenScreen' ) ),
new TwentyScreen( Tandem.rootTandem.createTandem( 'twentyScreen' ) ),
new CompareScreen( Tandem.rootTandem.createTandem( 'compareScreen' ) ),
new GameScreen( Tandem.rootTandem.createTandem( 'gameScreen' ) ),
new LabScreen( Tandem.rootTandem.createTandem( 'labScreen' ) )
], simOptions );
sim.start();
Expand Down
3 changes: 3 additions & 0 deletions number-play-strings_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"screen.compare": {
"value": "Compare"
},
"screen.game": {
"value": "Game"
},
"screen.lab": {
"value": "Lab"
},
Expand Down

0 comments on commit 023657e

Please sign in to comment.