I don't get where to insert the code and such; I could really use some help with this. :)
Here's my java file: (I removed irrelevant stuff)
package projectprojectile;
import java.applet.*;
import java.awt.*;
import java.io.File;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JOptionPane;
public class Main extends Applet implements Runnable
{
// Variables...
public void init() {
// Variable initialization
}
public void start(){
Thread th = new Thread(this);
th.start();
}
public void run () {
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while (true){
repaint();
try{
Thread.sleep (10);
}
catch (InterruptedException ex){
// Do nothing
}
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
}
}
// Lots of mouse events here such as "public boolean mouseDrag"
// This is a double buffering code
public void update (Graphics g){
if (dbImage == null){
dbImage = createImage (this.getSize().width, this.getSize().height);
dbg = dbImage.getGraphics ();
}
dbg.setColor (getBackground ());
dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);
dbg.setColor (getForeground());
paint (dbg);
g.drawImage (dbImage, 0, 0, this);
}
public void paint (Graphics g) {
// Draw methods
}
// My own functions
}
Where and how would I insert the FPS counter and FPS limiter code?