MMBasic for Windows - alphas
| Author | Message | ||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11033 |
MMBasic for Windows V5.07.03a0 MMBasic.zip The MMBasic for Windows code is now officially past the pre-alpha phase and enters alpha. i.e. most of the functionality is now there and there are not too many reports of issues but there is still work to do. The big change in V5.07.03a0 is support for proper transparency as per the CMM2 The mode command is changed as follows to follow the CMM2 as closely as possible: MODE modeno [,alphaenabled] [,background colour] By default alphaenabled is 0 and the background colour is BLACK To use the second layer set alphaenabled to 1 and optionally choose a background colour Unlike the CMM2 MMbasic for windows uses full ARGB8888 colour in all modes and has a transparency value (A) of 0-255 When you change the mode to alpha by default you are still writing to page 0 and it is cleared to RGB(BLACK)which is opaque. If you want to see the background colour pixels on page 0 must be written with a transparency of less than 255. Use CLS RGB(BLANK) to clear a page to completely transparent. If you set to write to page 1 this will overlay page 0 and the background to the extent that the alpha value of the pixels on PAGE 1 are set (between 0=transparent and 255=opaque). Note when playing with this at the command line you can get very confused so it is easier to understand what is happening with a very simple program. mode 14,1,rgb(magenta) 'set into 2 layer mode with the background set to magenta font 3 print "Click to get focus" mouseclick print "now we will clear page 0 to blank" print "click to continue" mouseclick cls rgb(blank) colour rgb(black),rgb(blank) print "This text is written on page 0 with transparent backgound" print "click to continue" mouseclick print "Now we will write to the top page" print "click to continue" mouseclick page write 1 cls rgb(blank) sprite loadpng 1,"apple" sprite write 1,50,10,1 sprite transparency 1,128 'change the transparency of the sprite sprite write 1,200,10,1 page write 0 print @(0,mm.info(fontheight)*4)"You can see the page 0 text through the right hand apple" print "Click to exit and remember to click again to get focus" mouseclick sprite close all mode 14 colour rgb(white),rgb(black) end sub mouseclick do loop until mouse(l) do loop until not mouse(l) end sub apple.zip Finally a note on the RGB function. RGB(COLOURNAME) will return a fully opaque representation of that colour RGB(red, green, blue) will return a fully opaque representation of that colour use RGB(red, green, blue, trans) to set a partially transparent colour If you must, you can use numerical values directly as colours e.g CLS &H80607080 This will set the transparency to &H80, the blue level to &H60, the green level to &H70 and the red level to &H80. Note that red and blue are reversed compared to the CMM2 if a direct numerical value is used in this way i.e ABRG8888 ![]() |
||||