All Projects → aaron-santos → zaffre

aaron-santos / zaffre

Licence: MIT License
A fast clojure console library

Programming Languages

clojure
4091 projects
GLSL
2045 projects
shell
77523 projects

Projects that are alternatives of or similar to zaffre

pyeez
easy elegant representation on console
Stars: ✭ 14 (-85.11%)
Mutual labels:  console
ascii chart
Nice-looking lightweight console ASCII line charts ╭┈╯. Port of kroitor/asciichart.
Stars: ✭ 24 (-74.47%)
Mutual labels:  console
nchat
Terminal-based Telegram client for Linux and macOS
Stars: ✭ 68 (-27.66%)
Mutual labels:  console
console.img
🎉 Display a picture in the Chrome browser console
Stars: ✭ 44 (-53.19%)
Mutual labels:  console
ctable
C library to print nicely formatted tables
Stars: ✭ 13 (-86.17%)
Mutual labels:  console
cmdr
POSIX-compliant command-line UI (CLI) parser and Hierarchical-configuration operations
Stars: ✭ 94 (+0%)
Mutual labels:  console
RecoverPy
🙈 Interactively find and recover deleted or 👉 overwritten 👈 files from your terminal
Stars: ✭ 189 (+101.06%)
Mutual labels:  console
tty-reader
A set of methods for processing keyboard input in character, line and multiline modes.
Stars: ✭ 73 (-22.34%)
Mutual labels:  console
command-line
⌨ Command line options and arguments parser.
Stars: ✭ 35 (-62.77%)
Mutual labels:  console
screeps-commander
用于游戏《Screeps》的移动端控制台 WEB 应用
Stars: ✭ 18 (-80.85%)
Mutual labels:  console
circumflex
🌿 It's Hacker News in your terminal
Stars: ✭ 43 (-54.26%)
Mutual labels:  console
slim-command
Useful commands for slim application
Stars: ✭ 13 (-86.17%)
Mutual labels:  console
ishell
Create shell environments with Python
Stars: ✭ 70 (-25.53%)
Mutual labels:  console
preact-component-console
A console emulator for preact.
Stars: ✭ 29 (-69.15%)
Mutual labels:  console
dune
A shell🐚 by the beach🏖️!
Stars: ✭ 610 (+548.94%)
Mutual labels:  console
WeConsole
功能全面、界面与体验对标 Chrome devtools 的可定制化的小程序开发调试面板
Stars: ✭ 137 (+45.74%)
Mutual labels:  console
yii-console
Yii console components
Stars: ✭ 48 (-48.94%)
Mutual labels:  console
ddquery
Django Debug Query (ddquery) beautiful colored SQL statements for logging
Stars: ✭ 25 (-73.4%)
Mutual labels:  console
terminator-cheat-sheet
Cheat Sheet for Terminator
Stars: ✭ 72 (-23.4%)
Mutual labels:  console
fdlinecombine
Read multiple fds and print data to stdout linewise.
Stars: ✭ 40 (-57.45%)
Mutual labels:  console

Zaffre

A fast Clojure library for emulating a terminal

Zaffre is fast console library for drawing characters to a screen.

Screenshot using 2-bit tileset by Muziak

Features

  • It's fast. Zaffre uses LWJGL and OpenGL to render characters as fast as possible.
  • Unicode support (minus CJK code points)
  • CP437 tileset support (eg: loading Dwarf Fortress Wiki: Tileset repository)
  • Cross-platform codebase
  • Thread safe
  • Multiple fonts
  • Glyph stacking
  • Non-character tiles ie: sprites
  • Mix different font sizes

Screenshot using 16x16 Fantasy tileset by Jerom

Not Features

  • Effects
  • Animation
  • GUI control emulation

Usage

Add the dependency to your project:

[zaffre "0.4.0-SNAPSHOT"]

Quickstart

Runs a little hello world terminal

(ns examples.basic
  (:require [zaffre.terminal :as zat]
            [zaffre.glterminal :as zgl]
            [zaffre.events :as zevents]
            [zaffre.font :as zfont]
            [zaffre.tilesets :as ztiles]
            [zaffre.util :as zutil]
            [clojure.core.async :as async :refer [<! <!! go-loop]]))

(defn -main [& _]
   (zgl/create-terminal
     {:app {           ;; Setup a layer group `:app`
       :layers [:text] ;; With one layer `:text`
       :columns 16     ;; 16 characters wide
       :rows 16        ;; 16 characters tall
       :pos [0 0]      ;; With no position offset
       :font (constantly ztiles/pastiche-16x16)}} ;; Give the group a nice font
     {:title "Zaffre demo"     ;; Set the window title
      :screen-width (* 16 16)  ;; Screen dimentions in pixels
      :screen-height (* 16 16)} ;; Since our font is 16x16 and our layer group
                                ;; is also 16x16
     (fn [terminal]     ;; Receive the terminal in a callback
       (let [last-key (atom nil)]   ;; Save the last key press in an atom
             ;; Every 33ms, draw a full frame
         (zat/do-frame terminal 33
           (let [key-in (or @last-key \?)]
             ;; For each frame
             (zat/clear! terminal) ;; Clear the terminal
             ;; Draw strings
             (zutil/put-string terminal :text 0 0 "Hello world")
             (zutil/put-string terminal :text 12 0 (str key-in))))
         ;; Receive key presses
         (zevents/add-event-listener terminal :keypress
           (fn [new-key]
             ;; Save last key
             (reset! last-key new-key)
             ;; Make the `q` key quit the application
             (case new-key
               \q (zat/destroy! terminal)
               nil)))))))

Screenshot

More Examples

Run with

lein run -m examples.basic

or

lein run -m examples.tileset

etc.

Got to https://github.com/aaron-santos/zaffre/tree/master/src/examples for more.

License

Copyright © 2016 Aaron Santos

Distributed under the MIT license.

YourKit

Many thanks to YourKit for providing this project with licenses of its profiler to help us improve performance!

YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler and YourKit YouMonitor, tools for profiling Java and .NET applications.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].