33 lines
781 B
Rust
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")
|
|
}
|
|
}
|