Basicprogramming(.org) > SmallBASIC

Welcome to the SmallBASIC board

<< < (6/7) > >>

lettersquash:
Cheers for that B+, and thanks for the welcome. I've found it and made a copy. I don't know where the settings would be editable other than in Roaming though - I don't see a link to set anything in the program.

BTW, I love the text rotation fun, that's a clever piece of coding, but what does the line rect 0, 0, secWide, secHigh, 9 do at the end of the global variables section? It seems like it ought to be drawing a rectangle in colour 9, but I can't see one or get it to be seen, even when I mess about with it - change the colour, position, add filled to it, etc.

B+:
Text rotation fun? You will have to remind where that's at, not on-line or samples, from here at Retro?

ah! here: http://retrogamecoding.org/board/index.php?topic=630.msg4695#msg4695

I have to refresh my memory...

OK

--- Code: ---'global variables
message = "abcdefghijklmnopqrstuvwxyz""
secWide = txtw(message) + 2
secHigh = txth(message) + 2
dim sect(secWide, secHigh) 'array to store message points
color rgb(200, 200, 200),0 : cls
rect 0, 0, secWide, secHigh, 9

? message
input "ok" ;wate  'added this because I probably deleted it when everything was working correctly

--- End code ---

This was a check to see that I got the box dimensions correctly, that all the text was fitting in the Load Section.

Oh heck! It's here in this thread too! ;-))

B+:
Here is another one from BP.org (I think), still works! I think this is my own handmade font.

--- Code: ---'SB rotation.bas for SmallBASIC 0.12.2 [B+=MGA] 2016-04-11

cx=xmax/2:cy=ymax/2
secwide=275
sechigh=50
dim sect(secwide,sechigh)
sz=50
color 15,0:cls
post 18,8,sz,15,"SmallBASIC"
getsec 0,0
color 15,4:cls
rotate
pause

'scale for 1x2 cells
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 "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 "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 "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 "M":lx=px:ly=py+p4:tl 0,-p4:tl p1,p2:tl p1,-p2:tl 0,p4
    case "S":ac px+p1,py+p1,90,360:ac px+p1,py+p3,270,540
    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

sub getsec(xstart,ystart)
  local x,y
  'these are all global
  for y=0 to sechigh
    for x=0 to secwide
      sect(x,y)=POINT(xstart+x,ystart+y) '<== data from screen points
    next
  next
end

sub rotate 'and scale
  local cax,cay,ra,cc,d,anew,ax,ay
  dx=(xmax/secwide)/720 :dy=(ymax/sechigh)/720
  cax=secwide/2:cay=sechigh/2  'array center
  for i=1 to 721
    cls
    for y=0 to sechigh
      for x=0 to secwide
        cc=sect(x,y)
        if (x-cax)<>0 and cc<>0 then
          d=((x-cax)^2+(y-cay)^2)^.5
          anew=atan((y-cay)/(x-cax))
          if x-cax<0 and y-cay<0 then anew=anew+pi+rad(ra)  '-x,-y
          if x-cax<0 and y-cay>=0 then anew=anew+pi+rad(ra) '-x,+y
          if x-cax>=0 and y-cay<0 then anew=anew+rad(ra)    '+x,-y
          if x-cax>=0 and y-cay>=0 then anew=anew+rad(ra)   '+x,+y
          ax=d*cos(anew):ay=d*sin(anew)
          cc=sect(x,y)
          rect cx+ax*i*dx,cy+ay*i*dy step i*dx,i*dy filled
        end if
      next
    next
    ra+=1
    ra=ra%360
    showpage
    delay 10
  next
end

--- End code ---

Nope it was from here: http://retrogamecoding.org/board/index.php?topic=439.0

I sped up the display, in the above code. Very appropriate for this thread. :)

lettersquash:
Yeah, sorry I forgot to say where the code was I was referring to.  ::) ...neat.

chrisws:
Hi lettersquash,

Welcome to the forum!

> Would it be worth changing the name to avoid the confusion?
I'm not completely averse to that idea, but I'm not sure what Nicholas thinks about it. I guess if someone said, here's a new name, new icon, new marketing stuff along with some legal protection for the name - we probably wouldn't say no.

> One thing I'm puzzled about is the different files in the installation. sbasicg.exe and sbasicg64 are presumably 32-bit and 64-bit versions, are they?
Yes 32 and 64 bit variations. There are potential issues with large floating point numbers in the 32 bit build. Good to hear the 64 bit one is working for you, so just use that one. The web server version executes requested .bas files then returns the results using javascript graphics commands.  The other exe is a command line version. Just use what works and ignore the rest.

I made a "getting started" section on the android page, This more or less also applies to the desktop version:

https://smallbasic.github.io/pages/android.html

Cheers,
Chris

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version