Merge remote-tracking branch 'origin/master'

This commit is contained in:
Mike Schwörer 2014-08-11 15:36:33 +02:00
commit 1d13c5b754
10 changed files with 1993 additions and 6 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -0,0 +1,11 @@
{
"com.badlogic.gdx.graphics.g2d.BitmapFont": {
"font": { "file": "fonts/font.fnt" },
},
"com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle": {
"default": { "up": "blue_button2" , "down": "blue_button3", "font": font, "pressedOffsetY": -4 }
},
"com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
"default": { "font": font}
}
}

View File

@ -0,0 +1,155 @@
menuSkin.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
blue_panel
rotate: false
xy: 1, 23
size: 100, 100
split: 39, 60, 42, 57
orig: 100, 100
offset: 0, 0
index: -1
blue_button1
rotate: false
xy: 103, 74
size: 49, 49
split: 6, 6, 7, 10
orig: 49, 49
offset: 0, 0
index: -1
blue_button2
rotate: false
xy: 103, 23
size: 49, 49
split: 7, 7, 5, 9
orig: 49, 49
offset: 0, 0
index: -1
blue_button4
rotate: false
xy: 154, 74
size: 49, 49
split: 12, 19, 7, 10
orig: 49, 49
offset: 0, 0
index: -1
blue_button6
rotate: false
xy: 154, 23
size: 49, 49
split: 9, 12, 6, 10
orig: 49, 49
offset: 0, 0
index: -1
blue_button3
rotate: false
xy: 205, 78
size: 49, 45
split: 15, 15, 5, 7
orig: 49, 45
offset: 0, 0
index: -1
blue_button5
rotate: false
xy: 205, 31
size: 49, 45
split: 7, 8, 7, 8
orig: 49, 45
offset: 0, 0
index: -1
blue_button7
rotate: false
xy: 256, 78
size: 49, 45
split: 9, 11, 5, 5
orig: 49, 45
offset: 0, 0
index: -1
blue_boxCheckmark
rotate: false
xy: 256, 40
size: 38, 36
orig: 38, 36
offset: 0, 0
index: -1
blue_boxCross
rotate: false
xy: 307, 87
size: 38, 36
orig: 38, 36
offset: 0, 0
index: -1
grey_box
rotate: false
xy: 347, 87
size: 38, 36
orig: 38, 36
offset: 0, 0
index: -1
blue_circle
rotate: false
xy: 387, 87
size: 36, 36
split: 17, 18, 17, 18
orig: 36, 36
offset: 0, 0
index: -1
blue_sliderLeft
rotate: false
xy: 425, 92
size: 39, 31
orig: 39, 31
offset: 0, 0
index: -1
blue_sliderRight
rotate: false
xy: 466, 92
size: 39, 31
orig: 39, 31
offset: 0, 0
index: -1
blue_sliderDown
rotate: false
xy: 296, 34
size: 28, 42
orig: 28, 42
offset: 0, 0
index: -1
blue_sliderUp
rotate: false
xy: 326, 43
size: 28, 42
orig: 28, 42
offset: 0, 0
index: -1
blue_checkmark
rotate: false
xy: 1, 1
size: 21, 20
orig: 21, 20
offset: 0, 0
index: -1
blue_cross
rotate: false
xy: 356, 67
size: 18, 18
orig: 18, 18
offset: 0, 0
index: -1
blue_selection
rotate: false
xy: 24, 4
size: 17, 17
split: 8, 8, 8, 8
orig: 17, 17
offset: 0, 0
index: -1
blue_selection
rotate: false
xy: 24, 4
size: 17, 17
orig: 17, 17
offset: 0, 0
index: -1

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -0,0 +1,101 @@
package de.samdev.clorrunner.screens.menu;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import de.samdev.colorrunner.screens.gameScreen.GameScreen;
public class MainMenu implements Screen {
private Stage stage = new Stage();
private Table table = new Table();
private Skin skin = new Skin(Gdx.files.internal("skins/menuSkin.json"),
new TextureAtlas(Gdx.files.internal("skins/menuSkin.pack")));
private TextButton buttonPlay = new TextButton("Play", skin),
buttonExit = new TextButton("Exit", skin);
private Label title = new Label("Color Runner", skin);
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.act();
stage.draw();
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void show() {
buttonPlay.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y){
((Game)Gdx.app.getApplicationListener()).setScreen(new GameScreen());
}
});
buttonExit.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
Gdx.app.exit();
// or System.exit(0);
}
});
table.add(title).padBottom(40).row();
table.add(buttonPlay).size(150,60).padBottom(20).row();
table.add(buttonExit).size(150,60).padBottom(20).row();
table.setFillParent(true);
stage.addActor(table);
Gdx.input.setInputProcessor(stage);
}
@Override
public void hide() {
dispose();
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
stage.dispose();
skin.dispose();
}
}

View File

@ -0,0 +1,105 @@
package de.samdev.clorrunner.screens.menu;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.MathUtils;
public class SplashScreen implements Screen {
private float loadTime = 0;
private int random = MathUtils.random(5);
private Texture logo = new Texture("images/samlogo.png");
private OrthographicCamera cam = new OrthographicCamera();
private SpriteBatch sB;
@Override
public void render(float delta) {
if(random == 0){
Gdx.gl.glClearColor(0.4f, 0, 0, 1); // Rot
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}else if (random == 1){
Gdx.gl.glClearColor(0.8f, 0.8f, 0, 1); //Gelb
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}else if ((random == 2)){
Gdx.gl.glClearColor(1, 0.5f, 0.25f, 1); //Orange
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}else if (random == 3){
Gdx.gl.glClearColor(0.25f, 0.5f, 1, 1); //Blau
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}else if (random == 4){
Gdx.gl.glClearColor(0, 0.8f, 0.3f, 1); //Grün
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}else if (random == 5){
Gdx.gl.glClearColor(1, 1, 1, 1); //Weiß
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}
sB.begin();
sB.draw(logo, -9,
-8, 18, 16);
sB.end();
loadTime += delta;
if (loadTime > 0.5)
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void show() {
sB = new SpriteBatch();
this.cam = new OrthographicCamera(20,40);
this.cam.position.set(20 / 2, 40 / 2, 0);
sB.setProjectionMatrix(cam.combined);
cam.update();
}
@Override
public void hide() {
dispose();
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
logo.dispose();
}
}

View File

@ -2,19 +2,21 @@ package de.samdev.colorrunner;
import com.badlogic.gdx.Game;
import de.samdev.clorrunner.screens.menu.SplashScreen;
import de.samdev.colorrunner.screens.gameScreen.GameScreen;
public class CRGame extends Game {
public final static boolean DEBUG = true;
private GameScreen gameScreen;
private SplashScreen SplashScreen;
public static final int WIDTH=1000,HEIGHT=563;
@Override
public void create() {
gameScreen = new GameScreen();
SplashScreen = new SplashScreen();
//----------------------------------
setScreen(gameScreen);
setScreen(SplashScreen);
}
}

View File

@ -9,8 +9,8 @@ public class DesktopLauncher {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.title = "ColorRunner";
config.width = 1000;
config.height = 563;
config.width = CRGame.WIDTH;
config.height = CRGame.HEIGHT;
/*
* For FPS Independence Testing