Table of Contents
(method) Fewatsu:addMenuItem(path: string, displayName?: string)
-> nil
Adds a page to the Fewatsu menu. :setMenuAutoAdd()
must be false
.
path
can be either an absolute path to the file or the path from Fewatsu's current working directory. Looks for [path], then [path].json.
displayName
can be provided if you would like the item to have a different display name than the default (the page's title).
(method) Fewatsu:clearAnimatedImageCache()
-> nil
Clears the Fewatsu animated image cache.
(method) Fewatsu:clearMenuItems()
-> nil
Clears all side menu items. :setMenuAutoAdd()
must be false
.
(method) Fewatsu:getCurrentWorkingDirectory()
-> string
Returns the current working directory.
(method) Fewatsu:hide(preserveCache: boolean)
-> nil
Hides Fewatsu, restoring the original playdate.update()
function and input handlers.
If preserveCache
is true
, doesn't clear the animated image and QR code caches.
The current Fewatsu document and state are preserved.
(method) Fewatsu:init(workingDirectory?: string)
-> Fewatsu
Initializes a new Fewatsu instance at workingDirectory
and loads the default document.
Default path is manual/
.
(method) Fewatsu:load(data: table)
-> playdate.image
Parses the given table (if valid) and sets the current manual page to the image generated. Refer to the Fewatsu FORMAT.md doc for more information.
(method) Fewatsu:loadFile(path: string)
-> playdate.graphics.image
Shorthand function for loading a JSON file into Fewatsu.
path
can be an absolute path or a path from the current working directory.
File extension can be omitted (will check for .json
files).
Returns the generated image.
(method) Fewatsu:registerCustomElement(name: string, data: table)
-> nil
Registers a new custom element.
Please see the custom elements
section in the Fewatsu format documentation (FORMAT.md
) for more information.
(method) Fewatsu:setBGM(sound: playdate.sound.fileplayer)
-> nil
Sets the background music that will play while Fewatsu is active.
By default uses the file FEWATSU_LIB_PATH/snd/bgm
.
(method) Fewatsu:setBGMFade(fadetime: number)
-> nil
Sets the background music fade in/out time in seconds.
Defaults to 1
second.
(method) Fewatsu:setBGMVolume(volume: number)
-> nil
Sets the background music volume.
Defaults to 0.2
.
(method) Fewatsu:setBoldFont(font: playdate.graphics.font)
-> nil
Sets the font used for bold text.
(method) Fewatsu:setCallback(callback: function)
-> nil
Sets the function to be called when Fewatsu has completed its :hide()
function.
(method) Fewatsu:setClickSound(sound: playdate.sound.sampleplayer)
-> nil
Sets the sound that will be played when the A button is pressed.
(method) Fewatsu:setCurrentWorkingDirectory(dir: string)
-> boolean
Sets the current working directory. Fewatsu can use this to call for images and JSON files without using the absolute path.
By default, the working directory is set to /manual/
.
Returns true
on success, false
on failure.
(method) Fewatsu:setDarkMode(mode: boolean)
-> nil
Set if dark theme should be used. Doesn't apply to images, and is only applied on :load()
.
Defaults to false
.
(method) Fewatsu:setEnableBGM(status: boolean)
-> nil
Enables or disables background music.
Defaults to true
.
(method) Fewatsu:setEnableLoadingScreen(enable: boolean)
-> nil
Sets if a loading screen should be displayed on document load and Fewatsu is currently shown.
Please note that this increases load times when enabled.
Defaults to true
.
(method) Fewatsu:setEnableSFX(status: boolean)
-> nil
Sets if sound effects should play on user interaction (A button press, B button press, crank, etc)
Defaults to true
.
(method) Fewatsu:setEnableScrollBar(enable: boolean)
-> nil
Sets if the scroll bar should be displayed when the user scrolls through the Fewatsu document.
See :setScrollBarBackgroundImage()
and :setScrollBarImage()
to customize the scroll bar.
Defaults to true
.
(method) Fewatsu:setFont(font: playdate.graphics.font)
-> nil
Sets the font used for plaintext.
(method) Fewatsu:setHeadingFont(font: playdate.graphics.font)
-> nil
Sets the font used for heading text.
(method) Fewatsu:setItalicFont(font: playdate.graphics.font)
-> nil
Sets the font used for italic text.
(method) Fewatsu:setLeftPadding(px: number)
-> nil
Sets the pixel amount to pad the left side of the Fewatsu viewing area.
Defaults to 4
px.
(method) Fewatsu:setLinkFont(font: playdate.graphics.font)
-> nil
Sets the font used for link text.
(method) Fewatsu:setLoadingScreenShowPercent(show: boolean)
-> nil
Sets if loading screens should display the percent complete alongside the text.
The loading screen must be enabled for this to take effect. See :setEnableLoadingScreen()
for more details.
Loading screen text must be enabled for this to take effect. See :setLoadingScreenShowText()
for more details.
Defaults to true
.
(method) Fewatsu:setLoadingScreenShowSpinner(show: boolean)
-> nil
Sets if loading screens should display a spinner in the center of the screen.
The loading screen must be enabled for this to take effect. See :setEnableLoadingScreen()
for more details.
Defaults to true
.
(method) Fewatsu:setLoadingScreenShowText(show: boolean)
-> nil
Sets if loading screens should display text detailing the current action on the bottom of the screen.
The loading screen must be enabled for this to take effect. See :setEnableLoadingScreen()
for more details.
Defaults to true
.
(method) Fewatsu:setLoadingScreenTextAlignment(alignment: integer)
-> nil
Sets how the loading screen bottom information text should be aligned. Can be any kTextAlignment
or integer from 0 to 2.
The loading screen must be enabled for this to take effect. See :setEnableLoadingScreen()
for more details.
Loading screen text must be enabled for this to take effect. See :setLoadingScreenShowText()
for more details.
Defaults to kTextAlignment.right
.
(method) Fewatsu:setMenuAutoAdd(enable: boolean)
-> nil
Enables or disables the automatic adding of pages to the Fewatsu menu.
By default, the menu will add all of the valid Fewatsu JSON files in the current working directory.
To customize the menu manually, see :addMenuItem()
and :clearMenuItems()
. (auto add must be false
)
(method) Fewatsu:setMenuEaseDuration(ms: number)
-> nil
Sets the time it takes for the menu to ease in.
Defaults to 350
ms.
(method) Fewatsu:setMenuEasingFunction(func: function)
-> nil
Sets a different easing function which will be used instead of the default when animating the menu slide-in. Can be any playdate.easingFunction
.
Defaults to playdate.easingFunctions.outExpo
.
(method) Fewatsu:setMenuSound(sound: playdate.sound.sampleplayer)
-> nil
Sets the sound that will be played when the Fewatsu menu is opened or closed.
(method) Fewatsu:setMenuTitle(title: string)
-> nil
Sets the text shown at the top of the menu.
Defaults to Fewatsu
.
(method) Fewatsu:setMenuWidth(width: number)
-> nil
Sets the menu width.
Defaults to 120
px.
(method) Fewatsu:setPadding(px: number)
-> nil
Sets the amount to pad both sides of the Fewatsu document.
Shorthand function for :setLeftPadding()
and :setRightPadding()
.
Defaults to 4
px.
(method) Fewatsu:setPostUpdate(func: function)
-> nil
Sets the function that is called after all processing in :update()
.
(method) Fewatsu:setPreUpdate(func: function)
-> nil
Sets the function that is called before any processing happens in :update()
.
(method) Fewatsu:setQuoteBoxPadding(px: number)
-> nil
Sets the pixel amount to pad the right and left side of quote boxes.
Defaults to 30
px.
(method) Fewatsu:setRightPadding(px: number)
-> nil
Sets the pixel amount to pad the right side of the Fewatsu viewing area.
Defaults to 4
px.
(method) Fewatsu:setScrollBarBackgroundImage(image: playdate.graphics.image)
-> nil
Sets the image to use for the scroll bar background.
The image should be 20 pixels wide and 240 pixels tall.
(method) Fewatsu:setScrollBarImage(image: playdate.graphics.image)
-> nil
Sets the image to use for the scroll bar.
The image should be 20 pixels wide, and up to 160 pixels tall. For the best results, it is recommended to add two or so pixels of padding to every side of the image.
(method) Fewatsu:setScrollBarTimeout(ms: any)
-> nil
Sets the amount of time after user input has stopped to retract the scroll bar.
Defaults to 750
ms.
(method) Fewatsu:setScrollDuration(ms: number)
-> nil
Sets the time it takes to scroll to a new manual page offset.
Defaults to 400
ms.
(method) Fewatsu:setScrollEasingFunction(func: function)
-> nil
Sets a different easing function which will be used instead of the default when scrolling to a new manual page offset. Can be any playdate.easingFunction
.
Defaults to playdate.easingFunctions.outExpo
.
(method) Fewatsu:setSelectSound(sound: playdate.sound.sampleplayer)
-> nil
Sets the sound that will be played in the Fewatsu menu when up
or down
is pressed.
(method) Fewatsu:setShowSplash(show: boolean)
-> nil
Set if a splash screen should be displayed when :show()
is called.
Defaults to true
.
(method) Fewatsu:setSplashBackground(bg: playdate.graphics.image)
-> nil
Sets the splash screen background.
Requires that :setShowSplash()
has been set to true.
By default, shows the latest Fewatsu frame.
bg
image size must be 400 x 240 pixels.
(method) Fewatsu:setSplashFont(font: playdate.graphics.font)
-> nil
Sets the splash screen font.
Requires that :setShowSplash()
has been set to true.
(method) Fewatsu:setSplashText(text: string)
-> nil
Sets the splash screen text.
Requires that :setShowSplash()
has been set to true.
Defaults to Fewatsu
.
(method) Fewatsu:setSubheadingFont(font: playdate.graphics.font)
-> nil
Sets the font used for subheading text.
(method) Fewatsu:setTitleFont(font: playdate.graphics.font)
-> nil
Sets the font used for title text.
(method) Fewatsu:setTopPadding(px: number)
-> nil
Sets the amount to pad the top of the Fewatsu document.
Defaults to 4
px.
(method) Fewatsu:show(callback: function)
-> nil
Displays Fewatsu.
Executing this function replaces the current playdate.update
function, pushes new input handlers, and changes the display refresh rate. To restore, call :hide()
.
All playdate.menu
items will also be cleared. To restore these, set a callback function using :setCallback()
containing instructions to restore the previous menu items.
callback
can be provided if you would like an action to be performed after Fewatsu's splash screen has finished displaying (or, if you have it disabled, immediately after Fewatsu finishes its show()
function).
(method) Fewatsu:update(force: boolean)
-> nil
Updates Fewatsu and draws it to the screen if needed.
If force
is true, draw to the screen regardless of status.
You shouldn't have to call this at all yourself. If you're looking to display Fewatsu, see :show()
.