Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Added Menu with MouseInput (click the star in the bottom right for
Padraic Single Player)
- Loading branch information
Showing
4 changed files
with
145 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
package main; | |||
import java.awt.Color; | |||
import java.awt.Graphics; | |||
import java.awt.Font; | |||
|
|||
public class Menu { | |||
|
|||
public void render(Graphics g){ | |||
Font title_font = new Font("comic sans ms", Font.BOLD, 100); | |||
g.setFont(title_font); | |||
g.setColor(Color.white); | |||
g.drawString("spaaaaaace", 145, 150); | |||
|
|||
Font single_font = new Font("comic sans ms", Font.BOLD, 50); | |||
g.setFont(single_font); | |||
g.drawString("single player", 265, 275); | |||
|
|||
Font multi_font = new Font("comic sans ms", Font.BOLD, 50); | |||
g.setFont(multi_font); | |||
g.drawString("multiplayer", 285, 375); | |||
|
|||
Font quit_font = new Font("comic sans ms", Font.BOLD, 50); | |||
g.setFont(quit_font); | |||
g.drawString("quit", 365, 475); | |||
} | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
package main; | |||
|
|||
import java.awt.event.MouseEvent; | |||
import java.awt.event.MouseListener; | |||
|
|||
public class MouseInput implements MouseListener{ | |||
|
|||
public void mouseClicked(MouseEvent arg0) { | |||
// TODO Auto-generated method stub | |||
|
|||
} | |||
|
|||
public void mouseEntered(MouseEvent arg0) { | |||
// TODO Auto-generated method stub | |||
|
|||
} | |||
|
|||
public void mouseExited(MouseEvent arg0) { | |||
// TODO Auto-generated method stub | |||
|
|||
} | |||
|
|||
public void mousePressed(MouseEvent e) { | |||
int mx = e.getX(); | |||
int my = e.getY(); | |||
|
|||
if(mx >= 265 && mx <= 535 && my >= 225 && my <= 275) | |||
{ | |||
Game.numberOfPlayers = 1; | |||
Game.padraicmode = false; | |||
Game.State = Game.STATE.GAME; | |||
} | |||
else if(mx >= 285 && mx <= 515 && my >= 325 && my <= 375) | |||
{ | |||
Game.numberOfPlayers = 2; | |||
Game.padraicmode = false; | |||
Game.State = Game.STATE.GAME; | |||
} | |||
else if(mx >= 365 && mx <= 435 && my >= 425 && my <= 475) | |||
{ | |||
System.exit(1); | |||
} | |||
else if(mx >= 610 && mx <= 650 && my >= 540 && my <= 580) | |||
{ | |||
Game.numberOfPlayers = 1; | |||
Game.padraicmode = true; | |||
Game.State = Game.STATE.GAME; | |||
} | |||
|
|||
|
|||
} | |||
|
|||
public void mouseReleased(MouseEvent arg0) { | |||
// TODO Auto-generated method stub | |||
|
|||
} | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters