Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SmallBASIC - drawn font Plasma Deluxe
#1
Code: (Select All)
' Plasma Deluxe.bas  SmallBASIC 0.12.6 [B+=MGA] 2016-05-16
' license info below

sub post(x,y,scale,fore,mess)
  local lm,i,c,p1,p2,p3,p4,px,gf
  thick=1/40*scale
  dr=1/6*scale-.5*thick
  gf=.04*scale
  color fore
  p1=.16*scale : p2=.32*scale : p3=.48*scale : p4 =.64*scale
  lm=len(mess) : py=y+.5*thick
  if lm*scale*.5+x-xmax>0 then Beep 'draw it anyway
  for i=1 to lm
    c=mid(mess,i,1)
    px=x+(i-1)*scale*.5+.5*thick
    select case c
    case "a":ac px+p1,py+p3,0,360:lx=px+p2:ly=py+p2-gf:tl 0,p2:tl 0,2*gf
    case "b":ac px+p1,py+p3,0,360:lx=px:ly=py:tl 0,p4
    case "c":ac px+p1,py+p3,40,320
    case "d":ac px+p1,py+p3,0,360:lx=px+p2:ly=py:tl 0,p4
    case "e":ac px+p1,py+p3,45,360:lx=px:ly=py+p3:tl p2,0
    case "f":ac px+p2,py+p1+gf,180,270:lx=px:ly=py+p2:tl p2,0:lx=px+p1:ly=py+p1:tl 0,p3
    case "g":ac px+p1,py+p3,0,360:lx=px+p2:ly=py+p2:tl 0,p2:ac px+p1,py+p4,0,90:lx=px:ly=py+p4+p1:tl p1,0
    case "h":ac px+p1,py+p3,180,360:lx=px:ly=py:tl 0,p4:lx=px+p2:ly=py+p3:tl 0,p1
    case "i":lx=px+p1-gf:ly=py+p2:tl gf,0:tl 0,p2:tl -gf,0:tl 2*gf,0
             lx=px+p1-gf:ly=py+p1:tl gf,0:tl 0,-gf:tl -gf,0:tl 0,gf
    case "j":lx=px+p1-gf:ly=py+p2:tl gf,0:tl 0,p2:ac px,py+p4,0,120
             lx=px+p1-gf:ly=py+p1:tl gf,0:tl 0,-gf:tl -gf,0:tl 0,gf 
    case "k":lx=px:ly=py:tl 0,p4:lx=px+p2:ly=py+p2:tl -p2,p1:tl p2,p1
    case "l":lx=px+p1-gf:ly=py:tl gf,0:tl 0,p4:tl gf,0:tl -2*gf,0
    case "m":lx=px:ly=py+p2:tl 0,p2:lx=px+p1:ly=py+p4:tl 0,-p2:tl -p1,p1:lx=px+p2:ly=py+p4:tl 0,-p2:tl -p1,p1
    case "n":ac px+p1,py+p3,180,360:lx=px:ly=py+p2-gf:tl 0,p2+gf:lx=px+p2:ly=py+p3:tl 0,p1
    case "o":ac px+p1,py+p3,0,360
    case "p":ac px+p1,py+p3,0,360:lx=px:ly=py+p2-gf:tl 0,p4-2*gf
    case "q":ac px+p1,py+p3,0,360:lx=px+p2:ly=py+p2-gf:tl 0,p4-2*gf:tl 2*gf,0
    case "r":lx=px:ly=py+p2:tl 0,p2:ac px+p1,py+p3,180,340
    case "s":dr=1/12*scale:ac px+.5*p1,py+p2+dr,90,270:ac px+1.5*p1,py+p3+dr,270,450:dr=1/6*scale
             lx=px+.5*p1:ly=py+p2:tl p1*1.5,0:lx=px:ly=py+p4:tl p1*1.5,0:lx=px+.5*p1:ly=py+p3:tl p1,0     
    case "t":lx=px+p1:ly=py:tl 0,p4:tl 2*gf,0:lx=px:ly=py+p2:tl p2,0
    case "u":ac px+p1,py+p3,0,180:lx=px:ly=py+p2:tl 0,p1*1.5:lx=px+p2:ly=py+p2:tl 0,p2+gf     
    case "v":lx=px:ly=py+p2:tl p1,p2+gf:tl p1,-p2-1.5*gf
    case "w":lx=px-gf:ly=py+p2:tl gf+p1*.5,p2:tl .5*p1,-p2:tl p1*.5,p2:tl p1*.5+gf,-p2       
    case "x":lx=px:ly=py+p2:tl p2,p2:lx=px:ly=py+p4:tl p2,-p2
    case "y":lx=px:ly=py+p2:tl p1,p2:lx=px+p2:ly=py+p2:tl -p2,p3+gf 
    case "z":lx=px:ly=py+p2:tl p2,0:tl -p2,p2:tl p2,0     
    case "A":lx=px:ly=py+p4:tl p1-gf,-p4:tl 2*gf,0:tl p1-gf,p4:lx=px+p1-2*gf:ly=py+p2:tl p1,0
    case "B":ac px+p1,py+p1,270,450:ac px+p1,py+p3,270,450
             lx=px:ly=py:tl 0,p4:tl p1,0:lx=px:ly=py+p2:tl p1,0:lx=px:ly=py:tl p1,0     
    case "C":ac px+p1,py+p1,180,320:ac px+p1,py+p3,40,180:lx=px:ly=py+p1:tl 0,p2   
    case "D":ac px+p1,py+p1,270,360:ac px+p1,py+p3,0,90
             lx=px+p1:ly=py:tl -p1,0:tl 0,p4:tl p1,0:lx=px+p2:ly=py+p1:tl 0,p2
    case "E":lx=px+p2:ly=py:tl -p2,0:tl 0,p4:tl p2,0:lx=px:ly=py+p2:tl p1+2*gf,0
    case "F":lx=px+p2:ly=py:tl -p2,0:tl 0,p4:lx=px:ly=py+p2:tl p1+2*gf,0
    case "G":ac px+p1,py+p1,180,345:ac px+p1,py+p3,0,180
             lx=px:ly=py+p1:tl 0,p2:lx=px+p2:ly=py+p4+gf:tl 0,-p2-gf:tl -p1,0   
    case "H":lx=px:ly=py:tl 0,p4:tl 0,-p2:tl p2,0:tl 0,p2:tl 0,-p4     
    case "I":lx=px+p1*.5:ly=py:tl p1,0:lx=px+p1*.5:ly=py+p4:tl p1,0:lx=px+p1:ly=py:tl 0,p4
    case "J":ac px+p1,py+p3,0,180:lx=px+p1*1.5:ly=py:tl p1*.5,0:tl 0,p3   
    case "K":lx=px:ly=py:tl 0,p4:lx=px+p2:ly=py:tl -p2,p2:tl p2,p2
    case "L":lx=px:ly=py:tl 0,p4:tl p2,0
    case "M":lx=px:ly=py+p4:tl 0,-p4:tl p1,p2:tl p1,-p2:tl 0,p4
    case "N":lx=px:ly=py+p4:tl 0,-p4:tl p2,p4:tl 0,-p4
    case "O":ac px+p1,py+p1,180,360:ac px+p1,py+p3,0,180:lx=px:ly=py+p1:tl 0,p2:lx=px+p2:ly=py+p1:tl 0,p2
    case "P":ac px+p1,py+p1,270,450:lx=px+p1:ly=py:tl -p1,0:tl 0,p4:lx=px:ly=py+p2:tl p1,0
    case "Q":ac px+p1,py+p1,180,360:ac px+p1,py+p3,0,180
             lx=px:ly=py+p1:tl 0,p2:lx=px+p2:ly=py+p1:tl 0,p2:lx=px+p1:ly=py+p2:tl p1+gf,p2+gf             
    case "R":ac px+p1,py+p1,270,450:lx=px+p1:ly=py:tl -p1,0:tl 0,p4:lx=px:ly=py+p2:tl p1,0:tl p1,p2 
    case "S":ac px+p1,py+p1,90,360:ac px+p1,py+p3,270,540
    case "T":lx=px:ly=py:tl p2,0:lx=px+p1:ly=py:tl 0,p4
    case "U":ac px+p1,py+p3,0,180:lx=px:ly=py:tl 0,p3:lx=px+p2:ly=py:tl 0,p3 
    case "V":lx=px:ly=py:tl p1,p4:tl p1,-p4
    case "W":lx=px-gf:ly=py:tl gf,p4:tl p1,-p2:tl p1,p2:tl gf,-p4
    case "X":lx=px:ly=py:tl p2,p4:lx=px+p2:ly=py:tl -p2,p4       
    case "Y":lx=px:ly=py:tl p1,p2:tl 0,p2:lx=px+p2:ly=py:tl -p1,p2
    case "Z":lx=px:ly=py:tl p2,0:tl -p2,p4:tl p2,0
     
    case "0":ac px+p1,py+p1,180,360:ac px+p1,py+p3,0,180:lx=px:ly=py+p1:tl 0,p2:tl p2,-p2:tl 0,p2
    case "1":lx=px:ly=py+p1:tl p1,-p1:tl 0,p4:tl -p1,0:tl p2,0
    case "2":ac px+p1,py+p1,180,360:lx=px+p2:ly=py+p1:tl -p2,p3:tl p2,0
    case "3":ac px+p1,py+p1,180,450:ac px+p1,py+p3,270,540
    case "4":lx=px+p1:ly=py:tl -p1,p2:tl p2,0:tl 0,p2:lx=px+p2:ly=py:tl 0,p2
    case "5":ac px+p1,py+p3,270,520:lx=px+p1:tl -p1,0:tl 0,-p2:tl p2,0
    case "6":ac px+p1,py+p3,0,360:lx=px:ly=py+p3:tl p1,-p3
    case "7":lx=px:ly=py:tl p2,0:tl -p1,p4
    case "8":ac px+p1,py+p1,0,360:ac px+p1,py+p3,0,360
    case "9":ac px+p1,py+p1,0,360:lx=px+p2:ly=py+p1:tl -p1,p3
    case ".":lx=px:ly=py+p4:tl gf,0:tl 0,-gf:tl -gf,0:tl 0,gf
    case "!":lx=px:ly=py+p4:tl gf,0:tl 0,-gf:tl -gf,0:tl 0,gf::lx=px:ly=py:tl 0,p2
    case ",":lx=px+gf:ly=py+p4:tl -gf,0:tl 0,-gf:tl gf,0:tl 0,gf:tl -gf,.5*p1+gf
    case "?":lx=px+p1:ly=py+p4:tl gf,0:tl 0,-gf:tl -gf,0:tl 0,gf:ac px+p1,py+p1,180,450:lx=px+p1:ly=py+p2:tl 0,p1-gf
    end select
  next
end

'ac is for arc, x,y is radius center, das=degree angle start, dae=degree angle end
sub ac(x,y,das,dae)
  'note dr, drawing radius has to be global, use COLOR globally sets color
  'note thick also made globals by POST sub
  local a,x1,y1,stepper
  if dr then
    if int(thick)=0 then stepper=1/(dr*pi) else stepper=(thick/2)/(dr*pi/2)
    for a=das to dae step stepper
      x1=dr*cos(rad(a)) : y1=dr*sin(rad(a))
      if int(thick)<1 then  pset x+x1,y+y1 else circle x+x1,y+y1,thick filled
    next
  fi
end

'tl stands for thick line in the LINE STEP x,y format
sub tl(stepx,stepy) 'tl=thickline 
  'lastx, lasty globals for last drawn position
  'thick has to be global
  'note thick=0 still draws a line, use COLOR so line is drawn from this global
  local length,dx,dy,i
  length=((stepx)^2 +(stepy)^2)^.5
  if length then
    dx=stepx/length : dy=stepy/length
    for i=0 to length
      circle lx+dx*i,ly+dy*i,thick filled
    next
  end if
  lx=lx+stepx : ly=ly+stepy
end

const a=127
while 1
  color 0, 0 : cls
  b = rnd ^ 2 : c = rnd ^ 2 : d = rnd ^ 2
  for i=1 to 400
    clr = RGB(a + a * sin(b * i), a + a * sin(c * i), a + a * sin(d * i))
    post i, i, 100, clr, "PLASMA DELUXE"
    showpage
    delay 1
  next
wend

####################################################################################

# The MIT License (MIT)
# Copyright (c) 2016-2017 B+=MGA
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

#####################################################################################
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#2
Anyone remember Mennonite? QBSamples: SineCube and Kite

I did not know him when he was there in time of Galleon. I met up with him at BP.org under name BestOfQBasic something like that. That forum went belly up but I caught up with him at Walters QB64 forum back in day Walter did his own fork. Then BestOf was going by another name EasyLang if I remember correctly and was moderator for Walter before things blew up there too, yikes!

Anyway seeing that MIT License at the end of the code reminded me of him, his idea. Some ideas for my interpreter came from him, in fact I won a contest for 100 LOC Interpreter in SmallBASIC while there. I think he followed through on that EasyLang vision and created it. Cheers!

(Don't think its (EasyLang) the samething I'm finding on Google today, maybe he got into AI, likely actually.)
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QBJS String Patterns to Font Help bplus 4 1,002 08-30-2023, 06:10 PM
Last Post: bplus
  BAM: New Font-Weight setting for IDE CharlieJV 8 1,642 07-28-2023, 04:45 PM
Last Post: CharlieJV

Forum Jump:


Users browsing this thread: 1 Guest(s)