Well, I was working on a plugin, and I thought of something that would be really nice as an addendum to everything we already have: a method to attach images to lines with a certain offset so they can enrich the text in-context rather than to be a fixed part on the screen.
I figured the images from a certain miniwindow could be used, or perhaps a specialized miniwindow could be made to hold the images for this feature.
I propose the following:
AttachImageToLine(line, imageid, xpos, ydelta, flags)
-line: number of line to attach to, or -1 for the line Tell() would be writing to next.
-imageid: image id of previously loaded image with WindowLoadImage.
-xpos:position of left edge image, relative to the left-most part of drawing area. PIXELS.
-ydelta:delta from top edge of the line the function applies to in regards to the top edge of the image.
-flags:bitwise orred field like the ones in WindowCreate etc. It should support the following flags:
*above (like the opposite of the underneath window style, not specified means it is drawn UNDERNEATH any text, which is preferable as it would not interfere with the user selecting text because of scripting oversight.)
*transparent (you figure it out)
*matches_line_visibility (only drawn when the actual line it belongs to is visible as well; default would be to draw whenever it could logically be seen.)
*no_clip (don't clip to textrectangle boundaries - could give some nice effects with wide images I reckon)
Multiple images should be addable to the same line, and likewise, they should be removable at a later date. Stretching is one of those things that might be useful as well.
(Maybe an AttachImage() could be used that adds to the current line so that the AttachImageToLine() variety could use an unsigned int and specialize on modifying old things.)
Now that I am done writing all that, maybe it would be better and use more already written features to make it slightly different: turn it into an AttachWindowToLine(). That way hotspot functionality could easily be implemented as well. Only pinch would be to make sure the same window could be in multiple places at once (perhaps even on the same screen).
Anyhow, example mockup at: http://qs.merseine.nu/images/sillymockup.png
Explanation of lines:
CYAN: top of the line that was just displayed or noted or whatever.
GREEN: left edge of text rectangle
RED: boundaries used image (miniwindow?).
The codethat would probably match that output would be (triggering on the TYPE LEVEL line):
AttachImageToLine(-1, "sword", 0, -15, flag.above + flag.transparent)
Note("\n\n\n\n\n\n") -- for extra whitespace
If the way the Tell() code works wouldn't allow writing to the same line (and instead to a fresh one) it could be rewritten to the following with use of :
Note("%0")
AttachImageToLine(-1, "sword", 0, -15, flag.above + flag.transparent)
Note("\n\n\n\n\n\n") -- for extra whitespace
This should make things possible like.. putting a parchment / letter background beneath written letters in your game, icons in your score, flavoring images etc. Where miniwindows are static and a part of the user interface, these could be a part of the content. And unlike inline images, which would require lineheight etc to be taken into account, this is more like a 'set relative position, done' kind of deal.
Thoughts? |