primer commit
This commit is contained in:
51
tools/run_headless.sh
Normal file
51
tools/run_headless.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# Script para ejecutar JailDoctor's Dilemma en modo headless (sin pantalla)
|
||||
# Usa Xvfb (X Virtual Framebuffer) para simular un display
|
||||
|
||||
# Configuración
|
||||
GAME_EXECUTABLE="../pollo"
|
||||
DISPLAY_SIZE="1280x720x24" # Resolución y profundidad de color
|
||||
|
||||
# Colores para output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${GREEN}=== JailDoctor's Dilemma - Modo Headless ===${NC}"
|
||||
echo ""
|
||||
|
||||
# Verificar que Xvfb está instalado
|
||||
if ! command -v xvfb-run &> /dev/null; then
|
||||
echo -e "${YELLOW}ERROR: Xvfb no está instalado${NC}"
|
||||
echo "Instálalo con: sudo apt-get install xvfb"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verificar que el ejecutable existe
|
||||
if [ ! -f "$GAME_EXECUTABLE" ]; then
|
||||
echo -e "${YELLOW}ERROR: No se encuentra el ejecutable $GAME_EXECUTABLE${NC}"
|
||||
echo "Compila el juego primero con: cmake --build build"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Iniciando juego con Xvfb..."
|
||||
echo "Display virtual: $DISPLAY_SIZE"
|
||||
echo ""
|
||||
echo -e "${YELLOW}Nota: El juego está corriendo. Presiona Ctrl+C para detenerlo.${NC}"
|
||||
echo ""
|
||||
|
||||
# Ejecutar el juego con Xvfb
|
||||
# Opciones:
|
||||
# -a: Selecciona automáticamente un número de display disponible
|
||||
# -s: Configura el servidor X (resolución y profundidad)
|
||||
xvfb-run -a -s "-screen 0 ${DISPLAY_SIZE}" "$GAME_EXECUTABLE" "$@"
|
||||
|
||||
EXIT_CODE=$?
|
||||
echo ""
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo -e "${GREEN}Juego finalizado correctamente${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}Juego finalizado con código de salida: $EXIT_CODE${NC}"
|
||||
fi
|
||||
|
||||
exit $EXIT_CODE
|
||||
Reference in New Issue
Block a user