Commit 3d505edb authored by Fjen Undso's avatar Fjen Undso
Browse files

mainmenu: fix gametitle placement. ref #15

parent 85590716
...@@ -60,12 +60,17 @@ public class FrozenNumbersGame extends ApplicationAdapter { ...@@ -60,12 +60,17 @@ public class FrozenNumbersGame extends ApplicationAdapter {
size2Params.fontFileName = "fonts/crayon.ttf"; size2Params.fontFileName = "fonts/crayon.ttf";
size2Params.fontParameters.size = 20; size2Params.fontParameters.size = 20;
assets.load("size20.ttf", BitmapFont.class, size2Params); assets.load("size20.ttf", BitmapFont.class, size2Params);
FreetypeFontLoader.FreeTypeFontLoaderParameter size3Params = new FreetypeFontLoader.FreeTypeFontLoaderParameter(); FreetypeFontLoader.FreeTypeFontLoaderParameter size3Params = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
size3Params.fontFileName = "fonts/crayon.ttf"; size3Params.fontFileName = "fonts/crayon.ttf";
size3Params.fontParameters.size = 40; size3Params.fontParameters.size = 40;
assets.load("size40.ttf", BitmapFont.class, size3Params); assets.load("size40.ttf", BitmapFont.class, size3Params);
FreetypeFontLoader.FreeTypeFontLoaderParameter size4Params = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
size4Params.fontFileName = "fonts/crayon.ttf";
size4Params.fontParameters.size = 60;
assets.load("size60.ttf", BitmapFont.class, size4Params);
assets.load("backgrounds/background.jpg", Texture.class); assets.load("backgrounds/background.jpg", Texture.class);
// menu // menu
assets.load("sprites/btn_help.png", Texture.class); assets.load("sprites/btn_help.png", Texture.class);
......
...@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.GL20; ...@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch; import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont; 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.Sprite;
import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Label;
...@@ -25,6 +26,7 @@ public class MainMenuScreen implements Screen { ...@@ -25,6 +26,7 @@ public class MainMenuScreen implements Screen {
Sprite p1_quest, p2_quest; Sprite p1_quest, p2_quest;
boolean p1_isready, p2_isready; boolean p1_isready, p2_isready;
float wWidth, wHeight; float wWidth, wHeight;
GlyphLayout glyphLayout = new GlyphLayout();
public MainMenuScreen(Game g, Map<String, Screen> m) { public MainMenuScreen(Game g, Map<String, Screen> m) {
game = g; game = g;
...@@ -102,7 +104,7 @@ public class MainMenuScreen implements Screen { ...@@ -102,7 +104,7 @@ public class MainMenuScreen implements Screen {
} }
//drawing stuff // Drawing Stuff
Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
Batch batch = FrozenNumbersGame.batch; Batch batch = FrozenNumbersGame.batch;
...@@ -116,13 +118,15 @@ public class MainMenuScreen implements Screen { ...@@ -116,13 +118,15 @@ public class MainMenuScreen implements Screen {
p1_quest.draw(batch); p1_quest.draw(batch);
p2_quest.draw(batch); p2_quest.draw(batch);
// Game Title
Label p2TextLabel = new Label("Frozen Numbers", new Label.LabelStyle(FrozenNumbersGame.assets.get("size40.ttf", BitmapFont.class), Color.WHITE));
Table container = new Table(); Table container = new Table();
container.setTransform(true); container.setTransform(true);
container.add(p2TextLabel); Label p2GameTName = new Label("Frozen Numbers", new Label.LabelStyle(FrozenNumbersGame.assets.get("size60.ttf", BitmapFont.class), Color.WHITE));
container.add(p2GameTName);
container.setPosition(wWidth / 2.0f, wHeight / 2.0f - 30);
container.draw(batch, 1);
container.setRotation(180); container.setRotation(180);
container.setPosition((float) (wWidth / 2.0), (float) (wHeight / 2.0 + 60)); container.setPosition(wWidth / 2.0f, wHeight / 2.0f + 30);
container.draw(batch, 1); container.draw(batch, 1);
batch.end(); batch.end();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment