def clockthree_scroll(c2, color_mask): c2.paused = True c2.clearall() msg = 'ClockTHREE' msg_font = zeros(8 * len(msg), 'uint32') for i, char in enumerate(msg): msg_font[8 * i:8 * (i + 1)] = mono8x8_to_RGB(basic.get(char)) # trim pairs of zeros cols = [msg_font[0]] for col in msg_font: if col == 0 and cols[-1] == 0: continue else: cols.append(col & color_mask) for col in cols: c2.screen.buffer[:-1] = c2.screen.buffer[1:] c2.screen.buffer[-1] = col c2.refresh() for i in range(c2.N_COL): c2.screen.buffer[:-1] = c2.screen.buffer[1:] c2.screen.buffer[-1] *= 0 c2.refresh() c2.paused = False
def scroll_msg(c2, msg, color_mask, clearall=True, clear_rgb=False): c2.paused = True if clearall: c2.clearall() if clear_rgb: c2.clear_rgb() msg_font = zeros(8 * len(msg), 'uint32') for i, char in enumerate(msg): msg_font[8 * i:8 * (i + 1)] = mono8x8_to_RGB(basic.get(char)) # apply color cols = [] for col in msg_font: cols.append(col & color_mask) # scroll msg in fixed = 0b11111 << 27 for col in cols: c2.screen.buffer[:-1] = (c2.screen.buffer[1:] & ~fixed) | (c2.screen.buffer[:-1] & fixed) c2.screen.buffer[-1] = (col & ~fixed) | (c2.screen.buffer[-1] & fixed) c2.refresh(delay=.05) # scroll msg out for i in range(c2.N_COL): c2.screen.buffer[:-1] = c2.screen.buffer[1:] c2.screen.buffer[-1] *= 0 c2.refresh() c2.paused = False