clojure-lanterna/index.html @ c08f300f1982
roul: Update site.
author |
Steve Losh <steve@stevelosh.com> |
date |
Mon, 10 Oct 2016 21:50:32 +0000 |
parents |
cb51d5fdb559 |
children |
be9b7c8cdbbc |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>clojure-lanterna</title>
<link rel="stylesheet" href="./_dmedia/bootstrap.css"/>
<link rel="stylesheet" href="./_dmedia/tango.css"/>
<link rel="stylesheet/less" type="text/css" href="./_dmedia/style.less">
<script src="./_dmedia/less.js" type="text/javascript">
</script>
</head>
<body class="index">
<div class="wrap">
<header><h1><a href="">clojure-lanterna</a></h1></header>
<div class="markdown">
<p>clojure-lanterna is a thin wrapper around the <a href="https://code.google.com/p/lanterna/">Lanterna</a> Java library to make
it more Clojure-friendly.</p>
<p><strong>It's still pre-1.0, so expect brokenness and backwards incompatibility. Once
it hits 1.0 you can be confident I'll stop breaking your shit all the time.</strong></p>
<p><strong>License:</strong> GNU Lesser GPL (yes, you can link with code under another license!)<br />
<strong>Documentation:</strong> <a href="http://sjl.bitbucket.org/clojure-lanterna/">http://sjl.bitbucket.org/clojure-lanterna/</a><br />
<strong>Issues:</strong> <a href="http://github.com/sjl/clojure-lanterna/issues/">http://github.com/sjl/clojure-lanterna/issues/</a><br />
<strong>Git:</strong> <a href="http://github.com/sjl/clojure-lanterna/">http://github.com/sjl/clojure-lanterna/</a><br />
<strong>Mercurial:</strong> <a href="http://bitbucket.org/sjl/clojure-lanterna/">http://bitbucket.org/sjl/clojure-lanterna/</a></p>
<h2 id="what-is-it">What is It?</h2>
<p><a href="https://code.google.com/p/lanterna/">Lanterna</a> is a Java library for interacting with terminals. It's kind of
like curses, except it's pure Java so it'll run anywhere. It lets you move the
cursor around, draw colored text, and so on.</p>
<p>It also contains a simple Swing "terminal emulator", so you can run your code
either in the terminal or in a separate Swing window when you don't have
a real terminal available (inside an IDE or on a certain terrible OS).</p>
<p>It's particularly nice for writing Roguelikes.</p>
<h2 id="how-to-use-it">How to Use It</h2>
<p>There are three main layers to Lanterna. Currently clojure-lanterna supports
the first two layers of Lanterna: Terminal and Screen. At some point support
may be added for the GUI layer, but not any time soon.</p>
<p>To get started:</p>
<ol>
<li>
<p>Read the <a href="https://code.google.com/p/lanterna/wiki/DevelopmentGuide">first page</a> of the <a href="https://code.google.com/p/lanterna/wiki/DevelopmentGuide">Lanterna
documentation</a>. It sums up some main concepts and things
you'll need to watch out for.</p>
</li>
<li>
<p>Come back here and read the <a href="./installation/">Installation</a> docs to get
clojure-lanterna on your machine.</p>
</li>
<li>
<p>Read the <a href="./terminals/">Terminal</a> and <a href="./screens/">Screen</a> documents here in
order.</p>
</li>
<li>
<p>Have fun! Consult the <a href="./reference/">Reference</a> document if you need more
detailed information about something. Most functions also have docstrings.</p>
</li>
</ol>
<h2 id="i-want-a-hello-world">I Want a Hello, World!</h2>
<p>Okay, fine:</p>
<div class="codehilite"><pre><span class="p">(</span><span class="nf">require</span> <span class="o">'</span><span class="p">[</span><span class="nv">lanterna.screen</span> <span class="ss">:as</span> <span class="nv">s</span><span class="p">])</span>
<span class="p">(</span><span class="k">def </span><span class="nv">scr</span> <span class="p">(</span><span class="nf">s/get-screen</span><span class="p">))</span>
<span class="p">(</span><span class="nf">s/start</span> <span class="nv">scr</span><span class="p">)</span>
<span class="p">(</span><span class="nf">s/put-string</span> <span class="nv">scr</span> <span class="mi">10</span> <span class="mi">10</span> <span class="s">"Hello, world!"</span><span class="p">)</span>
<span class="p">(</span><span class="nf">s/put-string</span> <span class="nv">scr</span> <span class="mi">10</span> <span class="mi">11</span> <span class="s">"Press any key to exit!"</span><span class="p">)</span>
<span class="p">(</span><span class="nf">s/redraw</span> <span class="nv">scr</span><span class="p">)</span>
<span class="p">(</span><span class="nf">s/get-key-blocking</span> <span class="nv">scr</span><span class="p">)</span>
<span class="p">(</span><span class="nf">s/stop</span> <span class="nv">scr</span><span class="p">)</span>
</pre></div>
<p>But really, please read the docs if you actually want to use this. They're not
that long.</p><h2>Table of Contents</h2><ol class="toc"><li><a href="installation/">Installation</a></li><li><a href="terminals/">Terminals</a></li><li><a href="screens/">Screens</a></li><li><a href="reference/">Reference</a></li><li><a href="changelog/">Changelog</a></li></ol>
</div>
<footer><p>Created by <a href="http://stevelosh.com">Steve Losh</a>.
Documentation created with <a href="http://sjl.bitbucket.org/d/">d</a>.</p>
<p><br/><a id='rochester-made' href='http://rochestermade.com' title='Rochester Made'><img src='http://rochestermade.com/media/images/rochester-made-dark-on-light.png' alt='Rochester Made' title='Rochester Made' /></a></p>
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '4f843f8c613f5d65280000e6');
t.src = '//secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script></footer>
</div>
</body>
</html>