mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 06:11:50 +09:00
added sources for Slick
Former-commit-id: 1647fa32ef6894bd7db44f741f07c2f4dcdf9054 Former-commit-id: 0e5810dcfbe1fd59b13e7cabe9f1e93c5542da2d
This commit is contained in:
80
lib/slick-source/org/newdawn/slick/tests/PureFontTest.java
Normal file
80
lib/slick-source/org/newdawn/slick/tests/PureFontTest.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package org.newdawn.slick.tests;
|
||||
|
||||
import org.newdawn.slick.AngelCodeFont;
|
||||
import org.newdawn.slick.AppGameContainer;
|
||||
import org.newdawn.slick.BasicGame;
|
||||
import org.newdawn.slick.Font;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Image;
|
||||
import org.newdawn.slick.Input;
|
||||
import org.newdawn.slick.SlickException;
|
||||
|
||||
/**
|
||||
* A test of the font rendering capabilities
|
||||
*
|
||||
* @author kevin
|
||||
*/
|
||||
public class PureFontTest extends BasicGame {
|
||||
/** The font we're going to use to render */
|
||||
private Font font;
|
||||
/** The image */
|
||||
private Image image;
|
||||
|
||||
/**
|
||||
* Create a new test for font rendering
|
||||
*/
|
||||
public PureFontTest() {
|
||||
super("Hiero Font Test");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.newdawn.slick.Game#init(org.newdawn.slick.GameContainer)
|
||||
*/
|
||||
public void init(GameContainer container) throws SlickException {
|
||||
image = new Image("testdata/sky.jpg");
|
||||
font = new AngelCodeFont("testdata/hiero.fnt","testdata/hiero.png");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
|
||||
*/
|
||||
public void render(GameContainer container, Graphics g) {
|
||||
image.draw(0,0,800,600);
|
||||
font.drawString(100, 32, "On top of old smokey, all");
|
||||
font.drawString(100, 80, "covered with sand..");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
|
||||
*/
|
||||
public void update(GameContainer container, int delta) throws SlickException {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.newdawn.slick.BasicGame#keyPressed(int, char)
|
||||
*/
|
||||
public void keyPressed(int key, char c) {
|
||||
if (key == Input.KEY_ESCAPE) {
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/** The container we're using */
|
||||
private static AppGameContainer container;
|
||||
|
||||
/**
|
||||
* Entry point to our test
|
||||
*
|
||||
* @param argv The arguments passed in the test
|
||||
*/
|
||||
public static void main(String[] argv) {
|
||||
try {
|
||||
container = new AppGameContainer(new PureFontTest());
|
||||
container.setDisplayMode(800,600,false);
|
||||
container.start();
|
||||
} catch (SlickException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user