Add buttons to toggle channels on/off in music editor #193

This commit is contained in:
BADIM-PC\Vadim 2017-09-28 19:03:07 +03:00
parent 20c49034ac
commit ea1900c2d8
1 changed files with 10 additions and 3 deletions

View File

@ -1126,7 +1126,7 @@ static void drawTrackerChannel(Music* music, s32 x, s32 y, s32 channel)
}
}
static void drawTumbler(Music* music, s32 x, s32 y, s32 i)
static void drawTumbler(Music* music, s32 x, s32 y, s32 index)
{
tic_mem* tic = music->tic;
@ -1141,11 +1141,18 @@ static void drawTumbler(Music* music, s32 x, s32 y, s32 i)
showTooltip("on/off channel");
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
music->tracker.patterns[i] = !music->tracker.patterns[i];
{
if (SDL_GetModState() & KMOD_CTRL)
{
for (s32 i = 0; i < TIC_SOUND_CHANNELS; i++)
music->tracker.patterns[i] = i == index;
}
else music->tracker.patterns[index] = !music->tracker.patterns[index];
}
}
u8 color = Chroma;
tic->api.sprite(tic, &tic->config.gfx, music->tracker.patterns[i] ? On : Off, x, y, &color, 1);
tic->api.sprite(tic, &tic->config.gfx, music->tracker.patterns[index] ? On : Off, x, y, &color, 1);
}
static void drawTracker(Music* music, s32 x, s32 y)