# 🌍 Suporte Multiplataforma - SevenX Engine v0.2.8
A SevenX Engine é totalmente multiplataforma! Funciona em Windows, Linux, macOS e Android.
## ✅ Plataformas Suportadas
### 🖥️ Desktop
| **Windows** | ✅ Completo | x86_64 | Testado no Windows 10/11 |
| **Linux** | ✅ Completo | x86_64, ARM64 | Ubuntu, Fedora, Arch, etc |
| **macOS** | ✅ Completo | x86_64, ARM64 (M1/M2) | macOS 10.15+ |
### 📱 Mobile
| **Android** | ✅ Completo | ARM64, ARMv7, x86_64 | Android 7.0+ (API 24+) |
| **iOS** | 🚧 Planejado | ARM64 | v0.3.0 |
#### Android Features v0.2.9
- ✅ Multi-touch input
- ✅ Joystick virtual
- ✅ Acelerômetro e giroscópio
- ✅ Sistema de vibração
- ✅ Gerenciamento de bateria
- ✅ Performance adaptativa
- ✅ Thermal throttling
---
## 🚀 Instalação por Plataforma
### Windows
```bash
# Instale o Rust
winget install Rustlang.Rust.MSVC
# Clone e compile
git clone https://github.com/sevenx777-dev/SevenX-Engine
cd SevenX-Engine
cargo build --release
cargo run --example jogo_teste
```
### Linux
```bash
# Ubuntu/Debian
sudo apt update
sudo apt install build-essential pkg-config libx11-dev libxcursor-dev libxrandr-dev libxi-dev libasound2-dev
# Fedora
sudo dnf install gcc pkg-config libX11-devel libXcursor-devel libXrandr-devel libXi-devel alsa-lib-devel
# Arch
sudo pacman -S base-devel libx11 libxcursor libxrandr libxi alsa-lib
# Instale o Rust
# Clone e compile
git clone https://github.com/sevenx777-dev/SevenX-Engine
cd SevenX-Engine
cargo build --release
cargo run --example jogo_teste
```
### macOS
```bash
# Instale Homebrew (se não tiver)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Instale o Rust
# Clone e compile
git clone https://github.com/sevenx777-dev/SevenX-Engine
cd SevenX-Engine
cargo build --release
cargo run --example jogo_teste
```
### Android
```bash
# 1. Instale o Android NDK
# Baixe de: https://developer.android.com/ndk/downloads
# 2. Configure variáveis de ambiente
export ANDROID_NDK_HOME=/path/to/android-ndk
export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
# 3. Adicione targets Android
rustup target add aarch64-linux-android
rustup target add armv7-linux-androideabi
rustup target add i686-linux-android
rustup target add x86_64-linux-android
# 4. Instale cargo-apk
cargo install cargo-apk
# 5. Compile para Android
cargo apk build --release --target aarch64-linux-android
# 6. Instale no dispositivo
cargo apk run --release --target aarch64-linux-android
```
---
## 🔧 Configuração Específica por Plataforma
### Linux - Wayland vs X11
A engine funciona tanto em Wayland quanto em X11:
```bash
# Forçar X11
WINIT_UNIX_BACKEND=x11 cargo run --example jogo_teste
# Forçar Wayland
WINIT_UNIX_BACKEND=wayland cargo run --example jogo_teste
```
### macOS - Permissões
No macOS, você pode precisar dar permissões de acessibilidade:
```bash
# Adicione permissões no System Preferences > Security & Privacy
```
### Android - Manifest
Para Android, adicione ao `AndroidManifest.xml`:
```xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.touchscreen" />
<uses-feature android:name="android.hardware.sensor.accelerometer" />
<application
android:label="SevenX Game"
android:hasCode="true">
<activity
android:name="rust.SevenXActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
```
---
## 📦 Cross-Compilation
### Compilar para Linux no Windows (WSL)
```bash
# Instale WSL2
wsl --install
# No WSL, siga as instruções de Linux
```
### Compilar para Windows no Linux
```bash
# Instale mingw
sudo apt install mingw-w64
# Adicione target
rustup target add x86_64-pc-windows-gnu
# Compile
cargo build --release --target x86_64-pc-windows-gnu
```
### Compilar para macOS no Linux (OSXCross)
```bash
# Instale OSXCross
git clone https://github.com/tpoechtrager/osxcross
cd osxcross
# Siga instruções do README
# Adicione target
rustup target add x86_64-apple-darwin
# Compile
cargo build --release --target x86_64-apple-darwin
```
---
## 🎮 Diferenças por Plataforma
### Input
| Teclado | ✅ | ✅ | ✅ | ❌ |
| Mouse | ✅ | ✅ | ✅ | ❌ |
| Gamepad | ✅ | ✅ | ✅ | ✅ |
| Touch | ❌ | ❌ | ❌ | ✅ |
| Acelerômetro | ❌ | ❌ | ❌ | ✅ |
### Áudio
| Música | ✅ | ✅ | ✅ | ✅ |
| SFX | ✅ | ✅ | ✅ | ✅ |
| 3D Audio | ✅ | ✅ | ✅ | ⚠️ |
### Gráficos
| 2D | ✅ | ✅ | ✅ | ✅ |
| 3D | ✅ | ✅ | ✅ | ⚠️ |
| Shaders | ✅ | ✅ | ✅ | ⚠️ |
| Post-FX | ✅ | ✅ | ✅ | ⚠️ |
⚠️ = Funciona mas pode ter performance reduzida
---
## 🐛 Problemas Conhecidos
### Linux
- **Wayland**: Algumas distribuições podem ter problemas com captura de mouse
- **Solução**: Use X11 com `WINIT_UNIX_BACKEND=x11`
- **Audio**: ALSA pode não funcionar em alguns sistemas
- **Solução**: Instale PulseAudio ou PipeWire
### macOS
- **M1/M2**: Primeira execução pode ser lenta (Rosetta)
- **Solução**: Compile nativamente com `--target aarch64-apple-darwin`
- **Gatekeeper**: Pode bloquear executáveis não assinados
- **Solução**: `xattr -d com.apple.quarantine ./seu_jogo`
### Android
- **Performance**: Dispositivos antigos podem ter FPS baixo
- **Solução**: Use configurações gráficas baixas
- **Touch**: Precisa adaptar controles para touch
- **Solução**: Use `input.get_touch_position()`
---
## 📊 Performance por Plataforma
### Desktop (Médio)
| Windows 11 | 60 FPS | 150 MB | 15% |
| Ubuntu 22.04 | 60 FPS | 140 MB | 12% |
| macOS 13 | 60 FPS | 160 MB | 18% |
### Mobile (Médio)
| Android High-end | 60 FPS | 200 MB | 3h |
| Android Mid-range | 45 FPS | 180 MB | 2.5h |
| Android Low-end | 30 FPS | 150 MB | 2h |
---
## 🔍 Testes
### Testado em:
**Windows**
- ✅ Windows 11 (x64)
- ✅ Windows 10 (x64)
**Linux**
- ✅ Ubuntu 22.04 LTS
- ✅ Fedora 38
- ✅ Arch Linux
- ✅ Pop!_OS 22.04
**macOS**
- ✅ macOS 13 Ventura (Intel)
- ✅ macOS 13 Ventura (M1)
- ✅ macOS 14 Sonoma (M2)
**Android**
- ✅ Android 13 (Pixel 6)
- ✅ Android 12 (Samsung S21)
- ⚠️ Android 10 (Xiaomi Mi 9)
---
## 🤝 Contribuindo
Testou em uma plataforma não listada? Abra uma issue ou PR!
---
## 📚 Recursos Adicionais
- [Rust Cross-Compilation Guide](https://rust-lang.github.io/rustup/cross-compilation.html)
- [Android NDK Documentation](https://developer.android.com/ndk/guides)
- [cargo-apk Documentation](https://github.com/rust-mobile/cargo-apk)
---
**SevenX Engine v0.2.8** - Crie jogos para qualquer plataforma! 🌍🎮✨