[Fluxus] Quick Text Overlay Hack

Dave Griffiths dave at pawfal.org
Tue Jul 7 01:34:09 PDT 2009


Hi Scott,

Sorry, I should have replied earlier to your message, but I've been
travelling around... 

That text looks really good - although it may be indeed be a better idea
to use type primitives - this is essentially what the scratchpad uses
(the code is currently just duplicated), so they are fast enough. My
long term aim is to rewrite the editor so it's written in scheme using
real type primitives and I can take the code out of the scratchpad.

What are you currently using to render the text? - it might be good to
make this into a new text drawing primitive, maybe replacing the old
(build-text) one.

It seems a common need to have an overlay method to do things in screen
space now - this should be possible by getting the camera matrix and
essentially parenting primitives to it. It would be better to have a
standard way of doing this, rather than having it hardcoded into
primitives like the image prim. 

I'll have a look into providing something like (overlay-transform) which
will allow such positioning to happen in screen space - eg:

(define (build-screen-text x y str)
    (with-state
        (concat (overlay-transform))
        (transform (vector x y 0))
        (build-type my-screen-font str)))

I need to do a load of gui work on the groworld game which will need
this too. I'll also make the gui reusable so we'll have some basic menu
widgets and things availible. I already have a text entry widget and
draggable objects in scheme bricks that need moving to the fluxus
collection.

cheers,

dave

On Mon, 2009-07-06 at 10:19 -0700, Scott wrote:
> (set-overlay-colour (vector 1.0 1.0 0.0 0.8))
> (set-overlay-vector (vector 
> "To: Fluxus"
> "From: Scott <alcoholiday at gmail.com>"
> "Subject: Quick Text Overlay Hack"
> " "
> ""
> "Hey Guys! I added the support for a text overlay. I'm using mostly
> for"
> "debug info, pop up menus and things like that."
> ""
> "Currently it just supports one non-proportional font, since I want
> to"
> "be able to line things up."
> ""
> "The api is really simple:"
> "(show-overlay 1) ;; turns it on"
> "(set-overlay-colour (vector 1.0 1.0 0.0 0.8)) ;; a nice 0.8 alpha
> yellow"
> "(set-overlay-vector (vector \"Your Text Here\""
> "                            \"Your Second line of text here\""
> "                            \"etc...\"))"
> ""
> "It's a little CPU intensive right now, but it would be easy to"
> "optimize it more if folks can use it."
> "-Scott"
> 
> 20090706-th69rtk4yh97iwanwfxs4ir6cn.jpg20090706-qwqiwyasmt811g3g9ywgdmncjw.jpg
> 




More information about the Fluxus mailing list