So many Swing settings and callbacks; one function to rule them all.
Clojure
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
src/super_simple_window
test/super_simple_window
.gitignore
LICENSE
README.md
project.clj

README.md

super-simple-window

Create and return a Canvas within a JFrame using a bunch of optional settings and callbacks with one function.

Installation

In Leiningen:

    [super-simple-window "0.1.0"]

Usage

There's just one function, new-super-simple-window.

(new-super-simple-window {:title "Bad example"
                          :on-render my-render-fn
                          :on-key-press my-keypress-handler}))

Create and return a Canvas within a JFrame using a bunch of optional settings and callbacks. Options:

:title Exactly what it sounds like. Defaults to \"Super simple window\".
:width The width of the Canvas within the window. Defaults to 640.
:height The height of the Canvas within the window. Defaults to 480.
:fps How often the timer (if used) runs. Defaults to 30.
:on-key-press Callback that receives a KeyEvent object.
:on-mouse-move Callback that receives a MouseEvent object.
:on-mouse-click Callback that receives a MouseEvent object.
:on-render Callback that receives a Graphics object.
:on-timer Callback that receives an ActionEvent object.

:on-render is called after all other callbacks. A Timer is setup if :on-timer is given.

License

Copyright © 2015 Trystan

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.