I'm sure this has been asked multiple times, but I couldn't think of the right combination of keywords to find it.
I never bothered with learning about memory stuff, but for efficiency I might need it.
This is sitelen pona, a writing system I am planning to use for a game. A glyph is 7x7(8x8 including borders), and so far I have a total of 132 characters.
I would like to know how I could
- efficiently store the glyphs(I can convert them into hexadecimal strings)
- have an efficient way to render them on the screen, with specified color
- have a way to store dialogue data, and render strings of characters
I'm sure I can find a way on my own, but so far I haven't had luck with the rendering part, and I'm also worried that it might be inefficient
take a look at the custom font stuff in the manual or in the release notes: https://www.lexaloffle.com/bbs/?tid=41544
"one-off characters" is another similar thing to search for, if you dont use these very often. but a custom font sounds like the way to go to me
Hi @Echo_Heo. If you just want to use P8SCII, there is a simple solution here:
(v03 01-02-22)
TO LOAD THIS PICO-8 CART, in immediate mode, type:
load #gift_of_glyphs
Examine source-code to see how it is done.
Call function glyph(xpos,ypos,glyphnumber,color)
And as @pancelor stated earlier, yes, you can have custom fonts. You are welcome to use my other tool here if you want to go that route. Fonts are stored 8-bytes per 8x8-pixeled character.
Here's a cart to help create your custom font. I've imported your image into a variation of @zep's font snippet tool.
I haven't attempted to move the characters around to match a good way to use your glyphs. You image was 12x12 and the custom font's are 16x?. (The m, n, o and other characters are not set to glyphs.) You'll want to copy and paste the glyphs around until it works for you. The cart will show you the original font characters so you can flip back and forth to align things up.
Well look what you did there, @McLeopold.
I was considering using the custom font, in fact I still have the code for it, but then I remembered that P8SCII's one-off would be nothing short of perfect and I wouldn't have to use a bunch of pokes for font or anything.
I was definitely going for brevity of code.
function _init() glyphs="001010100018146c002800306c386c18004444281028444400040c54fe540c04000000ec926e0000000044447c00100000442810001028440044442810101010001010102828c6000000244890482400000010107c101000006454381038544c0000384444443800000000384444000000fe92fe101010100000009282fe00000008344c38747c0c00384444443844820010306c1810287c00302818047444380000007a847a0000000054007c443800003050508888e60000ec927e10101010004444241c244444007c547c304a4c480010385444443800000038284428100000304c4482826418004824244448482400101028fe447c000030281800ccaa66003840504820100c0008102020201008000000c0be6000000068543c1028447c001c22fe22221c00007c4444447c5454000028107c1028000008102040201008000000281000000000000060920c0000007c44444444447c007c44380010287c00000010007c000000708888888a8c88000000fc927e0000004444444444443800385492fe92543800384444443828180082ba4444443800003844baaaba82820030281808080810003844444438fe82007c4438304a4c4800387caad6aa7c38007010101410107000ccba4644544438001e24484848241e00ccaa664444443800005454545454000000287c287c280000780472aa9a4438001010385410101000384444444444440010101010543810000000fc827e00000000141474443c0000101010003028180028544428544428000000c0a27c000000444444447c447c00fe928abaa292fe00304848304a4c480030282828282818002810281000281000540030484a4c480000040404047c00006c928244281010001028285454aafe0038101010101038002800103810381000000022a23e0000004444444444447c000000444438000000feaafe82aa92fe0000007c007c00000010929254440010000000feaaaa000000384040301000100080a0a8aaaa9e0000fe929292929292003844baaaba44380000101000c600000010080808382818001c10105010101c00fe8282d68282fe0054007c4444447c007880a8806a2a2a008282444428281000103844c6443810000000fe44440000000044aa000010000000003a468e00000020202038202020001814142222ce0000009c62008c720000385492b282443800540038444444380010284444447c000000282828282800006c92aa6c38281800007c44380010000000442810aa44000010926c28447c000020302820202020000810205480f808008282b2aaaa9a0000824428002844820000448292926c0000fe82baaaba82fe00001054aa280000003844447c44443800806098c698608000101010002810280010101000182828003078a878785a5a005400387c54443800feaafebac6fefe00ba44444438101000000000000c0c0000000c0c000c0c00" end function _update() end function glyph(x,y,t,c)print("\^:"..sub(glyphs,t*16+1,t*16+16),x,y,c)end |
Essentially 2-programming lines required to make use of.
[Please log in to post a comment]