BBC BASIC for Windows
Programming >> Graphics and Games >> BMPTOCODE example : NOTICE BOX (error msg)
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1460936711

BMPTOCODE example : NOTICE BOX (error msg)
Post by michael on Apr 17th, 2016, 11:45pm

The exclamation art is made with BMPTOCODE ( The BBC Basic version of BMPTOCODE is being worked on)

Now that I think about it I could modify this so it changes color with mouse presence!!

There is so much potential for this kind of art within code!!

Also the image was made with windows paint and the image is ( 256 BMP image that uses all colors on main palette except bottom right 2)

****I could probably make an executable and put it in DropBox and export it without conversion and make it generate BBC Basic code..**


(BMPTOCODE was a hard project and took me a long time to get to where it is with compression... and there is no way to compress it further, as I have tried)


BUT BMPTOCODE in its original form is flawed. ( a person who knows how to deal with the data can fix any cut offs with a colored block bellow the generated image)

It hasn't yet cut off the image itself... ( but time will tell)

MAKE SURE IN BBC BASIC OPTIONS TO DISABLE Lower Case Keywords ( OR you will have keyword errors ) (reboot BBC if you need to change that)

This took some trial and error. Now I need to make the width affected by text length and add a button..
I am working on a customizable button DEF PROC
This has some BMPTOCODE generated variables and is needing modifications. ( its just a showcase that will be replaced later)
Code:
      REM !!!  MAKE SURE IN BBC BASIC OPTIONS TO DISABLE  Lower Case Keywords  ( OR you will have keyword errors )
      REM SET GRAPHICS MODE TO 8 USING VDU
      VDU 22,8
      REM SET LINE THICKNESS TO 1
      VDU 23,23,1|
      REM Turn off the text cursor _
      OFF
      VDU 5 : REM Treat text as graphics (transparent background)
      PROC_color("b",0,0,0):CLG
      PROC_notice(100,500,"Syntax Error")
      WAIT 0
      END
      DEF PROC_notice(h,v,noticestring$)
      LOCAL ln%
      ln%=LEN(noticestring$)
      ln%=ln%*16.2
      PROC_color("f",255,255,255)
      REM boxfill(h,v,height,stringlength)
      RECTANGLE FILL h-20,v-180,500,290
      PROC_color("f",200,200,200):RECTANGLE FILL h-20,v-180,500,50
      PROC_color("f",150,150,150):RECTANGLE h-15,v-174,492,280
      MOVE h+60,v-10:PROC_color("f",0,0,0):PRINT noticestring$
      ost$="":r=0:g=0:b=0:a=0:c=0:t=0
      READ x,y
      REPEAT
        READ nst$,t
        IF nst$="0" THEN r=255:g=255:b=255  :REM 'black (set to white)             0   0   0
        IF nst$="1" THEN r=192:g=128:b=64  :REM' brown      192 128  64
        IF nst$="2" THEN r=64:g=64:b=192 :REM 'dark blue     64  64 192
        IF nst$="3" THEN r=128:g=128:b=128:REM' dark grey 128 128 128
        IF nst$="4" THEN r=128:g=0:b=0:REM 'dark red       128   0   0
        IF nst$="5" THEN r=224:g=192:b=0 :REM 'dark yellow  224   192   0
        IF nst$="6" THEN r=128:g=160:b=192:REM 'flat blue  128 160 192
        IF nst$="7" THEN r=32:g=192:b=64 : REM 'green        32 192  64
        IF nst$="8" THEN r=166:g=202:b=240: REM'light blue 166 202 240
        IF nst$="9" THEN r=192:g=192:b=192:REM 'light gray 192 192 192
        IF nst$="a" THEN r=192:g=224:b=0 :REM  'light green  192 224   0
        IF nst$="b" THEN r=224:g=32:b=64:REM 'light red    224  32  64
        IF nst$="c" THEN r=0:g=160:b=192:REM  'medblue        0 160 192
        IF nst$="d" THEN r=224:g=128:b=64 :REM 'orange       224 128 64
        IF nst$="e" THEN r=224:g=160:b=192:REM 'pink       224 160 192
        IF nst$="f" THEN r=160:g=64:b=192:REM 'purple      160 64 192
        IF nst$="g" THEN r=192:g=220:b=192:REM 'tan        192 220 192
        IF nst$="h" THEN r=255:g=255:b=255:REM 'white      255 255 255
        IF nst$="i" THEN r=255:g=255:b=0:REM 'yellow       255 255 0
        PROC_color("f",r,g,b)
        FOR u=0 TO t
          a=a+1: MOVE h+c,v-a:DRAW h+c,v-a:IF a>x  THEN c=c+1:a=0
        NEXT u
      UNTIL nst$="100000"
      MOVE h-20,v+110:PROC_color("f",0,0,0):PRINT "- Notice -"
      ENDPROC
      DATA 51,51
      DATA 0,303,4,2,0,45,4,6,0,42,4,8,0,39,4,11,0,37,4,13,0,34,4,16,0,32,4,12,b,0,4,4,0,29,4,13,5,1,b,0,4
      DATA 4,0,27,4,12,5,4,b,0,4,4,0,24,4,13,5,6,b,0,4,4,0,21,4,13,5,9,b,0,4,4,0,19,4,13,5,11,b,0,4,4
      DATA 0,16,4,13,5,14,b,0,4,4,0,14,4,13,5,16,b,0,4,4,0,11,4,13,5,19,b,0,4,4,0,9,4,12,5,22,b,0,4,4,0
      DATA 6,4,13,5,18,4,2,5,2,b,0,4,4,0,4,4,12,5,20,4,4,5,1,b,0,4,4,0,3,4,11,5,4,4,15,5,1,4,4,5,1
      DATA b,0,4,4,0,3,4,8,5,6,4,17,5,0,4,4,5,1,b,0,4,4,0,3,4,6,5,8,4,17,5,0,4,4,5,1,b,0,4,4,0
      DATA 3,4,6,b,1,5,6,4,17,5,0,4,4,5,1,b,0,4,4,0,3,4,8,b,2,5,4,4,15,5,1,4,4,5,1,b,0,4,4,0,3
      DATA 4,11,b,1,5,20,4,4,5,1,b,0,4,4,0,3,4,13,b,2,5,18,4,2,5,2,b,0,4,4,0,6,4,13,b,1,5,22,b,0,4
      DATA 4,0,9,4,12,b,2,5,19,b,0,4,4,0,11,4,13,b,1,5,17,b,0,4,4,0,14,4,12,b,1,5,15,b,0,4,4,0,16,4,13
      DATA b,1,5,12,b,0,4,4,0,19,4,12,b,1,5,10,b,0,4,4,0,21,4,13,b,1,5,7,b,0,4,4,0,24,4,13,b,0,5,5,b
      DATA 0,4,4,0,26,4,13,b,1,5,2,b,0,4,4,0,29,4,13,b,0,5,0,b,0,4,4,0,31,4,13,b,0,4,4,0,34,4,16,0,37
      DATA 4,13,0,39,4,11,0,42,4,8,0,44,4,6,0,47,4,2,100000,0
      REM this is the foreground and background tool.
      DEF PROC_color(fb$,r,g,b)
      IF fb$="f" OR fb$="F" THEN COLOUR 0,r,g,b : GCOL 0
      IF fb$="b" OR fb$="B" THEN COLOUR 1,r,g,b : GCOL 128+1
      ENDPROC
 

Re: Looks like you have an error!! NOTICE BOX
Post by michael on Apr 19th, 2016, 9:57pm

notice project... This post will be reposted over when improvements are made to the button feature and size effect.
The exclamation point was made using a BBC BASIC modified version of my BMPTOCODE
Re: BMPTOCODE example : NOTICE BOX (error msg)
Post by michael on Apr 21st, 2016, 10:43pm

Compression at its limit for a bmp image.
This is the template and example for BMPTOCODE along with the Notice Box construct.