Add some console roguelikes
This commit is contained in:
parent
7fb37be85f
commit
b63422050d
41
emacs/.emacs.d/config/init-games.el
Normal file
41
emacs/.emacs.d/config/init-games.el
Normal file
@ -0,0 +1,41 @@
|
||||
;; -*- lexical-binding: t; -*-
|
||||
|
||||
(defun roguelike-evil-insert ()
|
||||
(interactive)
|
||||
(vterm-reset-cursor-point)
|
||||
(call-interactively #'evil-insert))
|
||||
|
||||
(defun roguelike-buffer-setup ()
|
||||
(setq-local cursor-type 'box
|
||||
blink-cursor-mode nil
|
||||
evil-insert-state-cursor 'box
|
||||
evil-normal-state-cursor 'hollow
|
||||
evil-motion-state-cursor 'hollow
|
||||
left-fringe-width 0
|
||||
right-fringe-width 0)
|
||||
(evil-local-set-key 'normal (kbd "i") #'roguelike-evil-insert))
|
||||
|
||||
(defun play-roguelike (exe)
|
||||
(unless (executable-find exe)
|
||||
(user-error "%s is not installed" exe))
|
||||
(let ((buffer (format "*%s*" exe)))
|
||||
(when (get-buffer buffer)
|
||||
(kill-buffer buffer))
|
||||
(vterm buffer)
|
||||
(with-current-buffer buffer
|
||||
(roguelike-buffer-setup)
|
||||
(vterm-send-string (format "%s; exit" exe))
|
||||
(vterm-send-return))
|
||||
(switch-to-buffer buffer)))
|
||||
|
||||
(defun nethack ()
|
||||
(interactive)
|
||||
(play-roguelike "nethack"))
|
||||
|
||||
(defvar crawl-executable (expand-file-name "~/crawl/crawl-ref/source/crawl"))
|
||||
|
||||
(defun crawl ()
|
||||
(interactive)
|
||||
(play-roguelike crawl-executable))
|
||||
|
||||
(provide 'init-games)
|
@ -121,6 +121,7 @@
|
||||
(require 'init-wallabag)
|
||||
(require 'init-plantuml)
|
||||
(require 'init-mermaid)
|
||||
(require 'init-games)
|
||||
(require 'handwriting)
|
||||
(when (string-equal system-type "darwin")
|
||||
(require 'init-mac))
|
||||
|
Loading…
Reference in New Issue
Block a user