ProductPromotion
Logo

Clojure

made by https://0x3d.site

GitHub - kelsey-sorrels/zaffre: A fast clojure console library
A fast clojure console library. Contribute to kelsey-sorrels/zaffre development by creating an account on GitHub.
Visit Site

GitHub - kelsey-sorrels/zaffre: A fast clojure console library

GitHub - kelsey-sorrels/zaffre: A fast clojure console library

Zaffre

A fast Clojure library for emulating a terminal

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

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

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)))))))

More Examples

Run with

lein run -m examples.basic

or

lein run -m examples.tileset

etc.

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

License

Copyright © 2016 Kelsey Sorrels

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.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory