Astrolog, glyph redefinition and turtle graphics

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

Thanks for your reply! But from user viewpoint it doesn't make a big difference, like you have written. I have thought it should be possible to display really fast movements in FB. But now i tried myself if found out it seems to be limited.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

Another demo for colors:

Code: Select all

' glyph_string_color_test.bas 
#Include "fbgfx.bi"
Using fb

ScreenRes 1100, 888, 32,,GFX_ALPHA_PRIMITIVES
' draw itself seems not to work with transparency, but it should be possible to put a transparent box over it.

WindowTitle "Glyph-String color test"

Dim As String glyph(23), cursor,col
Dim As Integer i,x,a,r,g,b


' some big glyph-strings in no special order
glyph(00)="U0BU8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"                ' Sun
glyph(01)="ND8NL8NR8U8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"          ' Earth
glyph(02)="G2DG2DG2R12H2UH2UH2U8NG4F4"                             ' Vulcanus       
glyph(03)="BELHL4G3D4F3R4E3U4HUE7ND5L5"                            ' Mars     
glyph(04)="BD4LGD2FR2EU2HLU6NU2NR4L4NU4D2G2BU10NF2BR12G2D6F2"      ' Uranus #1
glyph(05)="BD8U4NL4NR4U10NU2NR2L2BL3LNU2NLD2FDFRFR4EREUEU2NLNRU2"  ' Neptune   
glyph(06)="D4NL4NR4D4BU16LGD2FR2EU2HLBL6D4FDFRFR4EREUEU4"          ' Pluto  #1
glyph(07)="BG4LGD2FR2EU2HLU7RF2RF2RFBU10GLG2LG2BLU5"               ' Chiron         
glyph(08)="BD8U2NL6NR6U4R3E3U4H3L4G2"                              ' Ceres         
glyph(09)="BD8U2NL6NR6U2E4HUHUHUHNUGDGDGDGF4"                      ' Pallas
glyph(10)="BD8U2NL4NR4U8NL7NR7NE5NF5NG5NH5U6"                      ' Juno           
glyph(11)="BU8D3BG5NL3DF2DF2DFEUE2UE2UR3BH4GDG2DGHUH2UH"           ' Vesta         
glyph(12)="BG4BDHL2GD2FR2EU5H2U4E4R4F4D4G2D5FR2EU2HL2G"            ' North Node     
glyph(13)="BH4BUGL2HU2ER2FD5G2D4F4R4E4U4H2U5ER2FD2GL2H"            ' South Node     
glyph(14)="BD8U7HU3HU2H2L2G2D2F2BR12E2U2H2L2G2D2GD3G"                            ' Aries   
glyph(15)="BH6BU2FDFRFNR4GLGDGD4FDFRFR4EREUEU4HUHLHEREUE"                        ' Taurus
glyph(16)="BL2U6LHLHBR14GLGLNL6D12NL6RFRFBL14ERERU6"                             ' Gemini
glyph(17)="BF5NLRE2U2H2L2G2D2F2G2L4HL2H3BE6NH2D2G2L2H2U2E2R2E2R4FR2F3"           ' Cancer
glyph(18)="BF8H4U2E2U4HUHLHL4GLGDGD4FDFD2GL2HU"                                  ' Leo   
glyph(19)="BF8BL2H3UHU5E4D9GDG3BU10U4H2G2ND12H2G2ND12H2"                         ' Virgo
glyph(20)="BH8F2ND12E2F2ND12E2F2D12F2RE2U3NGF"                                   ' Scorpio
glyph(21)="NL8NR8BH8F3DFD6GDG3BR16H3UHU6EUE3"                                    ' Pisces
glyph(22)="BH6BL2E2D4FD4FND4EU2EUEU2EUF2ND2E2R2F2D2G2L2NH2F4D4G2"                ' Capricorn #1
glyph(23)="BG8EUE2UEDFD2FDEUE2UEDFD2FDEUE2UEBU10GDG2DGUHU2HUGDG2DGUHU2HUGDG2DG"  ' Aquarius

' show some big glyphs darker from left to right
'randomize

For i = 0 To 23
  a = 0
  r = int(rnd*255)
  g = int(rnd*255)
  b = int(rnd*255)
  For x = 0 To 1080 step 20
    a+=1
    cursor = "bm" & x+20 & "," & (i+1)*20
    col = str(rgb(int(r-((r/56)*a)),int((g-(g/56)*a)),int((b-(b/56)*a))))
    Draw  cursor & "C" & col & glyph(i) ' set cursor, color, add glyph and draw
  Next x
Next i

sleep
End
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Astrolog, glyph redefinition and turtle graphics

Post by MrSwiss »

@lizard,

you've asked for it, here goes (more speed):

Code: Select all

' glyph_string_color_test.bas -- lizard
'
' speed improved by MrSwiss (see comments)

ScreenRes 1100, 888, 32,, 64    ' GFX_ALPHA_PRIMITIVES = 64 / &h40
' draw itself seems not to work with transparency, but it should be possible to put a transparent box over it.

WindowTitle "Glyph-String color test"

Dim As String   glyph(23), cursor, col
Dim As UInteger i, x    ' fastest loop counter (up-counting)

Union colour    ' instead of RGB() macro (for speed reasons)
    As ULong    clr             ' always 32-bit (fixed size)
    Type
        As UByte    b, g, r, a  ' LSB to MSB (on little endian systems)
    End Type
End Union

Dim As colour   cc  ' we only need one, in this case

' some big glyph-strings in no special order
glyph(00)="U0BU8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"                ' Sun
glyph(01)="ND8NL8NR8U8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"          ' Earth
glyph(02)="G2DG2DG2R12H2UH2UH2U8NG4F4"                             ' Vulcanus       
glyph(03)="BELHL4G3D4F3R4E3U4HUE7ND5L5"                            ' Mars     
glyph(04)="BD4LGD2FR2EU2HLU6NU2NR4L4NU4D2G2BU10NF2BR12G2D6F2"      ' Uranus #1
glyph(05)="BD8U4NL4NR4U10NU2NR2L2BL3LNU2NLD2FDFRFR4EREUEU2NLNRU2"  ' Neptune   
glyph(06)="D4NL4NR4D4BU16LGD2FR2EU2HLBL6D4FDFRFR4EREUEU4"          ' Pluto  #1
glyph(07)="BG4LGD2FR2EU2HLU7RF2RF2RFBU10GLG2LG2BLU5"               ' Chiron         
glyph(08)="BD8U2NL6NR6U4R3E3U4H3L4G2"                              ' Ceres         
glyph(09)="BD8U2NL6NR6U2E4HUHUHUHNUGDGDGDGF4"                      ' Pallas
glyph(10)="BD8U2NL4NR4U8NL7NR7NE5NF5NG5NH5U6"                      ' Juno           
glyph(11)="BU8D3BG5NL3DF2DF2DFEUE2UE2UR3BH4GDG2DGHUH2UH"           ' Vesta         
glyph(12)="BG4BDHL2GD2FR2EU5H2U4E4R4F4D4G2D5FR2EU2HL2G"            ' North Node     
glyph(13)="BH4BUGL2HU2ER2FD5G2D4F4R4E4U4H2U5ER2FD2GL2H"            ' South Node     
glyph(14)="BD8U7HU3HU2H2L2G2D2F2BR12E2U2H2L2G2D2GD3G"                            ' Aries   
glyph(15)="BH6BU2FDFRFNR4GLGDGD4FDFRFR4EREUEU4HUHLHEREUE"                        ' Taurus
glyph(16)="BL2U6LHLHBR14GLGLNL6D12NL6RFRFBL14ERERU6"                             ' Gemini
glyph(17)="BF5NLRE2U2H2L2G2D2F2G2L4HL2H3BE6NH2D2G2L2H2U2E2R2E2R4FR2F3"           ' Cancer
glyph(18)="BF8H4U2E2U4HUHLHL4GLGDGD4FDFD2GL2HU"                                  ' Leo   
glyph(19)="BF8BL2H3UHU5E4D9GDG3BU10U4H2G2ND12H2G2ND12H2"                         ' Virgo
glyph(20)="BH8F2ND12E2F2ND12E2F2D12F2RE2U3NGF"                                   ' Scorpio
glyph(21)="NL8NR8BH8F3DFD6GDG3BR16H3UHU6EUE3"                                    ' Pisces
glyph(22)="BH6BL2E2D4FD4FND4EU2EUEU2EUF2ND2E2R2F2D2G2L2NH2F4D4G2"                ' Capricorn #1
glyph(23)="BG8EUE2UEDFD2FDEUE2UEDFD2FDEUE2UEBU10GDG2DGUHU2HUGDG2DGUHU2HUGDG2DG"  ' Aquarius

' show some big glyphs darker from left to right
Randomize(Timer, 3) ' Mersenne Twister (see FB-DOC)

For i = 1 To 30     ' warm up the randomizer (180 call's)
    Rnd : Rnd : Rnd : Rnd : Rnd
Next

Do
    For i = 0 To 23
        cc.a = 0
        cc.r = CUByte(Rnd * 255)
        cc.g = CUByte(Rnd * 255)
        cc.b = CUByte(Rnd * 255)
        For x = 0 To 1080 step 20
            cursor = "bm" & x + 20 & "," & (i + 1) * 20
            ' some color fun (fast: using union, instead of RGB() macro)
            ' and, reducing calculations, to the minimum and, also:
            ' using integer division, instead of float division!
            With cc                 ' if one doesn't want to write 'cc' first
                .a += 1
                Dim As UByte aa = .a \ 5    ' once, instead of 3 times (per run of x)
                .r = Abs(.r - aa)   ' make sure, to be positive at all times (UByte!)
                .g = Abs(.g - aa)
                .b = Abs(.b - aa)
                col = str(.clr)
            End With
            Draw cursor & "C" & col & glyph(i) ' set cursor, color, add glyph and draw
        Next x
    Next i
    If Len(InKey) Then Exit Do      ' quit without sleeping first
    Sleep(750, 1)
Loop

End
You'll have to change the coding approach, in order to maximise speed ...
(more often than not: more code = faster run time!)
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

Thanks MrSwiss! I have no problem with being corrected if the program becomes faster. Then you are able to make the movement demo faster, too?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Astrolog, glyph redefinition and turtle graphics

Post by MrSwiss »

lizard wrote:Then you are able to make the movement demo faster, too?
Probably yes but, why don't you try it first ... ?

Study the changes I've made and, after understanding the code, tansfer the useful
parts and implement them, in order to improve your know-how.
The best way of learning IMHO.
(Also, study the FB-Manual for details you might not yet understand, or ask here.)
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

In matters of speed of programming i am with you. Every millisecond counts. Most in graphics and calculations.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

The movement demo is another case. I can't see where to use a union or cubyte there. Don't worry, i will not ask you to rewrite the whole editor for me. I have the changes already in mind.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

A new version 0.2 of the editor with many changes. Added colors, helpscreen and many little things. It works so far, if colors are not changed.

Edit: Updated the listing again.

Code: Select all

' glyph-string editor.bas
' edit glyph-strings for astrolog 6.30 and others in FreeBASIC

#include "fbgfx.bi"
using fb

'beep 

screenres 1115, 888, 24 ' three byte colors (without transparency)
windowtitle "Glyph-String Editor v 0.2 for astrolog 6.30 and others"

type box
x as integer
y as integer
aktiv as short
end type

'colors
dim shared as integer backindex=6, foreindex=12,choicebackindex=15,choiceforeindex=12
dim shared as integer editbackindex=12, editforeindex=0 ,editboxindex=5,editshapeindex=13
dim shared as integer col(16),back, fore, frame, backbox, choiceback, choicefore, editback, editfore, editshape, editbox
col(0) = &HE32322 'red
col(1) = &HED591E 'redorange
col(2) = &HF18E1C 'orange
col(3) = &HF9C20C 'yelloworange
col(4) = &HF4E500 'yellow
col(5) = &H91DD2E 'yellowgreen
col(6) = &H00BC25 'green
col(7) = &H1AA872 'bluegreen
col(8) = &H2A71B0 'blue
col(9) = &H586AC4 'blueviolet
col(10) = &H9250BF 'violet
col(11) = &HDB0493 'redviolet
col(12) = &HFFFFFF 'white
col(13) = &HBBBBBB 'lightgrey
col(14) = &H888888 'grey
col(15) = &H444444 'darkgrey
col(16) = &H000000 'black

frame = col(0)
back = col(backindex)
fore = col(foreindex)
editbox = col(editboxindex)
choiceback = col(choicebackindex)
choicefore = col(choiceforeindex)
editbox = col(editboxindex)
editfore = col(editforeindex)
editshape = col(editshapeindex)

dim shared as box small(9,9),big(17,17)
dim shared as integer sx,sy,ox,oy,ux=5,uy=5,lx=9,ly=9 
dim shared as boolean visible,nomove
dim shared as integer i,c1,c2,c3,x,y,onr,nr,zahl,speed,outside,p
dim shared as string smallglyph, bigglyph, glyph(109), names(54), help(54)
dim shared as string g,gold,gnew,g2,gold2,gnew2,mode
dim shared as any ptr buffer(109)

mode="choice"
visible=false
nomove=false

speed=1600 ' adjust speed here to slow down cursor

declare function colors(which as string)as integer
declare sub helpscreen
declare sub showscreen
declare sub loadglyphs
declare sub saveglyphs
declare sub writeswitch
declare sub editsmall
declare sub editbig
declare sub showbig
declare sub showsmall
declare sub moverect

' original definitions from data.cpp
names(00)="Aries"
names(01)="Taurus"
names(02)="Gemini"
names(03)="Cancer"
names(04)="Leo"
names(05)="Virgo"
names(06)="Libra"
names(07)="Scorpio"
names(08)="Sagittarius"
names(09)="Capricorn"
names(10)="Aquarius"
names(11)="Pisces"
names(12)="Earth"
names(13)="Sun"
names(14)="Moon"
names(15)="Mercury"
names(16)="Venus"
names(17)="Mars" 
names(18)="Jupiter"
names(19)="Saturn"
names(20)="Uranus"
names(21)="Neptune"
names(22)="Pluto"
names(23)="Chiron"
names(24)="Ceres"
names(25)="Pallas"
names(26)="Juno"
names(27)="Vesta"         
names(28)="North Node"
names(29)="South Node"                           
names(30)="Lilith"
names(31)="Fortune"
names(32)="Vertex"
names(33)="East Point"           
names(34)="Ascendant"
names(35)="2nd Cusp"
names(36)="3rd Cusp"
names(37)="Nadir"     ' mistake, not the same like imum coeli
names(38)="5th Cusp"
names(39)="6th Cusp"
names(40)="Descendant"
names(41)="8th Cusp"
names(42)="9th Cusp"
names(43)="Midheaven" ' better call it medium coeli, it's not zenit
names(44)="11th Cusp"
names(45)="12th Cusp"
names(46)="Vulcan"
names(47)="Cupido"
names(48)="Hades"
names(49)="Zeus"
names(50)="Kronos"         
names(51)="Apollon"
names(52)="Admetos"
names(53)="Vulkanus"
names(54)="Poseidon"

' original definitions from xdata.cpp, double defineds taken out

' small signs                   
glyph(00)="ND4HU2HLGDFBR6EUHLGD2G"               ' Aries         
glyph(01)="BL3D2F2R2E2U2H2NE2L2NH2G2"            ' Taurus        
glyph(02)="BLU3LHBR7GLNL3D6NL3RFBL7ERU3"         ' Gemini        
glyph(03)="BFNDERFDGLNHGL2HLHBU3NEDFREUHNLER2FRF"' Cancer        
glyph(04)="BF4H2UEU2H2L2G2D2FDGH"                ' Leo           
glyph(05)="BF4BLH2U3E2D5G2BU5U2HGND6HGND6H"      ' Virgo         
glyph(06)="BGNL3HUER2FDGR3BD2L8"                 ' Libra         
glyph(07)="BH4FND6EFND6EFD6FREU"                 ' Scorpio       
glyph(08)="BG4E3NH2NF2E5NL2D2"                   ' Sagittarius   
glyph(09)="BH3BLED4FND2EU2EUFNDERFDGLNHF2D2G"    ' Capricorn #1  
glyph(10)="BG4EUEDFDEUEDFDEUEBU5GDGUHUGDGUHUGDG" ' Aquarius      
glyph(11)="NL4NR4BH4F2D4G2BR8H2U4E2"             ' Pisces        

