diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-04 19:22:04 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 01:23:06 +0300 |
| commit | 41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch) | |
| tree | 3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/renderer.zig | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/renderer.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/renderer.zig | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/renderer.zig b/vendor/libghostty-vt/src/renderer.zig new file mode 100644 index 00000000..74755684 --- /dev/null +++ b/vendor/libghostty-vt/src/renderer.zig @@ -0,0 +1,66 @@ +//! Renderer implementation and utilities. The renderer is responsible for +//! taking the internal screen state and turning into some output format, +//! usually for a screen. +//! +//! The renderer is closely tied to the windowing system which usually +//! has to prepare the window for the given renderer using system-specific +//! APIs. The renderers in this package assume that the renderer is already +//! setup (OpenGL has a context, Vulkan has a surface, etc.) + +const build_config = @import("build_config.zig"); + +const cursor = @import("renderer/cursor.zig"); +const message = @import("renderer/message.zig"); +const size = @import("renderer/size.zig"); +pub const shadertoy = @import("renderer/shadertoy.zig"); +pub const Backend = @import("renderer/backend.zig").Backend; +pub const GenericRenderer = @import("renderer/generic.zig").Renderer; +pub const Metal = @import("renderer/Metal.zig"); +pub const OpenGL = @import("renderer/OpenGL.zig"); +pub const WebGL = @import("renderer/WebGL.zig"); +pub const Options = @import("renderer/Options.zig"); +pub const Overlay = @import("renderer/Overlay.zig"); +pub const Thread = @import("renderer/Thread.zig"); +pub const State = @import("renderer/State.zig"); +pub const CursorStyle = cursor.Style; +pub const Message = message.Message; +pub const Size = size.Size; +pub const Coordinate = size.Coordinate; +pub const CellSize = size.CellSize; +pub const ScreenSize = size.ScreenSize; +pub const GridSize = size.GridSize; +pub const Padding = size.Padding; +pub const cursorStyle = cursor.style; +pub const lib = @import("lib/main.zig"); + +/// The implementation to use for the renderer. This is comptime chosen +/// so that every build has exactly one renderer implementation. +pub const Renderer = switch (build_config.renderer) { + .metal => GenericRenderer(Metal), + .opengl => GenericRenderer(OpenGL), + .webgl => WebGL, +}; + +/// The health status of a renderer. These must be shared across all +/// renderers even if some states aren't reachable so that our API users +/// can use the same enum for all renderers. +pub const Health = enum(c_int) { + healthy, + unhealthy, + + test "ghostty.h Health" { + try lib.checkGhosttyHEnum(Health, "GHOSTTY_RENDERER_HEALTH_"); + } +}; + +test { + // Our comptime-chosen renderer + _ = Renderer; + + _ = cursor; + _ = message; + _ = shadertoy; + _ = size; + _ = Thread; + _ = State; +} |
