p2p/src/plugin.rs
Lucas Schwiderski 2c9ce46dd2
chore: Rework project structure
There likely won't be much need for multiple separate crates.
2023-05-26 23:42:01 +02:00

33 lines
781 B
Rust

use crate::stingray_sdk::{GetApiFunction, LoggingApi};
use crate::PLUGIN_NAME;
pub(crate) struct Plugin {
log: LoggingApi,
}
impl Plugin {
pub fn new(get_engine_api: GetApiFunction) -> Self {
let log = LoggingApi::get(get_engine_api);
Self { log }
}
pub fn setup_game(&self) {
self.log.info(
PLUGIN_NAME,
format!("[setup_game] Hello, world! This is {}!", PLUGIN_NAME),
);
}
pub fn shutdown_game(&self) {
self.log
.info(PLUGIN_NAME, format!("[shutdown_game] Goodbye, world!"));
}
pub fn update_game(&self, dt: f32) {}
}
impl std::fmt::Debug for Plugin {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("PluginApi")
}
}