Skip to content

Instantly share code, notes, and snippets.

View alexrestrepo's full-sized avatar

Alex Restrepo alexrestrepo

View GitHub Profile
@alexrestrepo
alexrestrepo / sdl-metal-example.m
Created September 2, 2023 17:21 — forked from gcatlin/sdl-metal-example.m
Minimal C SDL2 Metal example
//
// cc sdl-metal-example.m `sdl2-config --cflags --libs` -framework Metal -framework QuartzCore && ./a.out
//
#include <SDL.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
int main (int argc, char *args[])
{
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal");
@alexrestrepo
alexrestrepo / sdl-opengl-example.c
Created September 2, 2023 17:21 — forked from gcatlin/sdl-opengl-example.c
Minimal C SDL2 OpenGL example
//
// cc main.c glad.c -lSDL2
//
#include "glad.h" // https://glad.dav1d.de/
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <stdbool.h>
int main()
{