' small planets
glyph(12)="ND4NL4NR4U4LGLDGD2FDRFR2ERUEU2HULHL"   ' Earth            
glyph(13)="U0BH3DGD2FDRFR2ERUEU2HULHL2GL"         ' Sun              
glyph(14)="BG3E2U2H2ER2FRDFD2GDLGL2H"             ' Moon             
glyph(15)="BD4UNL2NR2U2REU2HNEL2NHGD2FR"          ' Mercury  
glyph(16)="LHU2ER2FD2GLD2NL2NR2D2"                ' Venus    
glyph(17)="HLG2DF2RE2UHE4ND2L2"                   ' Mars     
glyph(18)="BH3RFDGDGDR5NDNR2U6E"                  ' Jupiter  
glyph(19)="BH3R2NUNR2D4ND2E2RFDGDF"               ' Saturn   
glyph(20)="BD4NEHURBFULU3NUNR2L2NU2DGBU5NFBR6GD3F"' Uranus #1  
glyph(21)="BD4U2NL2NR2U5NUNRLBL2NUNLDF2R2E2UNRU"  ' Neptune    
glyph(22)="D2NL2NR2D2BU8GFEHBL3D2F2R2E2U2"        ' Pluto  #1  
glyph(23)="BG2LDFEULU3NURFRFBU5GLGLU2"            ' Chiron           
glyph(24)="BD4UNL3NR3U2RE2UH2L2G"                 ' Ceres            
glyph(25)="BD4UNL3NR3UE2HUHNUGDGF2"               ' Pallas Athena    
glyph(26)="BD4UNL2NR2U4NL4NR4NE3NF3NG3NH3U3"      ' Juno             
glyph(27)="BU4DBG3NLFDF2E2UERBH2GDGHUH"           ' Vesta            
glyph(28)="BG2LGFEU2HU2E2R2F2D2GD2FEHL"           ' North Node       
glyph(29)="BH2LHEFD2GD2F2R2E2U2HU2EFGL"           ' South Node       
glyph(30)="BG4E8BG2FD2G2L2H2U2E2R2F"              ' Lilith #1        
glyph(31)="NE2NF2NG2H2GD2F2R2E2U2H2L2G"           ' Part of Fortune  
glyph(32)="U2NHNEBD4NGNFU2L2NHNGR4NEF"            ' Vertex           
glyph(33)="BH4NR3D4NR2D4R3BR2U8R2FD2GL2"          ' East Point       
glyph(34)="BG4U4NR2U3EFD7BR2NURU2HU2RDBR3ULD5RU"  ' Ascendant   
glyph(35)="BH3ER4FD2GLGLG2DR6"                    ' 2nd Cusp    
glyph(36)="BH3ER4FD2GNL3FD2GL4H"                  ' 3rd Cusp    
glyph(37)="BH4R2NR2D8NL2R2BR4NUL2U8R2D"           ' Nadir       
glyph(38)="BG3FR4EU2HL5U4R6"                      ' 5th Cusp    
glyph(39)="BE3HL4GD6FR4EU2HL4G"                   ' 6th Cusp    
glyph(40)="BH4D8REU6HLBF7DRU2HU2RDBG4NRU3NRU2R"   ' Descendant  
glyph(41)="BL2GD2FR4EU2HNL4EU2HL4GD2F"            ' 8th Cusp    
glyph(42)="BG3FR4EU6HL4GD2FR4E"                   ' 9th Cusp    
glyph(43)="BG4U8F2ND6E2D8BR4NUL2U8R2D"            ' Midheaven   
glyph(44)="BH3ED8NLRBR2RNRU8G"                    ' 11th Cusp   
glyph(45)="BG4RNRU8GBR4ER2FD2GLG2D2R4"            ' 12th Cusp   
glyph(46)="NU4D4NH3E3"                            ' Vulcan    
glyph(47)="BH4BRFDG2DR8BG3UNL2NR2U5LUEFDL"        ' Cupido    
glyph(48)="BENUNL2NR2D3ND2NR2L2H2U2E2R4"          ' Hades     
glyph(49)="BU4NG2NF2D7NDBLHLBR6LGL2GLBR6LHL"      ' Zeus      
glyph(50)="BU2D3ND3NR2L2BH2UE2R4F2D"              ' Kronos    
glyph(51)="U3NLR2NRD3NL2NR2D4NRL2NLU4L4UEUH"      ' Apollon   
glyph(52)="BUNU2NL2NR2D2ND3LHU2ENHR2NEFD2GL"      ' Admetos   
glyph(53)="G2DGR6HUH2U4NG2F2"                     ' Vulcanus  
glyph(54)="ND4U4BL3DF2R2E2UBD8UH2L2G2D"           ' Poseidon  

' big signs
glyph(55)="BD8U7HU3HU2H2L2G2D2F2BR12E2U2H2L2G2D2GD3G"                            ' Aries   
glyph(56)="BH6BU2FDFRFNR4GLGDGD4FDFRFR4EREUEU4HUHLHEREUE"                        ' Taurus  
glyph(57)="BL2U6LHLHBR14GLGLNL6D12NL6RFRFBL14ERERU6"                             ' Gemini  
glyph(58)="BF5NLRE2U2H2L2G2D2F2G2L4HL2H3BE6NH2D2G2L2H2U2E2R2E2R4FR2F3"           ' Cancer  
glyph(59)="BF8H4U2E2U4HUHLHL4GLGDGD4FDFD2GL2HU"                                  ' Leo    
glyph(60)="BF8BL2H3UHU5E4D9GDG3BU10U4H2G2ND12H2G2ND12H2"                         ' Virgo  
glyph(61)=""                                                                     ' Libra  
glyph(62)="BH8F2ND12E2F2ND12E2F2D12F2RE2U3NGF"                                   ' Scorpio  
glyph(63)=""                                                                     ' Sagittarius   
glyph(64)="BH6BL2E2D4FD4FND4EU2EUEU2EUF2ND2E2R2F2D2G2L2NH2F4D4G2"                ' Capricorn #1  
glyph(65)="BG8EUE2UEDFD2FDEUE2UEDFD2FDEUE2UEBU10GDG2DGUHU2HUGDG2DGUHU2HUGDG2DG"  ' Aquarius  
glyph(66)="NL8NR8BH8F3DFD6GDG3BR16H3UHU6EUE3"                                    ' Pisces  

' big planets
glyph(67)="ND8NL8NR8U8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"          ' Earth  
glyph(68)="U0BU8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"                ' Sun    
glyph(69)="BG6E3UEU2HUH3E2R4FRF3DFD4GDG3LGL4H2"                    ' Moon   
glyph(70)=""                                                       ' Mercury  
glyph(71)=""                                                       ' Venus    
glyph(72)="BELHL4G3D4F3R4E3U4HUE7ND5L5"                            ' Mars     
glyph(73)="BH6BRRF2D2GDGDGDGDR10ND2NR4U12E2"                       ' Jupiter  
glyph(74)=""                                                       ' Saturn   
glyph(75)="BD4LGD2FR2EU2HLU6NU2NR4L4NU4D2G2BU10NF2BR12G2D6F2"      ' Uranus #1  
glyph(76)="BD8U4NL4NR4U10NU2NR2L2BL3LNU2NLD2FDFRFR4EREUEU2NLNRU2"  ' Neptune    
glyph(77)="D4NL4NR4D4BU16LGD2FR2EU2HLBL6D4FDFRFR4EREUEU4"          ' Pluto  #1  
glyph(78)="BG4LGD2FR2EU2HLU7RF2RF2RFBU10GLG2LG2BLU5"               ' Chiron         
glyph(79)="BD8U2NL6NR6U4R3E3U4H3L4G2"                              ' Ceres          
glyph(80)="BD8U2NL6NR6U2E4HUHUHUHNUGDGDGDGF4"                      ' Pallas Athena  
glyph(81)="BD8U2NL4NR4U8NL7NR7NE5NF5NG5NH5U6"                      ' Juno           
glyph(82)="BU8D3BG5NL3DF2DF2DFEUE2UE2UR3BH4GDG2DGHUH2UH"           ' Vesta          
glyph(83)="BG4BDHL2GD2FR2EU5H2U4E4R4F4D4G2D5FR2EU2HL2G"            ' North Node     
glyph(84)="BH4BUGL2HU2ER2FD5G2D4F4R4E4U4H2U5ER2FD2GL2H"            ' South Node     
glyph(85)=""                                                       ' Lilith #1        
glyph(86)=""                                                       ' Part of Fortune  
glyph(87)=""                                                       ' Vertex           
glyph(88)=""                                                       ' East Point       
glyph(89)="BG8U8NR4U6E2F2D14BR4NHREU3HLHU3ERFBR6HLGD8FRE"          ' Ascendant  
glyph(90)=""                                                       ' 2nd Cusp   
glyph(91)=""                                                       ' 3rd Cusp   
glyph(92)="BH8R4NR4D16NL4R4BR8BUNUGL3HU14ER3FD"                    ' Nadir  
glyph(93)=""                                                       ' 5th Cusp   
glyph(94)=""                                                       ' 6th Cusp   
glyph(95)="BH8D16R2E2U12H2L2BF14BGFREU3HLHU3ERFBG9NR3U5NR3U5R3"    ' Descendant  
glyph(96)=""                                                       ' 8th Cusp   
glyph(97)=""                                                       ' 9th Cusp   
glyph(98)="BG8U16F4ND12E4D16BR8BUNUGL3HU14ER3FD"                   ' Midheaven  
glyph(99)=""                                                       ' 11th Cusp  
glyph(100)=""                                                      ' 12th Cusp  
glyph(101)=""                                                      ' Vulcan     
glyph(102)="BH8BR2F2D2G2DG2DR16BG6U2NL4NR4U10LHU2ER2FD2GL"         ' Cupido     
glyph(103)=""                                                      ' Hades      
glyph(104)="BU8NG4NF4D14ND2BLHL2HLBR12LGL2GL2GL2GLBR12LHL2HL"      ' Zeus       
glyph(105)=""                                                      ' Kronos     
glyph(106)="U6NL2R4NR2D6NL4NR4D8NR2L4NL2U8L8UE2U3H2"               ' Apollon    
glyph(107)=""                                                      ' Admetos    
glyph(108)="G2DG2DG2R12H2UH2UH2U8NG4F4"                            ' Vulcanus   
glyph(109)=""                                                      ' Poseidon   

