Rev 377 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
package com.gebauz.tools;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Vector;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL10;
import com.gebauz.Bauzoid.file.FileUtil;
import com.gebauz.Bauzoid.parser.ScanException;
import com.gebauz.Bauzoid.parser.Tokenizer;
public class FontPotApp
implements ApplicationListener
{
public static final String LOG_TAG =
"FontPot";
public static boolean verbose =
true;
private String[] mArguments
;
public FontPotApp
(String[] args
)
{
super();
mArguments = args
;
}
@
Override
public void create
()
{
float w = Gdx.
graphics.
getWidth();
float h = Gdx.
graphics.
getHeight();
// only argument is the .txt font file
JFileChooser fileChooser =
new JFileChooser();
try
{
File f =
new File(new File(".").
getCanonicalPath());
fileChooser.
setCurrentDirectory(f
);
}
catch (IOException ex
)
{
}
int returnVal = fileChooser.
showOpenDialog(null);
if (returnVal ==
JFileChooser.
APPROVE_OPTION)
{
try
{
String filename = fileChooser.
getSelectedFile().
getAbsolutePath();
FontConverter.
convertFont(Gdx.
files.
absolute(filename
));
}
catch (ScanException e
)
{
}
}
/* if (mArguments.length != 1)
return;
try
{
convertFont(Gdx.files.absolute(mArguments[0]));
}
catch (ScanException e)
{
}*/
/*try
{
BufferedImage bi = new BufferedImage(100, 50, BufferedImage.TYPE_INT_ARGB);
for (int y = 0; y < 50; y++)
{
for (int x = 0; x < 100; x++)
{
int r = x;
int g = 255-x;
int b = (y * x) % 255;
int a = x * 2;
int col = (a << 24) | (r << 16) | (g << 8) | b;
bi.setRGB(x, y, col);
}
}
// retrieve image
//BufferedImage bi = getMyImage();
File outputfile = new File("D:\\saved.png");
ImageIO.write(bi, "png", outputfile);
}
catch (IOException e)
{
Gdx.app.log(LOG_TAG, "IOException: writing Image failed!");
}*/
}
@
Override
public void dispose
()
{
}
@
Override
public void render
()
{
Gdx.
app.
exit();
/*Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);*/
}
@
Override
public void resize
(int width,
int height
)
{
}
@
Override
public void pause
()
{
}
@
Override
public void resume
()
{
}
}