screen banks
Chris Hall (132) 3554 posts |
I have written a little programme to display two pages of a manual side by side and to ‘turn the page’ as an animated graphic. I thus need to wite to one screen bank whilst displaying the other. There is still a little flicker and if I press f12 then return whilst it is turning a page, the second screen bank disappears. Once the graphic is finished, I revert to one screen bank. What is the right protocol for dealing with a mode change in a multi-tasking BASIC prgramme? So far I have added the commands:
|
Stuart Swales (8827) 1357 posts |
When the control returns to the Wimp from the F12 CLI, anything could have happened on screen, so the Wimp just changes MODE. I’d be tempted to look for a F12 keypress event, stop your animation, then pass it on. Best check in 7450 : SYS “OS_ChangeDynamicArea”,2,scnorm% that you have actually changed that D.A. by enough to have the second bank of screen memory. You could reduce tearing by using OS_Byte 19 to wait for VSync to change the hardware bank (though on many systems these days I believe it is faked) |
GavinWraith (26) 1563 posts |
As part of the documentation for the ZapRedraw module (v0.41) there is BASIC example, R-Example, which deals with mode changes. I am not sure if this is any help. I do not know whether it is relevant to your case, but another tack is to use the Drawfile module which I guess automatically copes with mode changes. There is an example, !Codex, in the RiscLua distribution, that uses the toolbox and displays pages taken from a list of drawfiles. Clicking Select or Adjust on the iconbar icon moves you forward or backward through the list. |
Chris Hall (132) 3554 posts |
I do use DrawFile_Render as part of the redraw code, see example below:
|
GavinWraith (26) 1563 posts |
Your program is evidently doing a lot more than mine, with zooming and rotating. I have just tried changing mode with !Codex displaying a page and everything goes fine, so I guess that DrawFile_Render really does take care of mode changes automatically. This is !Codex’s only bit of code using the Drawfile module.
|
Andrew Conroy (370) 740 posts |
You can detect a mode change (including caused by a press of F12) by looking out for Wimp message &400c1 |
Kuemmel (439) 384 posts |
I don’t know if that’s relevant for the flicker on desktop, as I’m only familiar with non desktop coding: Jeffrey told and showed me (and it’s implemented in some of my demo related code and his) to use tripple buffering. As far as I remember especially on the RPI’s it’s needed. |
Chris Hall (132) 3554 posts |
Many thanks for the help. The application !RingBound is now available from !Store. |