An interactive Julia application that displays a controllable point using Makie.jl visualization. Control the point's movement using WASD keys with real-time coordinate updates and smooth continuous movement. Built with a backend-agnostic architecture following modern Makie.jl best practices.
The PointController application showing the interactive point (red dot) with real-time coordinate display and reference grid. Use WASD keys to move the point smoothly around the coordinate space.
- Interactive Point Visualization: Real-time point rendering using Makie.jl
- Backend-Agnostic Architecture: Works with GLMakie, CairoMakie, or WGLMakie
- WASD Keyboard Controls: Intuitive movement controls with immediate response
- Real-time Coordinate Display: Live coordinate updates as the point moves
- Smooth Continuous Movement: Fluid movement while keys are held down
- Diagonal Movement Support: Natural diagonal movement when multiple keys are pressed
- Robust Error Handling: Comprehensive error handling for graphics and input issues
- Performance Optimized: Efficient rendering and input processing
- CI/CD Ready: Comprehensive test suite with backend-specific testing strategies
- Julia 1.10 or higher
- For interactive graphics: OpenGL 3.3+ compatible graphics card and drivers
- For headless operation: No graphics hardware required
-
Install Julia: Download from julialang.org
-
Clone or download this project:
git clone https://github.com/bakulev/JuliaTestRocket.git cd JuliaTestRocket
-
Activate the project environment:
using Pkg Pkg.activate(".") Pkg.instantiate()
PointController follows modern Makie.jl patterns where users control backend activation. You must activate a Makie backend before using PointController functions.
GLMakie (Interactive Graphics):
using GLMakie
GLMakie.activate!()
- Best for: Interactive applications, real-time graphics
- Features: Full OpenGL acceleration, interactive windows
- Requirements: OpenGL 3.3+, display system
CairoMakie (Static/Headless Graphics):
using CairoMakie
CairoMakie.activate!()
- Best for: Publication-quality plots, CI environments, headless operation
- Features: Vector graphics, no display required
- Requirements: None (works in headless environments)
WGLMakie (Web Graphics):
using WGLMakie
WGLMakie.activate!()
- Best for: Web applications, browser-based graphics
- Features: WebGL-based, runs in browsers
- Requirements: WebGL-capable browser
Run the app with automatic backend selection. Optionally force a backend via environment variable JTR_BACKEND
(gl
, cairo
, or wgl
).
# Auto-select (tries GLMakie, falls back to CairoMakie)
julia run_app.jl
# Force a specific backend
JTR_BACKEND=gl julia run_app.jl
JTR_BACKEND=cairo julia run_app.jl
JTR_BACKEND=wgl julia run_app.jl
Start an interactive Julia session with the project loaded:
# Start interactive session
julia --project=. -i start_interactive.jl
# Then in the Julia REPL, activate your preferred backend:
using GLMakie; GLMakie.activate!()
run_point_controller()
Run the application directly with interactive graphics:
julia run_glmakie.jl
Run the application in headless mode (for CI/headless environments):
julia run_cairomakie.jl
For advanced users who want full control:
# Start Julia with project
julia --project=.
# In Julia REPL:
using Pkg; Pkg.instantiate()
using GLMakie; GLMakie.activate!()
using PointController
run_point_controller()
The recommended approach provides:
- Proper Module Loading: Each module loads in the correct order
- Error Handling: Each step can be verified before proceeding
- Interactive Debugging: Can inspect state and debug issues
- Resource Management: Proper cleanup and resource management
- Flexibility: Can easily switch backends or modify behavior
Key | Action |
---|---|
W | Move point up (positive Y direction) |
S | Move point down (negative Y direction) |
A | Move point left (negative X direction) |
D | Move point right (positive X direction) |
Q | Quit application |
Advanced Controls:
- Multiple keys: Press multiple WASD keys simultaneously for diagonal movement
- Window close: Close the window to exit the application
- Focus handling: Application safely handles window focus changes
- Red point: The controllable point that responds to keyboard input
- Coordinate display: Real-time position shown in the top-left corner
- Grid system: Reference grid for precise positioning
- Axis labels: X and Y coordinate axes with proper scaling
JuliaTestRocket/
├── Project.toml # Package configuration and dependencies
├── README.md # This documentation file
├── LICENSE # MIT license file
├── start_interactive.jl # Interactive startup script
├── run_app.jl # Auto-selecting launcher (GL → Cairo fallback)
├── run_glmakie.jl # GLMakie execution script
├── run_cairomakie.jl # CairoMakie execution script
├── docs/ # Documentation and assets
│ └── assets/ # Images and media files
│ └── WorkingApp.png # Application screenshot
├── src/ # Source code directory
│ ├── PointController.jl # Main module and application entry point
│ ├── movement_state.jl # Movement state management and key tracking
│ ├── input_handler.jl # Keyboard event processing and validation
│ └── visualization.jl # Makie visualization setup and rendering
└── test/ # Test suite directory
├── runtests.jl # Main test runner
├── test_movement_state.jl # Movement state and calculation tests
├── test_input.jl # Input handler and keyboard event tests
├── test_visualization.jl # Visualization component tests
├── test_glmakie_smoke.jl # GLMakie smoke tests
└── test_integration_comprehensive.jl # End-to-end integration tests
Full test suite:
using Pkg
Pkg.test()
From command line:
julia --project=. -e "using Pkg; Pkg.test()"
Individual test files:
# Test specific components
include("test/test_movement_state.jl")
include("test/test_input.jl")
include("test/test_visualization.jl")
The codebase is organized into modular components:
PointController.jl
: Main module with application lifecycle managementmovement_state.jl
: State management for point position and key trackinginput_handler.jl
: Keyboard event processing and input validationvisualization.jl
: Makie setup, rendering, and display management
- Backend-Agnostic Core: Core logic is independent of specific Makie backends
- Runtime Backend Detection: Automatically detects and adapts to active backends
- Modular Design: Separate concerns for movement, input, and visualization
- Modern Makie Patterns: Follows current best practices for backend activation
- Movement modifications: Edit
movement_state.jl
for new movement behaviors - Input handling: Modify
input_handler.jl
for additional key bindings - Visual changes: Update
visualization.jl
for rendering modifications - New functionality: Add to
PointController.jl
and create corresponding tests
- Julia: Version 1.10 or higher
- RAM: 512 MB available memory
- OpenGL: Version 3.3 or higher
- Graphics: Hardware-accelerated graphics card
- Display: Working display system (X11, Wayland, or native windowing)
- No graphics hardware required
- No display system required
- Julia: Version 1.11 or higher
- OpenGL: Version 4.0 or higher (for GLMakie)
- RAM: 1 GB available memory
- Graphics: Dedicated graphics card with updated drivers (for GLMakie)
- Linux: X11 and Wayland display systems
- macOS: Native windowing system
- Windows: DirectX-compatible graphics
"No Makie backend activated":
- Solution: Activate a backend before running the application
- Example:
using GLMakie; GLMakie.activate!()
GLMakie initialization fails:
- Update graphics drivers to latest version
- Verify OpenGL 3.3+ support:
glxinfo | grep "OpenGL version"
(Linux) - Try software rendering if hardware acceleration unavailable
- Use CairoMakie as alternative:
using CairoMakie; CairoMakie.activate!()
Window doesn't appear:
- Check display system configuration (DISPLAY variable on Linux)
- Verify X11 forwarding if using SSH:
ssh -X username@hostname
- Ensure window manager is running
- Use CairoMakie for headless operation
Keyboard input not working:
- Click on the window to ensure it has focus
- Check for conflicting key bindings in window manager
- Verify keyboard layout is standard QWERTY
Performance issues:
- Close other graphics-intensive applications
- Reduce window size if experiencing lag
- Check system resource usage (CPU, memory, GPU)
"OpenGL initialization failed":
Solution: Update graphics drivers and verify OpenGL 3.3+ support
Alternative: Use CairoMakie for headless operation
"Display system not available":
Solution: Use CairoMakie or ensure display system is available
For SSH: Enable X11 forwarding or use CairoMakie
"Out of memory error":
Solution: Close other applications and restart Julia session
Main entry point for the application. Initializes all components and starts the interactive loop.
Creates a new movement state with specified movement speed.
add_key!(state, key)
: Add a key to pressed keys setremove_key!(state, key)
: Remove a key from pressed keys setcalculate_movement_vector(state)
: Calculate movement based on pressed keys
Movement speed can be adjusted by modifying the MovementState
initialization:
# Slower movement
state = MovementState(0.05)
# Faster movement
state = MovementState(0.2)
This project is licensed under the MIT License. See the LICENSE file for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Make changes and add tests
- Run the test suite:
julia --project=. -e "using Pkg; Pkg.test()"
- Submit a pull request
See CONTRIBUTING.md for detailed guidelines.
For issues and questions:
- Check the troubleshooting section above
- Review existing issues in the repository
- Create a new issue with detailed error information and system specifications