|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T w
Length: 2350 (0x92e) Types: TextFile Names: »window.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/X/Xtetris/window.c«
#include "defs.h" static XtIntervalId timer; start_timer() { unsigned long interval; int level; level = 50 - (rows / 10); if (level < 0) level = 0; interval = level * 6; timer = XtAddTimeOut(interval, drop_block, NULL); } stop_timer() { XtRemoveTimeOut(timer); } set_events() { XtAddCallback(canvas, XtNselect,canvas_event_proc,NULL); XtAddCallback(canvas, XtNrelease,canvas_event_proc,NULL); XtAddCallback(canvas, XtNkeyDown,canvas_event_proc,NULL); } clear_events() { XtRemoveCallback(canvas, XtNselect,canvas_event_proc,NULL); XtRemoveCallback(canvas, XtNrelease,canvas_event_proc,NULL); XtRemoveCallback(canvas, XtNkeyDown,canvas_event_proc,NULL); } void restore_canvas(w, client_data, call_data) Widget w; caddr_t client_data; caddr_t call_data; { int x, y; XSetFunction(XtDisplay(toplevel), gc, GXclear); XFillRectangle(XtDisplay(toplevel), XtWindow(canvas), gc, 0, 0, UNIT * UWIDTH, UNIT * UHEIGHT); XSetFunction(XtDisplay(toplevel), gc, GXcopy); XSetLineAttributes(XtDisplay(toplevel), gc, 1, LineSolid, CapButt, JoinMiter); XDrawLine(XtDisplay(toplevel), XtWindow(canvas), gc, 0, UHEIGHT * UNIT, UWIDTH * UNIT, UHEIGHT * UNIT); XDrawLine(XtDisplay(toplevel), XtWindow(canvas), gc, 0, UHEIGHT * UNIT + SHADOW_HEIGHT, UWIDTH * UNIT, UHEIGHT * UNIT + SHADOW_HEIGHT); XDrawLine(XtDisplay(toplevel), XtWindow(canvas), gc, UWIDTH * UNIT, 0, UWIDTH * UNIT, UHEIGHT * UNIT + SHADOW_HEIGHT + NEXT_HEIGHT); for(x=0; x<UWIDTH; x++) for(y=0; y<UHEIGHT; y++) if (grid[x][y] == 1) { XFillRectangle(XtDisplay(toplevel),XtWindow(canvas),gc, x * UNIT, y * UNIT, UNIT, UNIT); XSetFillStyle(XtDisplay(toplevel), gc, FillTiled); XFillRectangle(XtDisplay(toplevel),XtWindow(canvas),gc, (x * UNIT)+1, (y * UNIT)+1, UNIT-2, UNIT-2); XSetFillStyle(XtDisplay(toplevel), gc, FillSolid); } XFlush(XtDisplay(toplevel)); print_shape(shape_no, xpos, ypos, rot, shape[shape_no].color); draw_shadow(shape_no, xpos, ypos, rot, shape[shape_no].color); show_next(); }