Advanced Cross-Platform Multimedia Framework with OpenGL, WebAssembly, and Interactive Console Support
View on GitHublibmx2 is a comprehensive, modern multimedia framework written in C++20 that provides developers with powerful tools for creating cross-platform applications with advanced graphics, audio, and interactive capabilities. The framework encompasses everything from basic SDL2 wrappers to sophisticated OpenGL rendering engines, complete with WebAssembly deployment support and an advanced command-line console system.
The libmx2 framework is built with a modular architecture that separates concerns and provides clean interfaces for different multimedia subsystems.
| Component | Description | Key Classes | Purpose |
|---|---|---|---|
| Core Framework (libmx/) | Base multimedia system with SDL2 abstraction | mx::mxWindow, mx::Texture, mx::Font | 2D rendering, window management, basic multimedia |
| OpenGL Engine | Advanced 3D graphics with modern OpenGL | gl::GLWindow, gl::ShaderProgram, gl::GLObject | 3D rendering, shader management, graphics pipeline |
| Console System | Interactive terminal with scripting support | console::GLConsole, console::Console | Command execution, text rendering, user interaction |
| MXCMD Engine (cmd/) | Complete scripting language with Scanner, Parser, AST | cmd::AstExecutor, cmd::Parser, cmd::Scanner | Script execution, command processing, automation |
| Android Platform | Mobile platform abstraction layer | Platform-specific implementations | Mobile deployment, touch input, mobile optimization |
| Model Viewer | Qt-based 3D model viewing application | Qt6 integration classes | Desktop model viewing, texture management |
Complete 2D game engine with sprite management, collision detection, and animation systems. Includes classic games like Asteroids, Breakout, Pong, and Space Shooter.
Modern OpenGL 3.3+ pipeline with shader management, 3D model loading, lighting systems, and particle effects. Supports MXMOD format and standard model formats.
Professional terminal emulator with command history, scrolling, and full MXCMD scripting language support with guide.
Comprehensive audio system with mixing, sound effects, and music playback capabilities.
Native compilation for Windows, Linux, macOS, Android, and WebAssembly with platform-specific optimizations and feature sets.
Model viewer, AST visualizer, and comprehensive debugging tools for efficient development workflows.
The framework includes over 50 complete example applications demonstrating various aspects of multimedia development.
| Application | Description | Features Demonstrated | WebAssembly Demo |
|---|---|---|---|
| Asteroids | Classic asteroid shooter with modern graphics | Sprite rotation, collision detection, particle effects | Play Now |
| Breakout | Ball and paddle brick breaking game | Physics simulation, power-ups, level progression | Play Now |
| Space Shooter | Vertical scrolling space combat | Enemy AI, weapon systems, background scrolling | Play Now |
| Pong | Classic paddle tennis game | Basic game loop, input handling, score tracking | Play Now |
| Knight's Tour | Chess puzzle visualization | Algorithm visualization, pathfinding display | Play Now |
| Application | Description | Graphics Features | WebAssembly Demo |
|---|---|---|---|
| 3D Asteroids | Three-dimensional asteroid field navigation | 3D movement, depth buffer, perspective projection | Play Now |
| Space3D | Advanced 3D space combat simulator | 3D models, lighting, particle systems, boss battles | Play Now |
| 3D Breakout | Three-dimensional brick breaking | 3D physics, camera controls, dynamic lighting | Play Now |
| 3D Pong | Volumetric paddle tennis game | 3D collision detection, camera movement, lighting | Play Now |
| Point Sprites | Advanced particle system demonstrations | GPU particles, point sprites, blend modes | View Demos |
| Demo | Technology | Description | Link |
|---|---|---|---|
| Skybox | Cubemap Texturing | 360-degree environment mapping | View Demo |
| Phong Lighting | Advanced Lighting | Realistic lighting model implementation | View Demo |
| Shadow Mapping | Dynamic Shadows | Real-time shadow casting and receiving | View Demo |
| Fire Simulation | Particle Effects | Realistic fire and smoke particle system | View Demo |
| Winter Scene | Environmental Effects | Snow particles and atmospheric effects | View Demo |
The Console Skeleton represents the pinnacle of the libmx2 framework's capabilities, combining advanced OpenGL graphics with a fully-featured interactive terminal and scripting system.
Professional-grade console with scrolling, command history, syntax highlighting, and customizable appearance. Supports mouse wheel scrolling and keyboard navigation.
Dynamic shader switching with 10+ built-in effects including cyclone, geometric distortion, VHS effects, and fractal patterns. Custom GLSL shader support.
Complete scripting language with Scanner, Parser, AST, variables, functions, control flow, and module system. Supports external library loading and command execution.
Windows WSL integration for seamless Linux command execution on Windows. Native platform support with automatic command routing.
| Guide | Feature | Syntax Example | Description |
|---|---|---|---|
| Variable Assignment | let x = 42 |
Dynamic typing with automatic type inference | |
| Function Definition | define func(a, b) begin ... end |
User-defined functions with parameters | |
| Control Flow | if condition ... else ... fi |
Conditional execution and loop constructs | |
| External Libraries | extern "module" "func" "alias" |
Dynamic library loading and symbol binding | |
| Command Execution | cmd "script.mxcmd" |
Script execution and command chaining |
# Example MXCMD Script
define init_graphics()
begin
let width = 1280
let height = 720
# Load external SDL module
extern "sdl-mod" "sdl_init" "sdl_init"
extern "sdl-mod" "sdl_create_window" "sdl_window"
# Initialize graphics
sdl_init
sdl_window "My Application" width height
printf "Graphics initialized: %dx%d\n" width height
return 0
end
# Execute initialization
init_graphics
One of libmx2's most powerful features is its comprehensive WebAssembly support, allowing native C++ applications to run seamlessly in web browsers with near-native performance.
| Category | Applications | Count | Features |
|---|---|---|---|
| Games | Asteroids, Breakout, Pong, Space Shooter, 3D variants | 12+ | Full gameplay, audio, graphics |
| Graphics Demos | Skybox, Lighting, Shadows, Particles | 8+ | Advanced rendering techniques |
| Visual Effects | Fire, Snow, Matrix Rain, Fractals | 6+ | Real-time particle systems |
| Interactive Tools | Model Viewer, Model compression tool, Console | 4+ | User interaction, file loading |
Primary: CMake with cross-platform configuration
WebAssembly: Emscripten toolchain with custom Makefiles
Dependencies: Automated dependency resolution
Total Lines: 100,000+ lines of C++
Applications: 50+ complete examples
Platforms: 5 target platforms supported
Rendering: 60+ FPS on modern hardware
WebAssembly: Near-native performance
Memory: Efficient memory management
Graphics: OpenGL 3.3+, Vulkan API
Audio: SDL2 Audio, SDL2_mixer support
UI: Qt6 integration for desktop tools
| Platform | Graphics | Audio | Input | Status |
|---|---|---|---|---|
| Linux | OpenGL 3.3+ | SDL2 Audio (SDL_Mixer 2.0) | Keyboard, Mouse, Gamepad | ✅ Full Support |
| Windows | OpenGL 3.3+ | SDL2 Audio (Mixer 2.0) | Keyboard, Mouse, Gamepad, WSL | ✅ Full Support |
| macOS | OpenGL 3.3+, Metal (via SDL2) | SDL2 Audio, Core Audio | Keyboard, Mouse, Gamepad | ✅ Full Support |
| WebAssembly | WebGL 2.0 | Web Audio API | Keyboard, Mouse, Touch, Gamepad | ✅ Full Support |
| Android | OpenGL ES 3.0+ | SDL2_Mixer | Touch, Sensors | 🔄 In Development |
Begin your journey with libmx2 by exploring the comprehensive example collection and following the build instructions for your target platform.
# install SDL2, SDL2_ttf, SDL2_mixer, GLM, zlib, libpng
# Clone the repository
git clone https://github.com/lostjared/libmx2.git
cd libmx2/libmx
# Build for desktop (Linux/macOS/Windows)
mkdir build && cd build
cmake .. -DDEBUG_MODE=ON -DEXAMPLES=ON
cmake --build .
sudo cmake --install
# Run examples from build directories
./gl_pong -p ../../gl_pong/v4
./space -p ../../space
./cmd-console
# compile libmx2 for WebAssembly
cd libmx2/libmx/libmx
make -f Makefile.em -j8 install
make -f Makefile.em clean
# WebAssembly build
cd MX2_Project
make -f Makefile.em
Comprehensive guides, API documentation, and tutorial content available in the repository and online at lostsidedead.biz
Experience the framework immediately by trying the WebAssembly demos at lostsidedead.biz without any installation
Start with basic examples and progress to advanced graphics programming with the step-by-step example progression
Join the development community on GitHub for support, contributions, and collaboration opportunities