News:

Welcome to RetroCoders Community

Main Menu

Just a silly screen painter to test LETCHR$ and PUTSTRING

Started by CharlieJV, May 07, 2023, 04:54 AM

Previous topic - Next topic

CharlieJV



sub PUTSTRING(s$, x%, y%)
' ⎺⎺⎺⎺⎺⎺⎺⎺⎺
for c = 1 to len(s$)
   sc$ = MID$(s$, c, 1)
this$ = _GETCHR$(ASC(sc$))
for yi = 0 to 7
for xi = 0 to 7
IF MID$(this$, (xi + yi*8) + 1, 1) = "X" THEN PSET (x% + xi + (c-1)*8, y% + yi)
next xi
next yi
next c
end sub

screen _newimage(1280, 480, 0 )

_LETCHR$(0 , _
    "X......." + _
    "XX......" + _
    "XXX....." + _
    "XXXX...." + _
    "XXXXX..." + _
    "XXXXXX.." + _
    "XXXXXXX." + _
    "XXXXXXXX")
    
_LETCHR$(1 , _
    ".......X" + _
    "......XX" + _
    ".....XXX" + _
    "....XXXX" + _
    "...XXXXX" + _
    "..XXXXXX" + _
    ".XXXXXXX" + _
    "XXXXXXXX")
    
_LETCHR$(2 , _
    "XXXXXXXX" + _
    ".XXXXXXX" + _
    "..XXXXXX" + _
    "...XXXXX" + _
    "....XXXX" + _
    ".....XXX" + _
    "......XX" + _
    ".......X")
    
_LETCHR$(3 , _
    "XXXXXXXX" + _
    "XXXXXXX." + _
    "XXXXXX.." + _
    "XXXXX..." + _
    "XXXX...." + _
    "XXX....." + _
    "XX......" + _
    "X.......")
    
again:
    v = int(rnd*4)
    color int(rnd*15) + 1
    putstring( chr$(v), int(rnd*1280), int(rnd*480) )
    _delay 0.00125
    goto again

CharlieJV

Published:


You cannot view this attachment.

johnno56

No way. Not silly at all. Something I noticed that I failed to see before...

You cannot view this attachment.

The "black" (".") of the string is not black but transparent!"
This would imply that, multi-coloured characters, could be built by
layering multiple characters. (Of course with the potential of
sacrificing performance...)

This could be fun!
May your journey be free of incident.  Live long and prosper.

johnno56

Something like this...

sub PUTSTRING(s$, x%, y%)
' ⎺⎺⎺⎺⎺⎺⎺⎺⎺
for c = 1 to len(s$)
   sc$ = MID$(s$, c, 1)
this$ = _GETCHR$(ASC(sc$))
for yi = 0 to 7
for xi = 0 to 7
IF MID$(this$, (xi + yi*8) + 1, 1) = "X" THEN PSET (x% + xi + (c-1)*8, y% + yi)
next xi
next yi
next c
end sub

screen _newimage(24, 24, 16 )

