1 ; -*- mode: c; tab-width: 4; fill-column: 128 -*-
4 ; Lines, Copyright (c) 2018 Dave Odell <dmo2118@gmail.com>
6 ; Permission to use, copy, modify, distribute, and sell this software and its
7 ; documentation for any purpose is hereby granted without fee, provided that
8 ; the above copyright notice appear in all copies and that both that
9 ; copyright notice and this permission notice appear in supporting
10 ; documentation. No representations are made about the suitability of this
11 ; software for any purpose. It is provided "as is" without express or
14 ; Another port of 20 year old QBasic code.
29 ; Up-down. Skip all blank columns.
33 jmp next_y ; next_y is too far to conditional-branch from here.
69 ; Repaint columns that were previously on.
87 ; 3 * 2 * 16 = 96 bytes
137 sta $1 ; Left, down, right, up.
168 ; px[0] = ((px[0] ^ px[1]) & 1) | (px[1] << 1)
171 lsr ; Save EOR bit in carry flag.
173 rol ; Restore EOR bit.
228 ; Bit 0: black row, bit 1: changed row
232 dcb 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
233 dcb 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
238 ;#include "screenhack.h"
242 ; unsigned width, height;
243 ; unsigned long delay;
247 ;static void *lines_init(Display *display, Window window)
249 ; struct _lines *self = malloc(sizeof(*self));
251 ; XWindowAttributes xgwa;
256 ; XGetWindowAttributes(display, window, &xgwa);
257 ; self->width = xgwa.width;
258 ; self->height = xgwa.height;
260 ; self->delay = get_integer_resource(display, "delay", "Integer");
262 ; gcv.function = GXxor;
263 ; gcv.foreground = get_pixel_resource(display, xgwa.colormap, "foreground", "Foreground");
264 ; self->gc = XCreateGC(display, window, GCFunction | GCForeground, &gcv);
266 ; XDrawPoint(display, window, self->gc, xgwa.width >> 1, xgwa.height >> 1);
271 ;static unsigned long lines_draw(Display *display, Window window, void *self_raw)
273 ; struct _lines *self = self_raw;
274 ; static const XPoint xy[] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
275 ; const XPoint *p = xy + NRAND(4);
277 ; XCopyArea(display, window, window, self->gc, 0, 0, self->width, self->height, p->x, p->y);
278 ; return self->delay;
281 ;static void lines_reshape(Display *display, Window window, void *self_raw, unsigned width, unsigned height)
283 ; struct _lines *self = self_raw;
284 ; self->width = width;
285 ; self->height = height;
288 ;static Bool lines_event(Display *display, Window window, void *self_raw, XEvent *event)
293 ;static void lines_free(Display *display, Window window, void *self_raw)
295 ; struct _lines *self = self_raw;
296 ; XFreeGC(display, self->gc);
300 ;static const char *lines_defaults[] =
307 ;static XrmOptionDescRec lines_options [] =
309 ; {"-delay", ".delay", XrmoptionSepArg, 0},
313 ;XSCREENSAVER_MODULE ("Lines", lines)