palette_20animation
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| palette_20animation [2018/03/31 13:19] – external edit 127.0.0.1 | palette_20animation [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| =====Palette animation===== | =====Palette animation===== | ||
| - | //by Alex Farlie and Richard Russell, July 2012//\\ \\ On ' | + | //by Alex Farlie and Richard Russell, July 2012//\\ \\ On ' |
| + | |||
| + | <code bb4w> | ||
| DEF PROCpaletted | DEF PROCpaletted | ||
| LOCAL bits%, hbm%, oldbm%, bmih{} | LOCAL bits%, hbm%, oldbm%, bmih{} | ||
| Line 18: | Line 20: | ||
| PROCanimate | PROCanimate | ||
| ENDPROC | ENDPROC | ||
| - | **@vdu%!208** and **@vdu%!212** are system variables containing the current width and height of the output window (client area) respectively. The third parameter of the call to **CreateDIBSection** is set to zero (DIB_RGB_COLORS) because the colour table will contain RGB colour values. Note that the colour table is not directly specified as it will be created dynamically later.\\ \\ The bitmap is then selected into the device context used by //BBC Basic for Windows//, and the previous bitmap deleted. Finally **PROCanimate** is called to initialise the colour table from the contents of the palette.\\ \\ Having changed the bitmap to 4bpp the contents of the palette may be changed in the usual way, for example using the [[http:// | + | </ |
| + | |||
| + | **@vdu%!208** and **@vdu%!212** are system variables containing the current width and height of the output window (client area) respectively. The third parameter of the call to **CreateDIBSection** is set to zero (DIB_RGB_COLORS) because the colour table will contain RGB colour values. Note that the colour table is not directly specified as it will be created dynamically later.\\ \\ The bitmap is then selected into the device context used by //BBC Basic for Windows//, and the previous bitmap deleted. Finally **PROCanimate** is called to initialise the colour table from the contents of the palette.\\ \\ Having changed the bitmap to 4bpp the contents of the palette may be changed in the usual way, for example using the [[http:// | ||
| + | |||
| + | <code bb4w> | ||
| DEF PROCanimate | DEF PROCanimate | ||
| LOCAL C%, pal%() | LOCAL C%, pal%() | ||
| Line 28: | Line 34: | ||
| SYS " | SYS " | ||
| ENDPROC | ENDPROC | ||
| - | Having set up the two routines to emulate palette animation, the following code demonstrates how to achieve an effect similar to the flashing colours on the BBC micro.\\ \\ First a screen mode is selected, and the palletised version of it created:\\ | + | </ |
| + | |||
| + | Having set up the two routines to emulate palette animation, the following code demonstrates how to achieve an effect similar to the flashing colours on the BBC micro.\\ \\ First a screen mode is selected, and the palletised version of it created: | ||
| + | |||
| + | <code bb4w> | ||
| MODE 8 | MODE 8 | ||
| PROCpaletted | PROCpaletted | ||
| - | Now some text and graphics, including the ' | + | </ |
| + | |||
| + | Now some text and graphics, including the ' | ||
| + | |||
| + | <code bb4w> | ||
| COLOUR 11 | COLOUR 11 | ||
| COLOUR 128+12 | COLOUR 128+12 | ||
| Line 49: | Line 63: | ||
| MOVE 968,180 | MOVE 968,180 | ||
| PRINT STRING$(41, CHR$127) " This has a flashing graphics background " | PRINT STRING$(41, CHR$127) " This has a flashing graphics background " | ||
| - | The code now enters a loop to animate the ' | + | </ |
| + | |||
| + | The code now enters a loop to animate the ' | ||
| + | |||
| + | <code bb4w> | ||
| REPEAT | REPEAT | ||
| FOR C% = 8 TO 15 | FOR C% = 8 TO 15 | ||
| Line 63: | Line 81: | ||
| UNTIL FALSE | UNTIL FALSE | ||
| END | END | ||
| - | Logical colours 8 to 15 are first defined as physical colours 0 to 7 respectively, | + | </ |
| + | |||
| + | Logical colours 8 to 15 are first defined as physical colours 0 to 7 respectively, | ||
| + | |||
| + | <code bb4w> | ||
| MODE 8 | MODE 8 | ||
| PROCpaletted | PROCpaletted | ||
| Line 125: | Line 147: | ||
| PROCanimate | PROCanimate | ||
| ENDPROC | ENDPROC | ||
| + | </ | ||
palette_20animation.1522502372.txt.gz · Last modified: 2024/01/05 00:17 (external edit)