mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-23 20:33:45 +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)
|
void gui(const uint8_t *buf, int skip, int nibbles)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
@ -235,12 +241,14 @@ void gui(const uint8_t *buf, int skip, int nibbles)
|
|||||||
zoom--;
|
zoom--;
|
||||||
break;
|
break;
|
||||||
case SDLK_LEFT:
|
case SDLK_LEFT:
|
||||||
if (pos)
|
pos -= pos_step(zoom);
|
||||||
pos--;
|
if (pos < 0)
|
||||||
|
pos = 0;
|
||||||
break;
|
break;
|
||||||
case SDLK_RIGHT:
|
case SDLK_RIGHT:
|
||||||
if (pos < nibbles-1)
|
pos += pos_step(zoom);
|
||||||
pos++;
|
if (pos > nibbles-1)
|
||||||
|
pos = nibbles-1;
|
||||||
break;
|
break;
|
||||||
case SDLK_RETURN:
|
case SDLK_RETURN:
|
||||||
case SDLK_q:
|
case SDLK_q:
|
||||||
|
Loading…
Reference in New Issue
Block a user