ampler/draw.c

19 lines
542 B
C
Raw Normal View History

2021-12-19 22:44:48 +00:00
// draw.c
void draw_frame(SDL_Window *w, SDL_Renderer *r, Ampler_state *state) {
SDL_SetRenderDrawColor(r, 0x1D, 0x2B, 0x53, 255);
SDL_RenderClear(r);
SDL_SetRenderDrawColor(r, 0xFF, 0x00, 0x4D, 255);
const space = (44100 * 8) / 512;
for int t = 0; t < arraylen(state -> tracks); t += 1 do
for int x = 0; x < 512; x += 1 do {
const int y = 128 + 256 * t;
const int val = state -> tracks[t][x * space];
SDL_RenderDrawLine(r, x, y + val / 8, x, y + val);
//SDL_RenderDrawPoint(r, x, y + val);
}
SDL_RenderPresent(r);
2021-12-19 22:44:48 +00:00
}