Created
May 22, 2011 18:55
-
-
Save ncweinhold/985749 to your computer and use it in GitHub Desktop.
Getting started with lispbuilder-sdl
This file contains hidden or 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
(defpackage #:hello-world-sdl | |
(:use :cl) | |
(:export :main)) | |
(in-package :hello-world-sdl) | |
(defparameter *screen-width* 640) | |
(defparameter *screen-height* 480) | |
(defparameter *bg-color* sdl:*black*) | |
(defparameter *text-color* sdl:*white*) | |
(defvar *running* nil) | |
(defun draw-text (text x y) | |
(sdl:draw-string-shaded-* text x y *text-color* *bg-color*)) | |
(defun main () | |
(setf *running* t) | |
(sdl:with-init (sdl:sdl-init-video) | |
(sdl:initialise-default-font) | |
(sdl:window *screen-width* *screen-height* | |
:title-caption "Hello World" | |
:icon-caption "Hello World") | |
(setf (sdl:frame-rate) 60) | |
(sdl:clear-display *bg-color*) | |
(sdl:with-events () | |
(:quit-event () (prog1 t | |
(setf *running* nil))) | |
(:idle () | |
(sdl:clear-display *bg-color*) | |
(draw-text "Hello World!" 250 150) | |
(sdl:update-display) | |
(when (not *running*) | |
(sdl:push-quit-event)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment