Client: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Client Documentation == === RegionSelection ===") |
Dat Hack3r (talk | contribs) m (Added page to Documentation category.) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Page in progress}} | |||
=== RegionSelection === | == w Namespace == | ||
* doGoToCoord(y: number, x: number) | |||
** Jump to a specific location. Coordinates are based on "Show coordinates" values. | |||
* typeChar(char: string, doNotMoveCursor: boolean, color: number, noNewline: boolean, undoCursorOffset: boolean, bgColor: number) | |||
** Write a character where the text cursor is. | |||
* getChar(tileX: number, tileY: number, charX: number, charY: number) | |||
** Retrieve the text content of a character where the text cursor is. | |||
* moveCursor(direction: string, preserveVertPos, amount: number) | |||
** Move the text cursor in any direction ("up", "down", "left", "right"). | |||
* fetchUnloadedTiles() | |||
** Fetch tiles in viewport that have not been loaded from the server. This is already called 3 times per second. | |||
* getTileVisibility() | |||
** Retrieve detailed viewport information. | |||
* getCenterCoords(): Array[number, number] | |||
** Get "Show coordinates" coordinates from the center of the screen. | |||
* broadcastReceive(force: boolean) | |||
** Opt-in to receiving raw user messages. | |||
* broadcastCommand(data: string, includeUsername: boolean) | |||
** Send a raw user message to all clients that have opted in. | |||
* jquery(callback: function) | |||
** Load the jQuery library from the official CDN (version 1.7). | |||
* redraw() | |||
** Re-render all text content from scratch immediately. | |||
* reloadRenderer() | |||
** Perform a full refresh of the renderer by invalidating the cache and resetting all of its internals. | |||
* setRedraw() | |||
** Schedule a redraw on the next frame. | |||
* setTileRedraw(tileX: number, tileY: number) | |||
** Schedule a redraw of a specific tile on the next frame. | |||
* setTileRender(tileX: number, tileY: number) | |||
** Schedule a re-plotting of a specific tile from cache to the screen on the next frame. | |||
* setTransparency(transparent: boolean) | |||
** Make internal canvas use 'alpha' mode, subsequently requiring only one rendering pass per tile and may make text use subpixel rendering. | |||
* render(redraw: boolean) | |||
** Plot all visible tiles from cache to the screen. | |||
* changeFont(fontData: string, noReload) | |||
** Change default global font. | |||
* fixFonts(mainType: string) | |||
** Load important fonts that aren't supported by the system. | |||
* loadFont(name: string, path: string, callback: function) | |||
** Load a specific font from URL. | |||
* changeSpecialCharFont(fontData: string, noReload: boolean) | |||
** Change the default font for special characters. This may include cells with combining characters. | |||
* enableCombining(noReload: boolean) | |||
** Make combining characters visible. | |||
* disableCombining(noReload: boolean) | |||
** Don't make combining characters visible. | |||
* enableSurrogates(noReload: boolean) | |||
** Make surrogate characters visible. Includes emoji characters. | |||
* disableSurrogates(noReload: boolean) | |||
** Don't make surrogate characters visible. | |||
* enableColors(noReload: boolean) | |||
** Render all text with colors. | |||
* disableColors(noReload: boolean) | |||
** Don't render all text with colors. | |||
* basic() | |||
** Disable colors, combining characters, and surrogate characters. | |||
* restore() | |||
** Re-enable colors, combining characters, and surrogate characters. | |||
* night(ignoreUnloadedPattern: boolean) | |||
** Enable night mode. | |||
* day(reloadStyle: boolean) | |||
** Disable night mode. Restore the original styles. | |||
* rotate(speed: number) | |||
** Unused 3D demo. | |||
* hideChat() | |||
** Hide the chat button. | |||
* showChat() | |||
** Show the chat button. | |||
* disableDragging() | |||
** Prevent the canvas from being draggable. | |||
* enableDragging() | |||
** Allow the canvas to be draggable. | |||
* disableCursor() | |||
** Disable the cursor. Cells cannot be selected and written to. | |||
* enableCursor() | |||
** Re-enable the cursor. | |||
* disableScrolling() | |||
** Prevent the user from using the scroll wheel to navigate. | |||
* enableScrolling() | |||
** Re-enable the scroll wheel. | |||
* setMouseCursor(cursor: string) | |||
** Set the default mouse cursor. | |||
* resetMouseCursor() | |||
** Reset the mouse cursor to the default setting. | |||
* setDragCursor(cursor: string) | |||
** Set the mouse cursor when dragging the canvas. | |||
* resetDragCursor() | |||
** Reset the mouse cursor when dragging the canvas. | |||
* changeSocket(address: string) | |||
** Change the client's socket address to another specified address. | |||
* changeColor(color: string) | |||
** Change the client's current text color. | |||
* changeBgColor(color: string) | |||
** Change the client's current cell background color. | |||
* fetchUpdates(margin: number) | |||
** Fetch new updates regardless of tiles that have been loaded. | |||
* splitTile(str: string): string | |||
** Split a string accounting for grapheme clusters (limited to surrogates and most combining characters). | |||
* shiftZoombar() | |||
** Shift the zoom bar on menu to the bottom when new options are added. | |||
* setFlushInterval(rate: number) | |||
** Change the interval at which writes are uploaded to the server. | |||
* registerHook(event: string, callback: function) | |||
** Allow specific client processes to be modified precisely. Limited to char rendering at the moment. | |||
== RegionSelection == | |||
* Constructor: ''RegionSelection'' | |||
* Properties | |||
** charColor: string | |||
** color: string | |||
** tiled: boolean | |||
* Methods | |||
** onselection | |||
*** coordA: Array[number, number, number, number] | |||
*** coordB: Array[number, number, number, number] | |||
*** regWidth: number | |||
*** regHeight: number | |||
** startSelection | |||
** stopSelectionUI | |||
Code example:<syntaxhighlight lang="javascript"> | |||
var selection = new RegionSelection(); | |||
this.charColor = "#00AA00"; | |||
this.color = "rgba(0, 0, 255, 0.1)"; | |||
this.tiled = false; | |||
selection.onselection(function(coordA, coordB, regWidth, regHeight) { | |||
console.log(coordA, coordB, regWidth, regHeight); | |||
}); | |||
w.on("keyDown", function(e) { | |||
if(checkKeyPress(e, "ALT+H")) { | |||
selection.startSelection(); | |||
} | |||
}); | |||
</syntaxhighlight> | |||
[[Category:Documentation]] |
Latest revision as of 10:37, 28 September 2023
This page is in progress Please check back later for additional changes |
w Namespace
- doGoToCoord(y: number, x: number)
- Jump to a specific location. Coordinates are based on "Show coordinates" values.
- typeChar(char: string, doNotMoveCursor: boolean, color: number, noNewline: boolean, undoCursorOffset: boolean, bgColor: number)
- Write a character where the text cursor is.
- getChar(tileX: number, tileY: number, charX: number, charY: number)
- Retrieve the text content of a character where the text cursor is.
- moveCursor(direction: string, preserveVertPos, amount: number)
- Move the text cursor in any direction ("up", "down", "left", "right").
- fetchUnloadedTiles()
- Fetch tiles in viewport that have not been loaded from the server. This is already called 3 times per second.
- getTileVisibility()
- Retrieve detailed viewport information.
- getCenterCoords(): Array[number, number]
- Get "Show coordinates" coordinates from the center of the screen.
- broadcastReceive(force: boolean)
- Opt-in to receiving raw user messages.
- broadcastCommand(data: string, includeUsername: boolean)
- Send a raw user message to all clients that have opted in.
- jquery(callback: function)
- Load the jQuery library from the official CDN (version 1.7).
- redraw()
- Re-render all text content from scratch immediately.
- reloadRenderer()
- Perform a full refresh of the renderer by invalidating the cache and resetting all of its internals.
- setRedraw()
- Schedule a redraw on the next frame.
- setTileRedraw(tileX: number, tileY: number)
- Schedule a redraw of a specific tile on the next frame.
- setTileRender(tileX: number, tileY: number)
- Schedule a re-plotting of a specific tile from cache to the screen on the next frame.
- setTransparency(transparent: boolean)
- Make internal canvas use 'alpha' mode, subsequently requiring only one rendering pass per tile and may make text use subpixel rendering.
- render(redraw: boolean)
- Plot all visible tiles from cache to the screen.
- changeFont(fontData: string, noReload)
- Change default global font.
- fixFonts(mainType: string)
- Load important fonts that aren't supported by the system.
- loadFont(name: string, path: string, callback: function)
- Load a specific font from URL.
- changeSpecialCharFont(fontData: string, noReload: boolean)
- Change the default font for special characters. This may include cells with combining characters.
- enableCombining(noReload: boolean)
- Make combining characters visible.
- disableCombining(noReload: boolean)
- Don't make combining characters visible.
- enableSurrogates(noReload: boolean)
- Make surrogate characters visible. Includes emoji characters.
- disableSurrogates(noReload: boolean)
- Don't make surrogate characters visible.
- enableColors(noReload: boolean)
- Render all text with colors.
- disableColors(noReload: boolean)
- Don't render all text with colors.
- basic()
- Disable colors, combining characters, and surrogate characters.
- restore()
- Re-enable colors, combining characters, and surrogate characters.
- night(ignoreUnloadedPattern: boolean)
- Enable night mode.
- day(reloadStyle: boolean)
- Disable night mode. Restore the original styles.
- rotate(speed: number)
- Unused 3D demo.
- hideChat()
- Hide the chat button.
- showChat()
- Show the chat button.
- disableDragging()
- Prevent the canvas from being draggable.
- enableDragging()
- Allow the canvas to be draggable.
- disableCursor()
- Disable the cursor. Cells cannot be selected and written to.
- enableCursor()
- Re-enable the cursor.
- disableScrolling()
- Prevent the user from using the scroll wheel to navigate.
- enableScrolling()
- Re-enable the scroll wheel.
- setMouseCursor(cursor: string)
- Set the default mouse cursor.
- resetMouseCursor()
- Reset the mouse cursor to the default setting.
- setDragCursor(cursor: string)
- Set the mouse cursor when dragging the canvas.
- resetDragCursor()
- Reset the mouse cursor when dragging the canvas.
- changeSocket(address: string)
- Change the client's socket address to another specified address.
- changeColor(color: string)
- Change the client's current text color.
- changeBgColor(color: string)
- Change the client's current cell background color.
- fetchUpdates(margin: number)
- Fetch new updates regardless of tiles that have been loaded.
- splitTile(str: string): string
- Split a string accounting for grapheme clusters (limited to surrogates and most combining characters).
- shiftZoombar()
- Shift the zoom bar on menu to the bottom when new options are added.
- setFlushInterval(rate: number)
- Change the interval at which writes are uploaded to the server.
- registerHook(event: string, callback: function)
- Allow specific client processes to be modified precisely. Limited to char rendering at the moment.
RegionSelection
- Constructor: RegionSelection
- Properties
- charColor: string
- color: string
- tiled: boolean
- Methods
- onselection
- coordA: Array[number, number, number, number]
- coordB: Array[number, number, number, number]
- regWidth: number
- regHeight: number
- startSelection
- stopSelectionUI
- onselection
Code example:
var selection = new RegionSelection();
this.charColor = "#00AA00";
this.color = "rgba(0, 0, 255, 0.1)";
this.tiled = false;
selection.onselection(function(coordA, coordB, regWidth, regHeight) {
console.log(coordA, coordB, regWidth, regHeight);
});
w.on("keyDown", function(e) {
if(checkKeyPress(e, "ALT+H")) {
selection.startSelection();
}
});