Created
September 19, 2016 15:01
-
-
Save JulienRouse/7a933f02da7143d462ae65821ee7cb73 to your computer and use it in GitHub Desktop.
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
;;;; draw-string.asd | |
(asdf:defsystem #:draw-string | |
:description "Describe draw-string here" | |
:author "Your Name <[email protected]>" | |
:license "Specify license here" | |
:depends-on (#:xelf) | |
:serial t | |
:components ((:file "package") | |
(:file "draw-string"))) | |
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
;;;; draw-string.lisp | |
(in-package #:draw-string) | |
(defparameter *width* 640) | |
(defparameter *height* 480) | |
(defclass foo (node) | |
((width :initform 16) | |
(height :initform 16))) | |
(defclass bar (buffer) | |
((width :initform *width*) | |
(height :initform *height*) | |
(foo :initform (make-instance 'foo)))) | |
;; ctrl+r to quit | |
(defmethod initialize-instance :after ((bar bar) &key) | |
(bind-event bar '(:r :control) 'quit)) | |
(defmethod start-game ((bar bar)) | |
(with-buffer bar | |
(draw-string "Hello World" 50 50 :color "red") | |
(current-buffer))) | |
(defun launch () | |
;; Configure the screen dimensions | |
(setf *screen-height* *height*) | |
(setf *screen-width* *width*) | |
;; Allow resizing of window and scaling | |
(setf *resizable* t) | |
(setf *scale-output-to-window* t) | |
(with-session | |
(open-project :plong) | |
;; this indexes everything defined with DEFRESOURCE | |
(index-pending-resources) | |
(let ((bar (make-instance 'bar))) | |
;; start the buffer running | |
(switch-to-buffer bar) | |
(start-game bar)))) | |
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
;;;; package.lisp | |
(defpackage #:draw-string | |
(:use #:cl #:xelf) | |
(:export launch)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying to do a minimum working example that launch a window, but no string come with xelf:draw-string