1. New thread on ver4 topic
- Posted by dcole Sep 25, 2010
- 1165 views
I want to thank everybody for your help/support.
Many have suggested that I upload the program for test.
Problem is that it is a very long program with references to files in different drives on my computer.
So I've created this test program.
include image.e include get.e integer i i=0 cursor(NO_CURSOR) while 1 do --setup page 0--------- clear_screen() text_color(GREEN) bk_color(WHITE) puts(1, "\nThis is page 0\n") text_color(BRIGHT_WHITE) bk_color(BLACK) puts(1,"Hit any key\n") -- set up screen 1 in the background, we can't see it because we are looking at page0 set_active_page(1) clear_screen() text_color(WHITE) bk_color(GREEN) puts(1, "\nThis is page 1\n") text_color(BRIGHT_WHITE) bk_color(BLACK) puts(1,"Hit any key\n") i=wait_key() set_display_page(1) -- now page 1 is visable i=wait_key() set_display_page(0) -- back to page 0 set_active_page(0) end while <\eucode> I would like to run this in Ver 4, Don Cole
2. Re: New thread on ver4 topic
- Posted by mattlewis (admin) Sep 25, 2010
- 1196 views
I want to thank everybody for your help/support.
Many have suggested that I upload the program for test.
Problem is that it is a very long program with references to files in different drives on my computer.
So I've created this test program.
Here's one way to do it. I'm not aware of a way to draw on a screen that's not displayed, though on my machine, I don't even notice a flicker when it starts up. I ran this on Linux, but everything here should be cross platform.
include std/graphics.e cursor(NO_CURSOR) sequence screen = {0, 0} -- set up the screens clear_screen() text_color(GREEN) bk_color(WHITE) puts(1, "\nThis is page 0\n") text_color(BRIGHT_WHITE) bk_color(BLACK) puts(1,"Hit any key\n") screen[1] = save_text_image( {1,1}, {80, 25}) clear_screen() text_color(WHITE) bk_color(GREEN) puts(1, "\nThis is page 1\n") text_color(BRIGHT_WHITE) bk_color(BLACK) puts(1,"Hit any key\n") screen[2] = save_text_image( {1,1}, {80, 25}) integer active_screen = 1 while 1 do clear_screen() display_text_image( {1,1}, screen[active_screen] ) wait_key() active_screen = 3 - active_screen end while
Matt
3. Re: New thread on ver4 topic
- Posted by dcole Sep 25, 2010
- 1117 views
Thanks Matt,
That works on 4.
I can get rid of the flickering by changing the order of things,
include std/graphics.e -- ?9/0 cursor(NO_CURSOR) sequence screen = {0, 0} -- set up the screen 1------------- clear_screen() text_color(GREEN) bk_color(WHITE) puts(1, "\nThis is page 0\n") text_color(BRIGHT_WHITE) bk_color(BLACK) puts(1,"Hit any key\n") screen[1] = save_text_image( {1,1}, {80, 25}) wait_key() --set up screen 2------------------ cursor(NO_CURSOR) clear_screen() text_color(WHITE) bk_color(GREEN) puts(1, "\nThis is page 1\n") text_color(BRIGHT_WHITE) bk_color(BLACK) puts(1,"Hit any key\n") screen[2] = save_text_image( {1,1}, {80, 25}) wait_key() ---------------------------------------------- integer active_screen = 1 while 1 do clear_screen() cursor(NO_CURSOR) display_text_image( {1,1}, screen[active_screen] ) wait_key() active_screen = 3 - active_screen end while
Don Cole