No worries - I had trouble posting it to the group when I embedded pictures, so I hope I didn't end up spamming multiple times as I kept trying new ways to get the reflector to accept the post.<br><br>This was truly a hack, and just walks a vector right using the same code as the FPS display. This was more just me practicing writing extensions the Fluxus way and solving my immediate problem. <br>

<br>Once I was half we through with this, I came to the conclusion that it would make more sense to write into a texture, and then put that texture on a poly in camera space.<br><br>I can't say I totally grokked what Gabor did for his overlay function (for that matter, I don't really understand how the scenegraph -vs- immediate mode stuff interacts!), but something like that as you point out is a more general solution. And obviously, my needs for text display would be addressed if the onscreen editor was implemented from Scheme since I could just use the display code directly.<br>

<br>-Scott<br><br>FYI here's the guts of what I added to Renderer.cpp:<br><br><span style="font-family: courier new,monospace;">    // Overlays a variable sized ascii display on top of rendered window</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    if (m_OverlayDisplay && !PickMode && m_OverlayDisplayVector)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      int lines = SCHEME_VEC_SIZE(m_OverlayDisplayVector);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      double top = Cam.GetTop();</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      double bot = Cam.GetBottom();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      double rowHeight = (top-bot)/lines;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      int i=0;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      for (double y=top; y>bot; i++, y-=rowHeight)</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        PushState();</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">        GetState()->Transform.translate(Cam.GetLeft(),y,0);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        GetState()->Colour=m_OverlayColour; </span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">        if(SCHEME_CHAR_STRINGP(SCHEME_VEC_ELS(m_OverlayDisplayVector)[i])){</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">          DrawText(SCHEME_BYTE_STR_VAL(scheme_char_string_to_byte_string(SCHEME_VEC_ELS(m_OverlayDisplayVector)[i])));</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">        }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        PopState();</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   </span> }<br><br><br><div class="gmail_quote">On Tue, Jul 7, 2009 at 1:34 AM, Dave Griffiths <span dir="ltr"><<a href="mailto:dave@pawfal.org">dave@pawfal.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Scott,<br>
<br>
Sorry, I should have replied earlier to your message, but I've been<br>
travelling around...<br>
<br>
That text looks really good - although it may be indeed be a better idea<br>
to use type primitives - this is essentially what the scratchpad uses<br>
(the code is currently just duplicated), so they are fast enough. My<br>
long term aim is to rewrite the editor so it's written in scheme using<br>
real type primitives and I can take the code out of the scratchpad.<br>
<br>
What are you currently using to render the text? - it might be good to<br>
make this into a new text drawing primitive, maybe replacing the old<br>
(build-text) one.<br>
<br>
It seems a common need to have an overlay method to do things in screen<br>
space now - this should be possible by getting the camera matrix and<br>
essentially parenting primitives to it. It would be better to have a<br>
standard way of doing this, rather than having it hardcoded into<br>
primitives like the image prim.<br>
<br>
I'll have a look into providing something like (overlay-transform) which<br>
will allow such positioning to happen in screen space - eg:<br>
<br>
(define (build-screen-text x y str)<br>
    (with-state<br>
        (concat (overlay-transform))<br>
        (transform (vector x y 0))<br>
        (build-type my-screen-font str)))<br>
<br>
I need to do a load of gui work on the groworld game which will need<br>
this too. I'll also make the gui reusable so we'll have some basic menu<br>
widgets and things availible. I already have a text entry widget and<br>
draggable objects in scheme bricks that need moving to the fluxus<br>
collection.<br>
<br>
cheers,<br>
<br>
dave<br>
<div><div></div><div class="h5"><br>
On Mon, 2009-07-06 at 10:19 -0700, Scott wrote:<br>
> (set-overlay-colour (vector 1.0 1.0 0.0 0.8))<br>
> (set-overlay-vector (vector<br>
> "To: Fluxus"<br>
> "From: Scott <<a href="mailto:alcoholiday@gmail.com">alcoholiday@gmail.com</a>>"<br>
> "Subject: Quick Text Overlay Hack"<br>
> " "<br>
> ""<br>
> "Hey Guys! I added the support for a text overlay. I'm using mostly<br>
> for"<br>
> "debug info, pop up menus and things like that."<br>
> ""<br>
> "Currently it just supports one non-proportional font, since I want<br>
> to"<br>
> "be able to line things up."<br>
> ""<br>
> "The api is really simple:"<br>
> "(show-overlay 1) ;; turns it on"<br>
> "(set-overlay-colour (vector 1.0 1.0 0.0 0.8)) ;; a nice 0.8 alpha<br>
> yellow"<br>
> "(set-overlay-vector (vector \"Your Text Here\""<br>
> "                            \"Your Second line of text here\""<br>
> "                            \"etc...\"))"<br>
> ""<br>
> "It's a little CPU intensive right now, but it would be easy to"<br>
> "optimize it more if folks can use it."<br>
> "-Scott"<br>
><br>
</div></div>> 20090706-th69rtk4yh97iwanwfxs4ir6cn.jpg20090706-qwqiwyasmt811g3g9ywgdmncjw.jpg<br>
><br>
<br>
</blockquote></div><br>