Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. package edu.pong.player;
  2.  
  3.  
  4. import edu.pong.utils.Comms;
  5. import java.awt.event.KeyEvent;
  6. import java.awt.event.KeyListener;
  7.  
  8. /*
  9. * To change this license header, choose License Headers in Project Properties.
  10. * To change this template file, choose Tools | Templates
  11. * and open the template in the editor.
  12. */
  13.  
  14. /**
  15. *
  16. * @author JuanjoGarau
  17. */
  18. public class ControladorEntradaUsuari extends Thread implements KeyListener{
  19.  
  20. protected ModelEstatPartida estat;
  21. protected SocketComunicacions sc;
  22.  
  23. public ControladorEntradaUsuari(ModelEstatPartida estat) {
  24. this.estat = estat;
  25. }
  26.  
  27. public void run() {
  28. while(true) {
  29. // Mirar l'entrada de les tecles del teclat
  30. //Si fletxa cap adalt
  31. sc.enviar(Comms.UP);
  32. // else fletxa cap abaix
  33. sc.enviar(Comms.DOWN);
  34. }
  35. }
  36.  
  37. @Override
  38. public void keyTyped(KeyEvent e) {
  39. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  40. }
  41.  
  42. @Override
  43. public void keyPressed(KeyEvent e) {
  44. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  45. }
  46.  
  47. @Override
  48. public void keyReleased(KeyEvent e) {
  49. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement