Skip to content
Snippets Groups Projects
Commit fdaa37cc authored by Sixten Müller's avatar Sixten Müller
Browse files

Merge branch '9-create-joingame-page' into 'main'

Resolve "Create JoinGame-page"

Closes #9

See merge request !3
parents 55ba6480 5b7cb55a
No related branches found
No related tags found
1 merge request!3Resolve "Create JoinGame-page"
package com.wordbattle.game.controller;
public class JoinGameController {
}
package com.wordbattle.game.states;
public class JoinGameState {
}
package com.wordbattle.game.view;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.math.Rectangle;
import com.wordbattle.game.WordBattle;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class JoinGameView {
private Texture backgroundTexture;
private Texture joinGameButton;
private Rectangle joinGameButtonBounds;
private OrthographicCamera cam;
public JoinGameView(OrthographicCamera cam){
this.cam = cam;
this.backgroundTexture = new Texture("bg2.png");
this.joinGameButton = new Texture("join_game.png");
joinGameButtonBounds = new Rectangle(
(WordBattle.WIDTH - joinGameButton.getWidth()) / 2,
(WordBattle.HEIGHT / 2 - joinGameButton.getHeight() / 2) - 50,
joinGameButton.getWidth(),
joinGameButton.getHeight()
);
}
public void render(SpriteBatch spriteBatch){
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
cam.update();
spriteBatch.setProjectionMatrix(cam.combined);
spriteBatch.begin();
spriteBatch.draw(backgroundTexture, 0, 0, WordBattle.WIDTH, WordBattle.HEIGHT);
spriteBatch.draw(joinGameButton, joinGameButtonBounds.x, joinGameButtonBounds.y);
spriteBatch.end();
}
public Rectangle getJoinGameButtonBounds() {
return joinGameButtonBounds;
}
public void dispose() {
backgroundTexture.dispose();
joinGameButton.dispose();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment