mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-11 21:48:36 +00:00
ChannelsSplit: Rename channels_set_current to set_current
Fancier API
This commit is contained in:
parent
454e98037e
commit
9a9484ff21
@ -20,10 +20,10 @@ fn main() {
|
||||
// Here, we draw a red line on channel 1 then a white circle on
|
||||
// channel 0. As a result, the red line will always appear on top of
|
||||
// the white circle.
|
||||
draw_list.channels_split(2, |draw_list| {
|
||||
draw_list.channels_split(2, |channels| {
|
||||
const RADIUS: f32 = 100.0;
|
||||
let canvas_pos = ui.get_cursor_screen_pos();
|
||||
draw_list.channels_set_current(1);
|
||||
channels.set_current(1);
|
||||
draw_list
|
||||
.add_line(
|
||||
canvas_pos,
|
||||
@ -33,7 +33,7 @@ fn main() {
|
||||
.thickness(5.0)
|
||||
.build();
|
||||
|
||||
draw_list.channels_set_current(0);
|
||||
channels.set_current(0);
|
||||
let center = (canvas_pos.0 + RADIUS, canvas_pos.1 + RADIUS);
|
||||
draw_list
|
||||
.add_circle(center, RADIUS, WHITE)
|
||||
|
||||
@ -100,10 +100,10 @@ impl<'ui> WindowDrawList<'ui> {
|
||||
/// # use imgui::*;
|
||||
/// fn custom_drawing(ui: &Ui) {
|
||||
/// let draw_list = ui.get_window_draw_list();
|
||||
/// draw_list.channels_split(2, |draw_list| {
|
||||
/// draw_list.channels_set_current(1);
|
||||
/// draw_list.channels_split(2, |channels| {
|
||||
/// channels.set_current(1);
|
||||
/// // ... Draw channel 1
|
||||
/// draw_list.channels_set_current(0);
|
||||
/// channels.set_current(0);
|
||||
/// // ... Draw channel 0
|
||||
/// });
|
||||
/// }
|
||||
@ -134,7 +134,7 @@ impl<'ui> ChannelsSplit<'ui> {
|
||||
/// Change current channel.
|
||||
///
|
||||
/// Panic if channel_index overflows the number of channels.
|
||||
pub fn channels_set_current(&self, channel_index: u32) {
|
||||
pub fn set_current(&self, channel_index: u32) {
|
||||
assert!(
|
||||
channel_index < self.channels_count,
|
||||
"Channel cannot be set! Provided channel index ({}) is higher than channel count ({}).",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user