[Ohrrpgce] Plan for LineSlice
teeemcee at gmail.com
Thu May 25 13:08:02 PDT 2017
On 25 May 2017 at 06:15, James Paige <Bob at hamsterrepublic.com> wrote:
> Here I am going to talk out LineSlice before I actually start implementing
> I think I have a pretty realistic chance of having time to do it sometime
> I'm going to go with a simple slice.
> It will draw a line from corner to corner
> I figure I can have a toggle for whether it draws from 0,0 <->
> width,height or 0, height <-> width,0
> I plan to also test it will negative width and height, although I think we
> have an unresolved issue of inside-out-slices sizes being off-by-one, and
> we have to decided how to resolve that.
We should fix that, no one is going to be relying on the exact
pixel-perfect size and position of negative rects*
The way I think about this is limit behaviour: as you decrease the width of
a rect slice from 10 to 0 to -10, it should be consistent, without jumping
by a pixel at the zero point.
* Well, actually, Adam did complain about negative-size rects in a
mailinglist post called "Version difference quirks" 4 years ago, but I
don't understand what the problem was. Maybe I should look at old copy of
Phantom Tactics to see.
(Aside: he also complained about key:Filtered alt problems, and I've
changed my mind since what I wrote in that thread, and now think that it
would be better to add some backcompat behaviour for old games, since PT is
probably not the only one broken by it).
Also I'm pretty confident in the plan I wrote on SS to allow negative width
slices by changing the way that anchor points and fillparent are affected
by negative sizes. I think you should be allowed to create negative size
line slices in the editor, since it's a lot more natural than having to
switch the start/end corners.
It may not be necessary to allow inputting negative sizes for other
slices... but if we've nailed down what the behaviour of negative size
slices is, then we also don't need to worry about allowing it.
> I would like to be able to do horizontal lines without having to care if
> height is 1 or 0, and vertical lines without caring if width is 1 or 0.
> Should there be a toggle for making zero-width / zero height lineslices
That's a good point. Zero-width/height rects are invisible, but line slices
should definitely be visible in that case. We don't need a toggle for that,
I see no use for it. I'm not certain about it, but 0x0 line slices could
also be drawn as a point.
> I will definitely be implementing convenience functions to set a line's
> position relative to screen points on other slices.
> I also really like the idea of being able to adjust line thickness, but I
> don't know the best way to go about that, especially regarding corners.
I don't know what the algorithm is to draw sharp corners, (though I think
opengl has builtin support for it?) but anyway it would require to know
which other line slice we're attached to.
The simpler alternative is to add an option to draw rounded line ends,
using ellipses. Giz created a screensaver which drew something like 10000
tiny ellipses to create a less-blocky grid, and it wasn't that slow.
But all of those things can be added later.
Note a thickness 2 or greater line will be drawn partially outside the
boundaries of the slice, but that's fine; rect slcies with borders already
do that (and width/height 0 line slices also)
> Maybe we need some kind of function allmodex function to paint a thick
> line... maybe even a styled line using a 1xwidth sprite?
A dedicated function would be good for efficiency, but it would be fine to
just draw a bunch of lines next to each other to achieve the same effect.
However, the tricky part is calculating the start/end position of each
line. They should be along a line perpendicular to the center of the line.
Oh, also if the end points are staggered like that, then the lines
potentially won't sit perfectly next to each other, you would have to draw
some extra lines to prevent gaps from opening. I can see exactly how to do
I hadn't thought about styled lines, but that's a neat idea. On the other
hand, not terribly much styling is possible with a 1*x sprite. But sticking
to 1*x has the large advantage that there would be no change in appearance
when the angle changes from 44 to 46. But if in future we switch to
hardware acceleration the way it appears could change.
> I am not worried about thick lines or styled lines in the first
> implementation, I just want to think about it enough to avoid any blunders
> that would make adding those later more difficult.
This is all fine.
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ohrrpgce