_LETCHR$(0 , _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X")
    
_LETCHR$(1 , _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X.")
    
again:
    color 11
    putstring( chr$(0), 0, 0 )
    color 12
		putstring( chr$(1), 0, 0 )
    goto again

Of course, this is only displaying two 'fixed' characters... I wonder how well an animated demo would look? Moo Ha Ha Ha!
May your journey be free of incident.  Live long and prosper.

johnno56

Slightly modified original... Hmm... Cannot detect any speed variance...

sub PUTSTRING(s$, x%, y%)
' ⎺⎺⎺⎺⎺⎺⎺⎺⎺
for c = 1 to len(s$)
   sc$ = MID$(s$, c, 1)
this$ = _GETCHR$(ASC(sc$))
for yi = 0 to 7
for xi = 0 to 7
IF MID$(this$, (xi + yi*8) + 1, 1) = "X" THEN PSET (x% + xi + (c-1)*8, y% + yi)
next xi
next yi
next c
end sub

screen _newimage(640, 240, 0 )

_LETCHR$(0 , _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X")

_LETCHR$(1 , _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X.")

_LETCHR$(2 , _
    "XXXXXXXX" + _
    "X......X" + _
    "X..XX..X" + _
    "X..XX..X" + _
    "X..XX..X" + _
    "X..XX..X" + _
    "X......X" + _
    "XXXXXXXX")

_LETCHR$(3 , _
    "........" + _
    ".XXXXXX." + _
    ".XX..XX." + _
    ".XX..XX." + _
    ".XX..XX." + _
    ".XX..XX." + _
    ".XXXXXX." + _
    "........")

again:
    x1 = int(rnd*640): y1 = int(rnd*240)
    color int(rnd*15) + 1
		putstring( chr$(0), x1, y1)
		color int(rnd*15) + 1
    putstring( chr$(1), x1, y1)
		x2 = int(rnd*640): y2 = int(rnd*240)
		color int(rnd*15) + 1
    putstring( chr$(2), x2, y2)
		color int(rnd*15) + 1
    putstring( chr$(3), x2, y2)
    _delay 0.00125
    goto again
May your journey be free of incident.  Live long and prosper.

CharlieJV

Quote from: johnno56 on May 07, 2023, 08:17 PMNo way. Not silly at all. Something I noticed that I failed to see before...

You cannot view this attachment.

The "black" (".") of the string is not black but transparent!"
This would imply that, multi-coloured characters, could be built by
layering multiple characters. (Of course with the potential of
sacrificing performance...)

This could be fun!


Huh.  I knew that the "." part was transparent, but I had not considered any wildly interesting things like layered characters.

I love unplanned/surprise "hey, we can do this" moments!

CharlieJV

Quote from: johnno56 on May 07, 2023, 09:01 PMSlightly modified original... Hmm... Cannot detect any speed variance...

sub PUTSTRING(s$, x%, y%)
' ⎺⎺⎺⎺⎺⎺⎺⎺⎺
for c = 1 to len(s$)
   sc$ = MID$(s$, c, 1)
this$ = _GETCHR$(ASC(sc$))
for yi = 0 to 7
for xi = 0 to 7
IF MID$(this$, (xi + yi*8) + 1, 1) = "X" THEN PSET (x% + xi + (c-1)*8, y% + yi)
next xi
next yi
next c
end sub

screen _newimage(640, 240, 0 )

_LETCHR$(0 , _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X")

_LETCHR$(1 , _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X." + _
    ".X.X.X.X" + _
    "X.X.X.X.")

_LETCHR$(2 , _
    "XXXXXXXX" + _
    "X......X" + _
    "X..XX..X" + _
    "X..XX..X" + _
    "X..XX..X" + _
    "X..XX..X" + _
    "X......X" + _
    "XXXXXXXX")

_LETCHR$(3 , _
    "........" + _
    ".XXXXXX." + _
    ".XX..XX." + _
    ".XX..XX." + _
    ".XX..XX." + _
    ".XX..XX." + _
    ".XXXXXX." + _
    "........")

again:
    x1 = int(rnd*640): y1 = int(rnd*240)
    color int(rnd*15) + 1
		putstring( chr$(0), x1, y1)
		color int(rnd*15) + 1
    putstring( chr$(1), x1, y1)
		x2 = int(rnd*640): y2 = int(rnd*240)
		color int(rnd*15) + 1
    putstring( chr$(2), x2, y2)
		color int(rnd*15) + 1
    putstring( chr$(3), x2, y2)
    _delay 0.00125
    goto again

I'm finding this really interesting.

CharlieJV

The blinking eyeball (?):

screen _newimage(12,12,0)  

sub PUTSTRING(s$, x%, y%)
' ⎺⎺⎺⎺⎺⎺⎺⎺⎺
for c = 1 to len(s$)
   sc$ = MID$(s$, c, 1)
this$ = _GETCHR$(ASC(sc$))
for yi = 0 to 7
for xi = 0 to 7
IF MID$(this$, (xi + yi*8) + 1, 1) = "X" THEN PSET (x% + xi + (c-1)*8, y% + yi)
next xi
next yi
next c
end sub

GOSUB SetupEyeballChars

Again:
  GOSUB CloseEyeball
  _DELAY 0.5 : GOSUB OpenEyeball1
  _DELAY 0.5 : GOSUB OpenEyeball2
  _DELAY 0.5 : GOSUB OpenEyeball3
  _DELAY 0.5 : GOSUB OpenEyeball4
  _DELAY 0.75
  _DELAY 0.5 : GOSUB CloseEyeball : GOSUB OpenEyeball3 
  _DELAY 0.5 : GOSUB CloseEyeball : GOSUB OpenEyeball2
  _DELAY 0.5 : GOSUB CloseEyeball : GOSUB OpenEyeball1
  _DELAY 0.5
GOTO Again:

END

CloseEyeball:
  COLOR 6
  PUTSTRING( CHR$(0), 2,2)
RETURN

OpenEyeball1:
  COLOR 15
  PUTSTRING( CHR$(1), 2,2)
  COLOR 9
  PUTSTRING( CHR$(2), 2,2)
RETURN

OpenEyeball2:
  COLOR 15
  PUTSTRING( CHR$(3), 2,2)
  COLOR 9
  PUTSTRING( CHR$(4), 2,2)
RETURN

OpenEyeball3:
  COLOR 15
  PUTSTRING( CHR$(5), 2,2)
  COLOR 9
  PUTSTRING( CHR$(6), 2,2)
RETURN

OpenEyeball4:
  COLOR 15
  PUTSTRING( CHR$(7), 2,2)
  COLOR 9
  PUTSTRING( CHR$(6), 2,2)
RETURN


SetupEyeballChars:

  _LETCHR$(0 , _
    "..XXXX.." + _
    ".XXXXXX." + _
    "XXXXXXXX" + _
    "XXXXXXXX" + _
    "XXXXXXXX" + _
    "XXXXXXXX" + _
    ".XXXXXX." + _
    "..XXXX..")
    
  _LETCHR$(1 , _
    "........" + _
    "........" + _
    "........" + _
    "........" + _
    ".XXXXXX." + _
    "........" + _
    "........" + _
    "........")
    
  _LETCHR$(2 , _
    "........" + _
    "........" + _
    "........" + _
    "........" + _
    "..XXXX.." + _
    "........" + _
    "........" + _
    "........")
    
  _LETCHR$(3 , _
    "........" + _
    "........" + _
    "........" + _
    ".XXXXXX." + _
    ".XXXXXX." + _
    "........" + _
    "........" + _
    "........")
    
  _LETCHR$(4 , _
    "........" + _
    "........" + _
    "........" + _
    "..XXXX.." + _
    "..XXXX.." + _
    "........" + _
    "........" + _
    "........")
    
  _LETCHR$(5 , _
    "........" + _
    "........" + _
    ".XXXXXX." + _
    "XXXXXXXX" + _
    "XXXXXXXX" + _
    ".XXXXXX." + _
    "........" + _
    "........")
    
  _LETCHR$(6 , _
    "........" + _
    "........" + _
    "...XX..." + _
    "..XXXX.." + _
    "..XXXX.." + _
    "...XX..." + _
    "........" + _
    "........")
    
  _LETCHR$(7 , _
    "........" + _
    "..XXXX.." + _
    ".XXXXXX." + _
    "XXXXXXXX" + _
    "XXXXXXXX" + _
    ".XXXXXX." + _
    "..XXXX.." + _
    "........")
    
RETURN

johnno56

May your journey be free of incident.  Live long and prosper.