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 / dds_texture_loader.c
Created September 8, 2017 07:02
Loading a DDS file DXT1 DXT3 DXT5 opengl
GLuint texture_loadDDS(const char* path) {
FILE* f;
f = fopen(path, "rb");
if(f == 0)
return 0;
// make sure this is a dds
char filecode[4];
fread(&filecode, 1, 4, f);
@tilkinsc
tilkinsc / assimp_opengl_load.c
Created September 8, 2017 08:52
Pure C Assimp model file loading example
VAO* load_model(const char* path) {
// import model
const struct aiScene* scene = aiImportFile(path, aiProcess_Triangulate); // http://assimp.sourceforge.net/lib_html/structai_scene.html
if(scene->mNumMeshes <= 0) {
aiReleaseImport(scene);
return 0;
}
struct aiMesh* mesh = *scene->mMeshes; // http://assimp.sourceforge.net/lib_html/structai_mesh.html
@tilkinsc
tilkinsc / load_dds.c
Last active March 23, 2024 17:20
C OpenGL DDS Loading Tutorial
/*
Can load easier and more indepth with https://github.com/Hydroque/DDSLoader
Because a lot of crappy, weird DDS file loader files were found online. The resources are actually VERY VERY limited.
Written in C, can very easily port to C++ through casting mallocs (ensure your imports are correct), goto can be replaced.
https://www.gamedev.net/forums/topic/637377-loading-dds-textures-in-opengl-black-texture-showing/
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-5-a-textured-cube/
^ Two examples of terrible code
@tilkinsc
tilkinsc / using.bat
Last active September 7, 2018 06:45
Batch file you can stick in C:\Windows or C:\Windows\System32 after setting paths in environment variables, which called will add those paths to PATH: using %ExamplePath% adds C:\Whatever;C:\Whatever2 to %PATH%
REM Created by: http://github.com/tilkinsc
REM Use the -v or /v switch anywhere to see the command issued.
REM Adds supplied path to the %PATH% variable, supports multiple paths per variable
REM Usage: using %EnvVariable% [-v]
REM Example:
REM set examp=C:\Whatever;C:\Whatever2
REM using %examp% -v
@tilkinsc
tilkinsc / ocd.bat
Created December 19, 2017 00:33
Open current directory batch file
REM opens current directory. Stick in C:\Windows or somewhere in path to use it easier.
REM Purpose is just to save typing and promote productivity
@echo off
explorer %cd%
exit /b
@tilkinsc
tilkinsc / incbin.c
Created January 29, 2018 17:40 — forked from mmozeiko/incbin.c
Include binary file with gcc
#include <stdio.h>
#define STR2(x) #x
#define STR(x) STR2(x)
#define INCBIN(name, file) \
__asm__(".section .rodata\n" \
".global incbin_" STR(name) "_start\n" \
".type incbin_" STR(name) "_start, @object\n" \
".balign 16\n" \
Considerate Jessica Grey
A Short Story
by Mr Pseudonym
Jessica Grey had always loved urban Camborne with its jealous, jittery jungle. It was a place where she felt anxious.
She was a considerate, patient, beer drinker with sloppy eyelashes and wobbly fingers. Her friends saw her as an obedient,
old ogre. Once, she had even saved a steady baby that was stuck in a drain. That's the sort of woman he was.
Jessica walked over to the window and reflected on her chilly surroundings. The clouds danced like shouting foxes.
@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 {
@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>
// 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