Permalink
Browse files

Add prompt helper

  • Loading branch information...
Shinmera committed Dec 9, 2018
1 parent 3a97aeb commit 865fa3dcec554790d29b2eed288ec1417247ac2a
Showing with 94 additions and 3 deletions.
  1. BIN data/PromptFont.ttf
  2. +91 −0 prompt.lisp
  3. +2 −3 text.lisp
  4. +1 −0 trial.asd
BIN +41.5 KB data/PromptFont.ttf
Binary file not shown.
@@ -0,0 +1,91 @@
#|
This file is a part of trial
(c) 2018 Shirakumo http://tymoon.eu (shinmera@tymoon.eu)
Author: Nicolas Hafner <shinmera@tymoon.eu>
|#

(in-package #:org.shirakumo.fraf.trial)

(define-asset (trial prompt-font) font
#p"PromptFont.ttf"
:charset " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~↞↟↠↡↤↥↦↧↰↱↲↳↺↻↼↽↾↿⇀⇁⇂⇃⇇⇈⇉⇊⇖⇗⇘⇙⇷⇸⇹␧␨␩␪␫␬␭␮␯␰␱␲␳␴␵␶␷␸␹①②③④⑤⑥⑦⑧⑨⑩⑪⑫"
:font-size 32)

(defun prompt-char (thing)
(etypecase thing
(character thing)
(symbol
(ecase thing
(:dpad-l #\↞)
(:dpad-u #\↟)
(:dpad-r #\↠)
(:dpad-d #\↡)
(:x #\↤)
(:y #\↥)
(:b #\↦)
(:a #\↧)
(:l1 #\↰)
(:r1 #\↱)
(:l2 #\↲)
(:r2 #\↳)
(:l #\↺)
(:r #\↻)
(:l-l #\↼)
(:r-l #\↽)
(:l-u #\↾)
(:r-u #\↿)
(:l-r #\⇀)
(:r-r #\⇁)
(:l-d #\⇂)
(:r-d #\⇃)
(:a-l #\⇇)
(:a-u #\⇈)
(:a-r #\⇉)
(:a-d #\⇊)
(:a-ul #\⇖)
(:a-ur #\⇗)
(:a-dr #\⇘)
(:a-dl #\⇙)
(:select #\⇷)
(:start #\⇸)
(:home #\⇹)
(:ctrl #\␧)
(:alt #\␨)
(:shift #\␩)
(:super #\␪)
(:tab #\␫)
(:caps #\␬)
(:backspace #\␭)
(:enter #\␮)
(:esc #\␯)
(:prtsc #\␰)
(:scrlk #\␱)
(:pause #\␲)
(:numlock #\␳)
(:insert #\␴)
(:home #\␵)
(:pageup #\␶)
(:delete #\␷)
(:end #\␸)
(:pagedown #\␹)
(:f1 #\①)
(:f2 #\②)
(:f3 #\③)
(:f4 #\④)
(:f5 #\⑤)
(:f6 #\⑥)
(:f7 #\⑦)
(:f8 #\⑧)
(:f9 #\⑨)
(:f10 #\⑩)
(:f11 #\⑪)
(:f12 #\⑫)))))

(define-shader-subject prompt (text)
((tetxure :initform (asset 'trial 'prompt-font))))

(defmethod (setf text) ((character character) (prompt prompt))
(setf (text prompt) (string character)))

(defmethod (setf text) ((symbol symbol) (prompt prompt))
(setf (text prompt) (string (prompt-char symbol))))
@@ -7,7 +7,7 @@
(in-package #:org.shirakumo.fraf.trial)

(define-shader-entity text (located-entity vertex-entity colored-entity textured-entity readied)
((texture :initarg :font :accessor font)
((texture :initarg :font :initform (error "FONT required.") :accessor font)
(text :initarg :text :accessor text)
(size :initarg :size :accessor size)
(wrap :initarg :wrap :accessor wrap)
@@ -19,8 +19,7 @@
:text ""
:wrap NIL
:width NIL
:height NIL
:font (error "FONT required."))
:height NIL)
(:inhibit-shaders (colored-entity :fragment-shader)
(textured-entity :fragment-shader)))

@@ -51,6 +51,7 @@
(:file "phong" :depends-on ("package" "helpers"))
(:file "pipeline" :depends-on ("package" "event-loop" "toolkit"))
(:file "pipelined-scene" :depends-on ("package" "pipeline" "scene" "loader"))
(:file "prompt" :depends-on ("package" "text"))
(:file "rails" :depends-on ("package" "subject" "helpers"))
(:file "render-texture" :depends-on ("package" "pipeline" "entity"))
(:file "renderable" :depends-on ("package" "toolkit"))

0 comments on commit 865fa3d

Please sign in to comment.