just testing out ollama cloud for vibecoding in C.
- C 98.6%
- Makefile 1.4%
| assets | ||
| src | ||
| .gitignore | ||
| LICENSE | ||
| Makefile | ||
| prompt.md | ||
| README.md | ||
C/SDL2 Game Framework
A lightweight, professional game template built with C and SDL2, designed for macOS. This project implements a robust game loop architecture with a cinematic introductory sequence and precise frame-rate management.
🚀 Features
- Fixed Time-Step Loop: Locked at 60 FPS using
SDL_Delayand execution time calculation to ensure consistent gameplay across different hardware. - Cinematic Intro System:
- Typewriter-style text animation driven by millisecond timers (
SDL_GetTicks). - Dynamic centering algorithm for text rendering regardless of string length.
- "Hold-to-Quit" mechanism utilizing
delta_timefor mathematical precision.
- Typewriter-style text animation driven by millisecond timers (
- State Management: Centralized
Gamestruct acting as the single source of truth for the application state. - macOS Optimized: Configured to work seamlessly with Homebrew-installed SDL2 libraries.
🛠️ Technical Stack
- Language: C (C11)
- Libraries:
SDL2: Core windowing, input, and rendering.SDL2_ttf: TrueType font rendering.SDL2_image&SDL2_mixer: Linked and ready for asset expansion.
📋 Prerequisites
You must have Homebrew installed on your macOS system. Install the required SDL2 dependencies using:
brew install sdl2 sdl2_ttf sdl2_image sdl2_mixer
🔨 Building and Running
The project includes a Makefile to automate the compilation process.
-
Compile the project:
make -
Run the game:
./game -
Clean build files:
make clean
📂 Project Structure
src/main.c: Core game logic, including the game loop, input handling, update, and render functions.Makefile: Build configuration usingsdl2-configfor path resolution.assets/: Directory for game assets (e.g.,font.ttf).
🎮 Controls
- Hold ESC: Exit the game (requires a 1-second hold during the intro).
- Arrow Keys: Movement logic is implemented (currently disabled during the intro sequence).
🗺️ Roadmap
- Implement transition from Intro Sequence to Active Gameplay.
- Integrate sprite rendering for the player character.
- Expand game world with interactive objects.
- Add background music and sound effects using
SDL2_mixer.
🔊 Audio Credits
- dialog-beep.wav: Sound effect from freesound.org by nugsano
🔤 Font Credits
- font.ttf: Determination Mono Web Font from FontSpace