Functions available as part of the fluxus scratchpad.
Returns void
Resets the camera transform, useful if it becomes trashed, or you get lost somewhere in space. Also turns off camera locking to objects with (lock-camera)
Example
; ruin the camera transform (set-camera-transform (vector 123 41832 28 0.2 128 0.001 123 41832 28 0.2 128 0.001 0.2 100 13 1931)) ; set it back to the starting position/orientation (reset-camera)
Returns void
Overrides and locks the camera transform with your own. To unlock again call reset-camera
Example
(set-camera-transform (mtranslate (vector 0 0 -10)))
Returns transform-matrix
Returns the current camera transform. To unlock again call reset-camera
Example
(define tx (get-camera-transform))
Returns void
Resets the camera transform, useful if it becomes trashed, or you get lost somewhere in space. Also turns off camera locking to objects with (lock-camera)
Example
; ruin the camera transform (set-camera-transform (vector 123 41832 28 0.2 128 0.001 123 41832 28 0.2 128 0.001 0.2 100 13 1931)) ; set it back to the starting position/orientation (reset-camera)
Returns void
Overrides and locks the camera transform with your own. To unlock again call reset-camera
Example
(set-camera-transform (mtranslate (vector 0 0 -10)))
Returns transform-matrix
Returns the current camera transform. To unlock again call reset-camera
Example
(define tx (get-camera-transform))
Returns void
Sets the language for the documentation
Example
(set-help-locale! "pt") ; switch to portuguese (set-help-locale! "en") ; and back to english
Returns void
Displays help information on a fluxus function, or a list with available functions matching regexp. For running in the repl mainly.
Example
(help "pop")
Returns boolean
Returns true if the specified key is currently pressed down.
Example
(when (key-pressed "q") (display "q pressed!"))
Returns keys-list
Returns a list of keys pressed down
Example
(display (keys-down))(newline)
Returns boolean
Returns true if the specified special key is currently pressed down. Special keys are ones which do not map to ascii values. The easiest way of finding what they are is to print out the result of key-special-pressed while holding down the key you are after.
Example
(when (key-special-pressed 100) (display "left cursor pressed")) (when (key-special-pressed 102) (display "right cursor pressed")) (when (key-special-pressed 101) (display "up cursor pressed")) (when (key-special-pressed 103) (display "down cursor pressed"))
Returns keys-list
Returns a list of special keys pressed down
Example
(display (keys-special-down))
Returns modifiers-list
Returns a list of key modifiers symbols consisting 'shift, 'ctrl and 'alt.
Example
(display (key-modifiers))
Returns boolean
Returns true if the specified key was first pressed down this frame.
Example
(when (key-pressed-this-frame "q") (display "q pressed!"))
Returns boolean
Returns true if the specified special key was first pressed down this frame.
Example
(when (key-special-pressed-this-frame "q") (display "q pressed!"))
Returns coord-number
Returns the x position of the mouse
Example
(display (mouse-x))
Returns coord-number
Returns the y position of the mouse
Example
(display (mouse-y))
Returns boolean
Returns true if the specifed mouse button is pressed. Button numbers start counting from 1 with the left mouse button.
Example
(display (mouse-button 1))
Returns boolean
Returns 1 if the mouse wheel was moved in one direction in the last frame or -1 if it was turned the other way, otherwise returns 0.
Example
(display (mouse-wheel))
Returns primitiveid-number
Returns the object the mouse is currently over.
Example
(grab (mouse-over)) (colour (vector 1 0 0)) ; paints objects the mouse is over red (ungrab)
Returns void
Sets a function to be called every time the render is about to draw a new frame.
Example
(define (myfunc) (colour (rndvec)) (draw-torus)) (every-frame (myfunc))
Returns void
Clears out the renderer of all objects and lights. Clears the physics system and resets the every-frame callback. Generally a Good Thing to put this at the beginning of scripts to make sure everything is cleared out each time you execute.
Example
(clear) ; without this we would accumulate a new cube every time F5 was pressed (build-cube)
Returns void
Starts saving frames to disk. Type can be one of "tif", "jpg" or "ppm". Filenames are built with the frame number added, padded to 5 zeros.
Example
(start-framedump "frame" "jpg")
Returns void
Stops saving frames to disk.
Example
(end-framedump)
Returns void
Call with #t to turn on debug rendering for the physics.
Example
(set-physics-debug #t)
Returns void
Allows you to override the frame callback, to control the rendering loop of fluxus in a more detailed way.
Example
(override-frame-callback myfunc) (override-frame-callback default-fluxus-frame-callback) ; set it back again...
Returns void
Sets the tabs size for the prettification auto indent on ctrl-p. Defaults to 2.
Example
(set-auto-indent-tab 2)
Returns void
Turns off camera update - allowing you to use (set-camera) - otherwise it gets written over by the mouse camera update. The reason for needing this is that (set-camera-transform) doesn't work with multiple cameras - need to fix.
Example
(set-camera-update #f) (set-camera-update #t)
Returns void
Launches a new per-frame task, a tasks: * execute once per graphic frame * are called in lexigraphical order by name * have unique names and if the same name is used the old task is removed prior to the new task being added * a task that returns #f will remove itself after executing (every-frame (build-cube)) is equivalent to (spawn-task (lambda () (build-cube)) 'every-frame-task)
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) (rm-task 'torus-task)
Returns void
Removes a task from the tasklist
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) ; add a task (rm-task 'torus-task) ; remove it again
Returns void
Removes all task from the tasklist, including the every-frame task.
Example
(rm-all-tasks)
Returns void
Prints a list of current a tasks
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) ; add a task (ls-tasks) (rm-task 'torus-task)
Returns boolean
Checks if a task is running.
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) (display (task-running? 'torus-task))(newline) (rm-task 'torus-task) (display (task-running? 'torus-task))(newline)
Returns void
Launches a new timed task, which will happen in the future, on the frame that the time specifies. Use (time-now) rather than (time) to obtain the time. I need to sort that out.
Example
(spawn-timed-task (+ (time-now) 10) ; schedule a task 10 seconds from now (lambda () (display "hello future!") (newline)))
Returns void
Sets the language for the documentation
Example
(set-help-locale! "pt") ; switch to portuguese (set-help-locale! "en") ; and back to english
Returns void
Displays help information on a fluxus function, or a list with available functions matching regexp. For running in the repl mainly.
Example
(help "pop")
Returns boolean
Returns true if the specified key is currently pressed down.
Example
(when (key-pressed "q") (display "q pressed!"))
Returns keys-list
Returns a list of keys pressed down
Example
(display (keys-down))(newline)
Returns boolean
Returns true if the specified special key is currently pressed down. Special keys are ones which do not map to ascii values. The easiest way of finding what they are is to print out the result of key-special-pressed while holding down the key you are after.
Example
(when (key-special-pressed 100) (display "left cursor pressed")) (when (key-special-pressed 102) (display "right cursor pressed")) (when (key-special-pressed 101) (display "up cursor pressed")) (when (key-special-pressed 103) (display "down cursor pressed"))
Returns keys-list
Returns a list of special keys pressed down
Example
(display (keys-special-down))
Returns modifiers-list
Returns a list of key modifiers symbols consisting 'shift, 'ctrl and 'alt.
Example
(display (key-modifiers))
Returns boolean
Returns true if the specified key was first pressed down this frame.
Example
(when (key-pressed-this-frame "q") (display "q pressed!"))
Returns boolean
Returns true if the specified special key was first pressed down this frame.
Example
(when (key-special-pressed-this-frame "q") (display "q pressed!"))
Returns coord-number
Returns the x position of the mouse
Example
(display (mouse-x))
Returns coord-number
Returns the y position of the mouse
Example
(display (mouse-y))
Returns boolean
Returns true if the specifed mouse button is pressed. Button numbers start counting from 1 with the left mouse button.
Example
(display (mouse-button 1))
Returns boolean
Returns 1 if the mouse wheel was moved in one direction in the last frame or -1 if it was turned the other way, otherwise returns 0.
Example
(display (mouse-wheel))
Returns primitiveid-number
Returns the object the mouse is currently over.
Example
(grab (mouse-over)) (colour (vector 1 0 0)) ; paints objects the mouse is over red (ungrab)
Returns void
Sets a function to be called every time the render is about to draw a new frame.
Example
(define (myfunc) (colour (rndvec)) (draw-torus)) (every-frame (myfunc))
Returns void
Clears out the renderer of all objects and lights. Clears the physics system and resets the every-frame callback. Generally a Good Thing to put this at the beginning of scripts to make sure everything is cleared out each time you execute.
Example
(clear) ; without this we would accumulate a new cube every time F5 was pressed (build-cube)
Returns void
Starts saving frames to disk. Type can be one of "tif", "jpg" or "ppm". Filenames are built with the frame number added, padded to 5 zeros.
Example
(start-framedump "frame" "jpg")
Returns void
Stops saving frames to disk.
Example
(end-framedump)
Returns void
Call with #t to turn on debug rendering for the physics.
Example
(set-physics-debug #t)
Returns void
Allows you to override the frame callback, to control the rendering loop of fluxus in a more detailed way.
Example
(override-frame-callback myfunc) (override-frame-callback default-fluxus-frame-callback) ; set it back again...
Returns void
Sets the tabs size for the prettification auto indent on ctrl-p. Defaults to 2.
Example
(set-auto-indent-tab 2)
Returns void
Turns off camera update - allowing you to use (set-camera) - otherwise it gets written over by the mouse camera update. The reason for needing this is that (set-camera-transform) doesn't work with multiple cameras - need to fix.
Example
(set-camera-update #f) (set-camera-update #t)
Returns void
Launches a new per-frame task, a tasks: * execute once per graphic frame * are called in lexigraphical order by name * have unique names and if the same name is used the old task is removed prior to the new task being added * a task that returns #f will remove itself after executing (every-frame (build-cube)) is equivalent to (spawn-task (lambda () (build-cube)) 'every-frame-task)
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) (rm-task 'torus-task)
Returns void
Removes a task from the tasklist
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) ; add a task (rm-task 'torus-task) ; remove it again
Returns void
Removes all task from the tasklist, including the every-frame task.
Example
(rm-all-tasks)
Returns void
Prints a list of current a tasks
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) ; add a task (ls-tasks) (rm-task 'torus-task)
Returns boolean
Checks if a task is running.
Example
(spawn-task (lambda () (draw-torus)) 'torus-task) (display (task-running? 'torus-task))(newline) (rm-task 'torus-task) (display (task-running? 'torus-task))(newline)
Returns void
Launches a new timed task, which will happen in the future, on the frame that the time specifies. Use (time-now) rather than (time) to obtain the time. I need to sort that out.
Example
(spawn-timed-task (+ (time-now) 10) ; schedule a task 10 seconds from now (lambda () (display "hello future!") (newline)))