paintutils or is it a special thing done at another level? (java) I know the function is in Java, but I need to know how it actually work, or even better, where can I have a look into it. Thanks for reading
How does term. clear() actually work?
Started by bjornir90, Apr 23 2014 04:35 PM
5 replies to this topic
#1
Posted 23 April 2014 - 04:35 PM
I mean, does it redraw all the screen with something like
paintutils or is it a special thing done at another level? (java) I know the function is in Java, but I need to know how it actually work, or even better, where can I have a look into it. Thanks for reading
paintutils or is it a special thing done at another level? (java) I know the function is in Java, but I need to know how it actually work, or even better, where can I have a look into it. Thanks for reading
#2
Posted 23 April 2014 - 04:41 PM
I'd have to look into it further to be sure, but I suspect it sends a packet from the server to any clients viewing the computer that instructs them to clear the screen, or sends a packet containing the new (cleared) contents of the screen. The native method is executed Java-side, so it would be hard to tell exactly without packet analysis, looking at the source, or an answer from dan himself.
If you need to write a similar version for a redirect buffer or similar, write one full line of spaces for every row of the screen.
If you need to write a similar version for a redirect buffer or similar, write one full line of spaces for every row of the screen.
#3
Posted 23 April 2014 - 08:31 PM
Thanks you Lyqyd
I want to know so I know if my buffer is useful even when using term. clear(), because repainting all the screen is very flickery ^^ so I guess it do it another way
#4
Posted 23 April 2014 - 10:27 PM
I'm of the impression that it manually fills the screen with blank lines. I say this because the end result is a screen covered in whatever the current text background colour is set to. It's my guess.
Generally, if you're getting a flickering effect with your screen clearing, then that either means you shouldn't be clearing the whole screen at once (maybe try clearing individual lines at a time?), or you're taking too long with the refresh process (make sure any lengthy calculations that are involved are performed before the wipe and redraw, not in-between).
Generally, if you're getting a flickering effect with your screen clearing, then that either means you shouldn't be clearing the whole screen at once (maybe try clearing individual lines at a time?), or you're taking too long with the refresh process (make sure any lengthy calculations that are involved are performed before the wipe and redraw, not in-between).
#5
Posted 24 April 2014 - 01:01 AM
Bomb Bloke, on 23 April 2014 - 10:27 PM, said:
I'm of the impression that it manually fills the screen with blank lines. I say this because the end result is a screen covered in whatever the current text background colour is set to. It's my guess.
public void clear() {
for (int y = 0; y < this.m_height; y++) {
if (!this.m_lines[y].equals(this.m_emptyLine)) {
this.m_lines[y] = this.m_emptyLine;
this.m_changed = true;
}
if (!this.m_colourLines[y].equals(this.m_emptyColourLine)) {
this.m_colourLines[y] = this.m_emptyColourLine;
this.m_changed = true;
}
}
}
Edited by theoriginalbit, 24 April 2014 - 01:02 AM.
#6
Posted 24 April 2014 - 08:18 AM
Ok, that is all I wanted to know, thanks you all!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











