-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Examples: Fix mixing of tabs and spaces. Only use spaces.
- Loading branch information
Showing
5 changed files
with
143 additions
and
143 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,53 +1,53 @@ | ||
var game = new Phaser.Game(400, 300, Phaser.AUTO, 'hscrollbar', { preload: preload, create: create }); | ||
|
||
function preload() { | ||
game.load.image("dummyButton", "assets/horizontal/sprite.png"); | ||
game.load.image("track", "assets/horizontal/track.png"); | ||
game.load.spritesheet('bar', 'assets/horizontal/bar.png', 44, 22); | ||
game.load.image("dummyButton", "assets/horizontal/sprite.png"); | ||
game.load.image("track", "assets/horizontal/track.png"); | ||
game.load.spritesheet('bar', 'assets/horizontal/bar.png', 44, 22); | ||
} | ||
|
||
function create() { | ||
// Create a viewport. A "window" with a limited area of view. | ||
var viewport = new uiWidgets.Viewport(game, 75, 75, 260, 128); | ||
|
||
// Create a row. Anything added to a row is placed next to the previous thing added. | ||
var row = new uiWidgets.Row(game); | ||
|
||
// Put the row inside the viewport. | ||
viewport.addNode(row); | ||
|
||
// Add things to the row. | ||
var dummy_sprite_a = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_b = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_c = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_d = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_e = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_f = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_g = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_h = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_i = this.game.add.sprite(0, 0, "dummyButton"); | ||
|
||
row.addNode(dummy_sprite_a); | ||
row.addNode(dummy_sprite_b); | ||
row.addNode(dummy_sprite_c); | ||
row.addNode(dummy_sprite_d); | ||
row.addNode(dummy_sprite_e); | ||
row.addNode(dummy_sprite_f); | ||
row.addNode(dummy_sprite_g); | ||
row.addNode(dummy_sprite_h); | ||
row.addNode(dummy_sprite_i); | ||
|
||
// Create a scrollbar for the viewport. | ||
var scrollbar = new uiWidgets.Scrollbar( | ||
game, | ||
viewport, | ||
true, | ||
false, | ||
"track", | ||
"bar", | ||
{'duration': 300, 'ease': Phaser.Easing.Quadratic.Out} | ||
); | ||
|
||
// Place scrollbar below viewport. | ||
scrollbar.alignTo(viewport, Phaser.BOTTOM_LEFT, 0, 10); | ||
// Create a viewport. A "window" with a limited area of view. | ||
var viewport = new uiWidgets.Viewport(game, 75, 75, 260, 128); | ||
|
||
// Create a row. Anything added to a row is placed next to the previous thing added. | ||
var row = new uiWidgets.Row(game); | ||
|
||
// Put the row inside the viewport. | ||
viewport.addNode(row); | ||
|
||
// Add things to the row. | ||
var dummy_sprite_a = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_b = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_c = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_d = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_e = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_f = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_g = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_h = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_i = this.game.add.sprite(0, 0, "dummyButton"); | ||
|
||
row.addNode(dummy_sprite_a); | ||
row.addNode(dummy_sprite_b); | ||
row.addNode(dummy_sprite_c); | ||
row.addNode(dummy_sprite_d); | ||
row.addNode(dummy_sprite_e); | ||
row.addNode(dummy_sprite_f); | ||
row.addNode(dummy_sprite_g); | ||
row.addNode(dummy_sprite_h); | ||
row.addNode(dummy_sprite_i); | ||
|
||
// Create a scrollbar for the viewport. | ||
var scrollbar = new uiWidgets.Scrollbar( | ||
game, | ||
viewport, | ||
true, | ||
false, | ||
"track", | ||
"bar", | ||
{'duration': 300, 'ease': Phaser.Easing.Quadratic.Out} | ||
); | ||
|
||
// Place scrollbar below viewport. | ||
scrollbar.alignTo(viewport, Phaser.BOTTOM_LEFT, 0, 10); | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
var game = new Phaser.Game(600, 400, Phaser.AUTO, 'vscrollbar', { preload: preload, create: create }); | ||
|
||
function preload() { | ||
game.load.image("dummyButton", "assets/vertical/sprite.png"); | ||
game.load.image("track", "assets/vertical/track.png"); | ||
game.load.spritesheet('bar', 'assets/vertical/bar.png', 22, 44); | ||
game.load.image("dummyButton", "assets/vertical/sprite.png"); | ||
game.load.image("track", "assets/vertical/track.png"); | ||
game.load.spritesheet('bar', 'assets/vertical/bar.png', 22, 44); | ||
} | ||
|
||
function create() { | ||
|
||
// Create a viewport. A "window" with a limited area of view. | ||
var viewport = new uiWidgets.Viewport(game, 75, 75, 600, 260); | ||
|
||
// Create a column. Anything added to a column is placed under the previous thing added. | ||
var column = new uiWidgets.Column(game); | ||
|
||
// Put the column inside the viewport. | ||
viewport.addNode(column); | ||
|
||
// Add things to the column. | ||
var dummy_sprite_a = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_b = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_c = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_d = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_e = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_f = this.game.add.sprite(0, 0, "dummyButton"); | ||
|
||
column.addNode(dummy_sprite_a); | ||
column.addNode(dummy_sprite_b); | ||
column.addNode(dummy_sprite_c); | ||
column.addNode(dummy_sprite_d); | ||
column.addNode(dummy_sprite_e); | ||
column.addNode(dummy_sprite_f); | ||
|
||
// Create a scrollbar for the viewport. | ||
var scrollbar = new uiWidgets.Scrollbar( | ||
game, | ||
viewport, | ||
true, | ||
true, | ||
"track", | ||
"bar", | ||
{'duration': 300, 'ease': Phaser.Easing.Quadratic.Out} | ||
); | ||
|
||
// Place scrollbar next to viewport. | ||
scrollbar.alignTo(viewport, Phaser.RIGHT_TOP, 10); | ||
// Create a viewport. A "window" with a limited area of view. | ||
var viewport = new uiWidgets.Viewport(game, 75, 75, 600, 260); | ||
|
||
// Create a column. Anything added to a column is placed under the previous thing added. | ||
var column = new uiWidgets.Column(game); | ||
|
||
// Put the column inside the viewport. | ||
viewport.addNode(column); | ||
|
||
// Add things to the column. | ||
var dummy_sprite_a = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_b = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_c = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_d = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_e = this.game.add.sprite(0, 0, "dummyButton"); | ||
var dummy_sprite_f = this.game.add.sprite(0, 0, "dummyButton"); | ||
|
||
column.addNode(dummy_sprite_a); | ||
column.addNode(dummy_sprite_b); | ||
column.addNode(dummy_sprite_c); | ||
column.addNode(dummy_sprite_d); | ||
column.addNode(dummy_sprite_e); | ||
column.addNode(dummy_sprite_f); | ||
|
||
// Create a scrollbar for the viewport. | ||
var scrollbar = new uiWidgets.Scrollbar( | ||
game, | ||
viewport, | ||
true, | ||
true, | ||
"track", | ||
"bar", | ||
{'duration': 300, 'ease': Phaser.Easing.Quadratic.Out} | ||
); | ||
|
||
// Place scrollbar next to viewport. | ||
scrollbar.alignTo(viewport, Phaser.RIGHT_TOP, 10); | ||
} |