Author |
Topic: "RETROLIB 2" Updated:NOV 28,2016 new commands (Read 1115 times) |
|
michael
Senior Member
member is offline


Posts: 335
|
 |
"RETROLIB 2" Updated:NOV 28,2016 new commands
« Thread started on: May 23rd, 2016, 05:10am » |
|
This link Does not cover RETROLIB 6.. I will release documentation for that in time.. Some commands in this reference would be obsolete, as RETROLIB 6 is more advanced.
If you find any bugs in the use of this library pleas let me know. Thankyou.
The next expansion will have special tools for displaying help screens ... I'll keep older versions available
There is more content being created for this library. And some commands, like FNbuttonz have enhanced abilities from the library
There are no executables in the folder. Just the code files.
A texture depth filler tool is being developed but wont be included until perfected.
I have made a dedicated folder *** NOTE : I have provided some samples in the link (some are old).*** Download ALL the content in this :LINK:
https://1drv.ms/f/s!AmYwmTjbmULXkl1rRQlS0cpefXmP
******* "RETROLIB 2" ************** Expansion with changes REM This must be at the beginning of any program that uses the following tools. INSTALL "RETROLIB 2" ON ERROR END PROCgraphics(screenwidth,screenheight) ***********************************************************
"INTERFACE" DEF PROCpr(X,Y,msg$,c$) - advanced graphics text tool DEF PROCprsub(X,Y,msg$,c$) - cleanup for PROCpr DEF FNinput(bx,by,textlimit) - graphics text input tool DEF FNbuttonz(X,Y,msg$) - advanced button tool
"OBJECTS" DEF PROCrighteye(x,y,location$,speed) - location$- "center" "right" "left" "up" "down" DEF PROClefteye(x,y,location$,speed) DEF FNcolormix(x,y) - color mix tool DEF PROCresetrgb - restore default color palettes DEF PROCblast(x%,y%,chance%)
DEF PROCellipse(h,v,sizex,sizey,x,c,a,dimmer) - x,c,a is R,G,B palette DEF PROCdotsize(n) -set pixel thickness DEF PROCdotrgb(x%,y%,r%,g%,b%) DEF PROC_button(H,V,BEGIN,SIZE,X,C,A,DI) DEF PROC_block(H,V,SIZE,X,C,A,DI) DEF PROC_donut(H,V,RR,GG,BB) DEF PROC_sphere(H,V,SIZE,R,G,B,DI) DEF PROC_ellipsering(CENTERH,CENTERV,H,V,SIZE,THICKNESS,X,C,A,DI)
"GRAPHICS" NEW: DEF PROCgraphics(x,y) -graphics screen x-width-y-height DEF FNkey -returns a key when you type DEF PROCsbox(x%,y%,w%,h%,c$) DEF PROCrect(x%,y%,w%,h%) DEF PROCcolor(fb$,rgb$) DEF PROCmask(x%,y%,h%,v%,name$) - for making masks DEF PROCpixel(x%,y%,c$) DEF PROCset(x%,y%,c$) DEF PROCgo(cmd$,coun%) - sorta like turtle tool DEF FNnumstr(num) - returns a 3 digit string from a number DEF PROCpaint(x%,y%,co$)
DEF FNrgb(x%,y%)-gets TINT color value and returns a "000,000,000" style color result
NEW: DEF PROCrgbret(x%,y%,RETURN r%,RETURN g%,RETURN b%) - direct RGB RETURN from TINT (efficient)
DEF PROCgetpic(num%,xx,yy,hh,vv) DEF PROCpastepic(num%,nx,ny) DEF PROCmovepic(num,nx,ny)
***************** OBSOLETE VERSION 1 ********************** *************************************************************** REM This must be at the beginning of any program that uses the following tools. INSTALL "RETROLIB" ON ERROR END PROCgraphics ***********************************************************
UPDATE: (3D objects) added commands:(for games and creating special objects):
DEF PROCresetrgb - restore default color palettes
DEF PROCellipse(h,v,sizex,sizey,x,c,a,dimmer) - x,c,a is R,G,B palette DEF PROCpixelthickness(n) DEF PROCdotrgb(x%,y%,r%,g%,b%) DEF PROC_button(H,V,BEGIN,SIZE,X,C,A,DI) DEF PROC_block(H,V,SIZE,X,C,A,DI) DEF PROC_donut(H,V,RR,GG,BB) DEF PROC_sphere(H,V,SIZE,R,G,B,DI) DEF PROC_ellipsering(CENTERH,CENTERV,H,V,SIZE,THICKNESS,X,C,A,DI) "INTERFACE" LIBRARY: DEF PROCpr(X,Y,msg$,c$) - advanced graphics text tool DEF PROCprsub(X,Y,msg$,c$) - cleanup for PROCpr DEF FNinput(bx,by,textlimit) - graphics text input tool DEFFNbuttonz(X,Y,msg$) - advanced button tool
"OBJECTS" LIBRARY: DEF PROCrighteye(x,y,location$,speed) - location$- "center" "right" "left" "up" "down" DEF PROClefteye(x,y,location$,speed) DEF FNcolormix(x,y) - color mix tool
"mygraphics" LIBRARY: DEF PROCgraphics -generic graphics screen DEF FNkey -returns a key when you type DEF PROCsbox(x%,y%,w%,h%,c$) DEF PROCrect(x%,y%,w%,h%) DEF PROCcolor(fb$,rgb$) DEF PROCmask(x%,y%,h%,v%,name$) - for making masks DEF PROCpixel(x%,y%,c$) DEF PROCset(x%,y%,c$) DEF PROCgo(cmd$,coun%) - sorta like turtle tool DEF FNnumstr(num) - returns a 3 digit string from a number DEF PROCpaint(x%,y%,co$) DEF FNrgb(x%,y%)-gets TINT color value and returns a "000,000,000" style color result DEF PROCgetpic(num%,xx,yy,hh,vv) DEF PROCpastepic(num%,nx,ny) DEF PROCmovepic(num,nx,ny)
|
« Last Edit: Dec 25th, 2016, 5:37pm by michael » |
Logged
|
I like making program generators and like reinventing the wheel
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: "mygraphics" Library +paint tool!!!
« Reply #1 on: Nov 8th, 2016, 08:41am » |
|
Hi Michael,
Since your graphics system essentially only uses colours 0 and 1 , would it be worth using some of the other colours for different purposes? For example, you could use colour 0 for foreground line drawing, 1 for background, as you do at the moment, but then use colour 2 for fills, and maybe colour 3 as a temporary background colour for your "Paint" (=fill) routine. You could use TINT to set colour 3, select that as the background (GCOL 128+3), do your fill, and then reset the background to whatever it was before simply with GCOL 128+1.
Having separate line and fill colours (as most painting programs do) might simplify some of your other routines -for example, drawing a box might involve GCOL 2, drawing a filled rectangle, setting the line width, GCOL 0, and drawing an (unfilled) rectangle.
Some of your routines seem confused about whether they take a bottom left x,y coordinates and then a width and height, or whether they take bottom left and top right coordinates. using w,h as the parameters suggests the former, but your decision to swap them if w<x or h<y suggest the latter. For consistency with BB4W's RECTANGLE command I'd probably go with corner point plus width and height, but it's a matter of personal choice. Depending on how you code it, using width and height, and allowing negative values, in effect allows you to specify ANY corner (so if both w and h are negative, the point will effectively be the top right corner). I guess giving diagonally opposite corners will have the same effect - you could specify them either way round.
Do you really want to be setting a fixed mode and VDU 5 in your graphics initialisation? Isn't that a bit inflexible? I'd prefer a graphics library to be able to handle any size window, and I'd prefer it not to ASSUME my program is going to be in VDU 5 mode all the time. I guess the latter isn't a problem if you are going to provide text positioning routines as part of the library, and expect the user to use those.
Hope that's useful.
D
|
|
Logged
|
|
|
|
DDRM
Administrator
member is offline