' help
help(00)=""
help(01)="Choice Mode:"
help(02)=""
help(03)="<Up>    Up"
help(04)="<Down>  Down"   
help(05)="<Left>  Left"
help(06)="<Right> Right"
help(07)=""
help(08)=""
help(09)="<1> Background Color"
help(10)="<2> Foreground Color"
help(11)="<3> Choiceback Color"
help(12)="<4> Choicefore Color"
help(13)="<5> Editback Color"
help(14)="<6> Editfore Color"
help(15)="<7> Editbox Color"
help(16)="<8> Editshape Color"
help(17)=""
help(18)="<L> Load  Glyphs"
help(19)="<S> Save  Glyphs"
help(20)="<W> Write Switches"
help(21)=""
help(22)="<Enter> Edit Big" 
help(23)="<Tab> Edit Small"  
help(24)=""
help(25)="<Esc> Exit"
help(26)=""
help(27)=""
help(28)="Edit Mode:"
help(29)=""
help(30)="<Up>    Up"
help(31)="<Down>  Down"   
help(32)="<Left>  Left"
help(33)="<Right> Right"
help(34)="<E> NE"
help(35)="<F> SE"
help(36)="<G> SW"
help(37)="<H> NW"
help(38)="or numpad"   
help(39)=""
help(40)=""
help(41)=""
help(42)="<C> Clear"
help(43)=""
help(44)="" '"<U> Undo"
help(45)=""
help(46)="<T> Take in Array"
help(47)="<V> Visible"
help(48)="<N> Nomove"
help(49)=""
help(50)="<X> Back to Choice"
help(51)=""     
help(52)="<F1> Help"
help(53)=""
help(54)="<Ctrl+C> Hot Seat"

' create editor coords
ox=425
oy=190
   
for sx = 1 to 9
  for sy = 1 to 9
    small(sx,sy).x = ox + sx * 20
    small(sx,sy).y = oy + sy * 20
  next sy
next sx

ox=345
oy+=200

for sx = 1 to 17
  for sy = 1 to 17
    big(sx,sy).x = ox + sx * 20
    big(sx,sy).y = oy + sy * 20
  next sy
next sx

sub helpscreen
  color fore,back
  cls
  print
  print
  print "  Usage: "
  print
  print
  print "  1.  In choice mode move the red frame to the glyph you want to edit."  
  print
  print "  2.  Press <Enter> to edit the big or <Tab> to edit the small glyph."  
  print
  print "  3.  You always start invisible in the middle with a yellow point."
  print
  print "  4.  Move to the point where you want to start your glyph."
  print
  print "  5.  Press <V> to switch to the visible mode. Draw the line."
  print
  print "  6.  Press <V> again and repeat step 4 and 5 as often as needed."
  print
  print "  7.  To take the glyph in the array press <T>."
  print
  print "  8.  To exit editor modes press <X>."
  print
  print "  9.  Now choose again a glyph in choice mode."
  print
  print "  10. When ready press <S> to save the array."
  print
  print "  11. To save switches for astrolog press <W>."
  print
  print "  12. These can be pasted at the end of astrolog.as."
  print
  print
  print
  print "  The lightgrey drawings show only the previous drawing for orientation."
  print
  print "  You cant`t alter them, because in turtle graphics you always have "
  print
  print "  to start a new glyph-string from the beginning, here the middle."
  print
  print "  They can be removed with <C>."
  print
  print
  print "  Have fun."
  sleep
  showscreen
end sub

function colors(which as string)as integer
  select case which
  
  case "back"
    backindex += 1
    if backindex = foreindex then backindex += 1
    if backindex > 16 then backindex = 0
    function = backindex
    
  case "fore"
    foreindex += 1
    if foreindex = backindex then foreindex += 1
    if foreindex > 16 then foreindex = 0
    function = foreindex
    
  case "choiceback"
    choicebackindex += 1
    if choicebackindex = choiceforeindex then choicebackindex += 1
    if choicebackindex > 16 then choicebackindex = 0
    function = choicebackindex
    
  case "choicefore"
    choiceforeindex += 1
    if choiceforeindex = choicebackindex then choiceforeindex += 1
    if choiceforeindex > 16 then choiceforeindex = 0
    function = choiceforeindex
    
  case "editback"
    editbackindex += 1
    if editbackindex = editboxindex then editbackindex += 1
    if editbackindex = editforeindex then editbackindex += 1   
    if editbackindex > 16 then editbackindex = 0
    function = editbackindex
    
  case "editfore"
    editforeindex += 1
    if editforeindex = editboxindex then editforeindex += 1
    if editforeindex = editbackindex then editforeindex += 1
    if editforeindex > 16 then editforeindex = 0
    function = editforeindex
    
  case "editbox"
    editboxindex += 1
    if editboxindex = editforeindex then editboxindex += 1
    if editboxindex = editbackindex then editboxindex += 1
    if editboxindex > 16 then editboxindex = 0
    function = editboxindex
    
  case "editshape" 
    editshapeindex += 1
    if editshapeindex = editforeindex then editshapeindex += 1
    if editshapeindex = editbackindex then editshapeindex += 1
    if editshapeindex > 16 then editshapeindex = 0
    function = editshapeindex
    
  end select
end function

sub showscreen
   'screenlock
   color fore,back
   cls 
   
   ' show names and help
   for i = 0 to 54
     draw string (50, 120 + i*13), names(i)
     draw string (920, 120 + i*13), help(i)
   next i
   
  ' color choicefore,choiceback
   
   ' show small glyphs
   for x = 0 to 54
     i = x '+ 1
     buffer(i) = imagecreate(9, 9, choiceback)
     draw buffer(i), "bm4,4" & glyph(i) ' set cursor to center and add glyph
     put (14 + 20 * x, 10), buffer(i), pset
   next x
   
    ' show big glyphs
   for x = 0 to 54
     i = x + 55
     buffer(i) = imagecreate(17, 17, choiceback)
     draw buffer(i), "bm8,8" & glyph(i) ' set cursor to center and add glyph
     put (10 + 20 * x, 30), buffer(i), pset
   next x
   
   ' draw editbox
   line(215,170) - step (640,620),editbox,bf 
   line(215,150) - step (640,16),back,bf    ' erase background
   draw string (215,154), str(nr),fore      ' show status
   draw string (280,154), "invisible",fore  ' show status
   draw string (390,154), "move",fore       ' show status
   draw string (770,154), "choice    ",fore ' show status
   
   ' show editors
   for x = 0 to 8
     for y = 0 to 8
       with small(x+1,y+1)
       if point(x,y,buffer(nr)) = choicefore then
       '  small(x+1,y+1).aktiv = 1
         line(.x,.y) - step (18,18),editshape,bf
       else
       '  small(x+1,y+1).aktiv = 0
         line(.x,.y) - step (18,18),editback,bf
       end if
       end with
     next y
   next x
   
   for x = 0 to 16
     for y = 0 to 16
       with big(x+1,y+1)
       if point(x,y,buffer(nr+55)) = choicefore then
       '  big(x+1,y+1).aktiv =1
         line(.x,.y) - step (18,18),editshape,bf
       else
       '  big(x+1,y+1).aktiv = 0
         line(.x,.y) - step (18,18),editback,bf
       end if 
       end with
     next y
   next x     
   
   ' show small glyph string
   color 0 ',0
   line(10,80) - step (1094,14),col(12),bf  ' erase background
   draw string (14,84), smallglyph     ' draw small glyph-string
 
   ' show big glyph string
   line(10,852) - step (1094,14),col(12),bf ' erase background
   draw string (14,856), bigglyph      ' draw big glyph-string
   moverect
   'screenunlock
