User Tools

Site Tools


using_20the_20entire_20desktop_20area

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

using_20the_20entire_20desktop_20area [2018/03/31 13:19]
127.0.0.1 external edit
using_20the_20entire_20desktop_20area [2018/04/17 14:01] (current)
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Using the entire desktop area===== =====Using the entire desktop area=====
  
-//by Richard Russell, October 2006//\\ \\  Normally you will want your BBC BASIC program either to use the default window size (this is appropriate for simple programs outputting only textual information) or to fix the window to a specific size in pixels (this will generally make incorporating graphics much easier, and makes your program independent of display resolution). The latter can be achieved either by using the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwin6.html#​mode|MODE]] statement or the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwin8.html#​vdu23|VDU 23,22]] command.\\ \\  If, however, you want to operate 'full screen'​ then using **MODE** is not appropriate. Although there is quite likely to be a MODE with the same dimensions as your screen (for example MODE 22 is 1024x768, which is a common display resolution) this does not take account of the window borders, title bar and task bar. Selecting MODE 22 on such a screen will result in Windows reducing the size of your window to fit, with undesirable consequences (for example your text and graphics may not correctly line up, and your program will not be compatible with other display resolutions).\\ \\  If you really want to fill the entire screen, without any border, title bar or even the Windows task bar (for example as some games do) then you can use the code listed in the main documentation under [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwine.html#​fullscreen|Using the entire screen]]. In this case you will need to provide an obvious means for the user to terminate your program, because the normal facilities in the title bar or task bar will be absent.\\ \\  An alternative to filling the entire screen is simply to maximise your window. You can do that using the following code:\\ \\ +//by Richard Russell, October 2006//\\ \\  Normally you will want your BBC BASIC program either to use the default window size (this is appropriate for simple programs outputting only textual information) or to fix the window to a specific size in pixels (this will generally make incorporating graphics much easier, and makes your program independent of display resolution). The latter can be achieved either by using the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwin6.html#​mode|MODE]] statement or the [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwin8.html#​vdu23|VDU 23,22]] command.\\ \\  If, however, you want to operate 'full screen'​ then using **MODE** is not appropriate. Although there is quite likely to be a MODE with the same dimensions as your screen (for example MODE 22 is 1024x768, which is a common display resolution) this does not take account of the window borders, title bar and task bar. Selecting MODE 22 on such a screen will result in Windows reducing the size of your window to fit, with undesirable consequences (for example your text and graphics may not correctly line up, and your program will not be compatible with other display resolutions).\\ \\  If you really want to fill the entire screen, without any border, title bar or even the Windows task bar (for example as some games do) then you can use the code listed in the main documentation under [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwine.html#​fullscreen|Using the entire screen]]. In this case you will need to provide an obvious means for the user to terminate your program, because the normal facilities in the title bar or task bar will be absent.\\ \\  An alternative to filling the entire screen is simply to maximise your window. You can do that using the following code: 
 + 
 +<code bb4w>
         SW_MAXIMIZE = 3         SW_MAXIMIZE = 3
         SYS "​ShowWindow",​ @hwnd%, SW_MAXIMIZE         SYS "​ShowWindow",​ @hwnd%, SW_MAXIMIZE
         VDU 26         VDU 26
-The **VDU 26** causes BBC BASIC to reset its text and graphics viewports to the new window size. Unfortunately a maximised window isn't necessarily ideal because the borders are hidden. If you want your window to be as large as possible without losing any of the borders or title bar etc. then you can use the following code:\\ \\ +</​code>​ 
 + 
 +The **VDU 26** causes BBC BASIC to reset its text and graphics viewports to the new window size. Unfortunately a maximised window isn't necessarily ideal because the borders are hidden. If you want your window to be as large as possible without losing any of the borders or title bar etc. then you can use the following code: 
 + 
 +<code bb4w>
         PROCfitworkarea(x%,​ y%, 0)         PROCfitworkarea(x%,​ y%, 0)
         VDU 23,​22,​x%;​y%;​8,​16,​16,​128         VDU 23,​22,​x%;​y%;​8,​16,​16,​128
Line 23: Line 29:
         y% -= rc.b%-rc.t%-y%         y% -= rc.b%-rc.t%-y%
         ENDPROC         ENDPROC
 +</​code>​
 +
 Because **VDU 23,22...** assumes there isn't a menu bar (even if there is!) you should usually set the last parameter of **PROCfitworkarea** to zero, as shown. Set it to 1 only if you want to know the size of the client area //​excluding//​ the menu bar. See also [[/​Effect%20of%20menu%20bar%20on%20window%20size|Effect of menu bar on window size]].\\ \\  Whenever you run 'full screen'​ using any of the methods listed above you will need to write your program to take account of different display resolutions and shapes (unless you are content for it to work only on your own PC). You can discover the current size of your window'​s client area (to which you can output) using the system variables **"​@vdu%!208"​** (width in pixels) and **"​@vdu%!212"​** (height in pixels). Since the origin for text coordinates is the top left and the origin for graphics coordinates is the bottom left you may need to take some care in order to ensure text and graphics line up correctly whatever the display resolution. Because **VDU 23,22...** assumes there isn't a menu bar (even if there is!) you should usually set the last parameter of **PROCfitworkarea** to zero, as shown. Set it to 1 only if you want to know the size of the client area //​excluding//​ the menu bar. See also [[/​Effect%20of%20menu%20bar%20on%20window%20size|Effect of menu bar on window size]].\\ \\  Whenever you run 'full screen'​ using any of the methods listed above you will need to write your program to take account of different display resolutions and shapes (unless you are content for it to work only on your own PC). You can discover the current size of your window'​s client area (to which you can output) using the system variables **"​@vdu%!208"​** (width in pixels) and **"​@vdu%!212"​** (height in pixels). Since the origin for text coordinates is the top left and the origin for graphics coordinates is the bottom left you may need to take some care in order to ensure text and graphics line up correctly whatever the display resolution.
using_20the_20entire_20desktop_20area.txt · Last modified: 2018/04/17 14:01 by richardrussell