Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Progark gruppe 3
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
Container registry
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ingebrigt Ørstad
Progark gruppe 3
Commits
d4faee67
Commit
d4faee67
authored
5 years ago
by
Turid Cecilie Dahl
Browse files
Options
Downloads
Patches
Plain Diff
#50
makes ViewHighScoreState prettier
parent
20271da3
No related branches found
No related tags found
1 merge request
!66
Resolve "Make it look pretty"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/core/src/com/gameware/game/states/ViewHighScoreState.java
+46
-3
46 additions, 3 deletions
...core/src/com/gameware/game/states/ViewHighScoreState.java
with
46 additions
and
3 deletions
frontend/core/src/com/gameware/game/states/ViewHighScoreState.java
+
46
−
3
View file @
d4faee67
...
@@ -2,13 +2,22 @@ package com.gameware.game.states;
...
@@ -2,13 +2,22 @@ package com.gameware.game.states;
import
com.badlogic.gdx.Gdx
;
import
com.badlogic.gdx.Gdx
;
import
com.badlogic.gdx.Input
;
import
com.badlogic.gdx.Input
;
import
com.badlogic.gdx.graphics.Color
;
import
com.badlogic.gdx.graphics.Pixmap
;
import
com.badlogic.gdx.graphics.Texture
;
import
com.badlogic.gdx.graphics.g2d.SpriteBatch
;
import
com.badlogic.gdx.graphics.g2d.SpriteBatch
;
import
com.badlogic.gdx.graphics.g2d.TextureRegion
;
import
com.badlogic.gdx.scenes.scene2d.InputEvent
;
import
com.badlogic.gdx.scenes.scene2d.InputEvent
;
import
java.util.List
;
import
java.util.List
;
import
com.badlogic.gdx.scenes.scene2d.ui.Image
;
import
com.badlogic.gdx.scenes.scene2d.ui.Label
;
import
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
;
import
com.badlogic.gdx.scenes.scene2d.ui.Skin
;
import
com.badlogic.gdx.scenes.scene2d.ui.Skin
;
import
com.badlogic.gdx.scenes.scene2d.ui.Table
;
import
com.badlogic.gdx.scenes.scene2d.ui.Table
;
import
com.badlogic.gdx.scenes.scene2d.ui.TextButton
;
import
com.badlogic.gdx.scenes.scene2d.ui.TextButton
;
import
com.badlogic.gdx.scenes.scene2d.utils.ClickListener
;
import
com.badlogic.gdx.scenes.scene2d.utils.ClickListener
;
import
com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable
;
import
com.gameware.game.QueryIntermediate
;
import
com.gameware.game.QueryIntermediate
;
import
com.gameware.game.GameWare
;
import
com.gameware.game.GameWare
;
import
com.gameware.game.models.Game
;
import
com.gameware.game.models.Game
;
...
@@ -21,9 +30,15 @@ import java.io.IOException;
...
@@ -21,9 +30,15 @@ import java.io.IOException;
public
class
ViewHighScoreState
extends
State
{
public
class
ViewHighScoreState
extends
State
{
private
Table
table
;
private
Table
table
;
private
Table
innerTable
;
private
ScrollPane
tournamentsPane
;
private
List
<
Game
>
games
;
private
List
<
Game
>
games
;
private
String
backBtnText
=
"Back"
;
private
String
backBtnText
=
"Back"
;
private
String
BtnText
=
"View High Score!"
;
private
Label
stateNameLabel
=
new
Label
(
"High Scores"
,
skin
,
"big"
);
private
Label
secondStateNameLabel
=
new
Label
(
"Select game"
,
skin
,
"big"
);
public
ViewHighScoreState
(
GameStateManager
gsm
)
{
public
ViewHighScoreState
(
GameStateManager
gsm
)
{
super
(
gsm
);
super
(
gsm
);
...
@@ -35,18 +50,46 @@ public class ViewHighScoreState extends State {
...
@@ -35,18 +50,46 @@ public class ViewHighScoreState extends State {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
makeStage
();
}
private
void
makeStage
(){
table
=
new
Table
();
table
=
new
Table
();
table
.
setFillParent
(
true
);
table
.
setFillParent
(
true
);
table
.
setBackground
(
background
);
stateNameLabel
.
setFontScale
(
titleFontBigScale
);
table
.
add
(
stateNameLabel
).
spaceBottom
(
spacingOnBottomInputFIeld
);
table
.
row
();
table
.
add
(
secondStateNameLabel
).
spaceBottom
(
spacingOnBottom
);
table
.
row
();
table
.
row
();
innerTable
=
new
Table
();
Pixmap
bgPixmap
=
new
Pixmap
(
1
,
1
,
Pixmap
.
Format
.
RGB565
);
bgPixmap
.
setColor
(
Color
.
SKY
);
bgPixmap
.
fill
();
TextureRegionDrawable
textureRegionDrawableBg
=
new
TextureRegionDrawable
(
new
TextureRegion
(
new
Texture
(
bgPixmap
)));
innerTable
.
setBackground
(
textureRegionDrawableBg
);
for
(
Game
g
:
games
){
for
(
Game
g
:
games
){
TextButton
gameBtn
=
new
TextButton
(
g
.
getName
(),
skin
);
innerTable
.
add
(
new
Image
(
GameWare
.
getInstance
().
getGameIdToPlayState
().
get
(
g
.
getId
()).
screenshot
)).
pad
(
spacingOnBottom
);
Table
innerInnerTable
=
new
Table
();
innerInnerTable
.
add
(
new
Label
(
g
.
getName
(),
skin
)).
spaceBottom
(
spacingOnBottom
);
innerInnerTable
.
row
();
TextButton
gameBtn
=
new
TextButton
(
BtnText
,
skin
);
gameBtn
.
addListener
(
new
ViewHighScoreState
.
MyClickListener
(
g
));
gameBtn
.
addListener
(
new
ViewHighScoreState
.
MyClickListener
(
g
));
table
.
add
(
gameBtn
).
spaceBottom
(
spacingOnBottom
);
innerInnerTable
.
add
(
gameBtn
);
table
.
row
();
innerTable
.
add
(
innerInnerTable
);
innerTable
.
row
();
}
}
tournamentsPane
=
new
ScrollPane
(
innerTable
,
skin
);
table
.
add
(
tournamentsPane
).
spaceBottom
(
spacingOnBottom
);
table
.
getCell
(
tournamentsPane
).
size
(
Gdx
.
graphics
.
getWidth
()/
1.2f
,
Gdx
.
graphics
.
getHeight
()/
3
f
);
table
.
row
();
stage
.
addActor
(
table
);
stage
.
addActor
(
table
);
stage
.
addActor
(
makeBackBtn
());
stage
.
addActor
(
makeBackBtn
());
}
}
...
...
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