end sub

sub loadglyphs  ' open and read the file
   dim as integer filehandle
   filehandle = freefile
   open "glyphs.txt" for input as #filehandle
   for i = 0 to 109
     line input #filehandle, glyph(i) 
   next i         
   close #filehandle
   showscreen
end sub

sub saveglyphs  ' open and write the file
   dim as integer filehandle
   filehandle = freefile
   open "glyphs.txt" for output as #filehandle
   for i = 0 to 109
      print #filehandle, glyph(i)
   next i
   close #filehandle
end sub

sub writeswitch ' open and write the file with switches
   dim as integer filehandle
   dim as string zeile
   filehandle = freefile
   open "astroglyphs.txt" for output as #filehandle 
   print #filehandle, ""
   print #filehandle, "; IMPORTANT! If you make redefinitions of the Uranians below please uncheck"
   print #filehandle, "; Uranians in 'SETTING/INCLUDE URANIANS' before 'VIEW/SHOW INTERPRETATIONS'."
   print #filehandle, ";The new names would be shown with the old texts of the Uranians! IMPORTANT!"
   print #filehandle, ""
   print #filehandle, "; Paste at the end of astrolog.as."
   print #filehandle, "; ----------------------------------------------------------------------------"
   print #filehandle,""
   for i = 0 to 54 ' write switches
     zeile = "-yxd " & names(i)  & " " & chr(34) & glyph(i) & chr(34) & " " & chr(34) & glyph(i+55) & chr(34)
     print #filehandle, zeile
   next i
  close #filehandle                   
end sub

ox=325
oy=190

sub showsmall                            ' make glyph-string
  color col(16) ' black
    if visible = false then                  ' invisible?
   
      if left(gold,1) = "B" then
        if mid(gold,2,1) = g then        ' same direction
          if len(gold) = 4 then
            zahl=val(right(gold,2))      ' old number 2 digit
          elseif len(gold) = 3 then
            zahl=val(right(gold,1))      ' old number 1 digit
          else
            zahl=1                       ' old number 0 digit
          end if
          smallglyph = rtrim (smallglyph,gold)
          gold = "B" & g & str(zahl+1) 
          if gold = "B0" then gold = ""                   
          smallglyph += gold               ' new bigglyph
        else                             ' another direction)
          gold = "B" & g
          smallglyph += gold               ' new bigglyph
        end if
      else                               ' invisible, no B
        gold = "B" & g               
        smallglyph += gold                 ' new bigglyph     
      end if 
     
    else                                 ' visible
   
      if left(gold,1) = "B" then         ' previous B
        gold = g                         ' new direction
        smallglyph += gold                 ' new bigglyph                                   
      else                               ' visible
        if mid(gold,1,1) = g then        ' same direction
          if len(gold) = 3 then
            zahl=val(right(gold,2))
          elseif len(gold) = 2 then
            zahl=val(right(gold,1))
          else
            zahl=1
          end if
          smallglyph = rtrim (smallglyph,gold)
          gold = g & str(zahl+1)
          smallglyph += gold               ' new bigglyph
        else                             ' new direction
          gold = g
          smallglyph += gold               ' new bigglyph
        end if
      end if 
     
    end if ' make glyph-string
  line(10,80) - step (1094,14),col(12),bf ' erase backgrund with white
  draw string (14,84), smallglyph ' draw small glyph-string
end sub
 
 gold = "B00"
 bigglyph=""
 
sub showbig
  color col(16) ' black
 
  ' make glyph-string
    if visible = false then                  ' invisible?
   
      if left(gold,1) = "B" then
        if mid(gold,2,1) = g then        ' same direction
          if len(gold) = 4 then
            zahl=val(right(gold,2))      ' old number 2 digit
          elseif len(gold) = 3 then
            zahl=val(right(gold,1))      ' old number 1 digit
          else
            zahl=1                       ' old number 0 digit
          end if
          bigglyph = rtrim (bigglyph,gold)
          gold = "B" & g & str(zahl+1) 
          if gold = "B0" then gold = ""                   
          bigglyph += gold               ' new bigglyph
        else                             ' another direction)
          gold = "B" & g
          bigglyph += gold               ' new bigglyph
        end if
      else                               ' invisible, no B
        gold = "B" & g               
        bigglyph += gold                 ' new bigglyph     
      end if 
     
    else                                 ' visible
   
      if left(gold,1) = "B" then         ' previous B
       ' bigglyph = rtrim (bigglyph,gold)
        gold = g                         ' new direction
        bigglyph += gold                 ' new bigglyph                                   
      else                               ' visible
        if mid(gold,1,1) = g then        ' same direction
          if len(gold) = 3 then
            zahl=val(right(gold,2))
          elseif len(gold) = 2 then
            zahl=val(right(gold,1))
          else
            zahl=1
          end if
          bigglyph = rtrim (bigglyph,gold)
          gold = g & str(zahl+1)
          bigglyph += gold               ' new bigglyph
        else                             ' new direction
          'trim (bigglyph,gold)
          gold = g
          bigglyph += gold               ' new bigglyph
        end if
      end if 
     
    end if ' make glyph-string
   
  line(10,852) - step (1094,14),col(12),bf ' erase background white
  draw string (14,856), bigglyph ' draw big glyph-string
end sub

sub editsmall
  line(770,150) - step (100,16),back,bf    ' erase background
  draw string (770,154), "smallglyph",fore ' show status
  
    if ux < 1 then ux = 1 :outside=1
    if ux > 9 then ux = 9 :outside=1
    if uy < 1 then uy = 1 :outside=1
    if uy > 9 then uy = 9 :outside=1
   
    if (p=1 and outside=0) then showsmall
    p=0:outside=0
   
    ' draw small box
    with small(ux,uy)
    if visible = true then
     .aktiv = 1
      'if .aktiv = 1 then
        line(.x,.y) - step (18,18),editfore,bf  
      'else
        'line(.x,.y) - step (18,18),editback,bf
     ' end if 
    else
      if .aktiv = 0 then
        line(.x,.y) - step (18,18),col(4),bf,00010001 'yellow
      else
        line(.x,.y) - step (18,18),editfore,bf 
      end if
    end if
    end with
    
    ' clear
    if multikey(SC_C) or multikey(SC_c)then
      for x = 0 to 8
        for y = 0 to 8
          with small(x+1,y+1)
           .aktiv = 0
           line(.x,.y) - step (18,18),editback,bf
          end with
        next y
      next x
      smallglyph = ""
      showsmall
      visible=false
      line(280,150) - step (100,16),back,bf   ' erase background
      draw string (280,154), "invisible",fore   ' show status
      ux=5:uy=5
    end if
   
    ' take into array
    if multikey(SC_t) or multikey(SC_T) then
     glyph(nr+0) = smallglyph
      imagedestroy(buffer(nr+0))                ' clear
     buffer(nr+0) = imagecreate(9, 9, choiceback)
     color choicefore,choiceback
     draw buffer(nr+0), "bm4,4" & glyph(nr+0) ' set cursor to center and add glyph
     put (14 + 20 * (nr), 10), buffer(nr+0), pset 
     'color c3,15 
    end if
   
   ' showsmall
end sub

sub editbig
  line(770,150) - step (100,16),back,bf  ' erase background
  draw string (770,154), "bigglyph",fore ' show status