Gender: 
Posts: 321
|
 |
Re: "mygraphics" Library +paint tool!!!
« Reply #2 on: Nov 8th, 2016, 08:57am » |
|
... and for the experimental RGB routine, you could think about
r=rgb% AND 255 g=rgb%>>8 AND 255 b=rgb%>>16 AND 255
Doing "AND 255" basically copies all the bottom 8 bits. The ">>" shifts the number right the specified number of bits (effectively discarding the lower ones), so >>8 moves the second eight bits (the green part of the colour number) to the bottom, and >>16 moves the blue down. This method will also avoid problems if there were transparency data in your rgb%, though TINT won't provide this.
If it were me, I'd make r,g, and b integers, though you don't need to. You could even make them byte variables (i.e. r&)
Best wishes,
D
|
|
Logged
|
|
|
|
michael
Senior Member
member is offline


Posts: 335
|
 |
Re: "mygraphics" Library +paint tool!!!
« Reply #3 on: Nov 8th, 2016, 12:12pm » |
|
Ill make the graphics screen size customizable
VDU 5 is essential for PROCpr - for plotting text on screen and FNinput The graphics text abilities will expand to include scroll bars and other text tools. I plan to make a data base manager and other cool windows like tools. ( one issue I am working on is making everything so it works virtually)
For example: You could add a text input box, but it wouldn't affect other controls. I am partly done making this happen. FNinput needs more work to make it passive.
There are many reasons why I am using a string to handle my colors. - it broadens the flexibility eg: PROCcolor("f","255,000,000") - foreground red RGB palette PROCcolor("b","red") - background red (matches the base palette 0-15 range) PROCcolor("f","1") - red again
I have made all my tools use strings for the interpreter. This would be slower, but gives a user flexibility if they are working with colors.
And I am using a delay in the paint example. I am not exactly sure how much slower the conversion is, BUT from my past experimentation, the majority of speed loss is in graphics plots and draws and not so much in variable and string manipulation.
I could make it more efficient too. This library is still being improved. Some commands will be made more efficient .. I also want to make your turtle tool compatible with this library and make it also part of the library.
I am also working on 4 more tools:
PROCslice(x,y,h,v,name$) - image dissection (its gonna be ground breaking) PROCscrollslice(h,v,name$,scalex,scaley) -image slice display tool. (this will be cool if it works well)
And body parts, like resizable eyes that take commands.
And one more tool, but I just forgot what it is.. LOL
If someone wants to help me create some tools for this library to help new age programmers and cross platform programmers be more productive in a competitive, high standards world, let me know.
When this project is perfected I will provide it to the BBC Basic community (including Richard to use as part of BBC Basic)
|
« Last Edit: Nov 8th, 2016, 2:13pm by michael » |
Logged
|
I like making program generators and like reinventing the wheel
|
|
|
|