Hoping Dr. Hyatt still comes on this board now and then.
I can remember, ages ago when I studied the Crafty code, there was a clever way to "redraw" just one part of the screen. Crafty updates it's time, or replaces parts of its PV, without having the screen scroll vertically.
I promised I would "make a note of this" for later use, and now, I am writing a GUI-less windows executable, and it would be a very handy thing to do!
Of course, I no longer remember where it is {was something like print(4095...} and now I need it.
Can you offer any insight?
Thanks.
Easy Crafty Question for Dr. Hyatt
- LiquidNitrogen
- Posts: 19
- Joined: Sun Jun 13, 2010 1:20 am
- Real Name: Ed Trice
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Easy Crafty Question for Dr. Hyatt
Sure. Rather than using \n, you use \r instead. This moves the cursor back to the beginning of the current line, like \n, but does _not_ emit a linefeed, so that the cursor stays on the same line. Only warning is to make sure than when you do this to display a new line, that the new line is at least as long as the previous one so that extra characters are not left "hanging". Simplest solution is to watch what you print and add enough " " characters to make sure you overwrite anything from the previous print...LiquidNitrogen wrote:Hoping Dr. Hyatt still comes on this board now and then.
I can remember, ages ago when I studied the Crafty code, there was a clever way to "redraw" just one part of the screen. Crafty updates it's time, or replaces parts of its PV, without having the screen scroll vertically.
I promised I would "make a note of this" for later use, and now, I am writing a GUI-less windows executable, and it would be a very handy thing to do!
Of course, I no longer remember where it is {was something like print(4095...} and now I need it.
Can you offer any insight?
Thanks.
- LiquidNitrogen
- Posts: 19
- Joined: Sun Jun 13, 2010 1:20 am
- Real Name: Ed Trice
Re: Easy Crafty Question for Dr. Hyatt
Wow, was it really that simple?hyatt wrote: Sure. Rather than using \n, you use \r instead.
Thanks.
So I take it you just would redraw the last line on the screen then, padding with the space characters as needed?
I'll check it out.
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Easy Crafty Question for Dr. Hyatt
Correct... There are traps of course, like automatic line wrap on some devices that can get this out of sync, just avoid lines > 80 and that should not bite you at all...LiquidNitrogen wrote:Wow, was it really that simple?hyatt wrote: Sure. Rather than using \n, you use \r instead.
Thanks.
So I take it you just would redraw the last line on the screen then, padding with the space characters as needed?
I'll check it out.