_Title "8X16 ASCII Character Editor" 'started 2018-08-27 by bplus
'QB64 X 64 version 1.2 20180228/86 from git b301f92
' 2020-09-18 modified to coexist with the 8X8 Character Editor in the same Folder
'========================== Instructions: =================================
'
' Arrow keys move the highlighter around, spacebar toggles tile on/off
' or just click with mouse to do the same.
' Click buttons to either
' 1. Enter an ascii by number to edit.
' 2. Enter a character by pressing the key(s) from which the ascii number is taken.
' 3. Save a modified character.
' 4. Save all edits made to file called "Character Set.DAT".
' Note: If want to work with more sets, just rename Character Set.DAT
' If that file isn't found, this app will start from scratch.
'
'==========================================================================
Const cFile$
= "8X16 Character Set.DAT"
'============================== main
'see if there is a file in the works to load else start from scratch
SAVED = -1
b$ = ""
CS(a) = b$
SAVED = 0
'END
'sample B for starters
AN% = 66
load AN%
CX = 1: CY = 1
'ascii # to edit
Line (500, 50)-(700, 100), BLK
, BF
If a%
>= 0 And a%
<= 255 Then AN%
= a%: load AN%
'chr$ to edit
Line (500, 110)-(700, 160), BLK
, BF
If a%
>= 0 And a%
<= 255 Then AN%
= a%: load AN%
'save character edit
b$ = ""
b$ = b$ + MAP(x, y)
CS(AN%) = b$
Line (500, 170)-(700, 220), BLK
, BF
SAVED = 0
'file character set
Line (500, 230)-(700, 280), BLK
, BF
SAVED = -1
'mouse over edit box, toggle tiles and update cursor
tx = (mx - XOFF) \ SQ: ty = (my - YOFF) \ SQ
CX = tx: CY = ty
If MAP
(CX
, CY
) = "1" Then MAP
(CX
, CY
) = "0" Else MAP
(CX
, CY
) = "1" If MAP
(CX
, CY
) = "1" Then MAP
(CX
, CY
) = "0" Else MAP
(CX
, CY
) = "1" If CY
- 1 >= 1 Then CY
= CY
- 1 If CY
+ 1 <= CH
Then CY
= CY
+ 1 If CX
- 1 >= 1 Then CX
= CX
- 1 If CX
+ 1 <= CW
Then CX
= CX
+ 1
update
y = i \ CW + 1
MAP
(x
, y
) = Mid$(CS
(asci
), i
, 1)
drwBtn 500, 50, "Load map with Ascii"
drwBtn 500, 110, "Load map with Chr$"
drwBtn 500, 170, "Save Character Edit"
drwBtn 500, 230, "File Character Set"
If SAVED
Then s$
= " Saved." Else s$
= " not Saved yet." Line (XOFF
- 1, YOFF
- 1)-Step((CW
+ 2) * SQ
+ 2, (CH
+ 2) * SQ
+ 2), _RGB32(255, 255, 0), B
Line (XOFF
+ 1, YOFF
+ 1)-Step((CW
+ 2) * SQ
, (CH
+ 2) * SQ
), BLK
, B
Line (XOFF
, YOFF
)-Step((CW
+ 2) * SQ
, (CH
+ 2) * SQ
), _RGB32(255, 80, 0), BF
Line ((x
) * SQ
+ XOFF
, (y
) * SQ
+ YOFF
)-Step(SQ
- 2, SQ
- 2), c&
, BF
' let's see actual size!
drwChar XOFF + 16 * (i * 2), .5 * YOFF - (16 * i) / 2, AN%, i
'highlight sqr
Line (CX
* SQ
- 1 + XOFF
, CY
* SQ
- 1 + YOFF
)-Step(SQ
, SQ
), WHT
, B
th
= 16: tw
= 8 * Len(s$
): gray&
= _RGB32(190, 190, 190) Line (x
+ 1, y
+ 1)-Step(197, 47), gray&
, BF
Sub drwChar
(x0
, y0
, ascn
, size
) 'what ever the present color is set at i = i + 1
If Mid$(CS
(ascn
), i
, 1) = "1" Then Line (x0
+ x
* size
, y0
+ y
* size
)-Step(size
- 1, size
- 1), , BF