Loading repository data…
Loading repository data…
Qerfcxz / repository
A pure Haskell UI engine built on Raw SDL2 bindings, featuring a state-machine based event flow, pixel-perfect adaptive text rendering, and a robust editor core. Designed specifically for text-heavy turn-based Roguelikes.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Note: The main content of this engine was completed within one month by a senior undergraduate student. It is built entirely from scratch using Haskell and SDL2 Raw Bindings, designed specifically to power a future text-heavy, turn-based Roguelike game.
Hsue is an experimental yet hardcore UI engine written in Haskell. Diverging from mainstream UI frameworks that rely on callbacks, DOM trees, or MVVM, Hsue adopts a unique State-Machine Event Flow, Sequence-Based Path Addressing, and a Pull/Request-Driven architecture.
It was born out of dissatisfaction with existing engines when handling complex text rendering, deep menu navigation, and pure state management. It prioritizes absolute control, performance optimization (especially for text), and logical decoupling over immediate ease of use.
The engine treats UI navigation as a state machine. Event handlers return explicit control IDs like Goto (jump to a specific widget flow) and Back (return to the previous state).
DS.Seq Int)Widgets are not directly nested in recursive data types. Instead, they are flattened into IntMaps and accessed via a strict path sequence (Data.Sequence Int).
Built-in support for a pure Coroutine widget (Wait, Loop, Then, Fork, Emit).
IO or dealing with thread synchronization.State mutation is entirely deferred. Widgets emit Requests (e.g., Create, Alter, Replace) combined with Instructions (spatial transforms like Move, , , ).
ScaleAngleFlipThe engine houses an incredibly complex and optimized text system:
IntMap to cache SDL Textures at the character/block level, recalculating and re-rasterizing dynamically based on the window's adaptive scale.Editor_binding), dual-cursor text selection, paragraph navigation, and native OS Clipboard integration (Copy/Paste).SDL_TEXTUREACCESS_TARGET) via the Canvas widget, allowing complex off-screen compositing before presenting to the main window.The Data Widget Family (Bool_data, Int_data, List_char_data, custom Data a) stores localized game state directly inside the UI map. Game logic can "pull" this data via IDs, perfectly decoupling the data layer from the presentation layer (ideal for Save/Load mechanics).
SDL.Raw bindings for low-level pointer and memory control)Data.Sequence (Finger Trees) for paths/text and Data.IntMap.Strict for high-performance widget storage.Text widget.binary or cereal for full UI state serialization (Save/Load system).说明: 本引擎的主要内容由一名大四学生在一个月内独立开发完成。它基于 Haskell 和 SDL2 Raw Bindings 从零构建,旨在支撑未来一款文字量巨大、逻辑复杂的回合制 Roguelike 游戏的开发。
Hsue 是一个实验性但硬核的纯 Haskell UI 引擎。与依赖回调、DOM树或 MVVM 的主流框架不同,Hsue 采用了独特的 状态机式事件流、基于序列的路径寻址 以及 请求驱动 (Request-Driven) 架构。
该引擎的诞生源于对现有引擎在处理复杂文本光栅化、深层菜单路由和纯函数状态管理时的局限性的不满。相比开箱即用,它更追求对底层的绝对控制力、极限的文本渲染性能以及业务逻辑的彻底解耦。
引擎将 UI 导航视为状态机。事件处理函数会返回显式的控制 ID,如 Goto(跳转到指定控件流)和 Back(回溯历史状态)。
DS.Seq Int)控件并非通过传统的递归数据类型直接嵌套。相反,它们被扁平化存储在 IntMap 中,并通过严格的路径序列 (Data.Sequence Int) 进行精确定位。
引擎原生提供了一个纯函数式的 Coroutine 控件(支持 Wait, Loop, Then, Fork, Emit)。
IO 机制,也无需处理多线程同步问题。所有状态变更都被延迟执行。控件发出 Request(如创建、修改、替换控件),并可附带 Instruction(空间变换指令,如 Move, Scale, Angle, Flip)。
引擎内部实现了一套极其复杂且高度优化的文本系统:
IntMap 对 SDL 纹理进行字符/块级别的缓存 (Block_font)。配合自适应缩放机制,在窗口尺寸改变时动态重新光栅化。Editor 控件,支持 50+ 可编程快捷键 (Editor_binding)、双光标高亮选区、段落级跳转,以及系统原生的剪贴板集成 (复制/粘贴)。Canvas 控件切换 SDL 渲染目标 (SDL_TEXTUREACCESS_TARGET),允许在最终呈现到屏幕前进行复杂的离屏渲染和图像合成。通过 Data 控件家族(Bool_data, Int_data, 自定义 Data a 等),组件的局部状态被直接保存在引擎的全局 Map 中。业务逻辑通过 ID "拉取 (Pull)" 这些数据,将数据层与渲染层完美剥离,天然支持游戏存读档 (Save/Load)。
SDL.Raw 绑定,进行底层的指针与内存操作,如 alloca, poke, peek)Data.Sequence (Finger Trees) 处理文本/路径,使用 Data.IntMap.Strict 构建极速的组件存储树。Text 控件添加 Markdown/XML 解析器以支持富文本排版。binary 或 cereal 库实现全 UI 状态序列化 (存读档系统)。