mirror of
https://github.com/Klagarge/PokeHES.git
synced 2025-10-30 11:19:17 +00:00
battleScreen and testYann
This commit is contained in:
@@ -1,5 +1,57 @@
|
||||
package Screen;
|
||||
|
||||
public class ScreenBattle {
|
||||
import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
|
||||
import ch.hevs.gdx2d.desktop.PortableApplication;
|
||||
import ch.hevs.gdx2d.lib.GdxGraphics;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.files.FileHandle;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeType.Bitmap;
|
||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
|
||||
public class ScreenBattle extends RenderingScreen{
|
||||
|
||||
private BitmapFont optimus40;
|
||||
|
||||
@Override
|
||||
public void onInit() {
|
||||
|
||||
//display the question
|
||||
generateFont("resources//font//OptimusPrinceps.ttf", optimus40, 100, Color.WHITE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGraphicRender(GdxGraphics g) {
|
||||
g.clear(Color.GREEN);
|
||||
g.drawStringCentered(g.getScreenHeight()/2, "question", optimus40);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
optimus40.dispose();
|
||||
|
||||
}
|
||||
|
||||
public void generateFont(String file, BitmapFont bitmapFont, int height, Color c ){
|
||||
FileHandle fileHandle = Gdx.files.internal(file);
|
||||
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
|
||||
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fileHandle);
|
||||
parameter.size = generator.scaleForPixelHeight(height);
|
||||
parameter.color = c;
|
||||
optimus40 = generator.generateFont(parameter);
|
||||
generator.dispose();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user