Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.
Ambdós costats versió prèvia Revisió prèvia Següent revisió | Revisió prèvia | ||
libgdx_comunicacions [2024/05/03 17:47] enric_mieza_sanchez [Ús en app libGDX] |
libgdx_comunicacions [2025/03/18 23:13] (actual) enric_mieza_sanchez [Exercicis] |
||
---|---|---|---|
Línia 58: | Línia 58: | ||
</ | </ | ||
- | I el més important, '' | + | I el més important, |
+ | General: | ||
<file gradle build.gradle> | <file gradle build.gradle> | ||
allprojects { | allprojects { | ||
Línia 69: | Línia 70: | ||
} | } | ||
} | } | ||
+ | </ | ||
- | project(" | + | <WRAP tip> |
- | dependencies { | + | ULL: als segúents només cal afegir la línia del repo de '' |
- | implementation "com.github.MrStahlfelge.gdx-websockets: | + | </ |
- | } | + | |
- | } | + | |
- | project(" | + | Core: |
- | dependencies { | + | <file gradle core/ |
- | implementation " | + | dependencies { |
- | } | + | api " |
+ | | ||
+ | |||
+ | // ... | ||
} | } | ||
+ | </ | ||
- | project(" | + | Android: |
- | dependencies { | + | <file gradle android/ |
- | implementation "com.github.MrStahlfelge.gdx-websockets: | + | dependencies { |
- | implementation " | + | // ... |
- | implementation | + | |
- | } | + | implementation " |
+ | implementation | ||
+ | |||
+ | // ... | ||
} | } | ||
+ | </ | ||
- | project(":core" | + | Desktop |
- | dependencies { | + | <file gradle lwjgl3/ |
- | implementation " | + | dependencies { |
- | } | + | implementation |
+ | implementation " | ||
+ | implementation " | ||
+ | implementation project(': | ||
+ | |||
+ | // ... | ||
+ | </ | ||
+ | |||
+ | HTML: | ||
+ | <file gradle html/ | ||
+ | dependencies { | ||
+ | // ... | ||
+ | implementation " | ||
+ | | ||
+ | | ||
+ | implementation " | ||
+ | |||
+ | implementation project(': | ||
+ | |||
+ | // ... | ||
} | } | ||
</ | </ | ||
Línia 171: | Línia 198: | ||
@Override | @Override | ||
public boolean onMessage(WebSocket webSocket, String packet) { | public boolean onMessage(WebSocket webSocket, String packet) { | ||
- | System.out.println(" | + | System.out.println(" |
return false; | return false; | ||
} | } | ||
Línia 177: | Línia 204: | ||
@Override | @Override | ||
public boolean onMessage(WebSocket webSocket, byte[] packet) { | public boolean onMessage(WebSocket webSocket, byte[] packet) { | ||
- | System.out.println(" | + | System.out.println(" |
return false; | return false; | ||
} | } | ||
Línia 322: | Línia 349: | ||
==== Exercicis ==== | ==== Exercicis ==== | ||
<WRAP todo> | <WRAP todo> | ||
- | Implementa el servidor NodeJS | + | **Servidor i app de prova en local** |
+ | |||
+ | Implementa el servidor NodeJS | ||
+ | |||
+ | Fes una aplicació libGDX que connecti amb el servidor i envii la posició on fas un //touch// en la pantalla. Per no saturar de missatges repetitius (i innecessaris), | ||
+ | </ | ||
+ | |||
+ | <WRAP todo> | ||
+ | **Servidor WebSockets en producció** | ||
+ | |||
+ | Implementa el servidor NodeJS al teu servidor públic (Proxmox). | ||
+ | |||
+ | Ajusta l' | ||
+ | |||
+ | Pots mirar de posar en producciò el servidor NodeJS amb el [[https:// | ||
+ | </ | ||
+ | |||
+ | <WRAP todo> | ||
+ | **Incorporant websockets a un joc** | ||
- | Afegeix la llibreria de WebSockets al teu joc libGDX i fes que envii la posició del nostre | + | Afegeix la llibreria de WebSockets al teu joc libGDX i fes que envii la posició del personatge 1 cop per segon. |
Assegura' | Assegura' |