Push a Unicode codepoint into the character input queue. Called by platform event loops when a key-down event produces a printable char.
(&mut self, c: u32)
| 175 | /// Push a Unicode codepoint into the character input queue. Called by |
| 176 | /// platform event loops when a key-down event produces a printable char. |
| 177 | pub fn push_char(&mut self, c: u32) { |
| 178 | let next = (self.char_queue_head + 1) % self.char_queue.len(); |
| 179 | if next != self.char_queue_tail { |
| 180 | self.char_queue[self.char_queue_head] = c; |
| 181 | self.char_queue_head = next; |
| 182 | } |
| 183 | // If the queue is full, silently drop the character. |
| 184 | } |
| 185 | |
| 186 | /// Pop the next queued character. Returns 0 when the queue is empty. |
| 187 | /// Called once per frame by the editor's text-input widget. |
no outgoing calls
no test coverage detected