mirror of
https://github.com/Klagarge/PokeHES.git
synced 2025-06-27 04:32:31 +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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
47
src/testYann.java
Normal file
47
src/testYann.java
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
import Screen.ScreenBattle;
|
||||
import ch.hevs.gdx2d.desktop.PortableApplication;
|
||||
import ch.hevs.gdx2d.lib.GdxGraphics;
|
||||
import ch.hevs.gdx2d.lib.ScreenManager;
|
||||
|
||||
public class testYann extends PortableApplication{
|
||||
|
||||
private ScreenManager s = new ScreenManager();
|
||||
|
||||
ScreenBattle b;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new testYann();
|
||||
|
||||
}
|
||||
|
||||
testYann(){
|
||||
super(1000, 800);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInit() {
|
||||
b = new ScreenBattle();
|
||||
s.registerScreen(b.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGraphicRender(GdxGraphics g) {
|
||||
s.render(g);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onKeyDown(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onKeyDown(keycode);
|
||||
}
|
||||
@Override
|
||||
public void onKeyUp(int keycode) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onKeyUp(keycode);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user