Age | Commit message (Collapse) | Author |
|
Cosmetic readability change, I don't like to typedef pointer types
|
|
some trivial rearranging as well
|
|
|
|
It appears at some point some of the getters were lost, or
maybe were never implemented.
Regardless, what's there uses result pointer parameters and it's
more annoying to use that way. Just return the values directly,
not like there are error conditions to distinguish.
|
|
This hasn't belonged in libstage since losing all dimensionality
|
|
|
|
Now stage_t is the only type, and a tree of stages may be
constructed by supplying a parent to stage_new().
Essentially stage_t swallowed stage_node_t.
The heirarchy is handy for grouping stages logically, and alpha
is computed statefully during the recursive render. So alpha of
grouped stages may be varied at a single parent. The active
flag is also honored recursively for a similar effect; toggle
subtrees in a single place.
Container stages may be created by omitting object/render/free
attributes. These are handy for the aforementioned group
alpha/active controls.
|
|
|
|
|
|
|
|
|
|
|
|
Preparing to discard src/list.h
|
|
Now that libstage has no coupling to the rendering backend,
there's no need for this.
|
|
Having the stage manage the rendering dimensions for nodes
seemed like a good idea at the time.
This commit removes all that so there's no more coupling to
SDL or dimensional types. Now the stage really is nothing
more than a thin drawing list abstraction. The layers can be
used for ordering the drawing, which is the only semi-dimensional
thing remaining.
The stage_fit() helper remains for now out of convenience, but
it's really out of place in this library.
|
|
I added a way to set these mappings per-node, but not per-stage.
This adds setters for the stage, and new nodes are created with
the current per-stage setting. The nodes may still have their
mapping mode changed independent of the stage and one another, but
this gives a means of easily setting a global mapping mode for a
given stage.
|
|
Until now all aabb and position mapping has been simple linear
filling of the stage. When the stage isn't square, which is
usually, this isn't always desirable especially for the aabb
sizing of things. This introduces per-node settings for the
mapping of the node's aabb and position.
The default continues to be to map the full stage, with two new
settings for the minimum square and maximum square.
|
|
Static nodes are unaffected by stage movement, or if later there's a
hierarchy in the stage, this would probably escape all ancestral influence.
The anticipated use case is overlays like consoles, HUDs, and scores etc.
Things which don't move with the dynamic game field.
|
|
Initially it seemed plausible this might have to work on more than
stage nodes, like composite or ephemeral constructions involving the
same aabb/pos/origin types, but it doesn't seem to be the case for
now so operate on the higher order node and stage types.
Also makes it simpler to stick logic conditional on node state inside
the function...
|
|
Just pass in the boolean setting rather than having different
functions.
|
|
Callers of libstage may be middle abstractions which don't actually
have any SDL dependency, don't unnecessarily introduce one by forcing
them to include SDL headers.
|
|
There was too much fractional math happening at once resulting in
artifacts like nodes sharing the same position jiggling relative to
eachother as they moved. Instead compute the various values discretely,
flooring their values.
This also integrates the node origin, which previously was ignored.
A clamp has also been added to prevent zero-size nodes in rect w or h when
their AABB dimensions are non-zero.
|
|
A way to specify how the node's position relates to the node's
AABB rather than always being centered.
An origin of -1,-1 would place position at the bottom left corner
of the node's AABB, and +1,+1 the top right corner.
|
|
Starting to get an inkling of a need for a more hierarchical structure for
the stage. Something which allows arbitrary grouping of nodes which can
then be moved around and even scaled as one at the parent.
|
|
|
|
It's desirable to be able to fit dimensions to an aspect ratio prior
to stage creation. Since stage creation requires an SDL2 Renderer,
it must already have the window etc. Turn this into a lower level
helper for fitting so the window can be sized before creating the
renderer from it.
Should probably name it differently, but this is fine for now.
|
|
Convenient for whole-stage fades...
|
|
|
|
Leaving the existing node aabb semantics as both sizing and placing the
node relative to the stage size and its center, add a simple means of
statefully shifting the aabb.
When the position is left unset, it's 0,0, and effectively a noop leaving
the aabb to exclusively size and place the node. If you treat the aabb
as purely sizing the node, treating it as centered at 0,0 then you can
exclusively use this position api for placement of the node.
|
|
This code was used in whale [1], and prior to that was used in
a smaller project called mal. Since I seemed to be doing a lot of
reusing and building upon this, it seemed prudent to just stick it
in a repo as a .a I could submodule in future SDL2 art projects.
There are some kludges in this code currently, which will be fixed up
in time.
|