Created
September 14, 2011 15:40
-
-
Save alesya-h/1216905 to your computer and use it in GitHub Desktop.
MG lab1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ql:quickload "clx") | |
(defpackage #:lab-1 | |
(:use :cl :asdf)) | |
(in-package :lab-1) | |
(defun graphic-x (width height &optional (dots '((1 2) (2 3) (3 4) (4 5)))(host "")) | |
(let* ((display (xlib:open-display host)) | |
(screen (first (xlib:display-roots display))) | |
(black (xlib:screen-black-pixel screen)) | |
(white (xlib:screen-white-pixel screen)) | |
(root-window (xlib:screen-root screen)) | |
(grackon (xlib:create-gcontext | |
:drawable root-window | |
:foreground white | |
:background black)) | |
(my-window (xlib:create-window | |
:parent root-window | |
:x 0 | |
:y 0 | |
:width width | |
:height height | |
:background black | |
:event-mask (xlib:make-event-mask :exposure | |
:button-press)))) | |
(describe grackon) | |
(xlib:map-window my-window) | |
(xlib:event-case (display :force-output-p t | |
:discard-p t) | |
(:exposure () | |
(let ((last nil)) | |
(mapcar (lambda (point) | |
(setq last (xlib:draw-point my-window | |
grackon | |
(car point) (cadr point))) | |
nil | |
) | |
dots) | |
last)) | |
(:button-press () t)) | |
(xlib:destroy-window my-window) | |
(xlib:close-display display))) | |
(graphic-x 300 400) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment