BBC BASIC
« Minimalist palette graphics management »

Welcome Guest. Please Login or Register.
Jan 20th, 2018, 6:03pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Minimalist palette graphics management  (Read 182 times)
michael
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 141
xx Minimalist palette graphics management
« Thread started on: Jan 9th, 2017, 03:34am »

I picked what I considered the most useful tools for minimalist palette programming. As it is my favourite thing.

Try the tools.
Code:
      PROCgraphics(1000,600)
      x%=0:y%=0:www%=0:hhh%=0:rrr%=20:ggg%=20:bbb%=20
      PROCbrgb(0,0,0):CLS:REM background color of black
      PROCfrgb(255,200,100):REM foreground custom color
      CIRCLE FILL 500,500,100
      REM put your program here
      hhh%=30
      FOR www%= 1 TO 215 STEP 1
  
        PROCexperiment(500,500+www%,www%,hhh%,rrr%,ggg%,bbb%)
  
      NEXT www%
      END

      REM minimalist graphics management. Designed for speed and palette use only
      DEF PROCgraphics(x,y)
      VDU 23,22,x;y;8,15,16,1
      OFF
      VDU 5
      ENDPROC
      DEF PROCfrgb(r%,g%,b%)
      COLOUR 0,r%,g%,b% : GCOL 0
      ENDPROC
      DEF PROCbrgb(br%,bg%,bb%)
      COLOUR 1,br%,bg%,bb% : GCOL 128+1
      ENDPROC
      DEF PROC
      DEFPROCresetrgb
      COLOUR 0,0,0,0 :COLOUR 1,200,0,0 :COLOUR 2,000,200,000
      COLOUR 3,200,200,000:COLOUR 4,000,000,200:COLOUR 5,200,000,200
      COLOUR 6,000,200,200:COLOUR 7,200,200,200:COLOUR 8,056,056,056
      COLOUR 9,248,056,056:COLOUR 10,056,248,056:COLOUR 11,248,248,056
      COLOUR 12,056,056,248:COLOUR 13,248,056,248:COLOUR 14,056,248,248
      COLOUR 15,248,248,248
      ENDPROC
      REM name x,y width height
      DEF PROCsavebmp(name$,x%,y%,h%,v%)
      OSCLI "SCREENSAVE """+name$+""" "+STR$(x%)+","+STR$(y%)+","+STR$(h%)+","+STR$(v%)
      ENDPROC
      REM name x,y width height
      DEF PROCloadbmp(name$,x%,y%,h%,v%)
      OSCLI "DISPLAY """+name$+""" "+STR$(x%)+","+STR$(y%)+","+STR$(h%)+","+STR$(v%)
      ENDPROC
      REM for getting the palette color from a location on the screen
      DEF PROCrgbret(x%,y%,RETURN r%,RETURN g%,RETURN b%)
      LOCAL rgb%
      rgb%=TINT(x%,y%)
      r%=rgb% AND &FF
      g%=rgb%>>8 AND &FF
      b%=rgb%>>16 AND &FF
      ENDPROC
      DEFPROCexperiment(lx%,ly%,ww%,hh%,rr%,gg%,bb%)
      PROCfrgb(rr%+ww%,gg%+ww%,bb%+ww%)
      ELLIPSE lx%,ly%,ww%,hh%
      ELLIPSE lx%,500-ww%,ww%,hh%
      ENDPROC
 
« Last Edit: Jan 9th, 2017, 04:11am by michael » User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls