|
| 1 | +<!-- Use this file to provide workspace-specific custom instructions to Copilot. For more details, visit https://code.visualstudio.com/docs/copilot/copilot-customization#_use-a-githubcopilotinstructionsmd-file --> |
| 2 | + |
| 3 | +# Main Levels Editor - Geode Mod Development Guidelines |
| 4 | + |
| 5 | +## Project Overview |
| 6 | +This is a Geode mod for Geometry Dash that allows users to customize which levels appear in the level select screen. The mod supports importing/exporting custom .level files and provides a comprehensive level editor interface. |
| 7 | + |
| 8 | +## Key Technologies |
| 9 | +- **Geode SDK 4.8.0+** - Modern C++ modding framework for Geometry Dash |
| 10 | +- **CMake 3.21+** - Build system |
| 11 | +- **C++20** - Programming language standard |
| 12 | +- **Geometry Dash 2.2074** - Target game version |
| 13 | + |
| 14 | +## Code Style and Conventions |
| 15 | + |
| 16 | +### File Handling |
| 17 | +- Always use `string::pathToString()` instead of `std::filesystem::path::string()` for Unicode safety |
| 18 | +- Use Geode's file utilities (`file::readJson`, `file::writeJson`, etc.) instead of raw filesystem calls |
| 19 | +- Handle path operations safely with proper error checking |
| 20 | + |
| 21 | +### Geode-Specific Guidelines |
| 22 | +- Use `$modify` classes for hooking game functions |
| 23 | +- Prefer Geode's UI components (`Popup`, `TextInput`, `ButtonSprite`) over raw Cocos2d |
| 24 | +- Use `Ref<>` for automatic memory management of Cocos2d objects |
| 25 | +- Follow Geode naming conventions with proper namespacing |
| 26 | + |
| 27 | +### Memory Management |
| 28 | +- Use RAII principles |
| 29 | +- Prefer smart pointers and Geode's `Ref<>` system |
| 30 | +- Always check for null pointers before dereferencing |
| 31 | +- Clean up resources in destructors |
| 32 | + |
| 33 | +### Error Handling |
| 34 | +- Use Geode's `Result<>` type for operations that can fail |
| 35 | +- Provide meaningful error messages to users via `Notification::create()` |
| 36 | +- Log errors using `log::error()` for debugging |
| 37 | + |
| 38 | +### UI Development |
| 39 | +- Use Geode's layout system (`AxisLayout`, `RowLayout`) for responsive UIs |
| 40 | +- Make UI elements accessible and intuitive |
| 41 | +- Support both desktop and mobile interfaces |
| 42 | +- Use consistent styling with Geometry Dash's theme |
| 43 | + |
| 44 | +## Architecture Notes |
| 45 | + |
| 46 | +### Core Components |
| 47 | +- **Level File System**: Custom `.level` format for sharing levels with metadata and audio |
| 48 | +- **Level List Management**: Dynamic level listing configuration |
| 49 | +- **Editor Integration**: Hooks into GD's level editor for enhanced functionality |
| 50 | +- **UI Overlays**: Custom popups and menus integrated into game flow |
| 51 | + |
| 52 | +### Hook Points |
| 53 | +- `LocalLevelManager`: For loading custom levels |
| 54 | +- `GameLevelManager`: For level data management |
| 55 | +- `LevelSelectLayer`: For custom level listings |
| 56 | +- `EditorUI`: For level editor enhancements |
| 57 | + |
| 58 | +## Important Considerations |
| 59 | +- Always test on multiple platforms (Windows, macOS, Android) |
| 60 | +- Ensure backwards compatibility with existing .level files |
| 61 | +- Performance is critical - avoid blocking operations in game loops |
| 62 | +- Unicode support is essential for international users |
| 63 | +- Follow Geode's mod certification guidelines for distribution |
| 64 | + |
| 65 | +## Common Pitfalls to Avoid |
| 66 | +- Don't use raw `std::filesystem::path::string()` - use `string::pathToString()` |
| 67 | +- Don't create UI elements on the main thread without proper scheduling |
| 68 | +- Don't forget to handle edge cases in level ID parsing |
| 69 | +- Don't modify game state without proper validation |
| 70 | +- Don't block the UI thread with heavy file operations |
0 commit comments