6 Emulation
| (require ledum/define/emul) | package: ledum-definers |
This module provides the with-emulator binding and re-provides the with-emulator-window binding from ledum/define/emul/window.
syntax
addr : exact-positive-integer?
word : exact-positive-integer?
6.1 GUI Window
| (require ledum/define/emul/window) | package: ledum-definers |
syntax
(with-emulator-window (vfb) maybe-options body ...)
maybe-options = maybe-title maybe-fps maybe-scale maybe-title =
| #:title title maybe-fps =
| #:fps fps maybe-scale =
| #:scale scale
vfb : emufb?
title : string?
fps : exact-positive-integer?
scale : positive-real?
The emulator window ensures vfb is regularly checked for updates and if an update is detected, the window contents are redrawn. The frequency of updates is specified in the frames-per-second fps argument which defaults to 25.
The scaling factor scale is applied to the actual window size and the image drawn is scaled by the same factor. Defaults to 1.0. Fractional scaling is supported.
The "%?" sequences are interpreted dynamically by the emuwin% implementation. See its constructor for more information.
constructor
(new emuwin% [vfb vfb] [ctrl ctrl] [main main] [title title] [ [fps fps] [scale scale]]) → (is-a?/c emuwin%) vfb : emufb? ctrl : controller? main : (-> any) title : string? fps : exact-positive-integer? = 25 scale : positive-real? = 1.0 Creates a new emuwin% with given video framebuffer device vfb as its backend. All the events of key presses and releases are forwarded to given ctrl controller.The min-width, min-height, width, height, stretchable-width and stretchable-height init fields of frame% class cannot be specified. However all other init fields are passed through.
Creates a background thread in which main is evaluated.
It also creates an internal timer which ticks fps times per second and checks vfb for any updates ensuring given frames per second refresh.
The frame% label is set to title with the following substitutions for character pairs beginning with #\% implemented:
#\w - width of the framebuffer
#\h - height of the framebuffer
#\s - scaling factor in use
anything else - the string "%?" is used to signal soft error
Stops the internal timer, breaks the background thread running the main program and waits for it to finish.Waits for the internal thread. Used by with-emulator-window to ensure the control remains in parameterized eventspace.
6.2 GUI Video
| (require ledum/define/emul/video) | package: ledum-definers |
This module provides a generic interface for any device that can be used with with-emulator-window.
generic interface
(emufb-width emufb)
(emufb-height emufb)
(emufb-dirty? emufb)
(reset-emufb-dirty! emufb)
(get-emufb-argb-pixels emufb)
procedure
(emufb-width efb) → exact-positive-integer?
efb : emufb?
procedure
(emufb-height efb) → exact-positive-integer?
efb : emufb?
procedure
(emufb-dirty? efb) → boolean?
efb : emufb?
procedure
(reset-emufb-dirty! efb) → void?
efb : emufb?
procedure
(get-emufb-argb-pixels efb bs) → bytes?
efb : emufb? bs : (or/c #f bytes?)
constructor
(new emucan% [ [key-press-callback key-press-callback] [key-release-callback key-release-callback]]) → (is-a?/c emucan%) key-press-callback : procedure? = void key-release-callback : procedure? = void Creates a new emucan% with given callbacks for respective keyboard events.
method
ch : (is-a?/c key-event%) Passes key presses and releases to the corresponding key-press-callback and key-release-callback.
6.3 Emulated Controller
| (require ledum/define/emul/controller) | |
| package: ledum-definers | |
This module provides a generic interface to keyboard-like controllers.
(emuctrl-press emuctrl kc)
(emuctrl-release emuctrl kc)