Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TDT4240 Tank Wars
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
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
Snorre Skjellestad Kristiansen
TDT4240 Tank Wars
Commits
858ee25d
Commit
858ee25d
authored
2 years ago
by
Sander Østrem Fagernes
Browse files
Options
Downloads
Patches
Plain Diff
feat: Logo, header box added
Issue
#19
parent
891b2213
No related branches found
Branches containing commit
No related tags found
1 merge request
!16
Resolve "Login screen setup (without backend)"
Pipeline
#204516
passed
2 years ago
Stage: backend test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/core/src/com/game/tankwars/controller/LoginController.java
+1
-1
1 addition, 1 deletion
...ore/src/com/game/tankwars/controller/LoginController.java
frontend/core/src/com/game/tankwars/view/LoginScreen.java
+43
-0
43 additions, 0 deletions
frontend/core/src/com/game/tankwars/view/LoginScreen.java
with
44 additions
and
1 deletion
frontend/core/src/com/game/tankwars/controller/LoginController.java
+
1
−
1
View file @
858ee25d
...
...
@@ -12,7 +12,7 @@ public class LoginController {
}
public
void
handleInput
(
Vector3
touchPos
)
{
System
.
out
.
println
(
"T
ouch
ed"
);
System
.
out
.
println
(
t
ouch
Pos
);
}
}
This diff is collapsed.
Click to expand it.
frontend/core/src/com/game/tankwars/view/LoginScreen.java
+
43
−
0
View file @
858ee25d
...
...
@@ -3,9 +3,13 @@ package com.game.tankwars.view;
import
com.badlogic.gdx.Gdx
;
import
com.badlogic.gdx.InputAdapter
;
import
com.badlogic.gdx.Screen
;
import
com.badlogic.gdx.graphics.Texture
;
import
com.badlogic.gdx.graphics.g2d.BitmapFont
;
import
com.badlogic.gdx.graphics.g2d.GlyphLayout
;
import
com.badlogic.gdx.graphics.g2d.Sprite
;
import
com.badlogic.gdx.graphics.g2d.SpriteBatch
;
import
com.badlogic.gdx.math.Vector3
;
import
com.badlogic.gdx.utils.ScreenUtils
;
import
com.badlogic.gdx.utils.viewport.FitViewport
;
import
com.badlogic.gdx.utils.viewport.Viewport
;
import
com.game.tankwars.TankWarsGame
;
...
...
@@ -20,6 +24,13 @@ public class LoginScreen extends InputAdapter implements Screen {
private
final
Viewport
viewport
;
private
final
LoginController
controller
;
private
final
Texture
background
;
private
final
Sprite
logo
;
private
final
Texture
headerBox
;
private
final
GlyphLayout
title
;
private
float
heightPercentile
;
private
final
Vector3
touchPos
;
public
LoginScreen
(
final
TankWarsGame
tankWarsGame
)
{
...
...
@@ -27,10 +38,25 @@ public class LoginScreen extends InputAdapter implements Screen {
batch
=
new
SpriteBatch
();
// Font from https://www.fontspace.com/roll-accurate-font-f32330
font
=
FontGeneratorTTF
.
generate
(
"RollAccurate-mvrx.ttf"
);
font
.
getData
().
setScale
(
0.6f
);
// Camera size set to main menu dimensions: portrait mode
viewport
=
new
FitViewport
(
220
f
,
220
f
*
Gdx
.
graphics
.
getHeight
()
/
Gdx
.
graphics
.
getWidth
());
heightPercentile
=
viewport
.
getWorldHeight
()
/
100
;
controller
=
new
LoginController
(
tankWarsGame
);
// TODO: Handle exception on file not found
background
=
new
Texture
(
"menu-background.png"
);
logo
=
new
Sprite
(
new
Texture
(
"tankwars-logo.png"
));
logo
.
setScale
(
1.3f
);
logo
.
setPosition
(-
logo
.
getWidth
()
/
2
,
32
*
heightPercentile
);
headerBox
=
new
Texture
(
"main-menu-welcome-box.png"
);
font
.
getData
().
setScale
(
1
f
);
title
=
new
GlyphLayout
(
font
,
"Log in"
);
font
.
getData
().
setScale
(
0.55f
);
touchPos
=
new
Vector3
();
}
...
...
@@ -41,12 +67,26 @@ public class LoginScreen extends InputAdapter implements Screen {
@Override
public
void
render
(
float
delta
)
{
ScreenUtils
.
clear
(
0
,
0
,
0
,
1
);
batch
.
setProjectionMatrix
(
viewport
.
getCamera
().
combined
);
batch
.
begin
();
batch
.
draw
(
background
,
-
background
.
getWidth
()
/
2
f
,
-
background
.
getHeight
()
/
2
f
);
logo
.
draw
(
batch
);
// TODO: Make its own class
batch
.
draw
(
headerBox
,
-
viewport
.
getWorldWidth
()
/
2
,
12
*
heightPercentile
,
viewport
.
getWorldWidth
(),
headerBox
.
getHeight
());
font
.
draw
(
batch
,
title
,
-
title
.
width
/
2
,
20
*
heightPercentile
);
batch
.
end
();
}
@Override
public
void
resize
(
int
width
,
int
height
)
{
viewport
.
update
(
width
,
height
);
heightPercentile
=
viewport
.
getWorldHeight
()
/
100
;
}
@Override
...
...
@@ -77,6 +117,9 @@ public class LoginScreen extends InputAdapter implements Screen {
public
void
dispose
()
{
batch
.
dispose
();
font
.
dispose
();
background
.
dispose
();
logo
.
getTexture
().
dispose
();
headerBox
.
dispose
();
}
...
...
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