Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (38 sloc) 1.59 KB
This file is a part of trial
(c) 2016 Shirakumo (
Author: Nicolas Hafner <>
(in-package #:org.shirakumo.fraf.trial)
(defclass fullscreenable (display)
((original-mode :initform NIL :accessor original-mode)
(resolution :accessor resolution)
(fullscreen :accessor fullscreen))
:resolution (list 800 600)
:fullscreen NIL))
(defmethod initialize-instance :after ((fullscreenable fullscreenable) &key resolution fullscreen)
(setf (original-mode fullscreenable) (cl-monitors:mode
(dolist (monitor (cl-monitors:detect))
(when (cl-monitors:primary-p monitor)
(return monitor)))))
(setf (resolution fullscreenable) resolution)
(setf (fullscreen fullscreenable) fullscreen))
(defmethod finalize :after ((fullscreenable fullscreenable))
(setf (resolution fullscreenable) NIL))
(defmethod (setf resolution) :before (resolution (fullscreenable fullscreenable))
(etypecase resolution
(cl-monitors:make-current (original-mode fullscreenable)))
(resize (context fullscreenable)
(first resolution)
(second resolution)))
(resize (context fullscreenable)
(cl-monitors:width resolution)
(cl-monitors:height resolution))
(cl-monitors:make-current resolution))))
(defmethod (setf fullscreen) :before (fullscreen (fullscreenable fullscreenable))
(show (context fullscreenable) :fullscreen fullscreen))