Struct hotline_rs::client::Client
source · pub struct Client<D: Device, A: App> {
pub app: A,
pub device: D,
pub main_window: A::Window,
pub swap_chain: D::SwapChain,
pub pmfx: Pmfx<D>,
pub cmd_buf: D::CmdBuf,
pub imdraw: ImDraw<D>,
pub imgui: ImGui<D, A>,
pub unit_quad_mesh: Mesh<D>,
pub user_config: UserConfig,
pub libs: HashMap<String, LibReloader>,
/* private fields */
}Expand description
Hotline client data members
Fields§
§app: A§device: D§main_window: A::Window§swap_chain: D::SwapChain§pmfx: Pmfx<D>§cmd_buf: D::CmdBuf§imdraw: ImDraw<D>§imgui: ImGui<D, A>§unit_quad_mesh: Mesh<D>§user_config: UserConfig§libs: HashMap<String, LibReloader>Implementations§
source§impl<D, A> Client<D, A>where
D: Device,
A: App,
impl<D, A> Client<D, A>where D: Device, A: App,
Hotline Client implementation
sourcepub fn create(info: HotlineInfo) -> Result<Self, Error>
pub fn create(info: HotlineInfo) -> Result<Self, Error>
Create a hotline context consisting of core resources
sourcepub fn present(&mut self, blit_view_name: &str)
pub fn present(&mut self, blit_view_name: &str)
Render and display a pmfx target ‘blit_view_name’ to the main window, draw imgui and swap buffers
sourcepub fn wait_for_last_frame(&mut self)
pub fn wait_for_last_frame(&mut self)
Wait for the last submitted frame to complete to ensure safe shutdown once all in-flight resources are no longer needed
sourcepub fn add_plugin_lib(&mut self, name: &str, path: &str)
pub fn add_plugin_lib(&mut self, name: &str, path: &str)
This assumes you pass the path to a Cargo.toml for a dylib which you want to load dynamically
The lib can implement the hotline_plugin! and Plugin trait, but that is not required
You can also just load libs and use lib.get_symbol to find custom callable code for other plugins.
sourcepub fn serialise_plugin_data<T: Serialize>(&mut self, plugin_name: &str, data: &T)
pub fn serialise_plugin_data<T: Serialize>(&mut self, plugin_name: &str, data: &T)
Allows users to pass serializable data which is stored into the UserConfig for the app.
Plugin data is arrange as a json object / dictionary hash map as so:
“plugin_data”: {
“plugin_name”: {
“plugin_data_members”: true
}
“another_plugin_name”: {
“another_plugin_name_data”: true
}
}
sourcepub fn deserialise_plugin_data<'de, T: Deserialize<'de> + Default>(
&'de mut self,
plugin_name: &str
) -> T
pub fn deserialise_plugin_data<'de, T: Deserialize<'de> + Default>( &'de mut self, plugin_name: &str ) -> T
Deserialises string json into a T returning defaults if the entry does not exist