wumpus-basic-0.17.0: Basic objects and system code built on Wumpus-Core.

PortabilityGHC
Stabilityhighly unstable
Maintainerstephen.tetley@gmail.com

Wumpus.Basic.Kernel.Objects.AdvObject

Contents

Description

Extended Graphic object - an AdvanceGraphic is a Graphic twinned with and advance vector.

Synopsis

Advance-vector object and graphic

data AdvObject u Source

Advance vector graphic - this partially models the PostScript show command which moves the current point by the advance (width) vector as each character is drawn.

Instances

makeAdvObject :: Query (Vec2 u) -> LocGraphic u -> AdvObject uSource

makeAdvObject : loc_context_function * graphic -> AdvObject

Build an AdvObject from a context function (CF) that generates the answer displacement vector and a LocGraphic that draws the AdvObject.

emptyAdvObject :: InterpretUnit u => AdvObject uSource

emptyAdvObjectAU : AdvObject

Build an empty AdvObject.

The emptyAdvObject is treated as a null primitive by Wumpus-Core and is not drawn, the answer vector generated is the zero vector (V2 0 0).

Composition

advance :: Num u => AdvObject u -> AdvObject u -> AdvObject uSource

Draw the first AdvObject and use the advance vector to displace the second AdvObject.

The final answer is the sum of both advance vectors.

advances :: InterpretUnit u => [AdvObject u] -> AdvObject uSource

Concatenate the list of AdvObjects with advance.

advspace :: Num u => Vec2 u -> AdvObject u -> AdvObject u -> AdvObject uSource

Combine the AdvObjects using the answer vector of the first object plus the separator to move the start of the second object.

evenspace :: InterpretUnit u => Vec2 u -> [AdvObject u] -> AdvObject uSource

List version of nextSpace.

advrepeat :: InterpretUnit u => Int -> AdvObject u -> AdvObject uSource

Repeat the AdvObject n times, moving each time with advance.

punctuate :: InterpretUnit u => AdvObject u -> [AdvObject u] -> AdvObject uSource

Concatenate the list of AdvObjects, going next and adding the separator at each step.

advfill :: Num u => Vec2 u -> AdvObject u -> AdvObject uSource

Render the supplied AdvObject, but swap the result advance for the supplied vector. This function has behaviour analogue to fill in the wl-pprint library.