Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Bricked
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
PlayWallDesktop wird heute 10 Jahre alt!
Show more breadcrumbs
Robert Goldmann
Bricked
Commits
10db35be
Commit
10db35be
authored
Oct 26, 2016
by
Max Wittig
Browse files
Options
Downloads
Patches
Plain Diff
added ability to start the game via mouse click
parent
19a08105
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/de/bricked/ui/LevelController.java
+34
-18
34 additions, 18 deletions
src/de/bricked/ui/LevelController.java
with
34 additions
and
18 deletions
src/de/bricked/ui/LevelController.java
+
34
−
18
View file @
10db35be
...
@@ -92,6 +92,28 @@ public class LevelController
...
@@ -92,6 +92,28 @@ public class LevelController
private
double
oldMousePosition
;
private
double
oldMousePosition
;
private
static
ArrayList
<
Label
>
brickLabels
;
private
static
ArrayList
<
Label
>
brickLabels
;
private
void
startGame
()
{
anchorPaneGame
.
heightProperty
().
removeListener
(
heightListener
);
anchorPaneGame
.
widthProperty
().
removeListener
(
widthListener
);
// start random into left or right direction
int
random
=
new
Random
().
nextInt
(
2
);
if
(
random
==
0
)
{
game
.
getBall
().
startBallToRight
();
}
else
{
game
.
getBall
().
startBallToLeft
();
}
timer
.
start
();
Logger
.
log
(
LogLevel
.
INFO
,
"ball start"
);
gameState
=
GameState
.
RUNNING
;
}
public
void
init
(
Stage
stage
,
LevelSelectController
levelSelectController
,
Game
game
)
public
void
init
(
Stage
stage
,
LevelSelectController
levelSelectController
,
Game
game
)
{
{
this
.
stage
=
stage
;
this
.
stage
=
stage
;
...
@@ -100,6 +122,17 @@ public class LevelController
...
@@ -100,6 +122,17 @@ public class LevelController
game
.
setBoard
(
new
Board
(
game
));
game
.
setBoard
(
new
Board
(
game
));
game
.
setLevelController
(
this
);
game
.
setLevelController
(
this
);
anchorPane
.
setOnMouseClicked
(
new
EventHandler
<
MouseEvent
>()
{
@Override
public
void
handle
(
MouseEvent
event
)
{
startGame
();
event
.
consume
();
anchorPaneGame
.
requestFocus
();
}
});
anchorPane
.
setOnKeyReleased
(
new
EventHandler
<
KeyEvent
>()
anchorPane
.
setOnKeyReleased
(
new
EventHandler
<
KeyEvent
>()
{
{
@Override
@Override
...
@@ -117,24 +150,7 @@ public class LevelController
...
@@ -117,24 +150,7 @@ public class LevelController
{
{
if
(
gameState
.
equals
(
GameState
.
WAITING
))
if
(
gameState
.
equals
(
GameState
.
WAITING
))
{
{
anchorPaneGame
.
heightProperty
().
removeListener
(
heightListener
);
startGame
();
anchorPaneGame
.
widthProperty
().
removeListener
(
widthListener
);
// start random into left or right direction
int
random
=
new
Random
().
nextInt
(
2
);
if
(
random
==
0
)
{
game
.
getBall
().
startBallToRight
();
}
else
{
game
.
getBall
().
startBallToLeft
();
}
timer
.
start
();
Logger
.
log
(
LogLevel
.
INFO
,
"ball start"
);
gameState
=
GameState
.
RUNNING
;
}
}
event
.
consume
();
event
.
consume
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment