# ROZE - The zero dependency game engine.
ROZE is a barebones, zero dependency Windows game engine using win32 and OpenGL. This is the 0.1 release and is subject to major api changes.
#### Current Features: * Texture loading system that supports 32bit rgba BMP and DDS files * Audio loading system that supports WAV files * Audio playback system for playing one-shots and loops * Text rendering * Input system for Mouse, Keyboard and Xinput Gamepads * Random number generation system * Textured Sprite and Primitives system * Basic Orthographic Camera system * Barebones Math library * Textured particle system * Basic fps, frametime and performance statistics
### Entry point: * The System struct defines most of the important functions. * Check SystemConf if you want more project setup options.
EventFunctions must be implemented to start a project.
Check out ParticleProperties to define a particle.
Displays a 600x600 window with red background.
``` pub struct Game {}
impl EventFunctions for Game { fn init(&mut self, system: &mut System) {} fn update(&mut self, system: &mut System, dt: Duration) {} fn draw(&mut self, system: &mut System) { system.display_clear(1.0, 0.0, 0.0, 1.0); } }
fn main() { let system = System::new(600, 600, "Game Title"); let game = Game {}; Event::run(game, system); } ```
Displays a window with a spinning textured sprite. An audio clip plays when the left mouse button is clicked.
``` pub struct Game { rotation: f32, }
impl EventFunctions for Game { fn init(&mut self, system: &mut System) { system.loadtexture("textures/SpriteA.bmp"); system.loadaudio("audio/sound.wav"); } fn update(&mut self, system: &mut System, dt: Duration) { self.rotation += 90.0 * dt.assecsf32();
if system.mouse_pressed(MOUSECODE::L) {
system.play_one_shot("sound", 1.0);
}
if system.keyboard_pressed(KEYCODE::ESC) {
system.quit();
}
} fn draw(&mut self, system: &mut System) { system.display_clear(0.05, 0.08, 0.05, 0.0);
system.sprite(
system.screen_width() / 2.0,
system.screen_height() / 2.0,
0.0,
100.0,
100.0,
self.rotation,
system.get_texture("SpriteA"),
(1.0, 1.0, 1.0, 1.0).into(),
);
} }
fn main() { let system = System::new(800, 800, "Sprites, Textures and Audio"); let game = Game { rotation: 0.0 }; Event::run(game, system); } ```
Define an untextured colored particle effect that moves out from the center of the screen. Also define a font and display the current fps in the top right of the screen.
``` pub struct Game { particle_prop: ParticleProperties, }
impl Game { pub fn new() -> Self { let particleprop = ParticleProperties { pos: (0.0, 0.0, 0.0).into(), velocity: (0.0, 0.0, 0.0).into(), velocityvar: (150.0, 150.0, 0.0).into(), colorbegin: (1.0, 0.0, 0.0, 1.0).into(), colorend: (0.0, 0.0, 1.0, 0.0).into(), sizebegin: 15.0, sizeend: 25.0, sizevar: 10.0, lifetime: 5.0, texid: None, }; Self { particle_prop } } }
impl EventFunctions for Game { fn init(&mut self, system: &mut System) { self.particleprop.pos = ( system.screenwidth() / 2.0, system.screen_height() / 2.0, 0.0, ) .into();
system.define_font(
"myFont",
22,
Weight::NORMAL,
false,
false,
false,
"consolas",
);
} fn update(&mut self, system: &mut System, dt: Duration) { system.particleemit(&self.particle_prop);
if system.keyboard_pressed(KEYCODE::ESC) {
system.quit();
}
} fn draw(&mut self, system: &mut System) { system.display_clear(0.05, 0.08, 0.05, 0.0);
system.text(
&format!("fps: {}", system.get_fps()),
system.screen_width() - 100.0,
20.0,
(1.0, 1.0, 1.0, 1.0),
"myFont",
);
} }
fn main() { let config = SystemConf { windowtitle: "Particles".into(), screenwidth: 1200, screenheight: 1200, audiooneshotchannels: 10, audioloopchannels: 5, particlepoolsize: 5000, rngseed: 1, rngpoolsize: 1000000, lockfps: false, }; let system = System::new_ex(config); let game = Game::new(); Event::run(game, system); } ```