Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm having an odd issue with my animation that is happening only on OSX, and not on windows. On my windows computer, the animation occurs full screen in a JFrame, as it is supposed to - however on my mac the animations are only drawn in the lower left corner:

Windows: Windows Version

OSX: OSX Version

Here is the code that I use to create the window, and draw the frame (Same on both computers):

public class AnimationMain extends JFrame implements Runnable{

BufferStrategy bs;
/**
 * Initializes the properties of the JFrame that we are drawing on
 */
public void init(){
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("Final Project V2");
    this.setSize(7*128, 5*128);
    this.setResizable(false);
    this.setVisible(true);

    createBufferStrategy(3);
    bs = getBufferStrategy();
}
/**
 * Calls out to a drawing method, which simply draws everything on the screen
 * @param g
 */
public void draw(Graphics2D g){
    if (GMI.gameState.equals(GameState.PLAYING) && GMI.gameReady){
        AnimationManagement.MainGameDisplay.drawMainGame(this, g);
    }

}


/**
 * Calls the init method, and then repaints the frame
 */
public void run() {
    init();
    while (true){
          Graphics2D g = (Graphics2D) bs.getDrawGraphics();
          draw(g);
          g.dispose();
          bs.show();
        try{Thread.sleep(AppInfo.frameTime);}catch(Exception e){e.printStackTrace();} //Sleep for 10ms between redraws
    }
}

Any help would be greatly appreciated, thanks!

share|improve this question
    
Try using a JPanel, and call panel.redraw() (I think it's panel.redraw) –  geekygenius Apr 5 '14 at 3:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.