pub struct MapModes { /* private fields */ }Expand description
The anvil-map.modes service.
Implementations§
Source§impl MapModes
impl MapModes
Sourcepub fn c_api(&self) -> Table<AnvilMapModesService>
pub fn c_api(&self) -> Table<AnvilMapModesService>
The C table, for what this crate does not wrap.
Sourcepub fn register(&self, info: &ModeInfo<'_>) -> Result<Mode>
pub fn register(&self, info: &ModeInfo<'_>) -> Result<Mode>
Registers a mode with no lines of its own in the tooltip, which then
shows the province’s name and owner only. A pool of 13 numbers is lent
in the order modes register: a fourteenth is Unsupported, and so is
any mode when another loader of map modes runs. A taken id is
AlreadyExists; a bad id, label, description or sprite is
InvalidArgument.
Sourcepub fn register_with_tooltip<F>(
&self,
info: &ModeInfo<'_>,
describe: F,
) -> Result<Mode>
pub fn register_with_tooltip<F>( &self, info: &ModeInfo<'_>, describe: F, ) -> Result<Mode>
Registers a mode whose tooltip lines describe gives: for a province
ID, the lines (separated by \n), or None for none. It runs on the
main thread after a frame of the main loop, where World may be read,
for the province under the cursor while the mode is shown; keep it
short. Text past the buffer anvil-map gives is cut at a whole
character.
Sourcepub fn set_colors(&self, mode: Mode, colors: &[u32]) -> Result<()>
pub fn set_colors(&self, mode: Mode, colors: &[u32]) -> Result<()>
Hands over the colours of mode: colors[i] for the province with
ID i (see rgb and NO_COLOR); provinces past the slice and
province 0 keep the political colour. The slice is copied. Only while
a session runs (WrongPhase otherwise, also when it ends during the
call: the slice is dropped); more entries than the
session’s province limit, or a colour with a top byte other than 0 or
0xFF, is InvalidArgument.
Sourcepub fn mode_id(&self, number: i32) -> Option<&'static str>
pub fn mode_id(&self, number: i32) -> Option<&'static str>
The id of the plugin mode that borrowed number, a value of the
game’s map mode enum; None for the game’s own modes.