|
|
|
@ -1,7 +1,9 @@
|
|
|
|
package com.trs.game;
|
|
|
|
package com.trs.game;
|
|
|
|
|
|
|
|
|
|
|
|
import com.badlogic.gdx.ApplicationAdapter;
|
|
|
|
import com.badlogic.gdx.ApplicationAdapter;
|
|
|
|
|
|
|
|
import com.badlogic.gdx.Game;
|
|
|
|
import com.badlogic.gdx.Gdx;
|
|
|
|
import com.badlogic.gdx.Gdx;
|
|
|
|
|
|
|
|
import com.badlogic.gdx.InputProcessor;
|
|
|
|
import com.badlogic.gdx.graphics.Color;
|
|
|
|
import com.badlogic.gdx.graphics.Color;
|
|
|
|
import com.badlogic.gdx.graphics.GL20;
|
|
|
|
import com.badlogic.gdx.graphics.GL20;
|
|
|
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
|
|
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
|
|
|
@ -12,8 +14,16 @@ import com.badlogic.gdx.utils.Timer;
|
|
|
|
import com.trs.game.model.Model;
|
|
|
|
import com.trs.game.model.Model;
|
|
|
|
import com.trs.game.view.View;
|
|
|
|
import com.trs.game.view.View;
|
|
|
|
import com.trs.game.view.Button;
|
|
|
|
import com.trs.game.view.Button;
|
|
|
|
|
|
|
|
import com.trs.game.view.Screen;
|
|
|
|
|
|
|
|
import com.trs.game.view.Screens.EndScreen;
|
|
|
|
|
|
|
|
import com.trs.game.view.Screens.GameScreen;
|
|
|
|
|
|
|
|
import com.trs.game.view.Screens.MainMenuScreen;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class Controller extends ApplicationAdapter implements InputProcessor {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final int GAME_WORLD_WIDTH = 1600;
|
|
|
|
|
|
|
|
final int GAME_WORLD_HEIGHT = 900;
|
|
|
|
|
|
|
|
|
|
|
|
public class Controller extends ApplicationAdapter {
|
|
|
|
|
|
|
|
SpriteBatch batch;
|
|
|
|
SpriteBatch batch;
|
|
|
|
ShapeRenderer renderer;
|
|
|
|
ShapeRenderer renderer;
|
|
|
|
Timer wallTimer;
|
|
|
|
Timer wallTimer;
|
|
|
|
@ -21,7 +31,7 @@ public class Controller extends ApplicationAdapter {
|
|
|
|
View view;
|
|
|
|
View view;
|
|
|
|
BitmapFont font;
|
|
|
|
BitmapFont font;
|
|
|
|
|
|
|
|
|
|
|
|
Button button;
|
|
|
|
Screen screen;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void create () {
|
|
|
|
public void create () {
|
|
|
|
@ -37,32 +47,29 @@ public class Controller extends ApplicationAdapter {
|
|
|
|
// TODO: Implement timertask
|
|
|
|
// TODO: Implement timertask
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 0, 1f);
|
|
|
|
}, 0, 1f);
|
|
|
|
button = new Button(0, 200, 150, 200, 80, "EHRE", Color.YELLOW, Color.BLACK);
|
|
|
|
|
|
|
|
font = new BitmapFont();
|
|
|
|
font = new BitmapFont();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// BITMAP FONT
|
|
|
|
|
|
|
|
font = new BitmapFont();
|
|
|
|
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font.ttf"));
|
|
|
|
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font.ttf"));
|
|
|
|
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
|
|
|
|
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
|
|
|
|
parameter.size = 21;
|
|
|
|
parameter.size = 21;
|
|
|
|
font = generator.generateFont(parameter);
|
|
|
|
font = generator.generateFont(parameter);
|
|
|
|
generator.dispose();
|
|
|
|
generator.dispose();
|
|
|
|
font.setColor(Color.BLACK);
|
|
|
|
font.setColor(Color.BLACK);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screen = new MainMenuScreen(GAME_WORLD_WIDTH,GAME_WORLD_HEIGHT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gdx.input.setInputProcessor(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void render () {
|
|
|
|
public void render () {
|
|
|
|
Gdx.gl.glClearColor(1, 1, 1, 1);
|
|
|
|
Gdx.gl.glClearColor(1, 1, 1, 1);
|
|
|
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
|
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
|
|
batch.begin();
|
|
|
|
|
|
|
|
batch.end();
|
|
|
|
|
|
|
|
renderer.begin(ShapeRenderer.ShapeType.Filled);
|
|
|
|
|
|
|
|
renderer.setColor(Color.WHITE);
|
|
|
|
|
|
|
|
renderer.rect(50,50,0,0,50,50,1,1,45);
|
|
|
|
|
|
|
|
renderer.setColor(Color.BLACK);
|
|
|
|
|
|
|
|
renderer.circle(50,50,5);
|
|
|
|
|
|
|
|
renderer.end();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button.render(batch,renderer,font);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screen.render(batch,renderer,font);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -70,4 +77,47 @@ public class Controller extends ApplicationAdapter {
|
|
|
|
batch.dispose();
|
|
|
|
batch.dispose();
|
|
|
|
renderer.dispose();
|
|
|
|
renderer.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean keyDown(int keycode) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean keyUp(int keycode) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean keyTyped(char character) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
|
|
|
|
|
|
|
if(screen.getId() == 0) screen = new GameScreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
|
|
|
|
|
|
|
|
else if(screen.getId() == 1) screen = new EndScreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
|
|
|
|
|
|
|
|
else if(screen.getId() == 2) screen = new MainMenuScreen(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean mouseMoved(int screenX, int screenY) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean scrolled(int amount) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|