Skip to content

Instantly share code, notes, and snippets.

View superwills's full-sized avatar

William superwills

View GitHub Profile
@superwills
superwills / Enum++.cpp
Created April 27, 2024 04:46
Enum increment operators
enum class MouseButton {
Left,
Middle,
Right,
NUM_BUTTONS
};
map< MouseButton, string > mouseButtonName = {
{ MouseButton::Left, "Left" },
@superwills
superwills / buildCurliOS.sh
Last active April 12, 2024 01:40
Build Curl for iOS
# IF SOMETHING IS NOT WORKING, BLOW AWAY YOUR CURL DOWNLOAD FOLDER AND THEN RE-UN-ZIP IT BECAUSE IT CACHES
# STATE BEYOND WHAT make clean CAN GET RID OF
# iPhone
export ARCH=arm64
export SDK=iphoneos
export DEPLOYMENT_TARGET=12.0
sudo xcode-select --switch /Applications/Xcode.app
export CFLAGS="-arch $ARCH -isysroot $(xcrun -sdk $SDK --show-sdk-path) -m$SDK-version-min=$DEPLOYMENT_TARGET"
@superwills
superwills / StopWatch.h
Created March 22, 2024 02:08
StopWatch / Every
#pragma once
#include <chrono>
struct StopWatch {
std::chrono::high_resolution_clock::time_point start;
StopWatch() {
reset();
}
@superwills
superwills / RenderToTextureMain.cpp
Created March 5, 2024 16:20
OpenGL renderbuffer Render to texture
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define GLEW_STATIC
#include <GL/glew.h>
#include <gl/gl.h>
#include <gl/glu.h>
@superwills
superwills / firstRun.cpp
Created February 19, 2024 19:27
First run
#include <stdio.h>
int main(int argc, const char * argv[]) {
struct FirstRun {
bool hasRun = 0;
operator bool() {
bool firstRun = !hasRun;
hasRun = 1;
// Put this in a separate .h file (called "getopt.h").
// The prototype for the header file is:
/*
#ifndef GETOPT_H
#define GETOPT_H
int getopt(int nargc, char * const nargv[], const char *ostr) ;
#endif
*/
@superwills
superwills / PerlinNoise.cpp
Created April 27, 2016 16:00
This is an implementation of Perlin simplex noise by Stefan Gustavson
// Noise1234
// Author: Stefan Gustavson (stegu@itn.liu.se)
//
// This library is public domain software, released by the author
// into the public domain in February 2011. You may do anything
// you like with it. You may even remove all attributions,
// but of course I'd appreciate it if you kept my name somewhere.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@superwills
superwills / OpenSSL RSA encryption sample
Last active November 2, 2022 09:45
Base64 encoding and RSA encryption sample
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <openssl/rsa.h>
#include <openssl/engine.h>
#include <openssl/pem.h>
// I'm not using BIO for base64 encoding/decoding. It is difficult to use.
// Using superwills' Nibble And A Half instead
@superwills
superwills / clean.bat
Created October 23, 2021 21:26
Visual Studio 2019 cleanup script
REM put this in the ROOT of your Visual Studio 2019 project folder.
rd .vs /s /q
rd Debug /s /q
rd Release /s /q
rd x64 /s /q
REM OpenGL is the name of your project
rd OpenGL\Debug /s /q
rd OpenGL\Release /s /q
rd OpenGL\x64 /s /q
@superwills
superwills / Source.cpp
Last active September 17, 2021 02:52
Why is glTexImage2D() backwards?
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#include <stdio.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <map>
#include <vector>
using namespace std;