Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProgArkProject
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sixten Müller
ProgArkProject
Merge requests
!8
Finished "Leaderboard" view, controller and state. needs extra logic when firebase is added
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Finished "Leaderboard" view, controller and state. needs extra logic when firebase is added
make-leaderboard
into
main
Overview
0
Commits
6
Pipelines
0
Changes
6
Merged
Marcus Christopher Wildish
requested to merge
make-leaderboard
into
main
1 year ago
Overview
0
Commits
6
Pipelines
0
Changes
6
Expand
0
0
Merge request reports
Compare
main
version 3
8549b5d8
1 year ago
version 2
e1d9630c
1 year ago
version 1
c1c22692
1 year ago
main (base)
and
latest version
latest version
03c22b46
6 commits,
1 year ago
version 3
8549b5d8
5 commits,
1 year ago
version 2
e1d9630c
4 commits,
1 year ago
version 1
c1c22692
1 commit,
1 year ago
6 files
+
559
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
core/src/com/wordbattle/game/controller/FinalLeaderBoardController.java
0 → 100644
+
85
−
0
Options
package
com.wordbattle.game.controller
;
import
com.badlogic.gdx.Gdx
;
import
com.badlogic.gdx.graphics.g2d.SpriteBatch
;
import
com.badlogic.gdx.math.Vector3
;
import
com.wordbattle.game.WordBattle
;
import
com.wordbattle.game.states.CreateGameState
;
import
com.wordbattle.game.states.FinalLeaderboardState
;
import
com.wordbattle.game.view.FinalLeaderBoardView
;
public
class
FinalLeaderBoardController
{
private
FinalLeaderboardState
state
;
private
FinalLeaderBoardView
finalLeaderBoardView
;
private
int
lenLeaderBordPage
;
public
FinalLeaderBoardController
(
FinalLeaderboardState
state
)
{
this
.
state
=
state
;
finalLeaderBoardView
=
new
FinalLeaderBoardView
(
state
.
getCam
());
lenLeaderBordPage
=
2400
;
//testing variable until firebase is implemented
finalLeaderBoardView
.
setNumBackgroundRenders
(
calculateBackgroundRenders
());
//Tells view how many backgroundTextures to load
}
int
mouseYCoordinate
;
public
void
handleInput
(){
if
(
Gdx
.
input
.
justTouched
()){
mouseYCoordinate
=
Gdx
.
input
.
getY
();
Vector3
touchPos
=
new
Vector3
(
Gdx
.
input
.
getX
(),
Gdx
.
input
.
getY
(),
0
);
state
.
getCam
().
unproject
(
touchPos
);
// convert from screen coordinates to world coordinates
if
(
finalLeaderBoardView
.
getBackToStartBounds
().
contains
(
touchPos
.
x
,
touchPos
.
y
)){
state
.
getStateManager
().
setState
(
new
CreateGameState
(
state
.
getStateManager
()));
//midlertidlig
}
}
if
(
Gdx
.
input
.
isTouched
()){
int
scrollDistance
=
mouseYCoordinate
-
Gdx
.
input
.
getY
();
mouseYCoordinate
=
Gdx
.
input
.
getY
();
if
(
(
finalLeaderBoardView
.
getCam
().
viewportHeight
/
2
+
finalLeaderBoardView
.
getCam
().
position
.
y
)
-
scrollDistance
<
WordBattle
.
HEIGHT
&&
(
(-
finalLeaderBoardView
.
getCam
().
viewportHeight
/
2
)
+
finalLeaderBoardView
.
getCam
().
position
.
y
)
-
scrollDistance
>
WordBattle
.
HEIGHT
-
lenLeaderBordPage
){
finalLeaderBoardView
.
getCam
().
translate
(
0
,-
scrollDistance
);
}
}
}
public
void
render
(
SpriteBatch
sb
){
finalLeaderBoardView
.
render
(
sb
);
}
public
void
update
(
float
dt
){
handleInput
();
}
public
int
calculateBackgroundRenders
(){
return
1
+
lenLeaderBordPage
/
WordBattle
.
HEIGHT
;
}
public
void
dispose
(){
}
}
Loading