Skip to content

Instantly share code, notes, and snippets.

View dotxnc's full-sized avatar

.xnc dotxnc

View GitHub Profile
@dotxnc
dotxnc / ResourceLoader.cpp
Created March 16, 2016 02:47
Resource Loader
#include "ResourceLoader.h"
bool ResourceLoader::m_done = false;
std::string ResourceLoader::datafolder = "data";
std::map<std::string, sf::Texture> ResourceLoader::m_textures;
std::map<std::string, sf::Font> ResourceLoader::m_fonts;
std::map<std::string, sf::SoundBuffer> ResourceLoader::m_sounds;
void ResourceLoader::m_load()
{
@dotxnc
dotxnc / makefile
Created July 27, 2016 10:43
moonscript makefile
DIRS = .
MOONS = $(wildcard $(DIRS:=/*.moon))
all: compile
love love/
compile:
@echo compiling ... $(MOONS)
moonc -t love/ $(MOONS)
@dotxnc
dotxnc / stb_image_aug.c
Created August 24, 2016 13:44
modified stb_image_aug.c found in SOIL library so that it works in MinGW.
/* stbi-1.16 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c
when you control the images you're loading
QUICK NOTES:
Primarily of interest to game developers and other people who can
avoid problematic images and only need the trivial interface
JPEG baseline (no JPEG progressive, no oddball channel decimations)
PNG non-interlaced
BMP non-1bpp, non-RLE
#!/usr/bin/luajit
local wpi = require ("wiringlua")
local ADDR = 0x27
local BLEN = 1
local fd = 0
function write_word(data)
local temp = data
@dotxnc
dotxnc / lcd_game.lua
Last active February 12, 2017 03:55
#!/usr/bin/luajit
local wpi = require ("wiringlua")
local ADDR = 0x27
local BLEN = 1
local fd = 0
function write_word(data)
local temp = data
//
// Created by Lumaio on 12/28/2016.
// C API for pushbullet.
// Requires libcURL
//
#ifndef PUSHBULLET_H
#define PUSHBULLET_H
#include <stdio.h>
@dotxnc
dotxnc / struct.h
Created January 14, 2017 04:56
rip old drop menu code
template <typename TYPE>
struct DropMenu {
std::vector<TYPE>* skins;
const wchar_t* name;
int index = 0;
bool thisdrop = false;
int x, y;
SourceEngine::EItemDefinitionIndex skinid;
bool needsupdate=true;
KeyToggle drop_click;
--[[
--
-- This is a lua jit wiringpi interface through luajit.
-- it's slow. it's bad. but it works.
--
-- (c) 2016-2017 Lumaio
--
--]]
@dotxnc
dotxnc / vector.lua
Created February 17, 2017 08:55
vector math as a lua object
local vector = {x,y,z}
vector.__index = vector
vector.__add = function(lhs, rhs)
if rhs == nil then return lhs end
local _n = vector(0,0,0)
if type(rhs) == "number" then rhs = vector(rhs,rhs,rhs) end
_n.x = lhs.x + rhs.x
_n.y = lhs.y + rhs.y
_n.z = lhs.z + rhs.z
return _n
@dotxnc
dotxnc / main.cpp
Created March 29, 2017 20:48
I was really lazy.
#include <stdio.h>
#include <iostream>
#include <string>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef __WIN32
#include <conio.h>
#define fstat _fstat64
#define stat _stat64