Artifact
29656fff104e225cc36c3a3f15ee1ad12287a320:
- File
sdl2/ttf-shim-functions.ss
— part of check-in
[31b4446932]
at
2018-01-08 17:10:49
on branch trunk
— Initial SDL_ttf support
(user:
ovenpasta@users.noreply.github.com
size: 2373)
0000: 28 64 65 66 69 6e 65 2d 73 64 6c 2d 66 75 6e 63 (define-sdl-func
0010: 20 28 2a 20 73 64 6c 2d 73 75 72 66 61 63 65 2d (* sdl-surface-
0020: 74 29 20 73 74 74 66 2d 72 65 6e 64 65 72 2d 74 t) sttf-render-t
0030: 65 78 74 2d 73 6f 6c 69 64 20 28 28 66 6f 6e 74 ext-solid ((font
0040: 20 28 2a 20 74 74 66 2d 66 6f 6e 74 29 29 20 28 (* ttf-font)) (
0050: 74 65 78 74 20 73 74 72 69 6e 67 29 20 28 66 67 text string) (fg
0060: 20 28 2a 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 (* sdl-color-t)
0070: 29 29 20 22 53 54 54 46 5f 52 65 6e 64 65 72 54 )) "STTF_RenderT
0080: 65 78 74 5f 53 6f 6c 69 64 22 29 0a 28 64 65 66 ext_Solid").(def
0090: 69 6e 65 2d 73 64 6c 2d 66 75 6e 63 20 28 2a 20 ine-sdl-func (*
00a0: 73 64 6c 2d 73 75 72 66 61 63 65 2d 74 29 20 73 sdl-surface-t) s
00b0: 74 74 66 2d 72 65 6e 64 65 72 2d 75 74 2d 66 38 ttf-render-ut-f8
00c0: 2d 73 6f 6c 69 64 20 28 28 66 6f 6e 74 20 28 2a -solid ((font (*
00d0: 20 74 74 66 2d 66 6f 6e 74 29 29 20 28 74 65 78 ttf-font)) (tex
00e0: 74 20 73 74 72 69 6e 67 29 20 28 66 67 20 28 2a t string) (fg (*
00f0: 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 29 29 20 sdl-color-t)))
0100: 22 53 54 54 46 5f 52 65 6e 64 65 72 55 54 46 38 "STTF_RenderUTF8
0110: 5f 53 6f 6c 69 64 22 29 0a 28 64 65 66 69 6e 65 _Solid").(define
0120: 2d 73 64 6c 2d 66 75 6e 63 20 28 2a 20 73 64 6c -sdl-func (* sdl
0130: 2d 73 75 72 66 61 63 65 2d 74 29 20 73 74 74 66 -surface-t) sttf
0140: 2d 72 65 6e 64 65 72 2d 75 6e 69 63 6f 64 65 2d -render-unicode-
0150: 73 6f 6c 69 64 20 28 28 66 6f 6e 74 20 28 2a 20 solid ((font (*
0160: 74 74 66 2d 66 6f 6e 74 29 29 20 28 74 65 78 74 ttf-font)) (text
0170: 20 28 2a 20 75 69 6e 74 31 36 29 29 20 28 66 67 (* uint16)) (fg
0180: 20 28 2a 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 (* sdl-color-t)
0190: 29 29 20 22 53 54 54 46 5f 52 65 6e 64 65 72 55 )) "STTF_RenderU
01a0: 4e 49 43 4f 44 45 5f 53 6f 6c 69 64 22 29 0a 28 NICODE_Solid").(
01b0: 64 65 66 69 6e 65 2d 73 64 6c 2d 66 75 6e 63 20 define-sdl-func
01c0: 28 2a 20 73 64 6c 2d 73 75 72 66 61 63 65 2d 74 (* sdl-surface-t
01d0: 29 20 73 74 74 66 2d 72 65 6e 64 65 72 2d 67 6c ) sttf-render-gl
01e0: 79 70 68 2d 73 6f 6c 69 64 20 28 28 66 6f 6e 74 yph-solid ((font
01f0: 20 28 2a 20 74 74 66 2d 66 6f 6e 74 29 29 20 28 (* ttf-font)) (
0200: 63 68 20 75 69 6e 74 31 36 29 20 28 66 67 20 28 ch uint16) (fg (
0210: 2a 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 29 29 * sdl-color-t)))
0220: 20 22 53 54 54 46 5f 52 65 6e 64 65 72 47 6c 79 "STTF_RenderGly
0230: 70 68 5f 53 6f 6c 69 64 22 29 0a 28 64 65 66 69 ph_Solid").(defi
0240: 6e 65 2d 73 64 6c 2d 66 75 6e 63 20 28 2a 20 73 ne-sdl-func (* s
0250: 64 6c 2d 73 75 72 66 61 63 65 2d 74 29 20 73 74 dl-surface-t) st
0260: 74 66 2d 72 65 6e 64 65 72 2d 74 65 78 74 2d 73 tf-render-text-s
0270: 68 61 64 65 64 20 28 28 66 6f 6e 74 20 28 2a 20 haded ((font (*
0280: 74 74 66 2d 66 6f 6e 74 29 29 20 28 74 65 78 74 ttf-font)) (text
0290: 20 73 74 72 69 6e 67 29 20 28 66 67 20 28 2a 20 string) (fg (*
02a0: 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 29 20 28 62 sdl-color-t)) (b
02b0: 67 20 28 2a 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 g (* sdl-color-t
02c0: 29 29 29 20 22 53 54 54 46 5f 52 65 6e 64 65 72 ))) "STTF_Render
02d0: 54 65 78 74 5f 53 68 61 64 65 64 22 29 0a 28 64 Text_Shaded").(d
02e0: 65 66 69 6e 65 2d 73 64 6c 2d 66 75 6e 63 20 28 efine-sdl-func (
02f0: 2a 20 73 64 6c 2d 73 75 72 66 61 63 65 2d 74 29 * sdl-surface-t)
0300: 20 73 74 74 66 2d 72 65 6e 64 65 72 2d 75 74 2d sttf-render-ut-
0310: 66 38 2d 73 68 61 64 65 64 20 28 28 66 6f 6e 74 f8-shaded ((font
0320: 20 28 2a 20 74 74 66 2d 66 6f 6e 74 29 29 20 28 (* ttf-font)) (
0330: 74 65 78 74 20 73 74 72 69 6e 67 29 20 28 66 67 text string) (fg
0340: 20 28 2a 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 (* sdl-color-t)
0350: 29 20 28 62 67 20 28 2a 20 73 64 6c 2d 63 6f 6c ) (bg (* sdl-col
0360: 6f 72 2d 74 29 29 29 20 22 53 54 54 46 5f 52 65 or-t))) "STTF_Re
0370: 6e 64 65 72 55 54 46 38 5f 53 68 61 64 65 64 22 nderUTF8_Shaded"
0380: 29 0a 28 64 65 66 69 6e 65 2d 73 64 6c 2d 66 75 ).(define-sdl-fu
0390: 6e 63 20 28 2a 20 73 64 6c 2d 73 75 72 66 61 63 nc (* sdl-surfac
03a0: 65 2d 74 29 20 73 74 74 66 2d 72 65 6e 64 65 72 e-t) sttf-render
03b0: 2d 75 6e 69 63 6f 64 65 2d 73 68 61 64 65 64 20 -unicode-shaded
03c0: 28 28 66 6f 6e 74 20 28 2a 20 74 74 66 2d 66 6f ((font (* ttf-fo
03d0: 6e 74 29 29 20 28 74 65 78 74 20 28 2a 20 75 69 nt)) (text (* ui
03e0: 6e 74 31 36 29 29 20 28 66 67 20 28 2a 20 73 64 nt16)) (fg (* sd
03f0: 6c 2d 63 6f 6c 6f 72 2d 74 29 29 20 28 62 67 20 l-color-t)) (bg
0400: 28 2a 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 29 (* sdl-color-t))
0410: 29 20 22 53 54 54 46 5f 52 65 6e 64 65 72 55 4e ) "STTF_RenderUN
0420: 49 43 4f 44 45 5f 53 68 61 64 65 64 22 29 0a 28 ICODE_Shaded").(
0430: 64 65 66 69 6e 65 2d 73 64 6c 2d 66 75 6e 63 20 define-sdl-func
0440: 28 2a 20 73 64 6c 2d 73 75 72 66 61 63 65 2d 74 (* sdl-surface-t
0450: 29 20 73 74 74 66 2d 72 65 6e 64 65 72 2d 67 6c ) sttf-render-gl
0460: 79 70 68 2d 73 68 61 64 65 64 20 28 28 66 6f 6e yph-shaded ((fon
0470: 74 20 28 2a 20 74 74 66 2d 66 6f 6e 74 29 29 20 t (* ttf-font))
0480: 28 63 68 20 75 69 6e 74 31 36 29 20 28 66 67 20 (ch uint16) (fg
0490: 28 2a 20 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 29 (* sdl-color-t))
04a0: 20 28 62 67 20 28 2a 20 73 64 6c 2d 63 6f 6c 6f (bg (* sdl-colo
04b0: 72 2d 74 29 29 29 20 22 53 54 54 46 5f 52 65 6e r-t))) "STTF_Ren
04c0: 64 65 72 47 6c 79 70 68 5f 53 68 61 64 65 64 22 derGlyph_Shaded"
04d0: 29 0a 28 64 65 66 69 6e 65 2d 73 64 6c 2d 66 75 ).(define-sdl-fu
04e0: 6e 63 20 28 2a 20 73 64 6c 2d 73 75 72 66 61 63 nc (* sdl-surfac
04f0: 65 2d 74 29 20 73 74 74 66 2d 72 65 6e 64 65 72 e-t) sttf-render
0500: 2d 74 65 78 74 2d 62 6c 65 6e 64 65 64 20 28 28 -text-blended ((
0510: 66 6f 6e 74 20 28 2a 20 74 74 66 2d 66 6f 6e 74 font (* ttf-font
0520: 29 29 20 28 74 65 78 74 20 73 74 72 69 6e 67 29 )) (text string)
0530: 20 28 66 67 20 28 2a 20 73 64 6c 2d 63 6f 6c 6f (fg (* sdl-colo
0540: 72 2d 74 29 29 29 20 22 53 54 54 46 5f 52 65 6e r-t))) "STTF_Ren
0550: 64 65 72 54 65 78 74 5f 42 6c 65 6e 64 65 64 22 derText_Blended"
0560: 29 0a 28 64 65 66 69 6e 65 2d 73 64 6c 2d 66 75 ).(define-sdl-fu
0570: 6e 63 20 28 2a 20 73 64 6c 2d 73 75 72 66 61 63 nc (* sdl-surfac
0580: 65 2d 74 29 20 73 74 74 66 2d 72 65 6e 64 65 72 e-t) sttf-render
0590: 2d 75 74 2d 66 38 2d 62 6c 65 6e 64 65 64 20 28 -ut-f8-blended (
05a0: 28 66 6f 6e 74 20 28 2a 20 74 74 66 2d 66 6f 6e (font (* ttf-fon
05b0: 74 29 29 20 28 74 65 78 74 20 73 74 72 69 6e 67 t)) (text string
05c0: 29 20 28 66 67 20 28 2a 20 73 64 6c 2d 63 6f 6c ) (fg (* sdl-col
05d0: 6f 72 2d 74 29 29 29 20 22 53 54 54 46 5f 52 65 or-t))) "STTF_Re
05e0: 6e 64 65 72 55 54 46 38 5f 42 6c 65 6e 64 65 64 nderUTF8_Blended
05f0: 22 29 0a 28 64 65 66 69 6e 65 2d 73 64 6c 2d 66 ").(define-sdl-f
0600: 75 6e 63 20 28 2a 20 73 64 6c 2d 73 75 72 66 61 unc (* sdl-surfa
0610: 63 65 2d 74 29 20 73 74 74 66 2d 72 65 6e 64 65 ce-t) sttf-rende
0620: 72 2d 75 6e 69 63 6f 64 65 2d 62 6c 65 6e 64 65 r-unicode-blende
0630: 64 20 28 28 66 6f 6e 74 20 28 2a 20 74 74 66 2d d ((font (* ttf-
0640: 66 6f 6e 74 29 29 20 28 74 65 78 74 20 28 2a 20 font)) (text (*
0650: 75 69 6e 74 31 36 29 29 20 28 66 67 20 28 2a 20 uint16)) (fg (*
0660: 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 29 29 20 22 sdl-color-t))) "
0670: 53 54 54 46 5f 52 65 6e 64 65 72 55 4e 49 43 4f STTF_RenderUNICO
0680: 44 45 5f 42 6c 65 6e 64 65 64 22 29 0a 28 64 65 DE_Blended").(de
0690: 66 69 6e 65 2d 73 64 6c 2d 66 75 6e 63 20 28 2a fine-sdl-func (*
06a0: 20 73 64 6c 2d 73 75 72 66 61 63 65 2d 74 29 20 sdl-surface-t)
06b0: 73 74 74 66 2d 72 65 6e 64 65 72 2d 74 65 78 74 sttf-render-text
06c0: 2d 62 6c 65 6e 64 65 64 2d 77 72 61 70 70 65 64 -blended-wrapped
06d0: 20 28 28 66 6f 6e 74 20 28 2a 20 74 74 66 2d 66 ((font (* ttf-f
06e0: 6f 6e 74 29 29 20 28 74 65 78 74 20 73 74 72 69 ont)) (text stri
06f0: 6e 67 29 20 28 66 67 20 28 2a 20 73 64 6c 2d 63 ng) (fg (* sdl-c
0700: 6f 6c 6f 72 2d 74 29 29 20 28 77 72 61 70 4c 65 olor-t)) (wrapLe
0710: 6e 67 74 68 20 75 69 6e 74 33 32 29 29 20 22 53 ngth uint32)) "S
0720: 54 54 46 5f 52 65 6e 64 65 72 54 65 78 74 5f 42 TTF_RenderText_B
0730: 6c 65 6e 64 65 64 5f 57 72 61 70 70 65 64 22 29 lended_Wrapped")
0740: 0a 28 64 65 66 69 6e 65 2d 73 64 6c 2d 66 75 6e .(define-sdl-fun
0750: 63 20 28 2a 20 73 64 6c 2d 73 75 72 66 61 63 65 c (* sdl-surface
0760: 2d 74 29 20 73 74 74 66 2d 72 65 6e 64 65 72 2d -t) sttf-render-
0770: 75 74 2d 66 38 2d 62 6c 65 6e 64 65 64 2d 77 72 ut-f8-blended-wr
0780: 61 70 70 65 64 20 28 28 66 6f 6e 74 20 28 2a 20 apped ((font (*
0790: 74 74 66 2d 66 6f 6e 74 29 29 20 28 74 65 78 74 ttf-font)) (text
07a0: 20 73 74 72 69 6e 67 29 20 28 66 67 20 28 2a 20 string) (fg (*
07b0: 73 64 6c 2d 63 6f 6c 6f 72 2d 74 29 29 20 28 77 sdl-color-t)) (w
07c0: 72 61 70 4c 65 6e 67 74 68 20 75 69 6e 74 33 32 rapLength uint32
07d0: 29 29 20 22 53 54 54 46 5f 52 65 6e 64 65 72 55 )) "STTF_RenderU
07e0: 54 46 38 5f 42 6c 65 6e 64 65 64 5f 57 72 61 70 TF8_Blended_Wrap
07f0: 70 65 64 22 29 0a 28 64 65 66 69 6e 65 2d 73 64 ped").(define-sd
0800: 6c 2d 66 75 6e 63 20 28 2a 20 73 64 6c 2d 73 75 l-func (* sdl-su
0810: 72 66 61 63 65 2d 74 29 20 73 74 74 66 2d 72 65 rface-t) sttf-re
0820: 6e 64 65 72 2d 75 6e 69 63 6f 64 65 2d 62 6c 65 nder-unicode-ble
0830: 6e 64 65 64 2d 77 72 61 70 70 65 64 20 28 28 66 nded-wrapped ((f
0840: 6f 6e 74 20 28 2a 20 74 74 66 2d 66 6f 6e 74 29 ont (* ttf-font)
0850: 29 20 28 74 65 78 74 20 28 2a 20 75 69 6e 74 31 ) (text (* uint1
0860: 36 29 29 20 28 66 67 20 28 2a 20 73 64 6c 2d 63 6)) (fg (* sdl-c
0870: 6f 6c 6f 72 2d 74 29 29 20 28 77 72 61 70 4c 65 olor-t)) (wrapLe
0880: 6e 67 74 68 20 75 69 6e 74 33 32 29 29 20 22 53 ngth uint32)) "S
0890: 54 54 46 5f 52 65 6e 64 65 72 55 4e 49 43 4f 44 TTF_RenderUNICOD
08a0: 45 5f 42 6c 65 6e 64 65 64 5f 57 72 61 70 70 65 E_Blended_Wrappe
08b0: 64 22 29 0a 28 64 65 66 69 6e 65 2d 73 64 6c 2d d").(define-sdl-
08c0: 66 75 6e 63 20 28 2a 20 73 64 6c 2d 73 75 72 66 func (* sdl-surf
08d0: 61 63 65 2d 74 29 20 73 74 74 66 2d 72 65 6e 64 ace-t) sttf-rend
08e0: 65 72 2d 67 6c 79 70 68 2d 62 6c 65 6e 64 65 64 er-glyph-blended
08f0: 20 28 28 66 6f 6e 74 20 28 2a 20 74 74 66 2d 66 ((font (* ttf-f
0900: 6f 6e 74 29 29 20 28 63 68 20 75 69 6e 74 31 36 ont)) (ch uint16
0910: 29 20 28 66 67 20 28 2a 20 73 64 6c 2d 63 6f 6c ) (fg (* sdl-col
0920: 6f 72 2d 74 29 29 29 20 22 53 54 54 46 5f 52 65 or-t))) "STTF_Re
0930: 6e 64 65 72 47 6c 79 70 68 5f 42 6c 65 6e 64 65 nderGlyph_Blende
0940: 64 22 29 0a 0a d")..