-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add game screen and update placeholder images, see #2
- Loading branch information
Showing
9 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters