Liberty BASIC Community Forum
« 3D Borders (very tough to figure out) »

Welcome Guest. Please Login or Register.
Sep 21st, 2017, 11:02am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: 3D Borders (very tough to figure out)  (Read 193 times)
michael
Team Liberty BASIC


member is offline

Avatar




PM


Posts: 111
xx 3D Borders (very tough to figure out)
« Thread started on: Feb 21st, 2016, 9:38pm »

This was incredibly hard to figure out.
Getting the shading to work without stupid color glitches was a pain.
There are limitations to a border such as this.
I tried to eliminate the complexity. Dimmer can not be less than 2
Dimmer can effect the appearance of the thickness
If your dimmer is too high it will make it colorless (grey- black) BUT that depends on your R G B color

(higher RGB colors means you need a higher dimmer to balance the appearance with other colors)

USE RGB COLOR MIXER TOOL to assist you in making the perfect border.

http://libertybasic.conforums.com/index.cgi?board=open&action=display&num=1429770071

Code:
call screen ' I made this for a generic screen call

'********H***V***Size***NSEW***R***G***B*dimmer
call corner 401,500,220,"west",250,250,250,10
call corner 399,500,220,"east",200,100,100,6
call corner 400,499,220,"south",100,200,200,8
call corner 400,501,220,"north",100,150,200,6
'****************************next example
call corner 401,500,50,"west",250,250,250,10
call corner 399,500,50,"east",200,100,100,6
call corner 400,499,50,"south",100,200,200,8
call corner 400,501,50,"north",100,150,200,6
wait
[quit]
 #1 "discard"
 close #1
 end
'initialize generic screen
sub screen
   nomainwin
   open "Another way of doing graphics !!" for graphics_nsb_fs as #1
   print #1, "Down trapclose [quit]"

    print #1, "fill black ; home ; down ; north"
end sub
' generic circle   syntax -  circle horizontal, vertical, size, color$

sub corner h,v,size,NESW$,x,c,a,dimmer ' dimmer cannot be more than 24
if dimmer<2 then dimmer =2
size2=size-20
p=size/2
double= dimmer+dimmer+dimmer
rev=size
mid=size-size2
mid2=mid/2
middle=size-mid2
cd=mid/dimmer
for reduce=1 to mid
a=a-dimmer
c=c-dimmer
x=x-dimmer
if a<2 then a=2
if c<2 then c=2
if x<2 then x=2
next reduce
for y=middle to size
rev=rev-1
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
if NESW$="north" then print #1, "line ";h-rev;" ";v-rev;" ";h+rev;" ";v-rev
if NESW$="east" then print #1, "line ";h+rev;" ";v-rev;" ";h+rev;" ";v+rev
if NESW$="south" then print #1, "line ";h+rev;" ";v+rev;" ";h-rev;" ";v+rev
if NESW$="west" then print #1, "line ";h-rev;" ";v+rev;" ";h-rev;" ";v-rev
x=x+dimmer
c=c+dimmer
a=a+dimmer
if x>255 then x=255
if c>255 then c=255
if r>255 then r=255
p=p-1
next y
for y=size2 to middle
rev=rev-1
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
if NESW$="north" then print #1, "line ";h-rev;" ";v-rev;" ";h+rev;" ";v-rev
if NESW$="east" then print #1, "line ";h+rev;" ";v-rev;" ";h+rev;" ";v+rev
if NESW$="south" then print #1, "line ";h+rev;" ";v+rev;" ";h-rev;" ";v+rev
if NESW$="west" then print #1, "line ";h-rev;" ";v+rev;" ";h-rev;" ";v-rev
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
p=p-1
next y
end sub

 


Here is another sample.
You will have to line your custom borders up because changing the size also affects its location..
( I don't have the ambition to figure out the code to auto place it)

Code:
call screen ' I made this for a generic screen call
'********H***V***Size***NSEW***R***G***B*dimmer
call corner 301,500,50,"west",200,150,200,8
call corner 499,500,50,"east",200,150,200,8
call corner 400,399,150,"south",200,150,200,8
call corner 400,601,150,"north",200,150,200,8
wait
[quit]
 #1 "discard"
 close #1
 end
'initialize generic screen
sub screen
   nomainwin
   open "Another way of doing graphics !!" for graphics_nsb_fs as #1
   print #1, "Down trapclose [quit]"
    print #1, "fill black ; home ; down ; north"
end sub
' generic circle   syntax -  circle horizontal, vertical, size, color$
sub corner h,v,size,NESW$,x,c,a,dimmer ' dimmer cannot be more than 24
if dimmer<2 then dimmer =2
size2=size-20
p=size/2
double= dimmer+dimmer+dimmer
rev=size
mid=size-size2
mid2=mid/2
middle=size-mid2
cd=mid/dimmer
for reduce=1 to mid
a=a-dimmer
c=c-dimmer
x=x-dimmer
if a<2 then a=2
if c<2 then c=2
if x<2 then x=2
next reduce
for y=middle to size
rev=rev-1
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
if NESW$="north" then print #1, "line ";h-rev;" ";v-rev;" ";h+rev;" ";v-rev
if NESW$="east" then print #1, "line ";h+rev;" ";v-rev;" ";h+rev;" ";v+rev
if NESW$="south" then print #1, "line ";h+rev;" ";v+rev;" ";h-rev;" ";v+rev
if NESW$="west" then print #1, "line ";h-rev;" ";v+rev;" ";h-rev;" ";v-rev
x=x+dimmer
c=c+dimmer
a=a+dimmer
if x>255 then x=255
if c>255 then c=255
if r>255 then r=255
p=p-1
next y
for y=size2 to middle
rev=rev-1
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 1"
if NESW$="north" then print #1, "line ";h-rev;" ";v-rev;" ";h+rev;" ";v-rev
if NESW$="east" then print #1, "line ";h+rev;" ";v-rev;" ";h+rev;" ";v+rev
if NESW$="south" then print #1, "line ";h+rev;" ";v+rev;" ";h-rev;" ";v+rev
if NESW$="west" then print #1, "line ";h-rev;" ";v+rev;" ";h-rev;" ";v-rev
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
p=p-1
next y
end sub


 
« Last Edit: Feb 22nd, 2016, 12:38am by michael » User IP Logged

I like making program generators and reinventing the wheel.. I never make mistakes.. Not ever.. (lie)
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

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