Libraries

s&box libraries

Hit Shapes

xaz.hit_shapes

non-rectangular UI regions in s&box

About

Hit Shapes
Non-rectangular UI regions in s&box

Hit Shapes wraps a shape resolver in a state machine that turns whole-panel mouse events into per-slot OnSlotEnter / OnSlotLeave / OnSlotClick callbacks.

Depends only on Vector2 and MousePanelEvent

Quick start example:
- Download the library
- Make a screen panel GameObject
- Add UI Panel --> Razor Hit Shape Demo
- Link camera to the Screen Panel
- Hit play

Built-in shapes

Radial(slots, innerRatio?, outerRatio?) - Wheel of equal wedges - 0..slots-1, clockwise from 12 o'clock
RectGrid(cols, rows) - Uniform grid - row-major, top-left = 0
Polygon(verts) - One polygon, unit coords - always 0 if inside
Polygons(polys) - Many polygons - index of first containing polygon
Custom(slotCount, nativeSize, fn) - Resolver de-scaled to a fixed pixel frame - whatever you return
CustomRaw(slotCount, fn) - Resolver receives raw engine-frame coords - whatever you return
Union(a, b) - A's slots, then B's offset by A.SlotCount - A wins on overlap
Intersect(a, b) - A's slot, only where B also resolves - A's slot count
Difference(a, b) - A's slot, where B does NOT resolve - A's slot count

csscustomhithitboxrazorscssshapeshapes

More by xazware

01
Razor Designer thumbnail
Razor Designer xaz.razordesigner

Drag and Drop UI editor for Razor

designdesignereditorgrainsrazor
+0 24h
14favorites
15upvotes
80%Wilson score
02
goo thumbnail
goo xaz.goo

a c# ui library for s&box. build hud and menu panels in pure c#, no .razor required.

csharpgooguilibraryrazor
+0 24h
3favorites
3upvotes
44%Wilson score