gdl.context

Application

protocol

members

exit-app

(exit-app _)

ApplicationScreens

protocol

members

change-screen

(change-screen _ new-screen)
Calls screen/hide on the current-screen (if there is one).
Throws AssertionError when the context does not have a new-screen.
Calls screen/show on the new screen and
returns the context with current-screen set to new-screen.

current-screen

(current-screen _)

Assets

protocol

members

all-sound-files

(all-sound-files _)

all-texture-files

(all-texture-files _)

cached-texture

(cached-texture _ file)

Graphics

protocol

members

->color

(->color _ r g b a)

->cursor

(->cursor _ file hotspot-x hotspot-y)
Takes care of disposing the cursor at application exit.

delta-time

(delta-time _)
the time span between the current frame and the last frame in seconds.

frames-per-second

(frames-per-second _)
the average number of frames per second

set-cursor!

(set-cursor! _ cursor)

GuiWorldViews

protocol

members

gui-mouse-position

(gui-mouse-position _)

pixels->world-units

(pixels->world-units _ pixels)

render-gui-view

(render-gui-view _ render-fn)

render-world-view

(render-world-view _ render-fn)

world-mouse-position

(world-mouse-position _)

ImageCreator

protocol

members

create-image

(create-image _ file)

get-scaled-copy

(get-scaled-copy _ image scale)
Scaled of original texture-dimensions, not any existing scale.

get-sprite

(get-sprite _ {:keys [tilew tileh], :as sheet} [x y])

get-sub-image

(get-sub-image _ {:keys [file sub-image-bounds], :as image})
Coordinates are from original image, not scaled one.

spritesheet

(spritesheet _ file tilew tileh)

ImageDrawer

protocol

members

draw-centered-image

(draw-centered-image _ image position)

draw-image

(draw-image _ image position)

draw-rotated-centered-image

(draw-rotated-centered-image _ image rotation position)

Input

protocol

members

button-just-pressed?

(button-just-pressed? _ button)

button-pressed?

(button-pressed? _ button)

key-just-pressed?

(key-just-pressed? _ k)

key-pressed?

(key-pressed? _ k)

ShapeDrawer

protocol

members

draw-arc

(draw-arc _ center-position radius start-angle degree color)

draw-circle

(draw-circle _ position radius color)

draw-ellipse

(draw-ellipse _ position radius-x radius-y color)

draw-filled-circle

(draw-filled-circle _ position radius color)

draw-filled-ellipse

(draw-filled-ellipse _ position radius-x radius-y color)

draw-filled-rectangle

(draw-filled-rectangle _ x y w h color)

draw-grid

(draw-grid drawer leftx bottomy gridw gridh cellw cellh color)

draw-line

(draw-line _ start-position end-position color)

draw-rectangle

(draw-rectangle _ x y w h color)

draw-sector

(draw-sector _ center-position radius start-angle degree color)

with-shape-line-width

(with-shape-line-width _ width draw-fn)

SoundStore

protocol

members

play-sound!

(play-sound! _ file)
Sound is already loaded from file, this will perform only a lookup for the sound and play it.

Stage

protocol

members

->stage-screen

(->stage-screen _ {:keys [stage sub-screen]})
A screen with a stage as an input-processor which gets drawn and 'act'ed after the given sub-screen.
The stage will get disposed also.
Sub-screen is optional.

get-stage

(get-stage _)
Stage implements clojure.lang.ILookup (get) on actor id.

mouse-on-stage-actor?

(mouse-on-stage-actor? _)

TextDrawer

protocol

members

draw-text

(draw-text _ {:keys [x y text font h-align up? scale]})
font, h-align, up? and scale are optional.
h-align one of: :center, :left, :right. Default :center.
up? renders the font over y, otherwise under.
scale will multiply the drawn text size with the scale.

TiledMapLoader

protocol

members

->tiled-map

(->tiled-map _ file)
Needs to be disposed.

render-tiled-map

(render-tiled-map _ tiled-map color-setter)
Renders tiled-map using world-view at world-camera position and with world-unit-scale.
Color-setter is a gdl.ColorSetter which is called for every tile-corner to set the color.
Can be used for lights & shadows.
The map-renderers are created and cached internally.
Renders only visible layers.

TrueTypeFontGenerator

protocol

members

generate-ttf

(generate-ttf _ {:keys [file size]})

Widgets

protocol

members

->actor

(->actor _ {:keys [draw act]})

->button-group

(->button-group _ {:keys [max-check-count min-check-count]})

->check-box

(->check-box _ text on-clicked checked?)

->group

(->group _)
Implements clojure.lang.ILookup (get) on actor id.

->horizontal-group

(->horizontal-group _)
Implements clojure.lang.ILookup (get) on actor id.

->image-button

(->image-button _ image on-clicked)

->image-widget

(->image-widget _ object opts)
Takes either an image or drawable. Opts are :scaling, :align and actor opts.

->label

(->label _ text)

->split-pane

(->split-pane _ {:keys [first-widget second-widget vertical?], :as opts})

->stack

(->stack _ actors)
A stack is a container that sizes its children to its size and positions them at 0,0 on top of each other.

The preferred and min size of the stack is the largest preferred and min size of any children. The max size of the stack is the smallest max size of any children.

Implements clojure.lang.ILookup (get) on actor id.

https://javadoc.io/static/com.badlogicgames.gdx/gdx/1.12.1/com/badlogic/gdx/scenes/scene2d/ui/Table.html
A group that sizes and positions children using table constraints.

Children added with add(Actor...) (and similar methods returning a Cell) are laid out in rows and columns. Other children may be added with Group.addActor(Actor) (and similar methods) but are not laid out automatically and don't affect the preferred or minimum sizes.

By default, Actor.getTouchable() is Touchable.childrenOnly.

The preferred and minimum sizes are that of the children laid out in columns and rows. 

->table

(->table _ opts)
:rows like gdl.scene2d.ui.table/add-rows.
Extra opts: :modal?

Implements clojure.lang.ILookup (get) on actor id.

https://javadoc.io/static/com.badlogicgames.gdx/gdx/1.12.1/com/badlogic/gdx/scenes/scene2d/ui/Table.html
A group that sizes and positions children using table constraints.

Children added with add(Actor...) (and similar methods returning a Cell) are laid out in rows and columns. Other children may be added with Group.addActor(Actor) (and similar methods) but are not laid out automatically and don't affect the preferred or minimum sizes.

By default, Actor.getTouchable() is Touchable.childrenOnly.

The preferred and minimum sizes are that of the children laid out in columns and rows.

->text-button

(->text-button _ text on-clicked)

->text-field

(->text-field _ text opts)

->texture-region-drawable

(->texture-region-drawable _ texture-region)

->window

(->window _ {:keys [title modal? close-button? center?], :as opts})