This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Fixes issues with invalidating matrix for SpriteBox & adds HUD to demo game #202
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cf1896d
Fixes issues with invalidating matrix for SpriteBox
vlidholt 61c0394
Fixes issues in demo game and adds heads up display
vlidholt 6216bc2
Merge branch 'master' of github.com:domokit/sky_engine
vlidholt ed4329e
Fixes formatting and removes redundant code in sprites
vlidholt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -51,6 +51,7 @@ main() async { | |
class GameDemoApp extends App { | ||
|
||
NavigationState _navigationState; | ||
GameDemoWorld _game; | ||
|
||
void initState() { | ||
_navigationState = new NavigationState([ | ||
|
@@ -84,21 +85,18 @@ class GameDemoApp extends App { | |
} | ||
|
||
Widget _buildGameScene(navigator, route) { | ||
return new SpriteWidget( | ||
new GameDemoWorld(_app, navigator, _loader, _spriteSheet) | ||
); | ||
return new SpriteWidget(_game); | ||
} | ||
|
||
Widget _buildMainScene(navigator, route) { | ||
return new Center( | ||
child: new RaisedButton( | ||
child: new Text("Play"), | ||
onPressed: () => navigator.pushNamed('/game') | ||
onPressed: () { | ||
_game = new GameDemoWorld(_app, navigator, _loader, _spriteSheet, _spriteSheetUI); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't this redundant with _buildGameScene? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW, generally, build functions should be stateless and idempotent, and state setting should happen in event callbacks within setState() blocks. Might be worth refactoring this a bit. |
||
navigator.pushNamed('/game'); | ||
} | ||
) | ||
); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resetGame seems to be dead code (nothing calls it). |
||
} | ||
|
||
void resetGame() { | ||
_app.scheduleBuild(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constructors should come first, then fields