Browse Source

Add string render test

master
Macoy Madson 11 months ago
parent
commit
c4fa153d77
  1. 21
      src/SDLFontAtlas.cake

21
src/SDLFontAtlas.cake

@ -334,6 +334,27 @@
20 100 "The quick brown fox\n
jumps over the lazy dog.")
(scope
(var string-bounds SDL_Rect (array 0))
(var test-str (addr (const char)) " hel o ")
(get-string-render-size
(addr atlas)
test-str (strlen test-str)
(addr (field string-bounds x)) (addr (field string-bounds y))
(addr (field string-bounds w)) (addr (field string-bounds h)))
(set-fields string-bounds
w (- (field string-bounds w) (field string-bounds x))
h (- (field string-bounds h) (field string-bounds y))
x (+ (field string-bounds x) 100)
y (+ (field string-bounds y) 200))
(SDL_SetRenderDrawColor
renderer 255 255 255 255)
(SDL_RenderDrawRect renderer (addr string-bounds))
(render-string-length renderer (addr atlas)
texture
100 200
test-str (strlen test-str)))
(SDL_RenderPresent renderer)
(SDL_UpdateWindowSurface window))

Loading…
Cancel
Save