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
a5cbe08b
Commit
a5cbe08b
authored
19 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Handy object to draw a graphic or portions thereof to different screen
positions.
parent
2ca6e56d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/graphic.js
+77
-0
77 additions, 0 deletions
exec/load/graphic.js
with
77 additions
and
0 deletions
exec/load/graphic.js
0 → 100644
+
77
−
0
View file @
a5cbe08b
// $Id$
/*
* "Graphic" object
* Allows a graphic to be stored in memory and portions of it redrawn on command
*/
function
Graphic
(
width
,
height
,
attribute
,
char
)
{
if
(
char
==
undefined
)
this
.
char
=
'
'
;
else
this
.
char
=
char
;
if
(
attribute
==
undefined
)
this
.
attribute
=
7
;
else
this
.
attribute
=
attribute
;
if
(
height
==
undefined
)
this
.
height
=
24
;
else
this
.
height
=
height
;
if
(
width
==
undefined
)
this
.
width
=
80
;
else
this
.
width
=
width
;
this
.
data
=
new
Array
(
width
,
height
);
var
x
;
var
y
;
for
(
y
=
0
;
y
<
this
.
height
;
y
++
)
{
for
(
x
=
0
;
x
<
this
.
width
;
x
++
)
{
this
.
data
[
x
][
y
]
=
new
Object
;
this
.
data
[
x
][
y
].
char
=
char
;
this
.
data
[
x
][
y
].
attr
=
attribute
;
}
}
this
.
draw
=
Graphic_draw
;
}
function
Graphic_draw
(
xpos
,
ypos
,
width
,
height
,
xoff
,
yoff
)
{
var
x
;
var
y
;
if
(
xpos
==
undefined
)
xpos
=
1
;
if
(
ypos
==
undefined
)
ypos
=
1
;
if
(
width
==
undefined
)
width
=
this
.
width
;
if
(
height
==
undefined
)
height
=
this
.
height
;
if
(
xoff
==
undefined
)
xoff
=
0
;
if
(
yoff
==
undefined
)
yoff
=
0
;
if
(
xoff
+
width
>
this
.
width
||
yoff
+
height
>
this
.
height
)
{
alert
(
"
Attempt to draw from outside of graphic
"
);
return
(
false
)
}
if
(
xpos
+
width
>
console
.
screen_columns
||
ypos
+
height
>
console
.
screen_rows
)
{
alert
(
"
Attempt to draw outside of screen
"
);
return
(
false
);
}
for
(
y
=
0
;
y
<
height
;
y
++
)
{
gotoxy
(
xpos
,
ypos
+
y
);
for
(
x
=
0
;
x
<
width
;
x
++
)
{
// Do not draw to the bottom left corner of the screen-would scroll
if
(
xpos
+
x
!=
console
.
screen_columns
||
ypos
+
y
!=
console
.
screen_rows
)
{
console
.
attributes
=
this
.
data
[
x
+
xoff
][
y
+
yoff
].
attr
;
console
.
write
(
this
.
data
[
x
+
xoff
][
y
+
yoff
].
char
;
}
}
}
return
(
true
);
}
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