' cursor
  if lx < 1  then lx=1 :outside=1
  if lx > 17 then lx=17:outside=1
  if ly < 1  then ly=1 :outside=1
  if ly > 17 then ly=17:outside=1
   
 if (p=1 and outside=0) then showbig
  p=0:outside=0
  
  ' draw big box
  with big(lx,ly)
    if visible = true then
     .aktiv = 1
    ' if .aktiv = 1 then
       line(.x,.y) - step (18,18),editfore,bf
     'else
       'line(.x,.y) - step (18,18),editback,bf
     'end if 
    else
     if .aktiv = 0 then
         line(.x,.y) - step (18,18),col(4),bf ' yellow
     else
         line(.x,.y) - step (18,18),col(14),bf 'light grey
     end if
   end if
   end with
   
    ' clear
    if multikey(SC_c) or multikey(SC_C)   then
      for x = 0 to 16
        for y = 0 to 16
          with big(x+1,y+1)
           .aktiv = 0
           line(.x,.y) - step (18,18),editback,bf
          end with
        next y
      next x
      visible = false 
      line(280,150) - step (100,16),back,bf     ' erase background
      draw string (280,154), "invisible",fore   ' show status
      lx=9:ly=9
      bigglyph = ""
      gold="B00"
      g=""
      line(10,852) - step (1094,14),15,bf ' erase background
      showbig
    end if
  
    ' take into array
    if multikey(SC_t) or multikey(SC_T) then
     glyph(nr+55) = bigglyph
      imagedestroy(buffer(nr+55))                ' clear
     buffer(nr+55) = imagecreate(17, 17, choiceback)
     color choicefore,choiceback
     draw buffer(nr+55), "bm8,8" & glyph(nr+55) ' set cursor to center and add glyph
     put (10 + 20 * (nr), 30), buffer(nr+55), pset 
    ' color c3,15 
    end if
end sub

sub moverect
  if nr > 54 then nr = 0
  if nr < 0 then nr = 54
  line(215,150) - step (40,16),back,bf     ' erase background
  draw string (215,154), str(nr),fore      ' show nr
  line(9+20*onr,6) - step (19,44),back,b   ' erase last frame
  line(9+20*nr,6) - step (19,44),frame,b   ' glyph red frame
  line(50,120+13*onr) - step (86,8),back,b ' erase last frame
  line(50,120+13*nr) - step (86,8),frame,b ' name red frame
  onr=nr
   
  smallglyph = ""
  bigglyph = ""
' show glyphs in editors
   for x = 0 to 8
     for y = 0 to 8
       with small(x+1,y+1)
       if point(x,y,buffer(nr)) = choicefore then
         'small(x+1,y+1).aktiv = 1
         line(.x,.y) - step (18,18),editshape,bf
       else
        ' small(x+1,y+1).aktiv = 0
         line(.x,.y) - step (18,18),editback,bf
       end if
       end with
     next y
   next x
   
   for x = 0 to 16
     for y = 0 to 16
       with big(x+1,y+1)
       if point(x,y,buffer(nr+55)) = choicefore then
       '  big(x+1,y+1).aktiv =1
         line(.x,.y) - step (18,18),editshape,bf
       else
      '   big(x+1,y+1).aktiv = 0
         line(.x,.y) - step (18,18),editback,bf
       end if 
       end with
     next y
   next x           
end sub

' mainloop
showscreen
'moverect
do
  
  If inkey = chr(255, 107) then end ' systemmenu close window
  if multikey(SC_CONTROL)and multikey(SC_C) then end ' hot seat
  if multikey(SC_L)                         then loadglyphs
  if multikey(SC_S)                         then saveglyphs
  if multikey(SC_W)                         then writeswitch
  if multikey(SC_F1)                        then helpscreen
  if multikey(SC_X)                         then mode = "choice":showscreen
  if multikey(SC_ENTER)                     then mode = "big":lx=9:ly=9:editbig
  if multikey(SC_TAB)                       then mode = "small":ux=5:uy=5:editsmall
  if multikey(SC_1)                         then back = col(colors("back")):showscreen
  if multikey(SC_2)                         then fore = col(colors("fore")):showscreen
  if multikey(SC_3)                         then choiceback = col(colors("choiceback")):showscreen
  if multikey(SC_4)                         then choicefore = col(colors("choicefore")):showscreen
  if multikey(SC_5)                         then editback = col(colors("editback")):showscreen
  if multikey(SC_6)                         then editfore = col(colors("editfore")):showscreen
  if multikey(SC_7)                         then editbox = col(colors("editbox")):showscreen
  if multikey(SC_8)                         then editshape = col(colors("editshape")):showscreen
   
' visible
  if multikey(SC_v) or multikey(SC_V)then
    if visible = false then
	  visible = true
	  line(280,150) - step (100,16),back,bf   ' erase background
      draw string (280,154), "visible",fore   ' show status
    else
      visible = false
      line(280,150) - step (100,16),back,bf   ' erase background
      draw string (280,154), "invisible",fore ' show status
    end if
  end if

' nomove
  if multikey(SC_n) or multikey(SC_N)then
    if nomove = false then
	  nomove = true
	  line(390,150) - step (100,16),back,bf  ' erase background
      draw string (390,154), "nomove",fore   ' show status
    else
	  nomove = false
	  line(390,150) - step (100,16),back,bf  ' erase background
      draw string (390,154), "move",fore     ' show status
    end if
  end if
  
  sleep speed ' adjust speed here if needed (slows down cursor to not move more than one step)
  
  ' cursor
  select case mode
  case "choice"
    if multikey(SC_LEFT)  or multikey(SC_UP)   then nr-=1:moverect
    if multikey(SC_RIGHT) or multikey(SC_DOWN) then nr+=1:moverect
    
  case "big"
    if multikey(SC_LEFT)                       then lx-=1      :p=1:g="L"
    if multikey(SC_RIGHT)                      then lx+=1      :p=1:g="R"
    if multikey(SC_UP)                         then ly-=1      :p=1:g="U"
    if multikey(SC_DOWN)                       then ly+=1      :p=1:g="D"
    if multikey(SC_END)      or multikey(SC_G) then lx-=1:ly+=1:p=1:g="G"
    if multikey(SC_HOME)     or multikey(SC_H) then lx-=1:ly-=1:p=1:g="H"
    if multikey(SC_PAGEDOWN) or multikey(SC_F) then lx+=1:ly+=1:p=1:g="F"
    if multikey(SC_PAGEUP)   or multikey(SC_E) then lx+=1:ly-=1:p=1:g="E"
    editbig
    
  case "small"
    if multikey(SC_LEFT)                       then ux-=1      :p=1:g="L"
    if multikey(SC_RIGHT)                      then ux+=1      :p=1:g="R"
    if multikey(SC_UP)                         then uy-=1      :p=1:g="U"
    if multikey(SC_DOWN)                       then uy+=1      :p=1:g="D"
    if multikey(SC_END)      or multikey(SC_G) then ux-=1:uy+=1:p=1:g="G"
    if multikey(SC_HOME)     or multikey(SC_H) then ux-=1:uy-=1:p=1:g="H"
    if multikey(SC_PAGEDOWN) or multikey(SC_F) then ux+=1:uy+=1:p=1:g="F"
    if multikey(SC_PAGEUP)   or multikey(SC_E) then ux+=1:uy-=1:p=1:g="E"
    editsmall
    
  end select
loop until multikey(SC_ESCAPE) ' until esc pressed

for i = 0 to 109
  imagedestroy buffer(i)
next i

end ' Glyph-String Editor
Last edited by lizard on Mar 22, 2018 23:30, edited 2 times in total.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

Glyph scale test:

Code: Select all

' glyph_string_scale_test.bas
' maybe better to create glyphs big and then scale down

ScreenRes 1280, 1024, 32,,&H01	' GFX_FULLSCREEN 

WindowTitle "Glyph-String scale test"

Dim As String  glyph(8), cursor
dim as integer s,i,x

' some big glyph-strings in no special order
glyph(00)="U0BU8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"                ' Sun
glyph(01)="ND8NL8NR8U8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"          ' Earth
glyph(02)="G2DG2DG2R12H2UH2UH2U8NG4F4"                             ' Vulcanus       
glyph(03)="BELHL4G3D4F3R4E3U4HUE7ND5L5"                            ' Mars     
glyph(04)="BD4LGD2FR2EU2HLU6NU2NR4L4NU4D2G2BU10NF2BR12G2D6F2"      ' Uranus #1
glyph(05)="BD8U4NL4NR4U10NU2NR2L2BL3LNU2NLD2FDFRFR4EREUEU2NLNRU2"  ' Neptune   
glyph(06)="D4NL4NR4D4BU16LGD2FR2EU2HLBL6D4FDFRFR4EREUEU4"          ' Pluto  #1
glyph(07)="BG4LGD2FR2EU2HLU7RF2RF2RFBU10GLG2LG2BLU5"               ' Chiron         
glyph(08)="BD8U2NL6NR6U4R3E3U4H3L4G2"                              ' Ceres         

