#ecs #game-engine #2d-game-engine #macroquad

gaymwtf-core

A modular 2D game engine and framework built with Rust and Macroquad

3 unstable releases

0.2.1 Jun 30, 2025
0.2.0 Jun 23, 2025
0.1.0 Jun 20, 2025

#846 in Game dev

Download history 1/week @ 2025-10-10

119 downloads per month

LGPL-3.0

66KB
1K SLoC

GaymWTF Core

Rust Macroquad

Crates.io Docs.rs

License Status

Downloads Downloads (latest)

A modular 2D game engine and framework built with Rust and Macroquad.

Features

  • Entity-Component System: Flexible entity management with support for custom components
  • Chunk-based World: Efficient world management with chunk loading and unloading
  • Tile System: Support for tile-based maps and environments
  • Biome System: Framework for creating and managing different game biomes
  • Menu System: Simple menu system for creating in-game menus
  • Serialization: Built-in support for saving and loading game state
  • Rendering: 2D rendering powered by Macroquad

Documentation

Getting Started

Prerequisites

  • Rust (latest stable version recommended)
  • Cargo (Rust's package manager)

Installation

Add this to your Cargo.toml:

[dependencies]
gaymwtf-core = "0.2.1"
macroquad = "0.4.14"

Or run:

cargo add gaymwtf-core macroquad

Usage

Basic example of setting up a game world:

use gaymwtf_core::*;
use macroquad::prelude::*;

#[macroquad::main("My Game")]
async fn main() {
    // Initialize registries
    let tile_registry = TileRegistry::new();
    let object_registry = ObjectRegistry::new();
    let biome_registry = BiomeRegistry::new();
    
    // Create a new world
    let mut world = World::new("MyGameWorld", tile_registry, object_registry, biome_registry);
    
    let mut camera = Camera2D::from_display_rect(Rect::new(0.0, 0.0, 800.0, 600.0));
    camera.zoom.y = -camera.zoom.y;

    // Game loop
    loop {
        
        // Update game state
        world.update(camera.target, vec2(screen_width(), screen_height()));

        // Render
        clear_background(BLACK);
        set_camera(&camera);
        
        world.draw(camera.target, vec2(screen_width(), screen_height()));
        
        next_frame().await;
    }
}

Examples

Example Project

The repository includes an example that serves as a working example of how to use the game engine. This test project demonstrates:

  • Setting up custom tiles, entities, and biomes
  • World generation
  • Basic game loop implementation
  • Rendering and input handling

To run the example project:

cargo run --example world

UI Example Project

Also the repository includes an other example that serves as a working example of how to use the game engine for UI. This example project demonstrates:

  • Setting up a menu system
  • Button and toggle button implementation
  • Rendering and input handling

To run the example project:

cargo run --example ui

Project Structure

  • src/core/: Core game systems (world, entities, tiles, biomes)
    • world/: World management
    • chunk/: Chunk system
    • object/: Object system and implementations
    • tile/: Tile system and implementations
    • biome/: Biome system and implementations
    • ui/: UI system and implementations
    • save/: Vec2Save
  • src/engine/: Rendering and other engine-specific code
  • src/utils/: Utility functions and helpers

License

This project is licensed under the LGPL v3 License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an Issue.

Acknowledgments

Dependencies

~21MB
~478K SLoC