Page 173 - MDP2022-3
P. 173
Music("buttonPressedMusic.mp3" , false);
buttonEnteredMusic.start();
//랭크창 이벤트
System.out.println("Rank 창 이벤트 ");
askScore();
}
});
add(RankButton);
menuBar.setBounds(0, 0, 1280, 30);
menuBar.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
mouseX = e.getX();
mouseY = e.getY();
}
});
menuBar.addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseDragged(MouseEvent e) {
int x = e.getXOnScreen();
int y = e.getYOnScreen();
setLocation(x - mouseX , y - mouseY);
}
});
add(menuBar);
}
public void paint(Graphics g) {
screenImage = createImage(Main.SCREEN_WIDTH, Main.SCREEN_HEIGHT);
screenGraphics = screenImage.getGraphics();
screenDraw((Graphics2D)screenGraphics);
g.drawImage(screenImage, 0, 0, null);
}
public void screenDraw(Graphics2D g) {
g.drawImage(background, 0, 0, null);
if(isFirstScreen) { }
if(isMainScreen) {
g.drawImage(selectedImage, 600, 100, null);
g.drawImage(titleImage, 600 , 45, null);
g.drawImage(levelImage, 720, 630, null);
}
if(isGameScreen) {
game.screenDraw(g);
}