Commit Graph

16 Commits

Author SHA1 Message Date
Bill Currie 79e4a5f6a8 [ui] Add the concept of draw order to canvases
Canvas draw order is sorted by group then order within the group. As a
fallback, the canvas entity id is used to keep the sort stable, but
that's only as stable as the ids themselves (if the canvases are
destroyed and recreated, the ids may switch around).
2023-07-09 23:27:26 +09:00
Bill Currie c2d68f5495 [ui] Avoid creating a subpool for the canvas component
It's never used and just not needed.
2023-07-09 22:22:05 +09:00
Bill Currie a8b80c4be5 [ui] Delete subpools when a canvas is deleted
Yet another finger in the memory dyke.
2023-07-09 12:06:08 +09:00
Bill Currie bf05da26cc [ui] Make Canvas_SetLen operate on only one canvas
I plan on using sub-canvases to fix the imui window overlap issue and
don't want the windows being affected by (eg) hud canvas size changes.
2023-07-08 20:56:40 +09:00
Bill Currie 0fab830be6 [ui] Implement auto-expand layout
By default, horizontal and vertical layouts expand to fill their parent
in their on-axis direction (horizontally for horizontal layouts), but
fit to their child views in their off-axis.

Flexible space views take advantage of auto-expansion, pushing sibling
views such that the grandparent view is filled on the parent view's
on-axis, and the parent view is filled by the space in the parent view's
off-axis. Flexible views currently have a background fill, allowing them
to provide background filling of the overall view with minimal overdraw
(ancestor views don't need to have any fill at all).
2023-07-05 19:33:00 +09:00
Bill Currie 104fba13a6 [ui] Add a text color component
Despite the current rendering API taking only byte color, the component
holds a uint32_t to allow for rgba color when I figure out a suitable
API.
2023-07-04 17:17:16 +09:00
Bill Currie 4eef11c329 [ui] Add visibility control to canvases 2023-07-01 19:53:26 +09:00
Bill Currie c1cd81222d [ui] Add font text drawing to canvas
Both passage and simple text are supported, but only simple text has
been tested at this stage. However, as passage text was taken directly
from rua_gui.c and formed the basis for simple text rendering, I expect
it's at least close to working.
2023-07-01 19:49:49 +09:00
Bill Currie 89afcfcb6d [ui] Add a lateupdate component to canvas
Like update, the function takes just a view, but is useful for updates
that need to run after the other components are run.
2023-01-22 03:43:58 +09:00
Bill Currie 03e867f0f8 [ui] Remove some extra debug outlines
Forcing hidden views and doing the outlines for the screen canvas were
part of sorting out weirdnesses with canvases and component sub-pools.
2023-01-21 11:20:09 +09:00
Bill Currie f0fab885d4 [ui] Get canvas into a usable state
Canvas_SortComponentPool now takes the raw canvas component id as it is
specialized to the canvas subpools.

Canvas_SetLen resizes the root view and then updates the hierarchy for
every canvas in the system.

Canvas_InitSys sets up the component system with the systems it needs
(canvas, view, text). This is required to ensure view_href is just past
the canvas components as it is needed for retrieving the actual canvas
component (and thus sub-pool range ids) from arbitrary views in the
canvas.

Entities are fetched with the correct offset from the pool entities.
2023-01-21 03:26:02 +09:00
Bill Currie 32cead5f88 [ui] Add a function to create a new canvas entity
The entity has only a canvas component and (root) view component
attached. The plan is to use it for screen-space canvases.
2023-01-20 15:57:29 +09:00
Bill Currie 4e1ddaa964 [renderer] Add fitted pic rendering
The pic is scaled to fill the specified rect (then clipped to the
screen (effectively)). Done just for the console background for now, but
it will be used for slice-pics as well.

Not implemented for vulkan yet as I'm still thinking about the
descriptor management needed for the instanced rendering.

Making the conback rendering conditional gave an approximately 3% speed
boost to glsl with the GL stub (~12200fps to ~12550fps), for either
conback render method.
2023-01-17 11:33:47 +09:00
Bill Currie 8833518826 [ecs] Support sorting subpools
Sorting the whole pool when subpools are in use could break the
subpools (very high probability, depending on the sort criteria and
subpool criteria).
2023-01-16 11:32:12 +09:00
Bill Currie b5912bba9b [ui] Clean up the canvas component
It turns out only the range ids are needed in the canvas component at
this stage, and moving the canvas system base into canvas_system_t makes
sense.
2022-12-21 01:54:10 +09:00
Bill Currie 6decbd18c4 [ui] Add a canvas system
This is the beginning of supporting 2d rendering in 3d space. The idea
is that a canvas can be in 2d orthographic space (not attached to any
entity with a 3d transform), or in 3d perspective space (attached to an
entity with a 3d transform, either as a child of the camera, or of some
object in 3d space).

It will replace the current HUD code when it's working.
2022-12-20 19:45:48 +09:00