Skip to content

Instantly share code, notes, and snippets.

View tilkinsc's full-sized avatar
▶️
Working on Lua.NET

Cody Tilkins tilkinsc

▶️
Working on Lua.NET
View GitHub Profile
@tilkinsc
tilkinsc / gist:88478d5f6ae3077a0bc1a425b7f9e563
Last active May 12, 2022 23:51
Kiwi's List of Writing Expertise
tilkinsc's List of Writing Expertise
Punctuation comes too late and may depend on context clues.
When reading, it can be against reading comprehension and against reading speed to read
punctuation at the end of a sentence. For example, a simple sentence who claims a subject
as or like an adjective can be easily misread not accounting for the tone a sentence has between punctuations.
While searching in the woods, you found a goregous set of roses. Declaritive.
While searching in the woods, you found a goregous set of roses? Interrogative.
@tilkinsc
tilkinsc / texture_atlas.cpp
Last active July 13, 2022 21:34
OpenGL Texture Atlas Array Texture Example
// tiles_x the amount of tiles in the image in the x dimension
// tiles_y the amount of tiles in the image in the y dimension
void Texture::finalizeArray(GLsizei tiles_x, GLsizei tiles_y) {
// read in file data
Material* mat = new Material("file.bmp"); // MUST be power of 2
mat->mips = 1; // !single image!
// defines ogl parameters
@tilkinsc
tilkinsc / gist:3a9f4a9f21be31a90bd226b3dac40f60
Last active January 16, 2019 18:29
Conversion from GCC to MSVS advice

Advice

  • Use CL instead of GCC
  • Use .lib and .dll instead of just .dll.a and .dll (and .so.a and .so)
  • Object files are now .obj instead of .o
  • Use /O2 and /Wall instead of -O2 and -Wall
  • Use /Iincdir instead of -Iincdir
  • I'm not sure, but probably /Llibdir instead of -Llibdir

Regular program

@tilkinsc
tilkinsc / sound.c
Created January 4, 2019 13:12
Using wav files with OpenAL
ALuint* sound_load_wav(const char* path) {
ALuint* sound = 0;
WaveData* w_data = 0;
ALenum error = 0;
w_data = wave_load(path);
if(w_data == 0) {
fprintf(stderr, "Failed to load wave file.\n");
goto exit;
@tilkinsc
tilkinsc / sound.c
Created October 31, 2018 14:01
OpenAL how to load an Ogg Vorbis file and play it
// Created by: http://github.com/tilkinsc
// returns ALuint* aka a single openal buffer of ready-to-play ogg vorbis sound samples
// returns 0 on error
ALuint* sound_load_ogg(const char* path) {
ALenum error = 0;
ALuint* sound = 0;
FILE* fp = 0;
OggVorbis_File vf;
@tilkinsc
tilkinsc / floor.c
Created October 9, 2018 01:24
Flooring a float in C
/**
* floating points:
* 32 bit number
*
* 0-22 mantissa
* 23-30 exp
* 31 sign
*
* Theory: You can use the exp potion to determine the offset and null out the bits to produce a floored number.
@tilkinsc
tilkinsc / reg_ext_cmd.reg
Created August 17, 2018 05:42
Windows 10 - Adds a `Open with cmd` option to right click menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"ShowBasedOnVelocityId"=dword:00639bc8
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\Shell\cmd\command]
@="cmd.exe /K pushd \"%V%"
// 32-bit Instructions Types
op a b c d f
_____________________
R-Type 6 5 5 5 5 6
I-type 6 5 5 16
J-Type 6 24
Bit Length
R-Types
@tilkinsc
tilkinsc / WOL.c
Last active June 25, 2018 17:37
A simple WINDOWS ONLY example using winsock to wake on lan WOL in C
//example mac: b1:27:eb:b4:a0:9e
//example hex mac: 0xb1, 0x27, 0xeb, 0xb4, 0xa0, 0x9e
//put example max in place of #define MAC, make sure to end with a , like shown below
//also update IP, and PORT if you need to
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winsock2.h>
@tilkinsc
tilkinsc / wave.c
Last active August 10, 2022 22:03
A simpilex wave file parser
#include "wave.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// wave.h start
typedef struct WaveData {