-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from pmaasz/develop
Develop
- Loading branch information
Showing
31 changed files
with
510 additions
and
427 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
.DS_Store | ||
|
||
.idea/ |
File renamed without changes.
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
public class DrawPanel extends JPanel | ||
{ | ||
private LeftEye leftEye; | ||
|
||
private RightEye rightEye; | ||
|
||
private Eyes eyes; | ||
|
||
public DrawPanel(LeftEye leftEye, RightEye rightEye, Eyes eyes) | ||
{ | ||
this.leftEye = leftEye; | ||
this.rightEye = rightEye; | ||
this.eyes = eyes; | ||
} | ||
|
||
public void paintComponent(Graphics g) | ||
{ | ||
Graphics2D g2 = (Graphics2D)g; | ||
|
||
//Background | ||
g2.setColor(Color.BLACK); | ||
g2.fillRect(0, 0, getWidth(), getHeight()); | ||
|
||
//Blink | ||
if (this.eyes.isBlink()) | ||
{ | ||
g.setColor(eyes.getColor()); | ||
} else { | ||
g.setColor(this.eyes.getColor()); | ||
} | ||
|
||
//Left | ||
g2.drawRoundRect(this.leftEye.getLeftXPos(),this.leftEye.getLeftYPos(), this.leftEye.getWidthleft(), this.leftEye.getHeightleft(), this.eyes.getCurve(), this.eyes.getCurve()); | ||
g2.fillRoundRect(this.leftEye.getLeftXPos(),this.leftEye.getLeftYPos(), this.leftEye.getWidthleft(), this.leftEye.getHeightleft(), this.eyes.getCurve(), this.eyes.getCurve()); | ||
|
||
//Right | ||
g2.drawRoundRect(this.rightEye.getRightXPos(),this.rightEye.getRightYPos(), this.rightEye.getWidthright(), this.rightEye.getHeightright(), this.eyes.getCurve(), this.eyes.getCurve()); | ||
g2.fillRoundRect(this.rightEye.getRightXPos(),this.rightEye.getRightYPos(), this.rightEye.getWidthright(), this.rightEye.getHeightright(), this.eyes.getCurve(), this.eyes.getCurve()); | ||
} | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import java.awt.*; | ||
|
||
public class Eyes | ||
{ | ||
private int curve = 30; | ||
|
||
private int radius = 2; | ||
|
||
private int counter = 0; | ||
|
||
private boolean blink = false; | ||
|
||
private Color color; | ||
|
||
public Eyes() | ||
{ | ||
this.color = new Color(10, 200, 255); | ||
} | ||
|
||
public Color getColor() { | ||
return this.color; | ||
} | ||
|
||
public void setColor(int r , int g, int b) { | ||
this.color = new Color(r , g, b); | ||
} | ||
|
||
public int getCurve() { | ||
return curve; | ||
} | ||
|
||
public void setCurve(int curve) { | ||
this.curve = curve; | ||
} | ||
|
||
public int getRadius() { | ||
return radius; | ||
} | ||
|
||
public void setRadius(int radius) { | ||
this.radius = radius; | ||
} | ||
|
||
public int getCounter() { | ||
return counter; | ||
} | ||
|
||
public void setCounter(int counter) { | ||
this.counter = counter; | ||
} | ||
|
||
public boolean isBlink() { | ||
return blink; | ||
} | ||
|
||
public void setBlink(boolean blink) { | ||
this.blink = blink; | ||
} | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
|
||
public class Frame extends JFrame | ||
{ | ||
private double mouseX; | ||
|
||
private double mouseY; | ||
|
||
private boolean click; | ||
|
||
private int counter = 0; | ||
|
||
protected DrawPanel drawPanel; | ||
|
||
public Frame(LeftEye leftEye, RightEye rightEye, Eyes eyes) | ||
{ | ||
this.drawPanel = new DrawPanel(leftEye, rightEye, eyes); | ||
|
||
add(this.drawPanel); | ||
pack(); | ||
setSize(300,300); | ||
setResizable(false); | ||
setLocationRelativeTo(null); | ||
setVisible(true); | ||
setTitle("S.T.E.V.E."); | ||
addMouseMotionListener(new KeyHandler()); | ||
addMouseListener(new KeyHandler()); | ||
addWindowListener(new WindowAdapter() | ||
{ | ||
public void windowClosing(WindowEvent e) | ||
{ | ||
System.exit(0); | ||
} | ||
}); | ||
} | ||
|
||
public void repaintDrawPanel() | ||
{ | ||
this.drawPanel.repaint(); | ||
} | ||
|
||
public double getMouseX() | ||
{ | ||
return mouseX; | ||
} | ||
|
||
public double getMouseY() | ||
{ | ||
return mouseY; | ||
} | ||
|
||
public void setMouseX(double mouseX) | ||
{ | ||
this.mouseX = mouseX; | ||
} | ||
|
||
public void setMouseY(double mouseY) | ||
{ | ||
this.mouseY = mouseY; | ||
} | ||
|
||
public boolean isClick() | ||
{ | ||
return click; | ||
} | ||
|
||
public void setClick(boolean click) | ||
{ | ||
this.click = click; | ||
} | ||
|
||
public int getCounter() { | ||
return counter; | ||
} | ||
|
||
public void setCounter(int counter) { | ||
this.counter = counter; | ||
} | ||
|
||
private class KeyHandler implements MouseMotionListener, MouseListener | ||
{ | ||
|
||
@Override | ||
public void mouseDragged(MouseEvent e) { } | ||
|
||
@Override | ||
public void mouseMoved(MouseEvent e) | ||
{ | ||
setMouseX(e.getX()); | ||
setMouseY(e.getY()); | ||
} | ||
|
||
@Override | ||
public void mouseClicked(MouseEvent e) { } | ||
|
||
@Override | ||
public void mousePressed(MouseEvent e) | ||
{ | ||
setClick(true); | ||
} | ||
|
||
@Override | ||
public void mouseReleased(MouseEvent e) | ||
{ | ||
setClick(false); | ||
} | ||
|
||
@Override | ||
public void mouseEntered(MouseEvent e) { } | ||
|
||
@Override | ||
public void mouseExited(MouseEvent e) { } | ||
} | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
public class LeftEye | ||
{ | ||
private int leftXPos = 55; | ||
|
||
private int leftYPos = 40; | ||
|
||
private int widthleft = 80; | ||
|
||
private int heightleft = 90; | ||
|
||
public LeftEye () | ||
{ | ||
|
||
} | ||
|
||
public int getLeftXPos() { | ||
return leftXPos; | ||
} | ||
|
||
public void setLeftXPos(int leftXPos) { | ||
this.leftXPos = leftXPos; | ||
} | ||
|
||
public int getLeftYPos() { | ||
return leftYPos; | ||
} | ||
|
||
public void setLeftYPos(int leftYPos) { | ||
this.leftYPos = leftYPos; | ||
} | ||
|
||
public int getWidthleft() { | ||
return widthleft; | ||
} | ||
|
||
public void setWidthleft(int widthleft) { | ||
this.widthleft = widthleft; | ||
} | ||
|
||
public int getHeightleft() { | ||
return heightleft; | ||
} | ||
|
||
public void setHeightleft(int heightleft) { | ||
this.heightleft = heightleft; | ||
} | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
public class Repo | ||
{ | ||
public void blink(Eyes eyes, Frame frame) | ||
{ | ||
int counter = frame.getCounter(); | ||
|
||
if (!eyes.isBlink() && ((counter % 1100) == 0)) | ||
{ | ||
eyes.setBlink(true); | ||
eyes.setColor(0,0,0); | ||
|
||
try { | ||
Thread.sleep(300); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
else if (counter > 1100) | ||
{ | ||
eyes.setBlink(false); | ||
} | ||
|
||
counter++; | ||
frame.setCounter(counter); | ||
} | ||
|
||
public void angry(Frame frame, Eyes eyes) | ||
{ | ||
if(frame.isClick()) | ||
{ | ||
eyes.setColor(255,30,30); | ||
} else { | ||
eyes.setColor(10, 200, 255); | ||
} | ||
} | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
public class RightEye | ||
{ | ||
private int rightXPos = 155; | ||
|
||
private int rightYPos = 40; | ||
|
||
private int widthright = 80; | ||
|
||
private int heightright = 90; | ||
|
||
public RightEye() | ||
{ | ||
|
||
} | ||
|
||
public int getRightXPos() { | ||
return rightXPos; | ||
} | ||
|
||
public void setRightXPos(int rightXPos) { | ||
this.rightXPos = rightXPos; | ||
} | ||
|
||
public int getRightYPos() { | ||
return rightYPos; | ||
} | ||
|
||
public void setRightYPos(int rightYPos) { | ||
this.rightYPos = rightYPos; | ||
} | ||
|
||
public int getWidthright() { | ||
return widthright; | ||
} | ||
|
||
public void setWidthright(int widthright) { | ||
this.widthright = widthright; | ||
} | ||
|
||
public int getHeightright() { | ||
return heightright; | ||
} | ||
|
||
public void setHeightright(int heightright) { | ||
this.heightright = heightright; | ||
} | ||
} |
Oops, something went wrong.