mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-23 21:08:07 +02:00
ubb-la/gui.c (gui): make panning zoom-dependent (2 samples at maximum zoom)
This commit is contained in:
parent
4fb2a8cbee
commit
435144223d
16
ubb-la/gui.c
16
ubb-la/gui.c
@ -206,6 +206,12 @@ static void update(void)
|
||||
}
|
||||
|
||||
|
||||
static int pos_step(int zoom)
|
||||
{
|
||||
return 1 << (MAX_ZOOM-zoom+1);
|
||||
}
|
||||
|
||||
|
||||
void gui(const uint8_t *buf, int skip, int nibbles)
|
||||
{
|
||||
SDL_Event event;
|
||||
@ -235,12 +241,14 @@ void gui(const uint8_t *buf, int skip, int nibbles)
|
||||
zoom--;
|
||||
break;
|
||||
case SDLK_LEFT:
|
||||
if (pos)
|
||||
pos--;
|
||||
pos -= pos_step(zoom);
|
||||
if (pos < 0)
|
||||
pos = 0;
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
if (pos < nibbles-1)
|
||||
pos++;
|
||||
pos += pos_step(zoom);
|
||||
if (pos > nibbles-1)
|
||||
pos = nibbles-1;
|
||||
break;
|
||||
case SDLK_RETURN:
|
||||
case SDLK_q:
|
||||
|
Loading…
Reference in New Issue
Block a user