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,

Hotline Client implementation

source

pub fn create(info: HotlineInfo) -> Result<Self, Error>

Create a hotline context consisting of core resources

source

pub fn new_frame(&mut self)

Start a new frame syncronised to the swap chain

source

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

source

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

source

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.

source

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 } }

source

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

source

pub fn run(self)

Very simple run loop which can take control of your application, you could roll your own

source

pub fn run_once(self)

Very simple run loop which can take control of your application, you could roll your own

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.