A minimal cross-platform example using raylib demonstrating a resizable window, simple input handling (keyboard, mouse, touch), and basic rendering.
Features
- Resizable window: The app uses a resizable window and reports current screen size.
- Input: Move the circle with arrow keys, mouse, or touch input.
- Status overlay: Shows FPS and current screen resolution.
Requirements
- CMake 3.24 or newer
- A C/C++ compiler supporting C++17 (MSVC, clang, gcc)
- raylib library installed and findable by CMake
Build (basic)
- Create a build directory and run CMake:
mkdir build &&cd build
cmake ..
cmake --build . --config Release- The produced executable name is controlled by
EXE_NAMEin CMakeLists.txt.
Platform notes:
- Windows: Use Visual Studio generator or pass
-G "Ninja"if you prefer Ninja. - macOS: You can build with Xcode or a Unix-style generator; the CMake file has basic Apple bundle settings for iOS/macOS.
- Linux: Ensure
Threadsand common system libraries are available; the CMake script linksmanddlwhere needed.
Run
- Run the generated executable from the build output. Example on Unix-like systems:
./MyRaylibAppControls
- Arrow keys: move the circle
- Mouse / touch: click or touch to move the circle to pointer position
- Esc or close window: exit
Project layout
src/main.cpp— main application sourceCMakeLists.txt— build configurationLICENSE— project license
Contributing Contributions and improvements are welcome. Open an issue or a pull request with proposed changes.
License
See the LICENSE file at the repository root.