Skip to content

Instantly share code, notes, and snippets.

@ncweinhold
Created May 22, 2011 18:55
Show Gist options
  • Save ncweinhold/985749 to your computer and use it in GitHub Desktop.
Save ncweinhold/985749 to your computer and use it in GitHub Desktop.
Getting started with lispbuilder-sdl
(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