' show some big glyphs bigger from left to right

For i = 0 To 8
  s=0   
  For x = 0 To 1200 step 80
    cursor = "bm" & x + 10 & "," & (i + 1) * 100
    s+=1
    Draw cursor & "S" & s & glyph(i) ' set cursor, scale, add glyph and draw
  Next x
Next i

sleep
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Astrolog, glyph redefinition and turtle graphics

Post by BasicCoder2 »

It seems to me that the LINE statement would draw nice lines and the CIRCLE command would give you nice circles and a U shape. You could use Bresenham's line drawing algorithm to make the lines thicker in the larger vector drawings. The circle and half circles could also be done with the Bresenham circle drawing algorithm along with thicker lines in the larger images. This would mean nice clean circles regardless of their size.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

Yes that is the normal way in FB to show a horoscope-diagram. Then display the symbols as .png files. I did it with few systems before, FB, Windows programming, Cairo, wx-c and others. It's all fast enough, faster than the eye can follow.

With glyph-strings you can have a set of symbols or tiles that is stored in the program itself like data-lines. That makes the final program compact and fast.

The quality of the glyphs depends on how they are created. If you make them with paper and pencil it will mostly look strange because they all lopk different. Thats why you better have an editor, where you can see all glyphs in line and how they look compared to each other. Then you see immediately which glyphs are not matching to the others.

But the real advantage of the glyph-strings is speed. I believe it is the fastest way ever to display a few symbols. And the faster the better. :-)
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

Funny, i was thinking draw is faster then put.

Code: Select all

' glyph_speed_test.bas
' compare speed of put and draw

screenres 1115, 888, 24 ' three byte colors (without transparency)
windowtitle "Glyph-String speed test"

dim as integer i,x
dim as string glyph(55 to 109)
dim as any ptr buffer(109)
dim as double Start,Start2,Ende,Ende2

' big signs
glyph(55)="BD8U7HU3HU2H2L2G2D2F2BR12E2U2H2L2G2D2GD3G"                            ' Aries   
glyph(56)="BH6BU2FDFRFNR4GLGDGD4FDFRFR4EREUEU4HUHLHEREUE"                        ' Taurus  
glyph(57)="BL2U6LHLHBR14GLGLNL6D12NL6RFRFBL14ERERU6"                             ' Gemini  
glyph(58)="BF5NLRE2U2H2L2G2D2F2G2L4HL2H3BE6NH2D2G2L2H2U2E2R2E2R4FR2F3"           ' Cancer  
glyph(59)="BF8H4U2E2U4HUHLHL4GLGDGD4FDFD2GL2HU"                                  ' Leo    
glyph(60)="BF8BL2H3UHU5E4D9GDG3BU10U4H2G2ND12H2G2ND12H2"                         ' Virgo  
glyph(61)=""                                                                     ' Libra  
glyph(62)="BH8F2ND12E2F2ND12E2F2D12F2RE2U3NGF"                                   ' Scorpio  
glyph(63)=""                                                                     ' Sagittarius   
glyph(64)="BH6BL2E2D4FD4FND4EU2EUEU2EUF2ND2E2R2F2D2G2L2NH2F4D4G2"                ' Capricorn #1  
glyph(65)="BG8EUE2UEDFD2FDEUE2UEDFD2FDEUE2UEBU10GDG2DGUHU2HUGDG2DGUHU2HUGDG2DG"  ' Aquarius  
glyph(66)="NL8NR8BH8F3DFD6GDG3BR16H3UHU6EUE3"                                    ' Pisces  

' big planets
glyph(67)="ND8NL8NR8U8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"          ' Earth  
glyph(68)="U0BU8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"                ' Sun    
glyph(69)="BG6E3UEU2HUH3E2R4FRF3DFD4GDG3LGL4H2"                    ' Moon   
glyph(70)=""                                                       ' Mercury  
glyph(71)=""                                                       ' Venus    
glyph(72)="BELHL4G3D4F3R4E3U4HUE7ND5L5"                            ' Mars     
glyph(73)="BH6BRRF2D2GDGDGDGDR10ND2NR4U12E2"                       ' Jupiter  
glyph(74)=""                                                       ' Saturn   
glyph(75)="BD4LGD2FR2EU2HLU6NU2NR4L4NU4D2G2BU10NF2BR12G2D6F2"      ' Uranus #1  
glyph(76)="BD8U4NL4NR4U10NU2NR2L2BL3LNU2NLD2FDFRFR4EREUEU2NLNRU2"  ' Neptune    
glyph(77)="D4NL4NR4D4BU16LGD2FR2EU2HLBL6D4FDFRFR4EREUEU4"          ' Pluto  #1  
glyph(78)="BG4LGD2FR2EU2HLU7RF2RF2RFBU10GLG2LG2BLU5"               ' Chiron         
glyph(79)="BD8U2NL6NR6U4R3E3U4H3L4G2"                              ' Ceres          
glyph(80)="BD8U2NL6NR6U2E4HUHUHUHNUGDGDGDGF4"                      ' Pallas Athena  
glyph(81)="BD8U2NL4NR4U8NL7NR7NE5NF5NG5NH5U6"                      ' Juno           
glyph(82)="BU8D3BG5NL3DF2DF2DFEUE2UE2UR3BH4GDG2DGHUH2UH"           ' Vesta          
glyph(83)="BG4BDHL2GD2FR2EU5H2U4E4R4F4D4G2D5FR2EU2HL2G"            ' North Node     
glyph(84)="BH4BUGL2HU2ER2FD5G2D4F4R4E4U4H2U5ER2FD2GL2H"            ' South Node     
glyph(85)=""                                                       ' Lilith #1        
glyph(86)=""                                                       ' Part of Fortune  
glyph(87)=""                                                       ' Vertex           
glyph(88)=""                                                       ' East Point       
glyph(89)="BG8U8NR4U6E2F2D14BR4NHREU3HLHU3ERFBR6HLGD8FRE"          ' Ascendant  
glyph(90)=""                                                       ' 2nd Cusp   
glyph(91)=""                                                       ' 3rd Cusp   
glyph(92)="BH8R4NR4D16NL4R4BR8BUNUGL3HU14ER3FD"                    ' Nadir  
glyph(93)=""                                                       ' 5th Cusp   
glyph(94)=""                                                       ' 6th Cusp   
glyph(95)="BH8D16R2E2U12H2L2BF14BGFREU3HLHU3ERFBG9NR3U5NR3U5R3"    ' Descendant  
glyph(96)=""                                                       ' 8th Cusp   
glyph(97)=""                                                       ' 9th Cusp   
glyph(98)="BG8U16F4ND12E4D16BR8BUNUGL3HU14ER3FD"                   ' Midheaven  
glyph(99)=""                                                       ' 11th Cusp  
glyph(100)=""                                                      ' 12th Cusp  
glyph(101)=""                                                      ' Vulcan     
glyph(102)="BH8BR2F2D2G2DG2DR16BG6U2NL4NR4U10LHU2ER2FD2GL"         ' Cupido     
glyph(103)=""                                                      ' Hades      
glyph(104)="BU8NG4NF4D14ND2BLHL2HLBR12LGL2GL2GL2GLBR12LHL2HL"      ' Zeus       
glyph(105)=""                                                      ' Kronos     
glyph(106)="U6NL2R4NR2D6NL4NR4D8NR2L4NL2U8L8UE2U3H2"               ' Apollon    
glyph(107)=""                                                      ' Admetos    
glyph(108)="G2DG2DG2R12H2UH2UH2U8NG4F4"                            ' Vulcanus   
glyph(109)=""                                                      ' Poseidon   

' draw big glyphs on buffer
   for x = 0 to 54
     i = x + 55
     buffer(i) = imagecreate(17, 17, 2)
     draw buffer(i), "bm8,8" & glyph(i) ' set cursor to center and add glyph
   next x
   
' put   
   Start = Timer
   for x = 0 to 54
     i = x + 55
     put (10 + 20 * x, 50), buffer(i), pset
    next x
   Ende=(Timer-Start)*1000
   draw string (10, 100) , "Time for put: " & Ende

' draw  
   Start2 = Timer
   for x = 0 to 54
     i = x + 55
     draw "bm" & 18+20*x & "," & 150 & glyph(i) ' set cursor  and add glyph
   next x
   Ende2=(Timer-Start2)*1000
   draw string (10, 200) , "Time for draw: " & Ende2

' calculate result
   if Ende < Ende2 then
     draw string (10, 300) , "Put is faster" 
   else
     draw string (10, 300) , "Draw is faster"
   end if
   
