GoudEngine Rust SDK

Alpha — This SDK is under active development. APIs change frequently. Report issues · Contact
Build 2D and 3D games in Rust with zero FFI overhead.
Install
cargo add goud-engine
Quick Start
use goudengine::*;
fn main() {
}
Flappy Bird Example
A complete Flappy Bird game is included in examples/rust/flappy_bird/. Run it with:
cargo run -p flappy-bird
The example demonstrates the main loop, sprite rendering, physics, and collision detection:
use goudengine::*;
fn main() {
let engine = Engine::new(SCREEN_WIDTH as u32, SCREEN_HEIGHT as u32, "Flappy Bird");
let mut manager = GameManager::new(&engine, "examples/csharp/flappy_goud/assets");
manager.start();
engine.enable_blending();
while !engine.should_close() {
let dt = engine.poll_events();
engine.begin_frame();
engine.clear(0.4, 0.7, 0.9, 1.0);
if !manager.update(&engine, dt) { break; }
manager.draw(&engine);
engine.end_frame();
engine.swap_buffers();
}
}
pub struct Movement {
pub velocity: f32,
gravity: f32,
jump_strength: f32,
jump_cooldown_timer: f32,
}
impl Movement {
pub fn apply_gravity(&mut self, dt: f32) {
self.velocity += self.gravity * dt * TARGET_FPS;
self.jump_cooldown_timer = (self.jump_cooldown_timer - dt).max(0.0);
}
pub fn try_jump(&mut self) {
if self.jump_cooldown_timer <= 0.0 {
self.velocity = self.jump_strength * TARGET_FPS;
self.jump_cooldown_timer = JUMP_COOLDOWN;
}
}
}
pub struct Pipe { pub x: f32, pub gap_y: f32 }
impl Pipe {
pub fn collides_with_bird(&self, bird_x: f32, bird_y: f32, w: f32, h: f32) -> bool {
aabb_overlap(bird_x, bird_y, w, h, self.x, self.top_pipe_y(), PIPE_IMAGE_WIDTH, PIPE_IMAGE_HEIGHT)
|| aabb_overlap(bird_x, bird_y, w, h, self.x, self.bottom_pipe_y(), PIPE_IMAGE_WIDTH, PIPE_IMAGE_HEIGHT)
}
}
pub fn update(&mut self, engine: &Engine, dt: f32) -> bool {
self.bird.update(dt, engine.is_key_pressed(KEY_SPACE));
for pipe in &mut self.pipes {
pipe.update(dt);
if pipe.collides_with_bird(self.bird.x, self.bird.y, BIRD_WIDTH, BIRD_HEIGHT) {
self.start(); return true;
}
}
self.pipe_spawn_timer += dt;
if self.pipe_spawn_timer > PIPE_SPAWN_INTERVAL {
self.pipe_spawn_timer = 0.0;
self.pipes.push(Pipe::new());
}
self.pipes.retain(|p| !p.is_off_screen());
true
}
Controls: Space / Left Click to flap, R to restart, Escape to quit.
Why a Separate Crate
This crate re-exports goud_engine::sdk::* from the internal engine. A standalone crate lets you depend on goud-engine without pulling in FFI exports, codegen build scripts, or napi dependencies. It also provides a clean versioned package for crates.io.
The internal crate goud-engine-core on crates.io is not intended for direct use.
Design
Unlike the C#, Python, and TypeScript SDKs which call through FFI, this crate links directly against the Rust engine with zero overhead.
pub use goud_engine::sdk::*;
Links