[slang-users] Refresh problem
John E. Davis
davis at space.mit.edu
Thu Jun 29 00:16:28 EDT 2006
On Wed, 28 Jun 2006 19:57:55 +0200, leslie.polzer at gmx.net said:
>No, nothing like that. The relevant code snippet is very simple:
>
>---
> SLtt_set_color(200, NULL, "white", "cyan");
>
> SLsmg_set_color(200);
>
> SLsmg_gotorc(1, 1);
> SLsmg_write_nstring(NULL, 10);
>
> SLsmg_gotorc(1, 1);
> SLsmg_printf("%s", "some string");
>
> SLsmg_refresh();
The SLtt_set_color function is a "setup" type of function that should
not be called everytime you want to update the screen. As you know,
it is a function that associates a foreground/background color with a
color object (an integer--- 200 in this case). Note that it is part
of the lower-level SLtt interface--- not the higher-level SLsmg
interface. When you call SLtt_set_color, it informs the SLsmg
interface that color object 200 has been changed causing SLsmg to
invalidate the display. This is the effect that you are seeing.
I may change the code in SLtt_set_color to do nothing if the
specified color object already has the requested attributes. However,
I encourage you to move the call to SLtt_set_color to some sort of
initialization function that you call once. For example, in main use:
int main (...)
{
/* Setup color objects */
SLtt_set_color (200, NULL, "white", "cyan");
.
.
main_loop ();
return 0;
}
void main_loop (void)
{
while (1)
{
.
.
draw_screen ();
SLsmg_refresh ();
.
.
}
}
--John
More information about the slang-users-l
mailing list