sleep
This test says another thing. Or did i made a mistake?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Astrolog, glyph redefinition and turtle graphics

Post by MrSwiss »

lizard wrote:But the real advantage of the glyph-strings is speed. I believe it is the fastest way ever to display a few symbols. And the faster the better. :-)
lizard wrote:Funny, i was thinking draw is faster then put.
The obvious advantage of Draw is: "built in" scalability, IMHO.
It's hardly surprising, that an interpreter (Draw) isn't necessarily, the fastest method.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

Yes, now i have tested it its crystal-clear.

Put must be much faster, because it draws each pixel of each buffer faster than draw which has not much work with the empty strings in this example. But it all is even below the range of milliseconds.
lizard
Posts: 440
Joined: Oct 17, 2017 11:35
Location: Germany

Re: Astrolog, glyph redefinition and turtle graphics

Post by lizard »

One thing i have forgotten: The buffers for put must be filled before. This time should be added:

Code: Select all

' glyph_speed_test_02.bas
' compare speed of put and draw with loading bmp files
' (after running this test you will have 54 little .bmp files in current folder)

screenres 1115, 888, 24 ' three byte colors (without transparency)
windowtitle "Glyph-String speed test"

dim as integer i,x
dim as string glyph(55 to 109)
dim as any ptr buffer(55 to 109),buffer2(55 to 109)
dim as double Start,Start2,Ende,Ende2

' big signs
glyph(55)="BD8U7HU3HU2H2L2G2D2F2BR12E2U2H2L2G2D2GD3G"                            ' Aries   
glyph(56)="BH6BU2FDFRFNR4GLGDGD4FDFRFR4EREUEU4HUHLHEREUE"                        ' Taurus  
glyph(57)="BL2U6LHLHBR14GLGLNL6D12NL6RFRFBL14ERERU6"                             ' Gemini  
glyph(58)="BF5NLRE2U2H2L2G2D2F2G2L4HL2H3BE6NH2D2G2L2H2U2E2R2E2R4FR2F3"           ' Cancer  
glyph(59)="BF8H4U2E2U4HUHLHL4GLGDGD4FDFD2GL2HU"                                  ' Leo    
glyph(60)="BF8BL2H3UHU5E4D9GDG3BU10U4H2G2ND12H2G2ND12H2"                         ' Virgo  
glyph(61)=""                                                                     ' Libra  
glyph(62)="BH8F2ND12E2F2ND12E2F2D12F2RE2U3NGF"                                   ' Scorpio  
glyph(63)=""                                                                     ' Sagittarius   
glyph(64)="BH6BL2E2D4FD4FND4EU2EUEU2EUF2ND2E2R2F2D2G2L2NH2F4D4G2"                ' Capricorn #1  
glyph(65)="BG8EUE2UEDFD2FDEUE2UEDFD2FDEUE2UEBU10GDG2DGUHU2HUGDG2DGUHU2HUGDG2DG"  ' Aquarius  
glyph(66)="NL8NR8BH8F3DFD6GDG3BR16H3UHU6EUE3"                                    ' Pisces  

' big planets
glyph(67)="ND8NL8NR8U8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"          ' Earth  
glyph(68)="U0BU8L2GLG3DGD4FDF3RFR4ERE3UEU4HUH3LHL2"                ' Sun    
glyph(69)="BG6E3UEU2HUH3E2R4FRF3DFD4GDG3LGL4H2"                    ' Moon   
glyph(70)=""                                                       ' Mercury  
glyph(71)=""                                                       ' Venus    
glyph(72)="BELHL4G3D4F3R4E3U4HUE7ND5L5"                            ' Mars     
glyph(73)="BH6BRRF2D2GDGDGDGDR10ND2NR4U12E2"                       ' Jupiter  
glyph(74)=""                                                       ' Saturn   
glyph(75)="BD4LGD2FR2EU2HLU6NU2NR4L4NU4D2G2BU10NF2BR12G2D6F2"      ' Uranus #1  
glyph(76)="BD8U4NL4NR4U10NU2NR2L2BL3LNU2NLD2FDFRFR4EREUEU2NLNRU2"  ' Neptune    
glyph(77)="D4NL4NR4D4BU16LGD2FR2EU2HLBL6D4FDFRFR4EREUEU4"          ' Pluto  #1  
glyph(78)="BG4LGD2FR2EU2HLU7RF2RF2RFBU10GLG2LG2BLU5"               ' Chiron         
glyph(79)="BD8U2NL6NR6U4R3E3U4H3L4G2"                              ' Ceres          
glyph(80)="BD8U2NL6NR6U2E4HUHUHUHNUGDGDGDGF4"                      ' Pallas Athena  
glyph(81)="BD8U2NL4NR4U8NL7NR7NE5NF5NG5NH5U6"                      ' Juno           
glyph(82)="BU8D3BG5NL3DF2DF2DFEUE2UE2UR3BH4GDG2DGHUH2UH"           ' Vesta          
glyph(83)="BG4BDHL2GD2FR2EU5H2U4E4R4F4D4G2D5FR2EU2HL2G"            ' North Node     
glyph(84)="BH4BUGL2HU2ER2FD5G2D4F4R4E4U4H2U5ER2FD2GL2H"            ' South Node     
glyph(85)=""                                                       ' Lilith #1        
glyph(86)=""                                                       ' Part of Fortune  
glyph(87)=""                                                       ' Vertex           
glyph(88)=""                                                       ' East Point       
glyph(89)="BG8U8NR4U6E2F2D14BR4NHREU3HLHU3ERFBR6HLGD8FRE"          ' Ascendant  
glyph(90)=""                                                       ' 2nd Cusp   
glyph(91)=""                                                       ' 3rd Cusp   
glyph(92)="BH8R4NR4D16NL4R4BR8BUNUGL3HU14ER3FD"                    ' Nadir  
glyph(93)=""                                                       ' 5th Cusp   
glyph(94)=""                                                       ' 6th Cusp   
glyph(95)="BH8D16R2E2U12H2L2BF14BGFREU3HLHU3ERFBG9NR3U5NR3U5R3"    ' Descendant  
glyph(96)=""                                                       ' 8th Cusp   
glyph(97)=""                                                       ' 9th Cusp   
glyph(98)="BG8U16F4ND12E4D16BR8BUNUGL3HU14ER3FD"                   ' Midheaven  
glyph(99)=""                                                       ' 11th Cusp  
glyph(100)=""                                                      ' 12th Cusp  
glyph(101)=""                                                      ' Vulcan     
glyph(102)="BH8BR2F2D2G2DG2DR16BG6U2NL4NR4U10LHU2ER2FD2GL"         ' Cupido     
glyph(103)=""                                                      ' Hades      
glyph(104)="BU8NG4NF4D14ND2BLHL2HLBR12LGL2GL2GL2GLBR12LHL2HL"      ' Zeus       
glyph(105)=""                                                      ' Kronos     
glyph(106)="U6NL2R4NR2D6NL4NR4D8NR2L4NL2U8L8UE2U3H2"               ' Apollon    
glyph(107)=""                                                      ' Admetos    
glyph(108)="G2DG2DG2R12H2UH2UH2U8NG4F4"                            ' Vulcanus   
glyph(109)=""                                                      ' Poseidon   

' draw big glyphs on buffer
   for x = 0 to 54
     i = x + 55
     buffer(i) = imagecreate(17, 17, 0)
     draw buffer(i), "bm8,8" & glyph(i) ' set cursor to center and add glyph
     bsave str(x) & ".bmp",buffer(i)
   next x
   
' put   
   Start = Timer
   for x = 0 to 54
     i = x + 55
     buffer2(i) = imagecreate(17, 17, 0)
     bload str(x) & ".bmp",buffer2(i)
     put (10 + 20 * x, 50), buffer2(i), pset
   next x
   Ende=(Timer-Start)*1000
   draw string (10, 100) , "Time for put: " & Ende & " ms"

' draw  
   Start2 = Timer
   for x = 0 to 54
     i = x + 55
     draw "bm" & 18+20*x & "," & 150 & glyph(i) ' set cursor  and add glyph
   next x
   Ende2=(Timer-Start2)*1000
   draw string (10, 200) , "Time for draw: " & Ende2 & " ms"

' calculate result
   if Ende < Ende2 then
     draw string (10, 300) , "Put is faster" 
   else
     draw string (10, 300) , "Draw is faster"
   end if
   
sleep
If we fill them with loaded .bmp files, then draw is faster. :-)
Post Reply