blizzard_engine/lib.rs
1//! # Blizzard Game Engine
2//!
3//! This library is a custom ECS game engine developed for integration with the Blizzard Server Engine.
4//! These two together can be used to develop TCP multiplayer games.
5//! However, the idea is that Blizzard will also work for any type of game, not just TCP or online games.
6//! Blizzard will be a modular game engine.
7//!
8//! As of now, it is just an ECS data engine.
9//!
10//! Some features in the roadmap:
11//! * Debugger
12//! * Platform abstraction
13//! * Window abstraction
14//! * Event handler
15//! * Renderer API with OpenGL
16//! * AI solutions
17//! * Many, many more features...
18//!
19
20#[cfg(test)]
21mod tests {
22 #[test]
23 fn it_works() {
24 assert_eq!(2 + 2, 4);
25 }
26}
27extern crate blizzard_id;
28
29pub mod core;
30pub mod ecs;
31pub mod game;
32
33use game::Game;
34use std::sync::mpsc;
35use std::sync::mpsc::Receiver;
36use std::sync::{Arc, Mutex};
37
38use crate::core::network_application::create_app;
39
40/// Start a networked app
41/// # Example
42/// 1. For example please see the official github repo workspace, inside the example lib
43/// 2. TODO: Example is inside src/bin/main.rs
44pub fn start_networked<T: Game<K, I>, K, I, M>(
45 game: T,
46 shared_state: K,
47 input: I,
48 handle_input: &'static (dyn Fn(Receiver<M>, Arc<Mutex<I>>) -> I + Sync),
49) where
50 I: Send + Copy,
51 M: Send,
52{
53 let mut app = create_app(game, shared_state, input, 1);
54 let (_, m_receiver) = mpsc::channel();
55
56 app.start(m_receiver, handle_input);
57}
58
59/// TODO: Start a non-networked app
60/// This feature is still missing
61pub fn start() {}