Skip to content

Instantly share code, notes, and snippets.

@CoryBloyd
CoryBloyd / SDLblit.cpp
Last active March 27, 2024 22:34
Minimal code to set up a window in SDL and blit from CPU RAM to the window
// This work (SDLblit.cpp, by Cory Bloyd) is free of known copyright restrictions.
// https://creativecommons.org/publicdomain/zero/1.0/
#include <SDL.h>
inline uint32_t argb(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { return (a<<24) | (r << 16) | (g << 8) | (b << 0); }
int main(int argc, char *argv[]) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Rect screenRect = { 0,0,1024,1024 };
@CoryBloyd
CoryBloyd / codeFromMarkdown.cpp
Created July 20, 2018 19:57
markdown <-> cpp
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_DEPRECATE
#include <string>
#include <vector>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>