diff options
author | cflip <cflip@cflip.net> | 2022-02-20 09:15:40 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2022-02-20 09:15:40 -0700 |
commit | a3f4ac00ee76f5e3b2dae7838a6c13ccae40ceac (patch) | |
tree | af8575869f901657b2252c56c7a15e278ef2c0f7 /main.cpp | |
parent | 3828bb56022c636a7dd056a4781249222ea0d3ca (diff) |
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 8fd1f2a..0000000 --- a/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include <SDL2/SDL.h> -#include <iostream> - -#include "audio.h" -#include "gui.h" -#include "sequence.h" - -int main(int argc, char** argv) -{ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { - std::cerr << "Failed to initalize SDL! " << SDL_GetError() << std::endl; - return 1; - } - - SDL_Window* window = SDL_CreateWindow("fmseq", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 320, SDL_WINDOW_SHOWN); - SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); - SDL_Event event; - - Sequence sequence; - AudioContext audio(sequence); - GUI gui(sequence); - - bool running = true; - while (running) { - while (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_QUIT: - running = false; - break; - case SDL_MOUSEBUTTONDOWN: - gui.OnMouseDown(event.button.x, event.button.y); - break; - case SDL_MOUSEMOTION: - gui.OnMouseMove(event.button.x, event.button.y); - break; - case SDL_MOUSEBUTTONUP: - gui.OnMouseUp(); - break; - } - } - - SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); - SDL_RenderClear(renderer); - - gui.Repaint(renderer, audio.CurrentStep()); - - SDL_RenderPresent(renderer); - SDL_UpdateWindowSurface(window); - - SDL_Delay(10); - } - - SDL_DestroyWindow(window); - SDL_Quit(); - - return 0; -}
\ No newline at end of file |