Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
d0230054
Commit
d0230054
authored
12 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Minor bugfixes.
Some updates to comments and example code.
parent
644e9d12
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/ansiedit.js
+41
-33
41 additions, 33 deletions
exec/load/ansiedit.js
with
41 additions
and
33 deletions
exec/load/ansiedit.js
+
41
−
33
View file @
d0230054
...
@@ -6,23 +6,28 @@
...
@@ -6,23 +6,28 @@
ansiEdit(x, y, width, height, attributes, frame, scrolling)
ansiEdit(x, y, width, height, attributes, frame, scrolling)
- 'x' and 'y' are coordinates for the top left corner of the editor
'x' and 'y' are coordinates for the top left corner of the editor
- 'width' and 'height' are the dimensions of the editor in characters
'width' and 'height' are the dimensions of the editor in characters
(Things will start breaking if you set these values too low)
(Things will start breaking if you set these values too low)
- 'attributes' are the default fg/bg colours (see sbbsdefs.js)
- 'frame' is a parent Frame object (see frame.js) to put this ANSI
'attributes' are the default fg/bg colours (see sbbsdefs.js)
editor in, if any. (Optional)
- 'scrolling' is true or false, whether to allow the length of the
'frame' is a parent Frame object (see frame.js) to put this ANSI
ANSI to exceed the fixed height of the ANSI editor
editor in, if any. (Optional, false may be passed as a placeholder.)
'scrolling' is true or false, whether to allow the length of the
ANSI to exceed the fixed height of the ANSI editor. (Optional,
defaults to false.)
Methods:
Methods:
ansiEdit.getcmd(str)
ansiEdit.getcmd(str)
-
Acts upon 'str' (eg. a return value from console.inkey()) to draw
Acts upon 'str' (eg. a return value from console.inkey()) to draw
a character, move the cursor, or bring up the pop-up menu.
a character, move the cursor, or bring up the pop-up menu.
-
Returns an object with the following properties:
Returns an object with the following properties:
x : x coordinate of the character drawn
x : x coordinate of the character drawn
y : y coordinate of the character drawn
y : y coordinate of the character drawn
...
@@ -31,29 +36,29 @@
...
@@ -31,29 +36,29 @@
ansiEdit.putChar(charObject)
ansiEdit.putChar(charObject)
-
Draws charObject on the canvas, where charObject is an object
Draws charObject on the canvas, where charObject is an object
with properties x, y, ch, and attr, meaning where to draw it, what
with properties x, y, ch, and attr, meaning where to draw it, what
to draw, and what colour to draw it in. (See sbbsdefs.js for
to draw, and what colour to draw it in. (See sbbsdefs.js for
more on colour attributes.)
more on colour attributes.)
ansiEdit.cycle()
ansiEdit.cycle()
-
Update the ANSI editor's canvas (ansiEdit.getcmd(str) does this
Update the ANSI editor's canvas (ansiEdit.getcmd(str) does this
automatically, but you will need to call this after calls to
automatically, but you will need to call this after calls to
ansiEdit.putChar().)
ansiEdit.putChar().)
ansiEdit.open()
ansiEdit.open()
-
Only needed if you've used ansiEdit.close() already. New ANSI editor
Only needed if you've used ansiEdit.close() already. New ANSI editor
objects open automagically.
objects open automagically.
ansiEdit.close()
ansiEdit.close()
-
Close the ANSI editor and remove it from the screen.
Close the ANSI editor and remove it from the screen.
ansiEdit.showUI(boolean)
ansiEdit.showUI(boolean)
-
Show or hide the cursor and character set (must ansiEdit.cycle() or
Show or hide the cursor and character set (must ansiEdit.cycle() or
cycle the parent frame for change to appear on screen.)
cycle the parent frame for change to appear on screen.)
Example:
Example:
...
@@ -74,9 +79,8 @@
...
@@ -74,9 +79,8 @@
b = console.inkey(K_NONE, 5);
b = console.inkey(K_NONE, 5);
if(b == "") continue;
if(b == "") continue;
c = a.getcmd(b);
c = a.getcmd(b);
a.cycle();
if(!c.ch) continue; // No character was drawn
if(!c.ch) continue; // No character was drawn
console.gotoxy(1, 2
3
);
console.gotoxy(1, 2
4
);
console.putmsg("\1h\1w" + c.toSource());
console.putmsg("\1h\1w" + c.toSource());
}
}
*/
*/
...
@@ -87,7 +91,11 @@ load("tree.js");
...
@@ -87,7 +91,11 @@ load("tree.js");
function
ansiEdit
(
x
,
y
,
width
,
height
,
attr
,
frame
,
scrolling
)
{
function
ansiEdit
(
x
,
y
,
width
,
height
,
attr
,
frame
,
scrolling
)
{
if
(
scrolling
==
undefined
)
var
scrolling
=
false
;
if
(
!
frame
||
frame
===
undefined
)
var
frame
=
new
Frame
(
x
,
y
,
width
,
height
,
attr
);
if
(
scrolling
===
undefined
)
var
scrolling
=
false
;
var
str
=
""
;
var
str
=
""
;
var
esc
=
ascii
(
27
);
var
esc
=
ascii
(
27
);
...
@@ -289,7 +297,7 @@ function ansiEdit(x, y, width, height, attr, frame, scrolling) {
...
@@ -289,7 +297,7 @@ function ansiEdit(x, y, width, height, attr, frame, scrolling) {
cursor
.
putmsg
(
ascii
(
219
));
cursor
.
putmsg
(
ascii
(
219
));
charSet
.
update
(
characterSet
);
charSet
.
update
(
characterSet
);
aF
rame
.
open
();
f
rame
.
open
();
tree
.
open
();
tree
.
open
();
aFrame
.
cycle
();
aFrame
.
cycle
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment