29#include <EASTL/functional.h>
128 void setup(
unsigned itemCount,
const Config& config);
130 void setOnEvent(eastl::function<
void(
Event)>&& callback) { m_callback = eastl::move(callback); }
145 void step(int32_t items) { m_target += FixedPoint<>(items, int32_t(0)); }
161 const Slot&
slot(
unsigned n)
const {
return m_slots[n]; }
173 unsigned wrap(int32_t
i)
const;
175 unsigned resolve()
const {
176 FixedPoint<> half(int32_t(0), int32_t(FixedPoint<>::scale / 2));
177 return wrap((m_position + half).integer<int32_t>());
181 if (m_callback) m_callback(
e);
184 void build(
const Trig<>& trig);
186 FixedPoint<> fadeFor(FixedPoint<> d)
const;
188 static Vertex vtx(FixedPoint<> x, FixedPoint<> y) {
189 return Vertex{{.x = int16_t(x.integer<int32_t>()), .y = int16_t(y.integer<int32_t>())}};
192 Vertex at(FixedPoint<>
r, FixedPoint<> cosT, FixedPoint<> sinT)
const {
193 int16_t x = int16_t(m_config.
center.
x + (
r * cosT).integer<int32_t>());
194 int16_t y = int16_t(m_config.
center.
y + (
r * sinT).integer<int32_t>());
195 return Vertex{{.x = x, .y = y}};
199 eastl::function<void(Event)> m_callback =
nullptr;
201 FixedPoint<> m_angleStep;
202 FixedPoint<> m_position;
203 FixedPoint<> m_target;
204 Cursor m_cursor = {};
206 unsigned m_slotCount = 0;
207 unsigned m_itemCount = 0;
208 unsigned m_selected = 0;
A helix selector, seen down its own axis.
Definition helix-selector.hh:68
const Slot & slot(unsigned n) const
Slot 0 is the furthest from the camera. Draw them in order.
Definition helix-selector.hh:161
const Cursor & cursor() const
Where to draw the cursor marker, just inside the ring at the cursor angle.
Definition helix-selector.hh:163
Angle cursorAngle() const
The cursor's current angle, if you want to orient the marker you draw.
Definition helix-selector.hh:165
static constexpr unsigned c_maxSlots
Definition helix-selector.hh:126
void setup(unsigned itemCount, const Config &config)
Definition helix-selector.cpp:31
unsigned currentIndex() const
Definition helix-selector.hh:158
unsigned visibleCount() const
Definition helix-selector.hh:159
void setStickAngle(Angle a)
Crank by an absolute stick angle.
Definition helix-selector.cpp:48
void update(const Trig<> &trig)
Settle one frame and rebuild the visible slots.
Definition helix-selector.cpp:74
void step(int32_t items)
Crank by whole items. This is the d-pad adapter.
Definition helix-selector.hh:145
void setOnEvent(eastl::function< void(Event)> &&callback)
Definition helix-selector.hh:130
void activate()
Your confirm button's rising edge.
Definition helix-selector.cpp:64
A trigonometry table.
Definition trigonometry.hh:74
uint32_t r
Definition cpu.c:310
int i
Definition gte-regio.c:299
FixedPoint< 10 > Angle
A fixed point angle.
Definition trigonometry.hh:48
char e[1]
Definition string.c:119
Definition helix-selector.hh:104
FixedPoint innerRadius
Definition helix-selector.hh:106
unsigned farSpan
Definition helix-selector.hh:119
FixedPoint outerRadius
Definition helix-selector.hh:107
FixedPoint gap
Definition helix-selector.hh:111
FixedPoint settleRate
Definition helix-selector.hh:112
FixedPoint cursorZ
Definition helix-selector.hh:109
FixedPoint pitch
Definition helix-selector.hh:110
unsigned itemsPerTurn
Definition helix-selector.hh:113
unsigned nearSpan
Definition helix-selector.hh:118
FixedPoint cursorGap
Definition helix-selector.hh:121
FixedPoint cameraDistance
Definition helix-selector.hh:108
FixedPoint cursorHalfWidth
Definition helix-selector.hh:123
FixedPoint cursorLength
Definition helix-selector.hh:122
unsigned fadeItems
Definition helix-selector.hh:120
Vertex center
Definition helix-selector.hh:105
The cursor marker, as a triangle you can draw directly.
Definition helix-selector.hh:100
Vertex tip
Definition helix-selector.hh:101
Vertex left
Definition helix-selector.hh:101
Vertex right
Definition helix-selector.hh:101
Definition helix-selector.hh:70
unsigned index
Definition helix-selector.hh:72
Type
Definition helix-selector.hh:71
@ SelectionChanged
Definition helix-selector.hh:71
@ Activated
Definition helix-selector.hh:71
enum psyqo::HelixSelector::Event::Type type
One visible item.
Definition helix-selector.hh:84
unsigned index
Definition helix-selector.hh:85
Vertex a
Definition helix-selector.hh:86
Vertex b
Definition helix-selector.hh:86
Vertex glyph
Definition helix-selector.hh:87
Vertex d
Definition helix-selector.hh:86
FixedPoint fade
Definition helix-selector.hh:89
Vertex c
Definition helix-selector.hh:86
FixedPoint scale
Definition helix-selector.hh:88
The Vertex struct.
Definition common.hh:47
int16_t y
Definition common.hh:53
int16_t x
Definition common.hh:50