add presentation mode: implement presentation logic, QR code support, animated quotes, assets display, and emotes
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 1m33s
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 1m33s
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"math"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
@@ -265,6 +266,20 @@ func (g *Game) UpdateGame() {
|
||||
g.updateQuotes()
|
||||
}
|
||||
|
||||
// --- EMOTES ---
|
||||
if inpututil.IsKeyJustPressed(ebiten.Key1) {
|
||||
g.SendCommand("EMOTE_1")
|
||||
}
|
||||
if inpututil.IsKeyJustPressed(ebiten.Key2) {
|
||||
g.SendCommand("EMOTE_2")
|
||||
}
|
||||
if inpututil.IsKeyJustPressed(ebiten.Key3) {
|
||||
g.SendCommand("EMOTE_3")
|
||||
}
|
||||
if inpututil.IsKeyJustPressed(ebiten.Key4) {
|
||||
g.SendCommand("EMOTE_4")
|
||||
}
|
||||
|
||||
// --- 6. KAMERA LOGIK (mit Smoothing) ---
|
||||
g.stateMutex.Lock()
|
||||
targetCam := g.gameState.ScrollX
|
||||
@@ -330,6 +345,15 @@ func (g *Game) handleTouchInput() {
|
||||
x, y := ebiten.TouchPosition(id)
|
||||
fx, fy := float64(x), float64(y)
|
||||
|
||||
// ── EMOTES ───────────────────────────────────────────────────────────
|
||||
if fx >= float64(g.lastCanvasWidth)-80.0 && fy >= 40.0 && fy <= 250.0 && isJustPressed(id) {
|
||||
emoteIdx := int((fy - 50.0) / 50.0)
|
||||
if emoteIdx >= 0 && emoteIdx <= 3 {
|
||||
g.SendCommand(fmt.Sprintf("EMOTE_%d", emoteIdx+1))
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if fx >= halfW {
|
||||
// ── RECHTE SEITE: Jump und Down ──────────────────────────────────────
|
||||
g.btnJumpPressed = true
|
||||
@@ -563,7 +587,25 @@ func (g *Game) drawPlayers(screen *ebiten.Image, snap renderSnapshot) {
|
||||
if name == "" {
|
||||
name = id
|
||||
}
|
||||
text.Draw(screen, name, basicfont.Face7x13, int((posX-g.camX)*snap.viewScale), int(screenY-25), ColText)
|
||||
|
||||
// In Presentation Mode normal players don't show names, only Host/PRESENTATION does (which is hidden anyway)
|
||||
if snap.status != "PRESENTATION" || name == g.playerName {
|
||||
text.Draw(screen, name, basicfont.Face7x13, int((posX-g.camX)*snap.viewScale), int(screenY-25), ColText)
|
||||
}
|
||||
|
||||
// Draw Emote if active
|
||||
if p.State != "" && strings.HasPrefix(p.State, "EMOTE_") {
|
||||
emoteStr := p.State[6:] // e.g. EMOTE_1 -> "1"
|
||||
emoteMap := map[string]string{
|
||||
"1": "❤️",
|
||||
"2": "😂",
|
||||
"3": "😡",
|
||||
"4": "👍",
|
||||
}
|
||||
if emoji, ok := emoteMap[emoteStr]; ok {
|
||||
text.Draw(screen, emoji, basicfont.Face7x13, int((posX-g.camX)*snap.viewScale+15), int(screenY-40), color.White)
|
||||
}
|
||||
}
|
||||
|
||||
if g.showDebug {
|
||||
g.drawPlayerHitbox(screen, posX, screenY, snap.viewScale)
|
||||
@@ -779,6 +821,20 @@ func (g *Game) drawTouchControls(screen *ebiten.Image) {
|
||||
vector.DrawFilledCircle(screen, float32(downX), float32(downY), float32(downR), color.RGBA{50, 120, 220, 55}, false)
|
||||
vector.StrokeCircle(screen, float32(downX), float32(downY), float32(downR), 2, color.RGBA{80, 160, 255, 120}, false)
|
||||
text.Draw(screen, "▼", basicfont.Face7x13, int(downX)-4, int(downY)+5, color.RGBA{200, 220, 255, 180})
|
||||
|
||||
// ── D) Emote Buttons (oben rechts) ─────────────────────────────────────────
|
||||
emoteY := 50.0
|
||||
emoteXBase := float64(tcW) - 60.0
|
||||
emoteSize := 40.0
|
||||
emotes := []string{"❤️", "😂", "😡", "👍"}
|
||||
|
||||
for i, em := range emotes {
|
||||
x := emoteXBase
|
||||
y := emoteY + float64(i)*50.0
|
||||
vector.DrawFilledRect(screen, float32(x), float32(y), float32(emoteSize), float32(emoteSize), color.RGBA{0, 0, 0, 100}, false)
|
||||
vector.StrokeRect(screen, float32(x), float32(y), float32(emoteSize), float32(emoteSize), 2, color.RGBA{255, 255, 255, 100}, false)
|
||||
text.Draw(screen, em, basicfont.Face7x13, int(x)+10, int(y)+25, color.White)
|
||||
}
|
||||
}
|
||||
|
||||
// TriggerShake aktiviert den Screen-Shake-Effekt.
|
||||
|
||||
Reference in New Issue
Block a user