Skip to content

Instantly share code, notes, and snippets.

View sharkwouter's full-sized avatar

Wouter Wijsman sharkwouter

  • gridscale
  • Cologne, Germany
  • 15:20 (UTC +02:00)
View GitHub Profile
@benob
benob / stbttf.h
Last active June 15, 2023 12:14
Example for using stb_truetype with SDL2 renderer. Only supports ASCII characters.
#ifndef __STBTTF_H__
#define __STBTTF_H__
#include <SDL2/SDL.h>
#include "stb_rect_pack.h"
#include "stb_truetype.h"
/* STBTTF: A quick and dirty SDL2 text renderer based on stb_truetype and stdb_rect_pack.
* Benoit Favre 2019
@brianshumate
brianshumate / docker-macos-terraform.md
Last active April 16, 2024 02:18
The Simplest Terraform with Docker on macOS

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@nderkach
nderkach / gist:b8f4fe57a7a09af7815cdeaf8d44adfe
Last active September 22, 2019 16:12
DevinantArt Private API (used by mobile app)
# get OAuth2 token
curl -H 'host:www.deviantart.com' -H 'User-Agent:DeviantArt/1.12 (iPhone; iOS 8.2; Scale/2.00)' -H 'Accept-Language:en;q=1' -H 'DA-SYNC-TOKEN:2fcf547f0e4ddcd8e8e45084b6dc0d2c' -H 'dA-minor-version:20160316' -H 'Accept:*/*' -H 'Content-Type:application/x-www-form-urlencoded' -H 'dA-session-id:b0618f6c2819e75b9d2b20b0e96c5802' -H 'Connection:keep-alive' -H 'Proxy-Connection:keep-alive' -H 'Content-Length:123' -H 'Accept-Encoding:gzip, deflate' -X POST 'https://www.deviantart.com/oauth2/token' --compressed --data-binary 'client_id=1701&client_secret=e6af3dc9712a1aad9efed05f16ceecf198aefcb5bab1531018e28034a3792e30&grant_type=client_credentials'
// compile with: clang++ main.cpp -o image_exmple -lSDL2 -lSDL2_image
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <cstdio>
#include <string>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
SDL_Window *window = NULL;
@flibitijibibo
flibitijibibo / flibitPackaging.md
Created June 17, 2016 16:00
Hope you like reading ldd output!

A week ago I was CC'd in on a thread about Linux packaging, and how to avoid doing it the wrong way (i.e. RPM, Deb, etc.). I've always used MojoSetup and I've never forced distributions to do any additional work, but this is still a new concept to a lot of people. Additionally, Amos suggested that I expand on Itch's FNA appendix, so here's a guide on how I package my games.

This is a bit of an expansion on my MAGFest 2016 presentation, which you can find here:

http://www.flibitijibibo.com/magfest2016/

https://www.youtube.com/watch?v=B83CWUh0Log

I would recommend looking at that first! After that, read on...

@johnv-valve
johnv-valve / 51-these-are-not-joysticks.rules
Last active January 26, 2016 22:38 — forked from denilsonsa/51-these-are-not-joysticks.rules
Fix for Microsoft keyboard being detected as joystick in Linux
# /etc/udev/rules.d/51-these-are-not-joysticks.rules
# https://gist.github.com/denilsonsa/978f1d842cf5430f57f6
#
# These are devices that, although recognized by kernel as joysticks, are not
# joysticks. These rules will prevent the non-functional /dev/input/js* devices
# from being used, by removing read/write permissions from them.
#
# This is just a blacklist, which will always be incomplete (until the actual
# bug gets fixed). Feel free to add more devices to this list.
#
@urkle
urkle / joypad.cpp
Created September 25, 2013 15:21
SDL2 Joystick hot-plugging example
#define MAX_CONTROLLERS 4
class JoypadController {
public:
JoypadController() : m_is_connected(false), m_gamepad(0), m_instance_id(-1), m_haptic(0) {}
int JoypadController::processEvent(const SDL_Event& event);
private:
SDL_GameController *m_gamepad;
SDL_Haptic *m_haptic;