public DisplayHack(String [] args, bool clear, bool erase, bool rainbow_color, int default_color_count, int default_delay) : base(args) { this.thread = new Thread (new ThreadStart(this.run)); this.clear = clear; this.erase_ = erase; int color_count = option.intt ("color-count", "total number of random colors", default_color_count); delay = option.longg ("delay", "delay between screens in ms", default_delay); if (erase) { eraser_delay = option.longg ("eraser-delay", "delay between iterations of eraser in ms", 10); eraser_delta = option.intt ("eraser-delta", "granularity of eraser", 5, 1, 10); eraser_mode = option.Enum ("eraser-mode", "which eraser", Eraser.ALL_STRINGS, Eraser.RANDOM_ERASER_INDEX); } Rectangle geometry = option.rectangle ("geometry", "initial geometry of main window", new Rectangle (10, 10, 600, 480)); if (help_option) return; gc = gnu.x11.GC.build (display); if (erase_) eraser_gc = gnu.x11.GC.build (display); colors = new Color [color_count]; if (rainbow_color) for (int i=0; i<color_count; i++) colors [i] = display.default_colormap. alloc_random_rainbow_color (random); else for (int i=0; i<color_count; i++) colors [i] = display.default_colormap. alloc_random_color (random); Window.Attributes win_attr = new Window.Attributes (); win_attr.set_background (display.default_black); win_attr.set_event_mask (Event.BUTTON_PRESS_MASK | Event.STRUCTURE_NOTIFY_MASK | Event.EXPOSURE_MASK | Event.KEY_PRESS_MASK); window = new Window (display.default_root, geometry, 0, win_attr); window.set_wm (this, "main"); window.set_wm_delete_window (); }
public DisplayHack(String [] args, bool clear, bool erase, bool rainbow_color, int default_color_count, int default_delay) : base(args) { this.thread = new Thread(new ThreadStart(this.run)); this.clear = clear; this.erase_ = erase; int color_count = option.intt("color-count", "total number of random colors", default_color_count); delay = option.longg("delay", "delay between screens in ms", default_delay); if (erase) { eraser_delay = option.longg("eraser-delay", "delay between iterations of eraser in ms", 10); eraser_delta = option.intt("eraser-delta", "granularity of eraser", 5, 1, 10); eraser_mode = option.Enum("eraser-mode", "which eraser", Eraser.ALL_STRINGS, Eraser.RANDOM_ERASER_INDEX); } Rectangle geometry = option.rectangle("geometry", "initial geometry of main window", new Rectangle(10, 10, 600, 480)); if (help_option) { return; } gc = gnu.x11.GC.build(display); if (erase_) { eraser_gc = gnu.x11.GC.build(display); } colors = new Color [color_count]; if (rainbow_color) { for (int i = 0; i < color_count; i++) { colors [i] = display.default_colormap. alloc_random_rainbow_color(random); } } else { for (int i = 0; i < color_count; i++) { colors [i] = display.default_colormap.alloc_random_color(random); } } Window.Attributes win_attr = new Window.Attributes(); win_attr.set_background(display.default_black); win_attr.set_event_mask(Event.BUTTON_PRESS_MASK | Event.STRUCTURE_NOTIFY_MASK | Event.EXPOSURE_MASK | Event.KEY_PRESS_MASK); window = new Window(display.default_root, geometry, 0, win_attr); window.set_wm(this, "main"); window.set_wm_delete_window(); }