Skip to content

Instantly share code, notes, and snippets.

@xreiju
Last active December 26, 2017 08:28
Show Gist options
  • Save xreiju/bf948df59f11c8e707c529f339119612 to your computer and use it in GitHub Desktop.
Save xreiju/bf948df59f11c8e707c529f339119612 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <SDL2/SDL.h>
int main() {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window;
SDL_Renderer* renderer;
SDL_CreateWindowAndRenderer(300, 300, SDL_RENDERER_PRESENTVSYNC, &window, &renderer);
int running = 1;
while(running) {
SDL_Event e;
while(SDL_PollEvent(&e)) {
if(e.type == SDL_QUIT) {
running = 0;
}
if(e.key.keysym.sym == SDLK_q) running = 0;
}
SDL_SetRenderDrawColor(renderer, 230, 230, 230, 255);
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderDrawLine(renderer, 119, 0, 119, 300);
SDL_RenderPresent(renderer);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment