This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <fmt/format.h> | |
#include <physfs.h> | |
template <typename Derived> | |
struct PhysfsIo : PHYSFS_Io { | |
protected: | |
PhysfsIo() | |
: PHYSFS_Io { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <string> | |
#include <spdlog/spdlog.h> | |
template <typename Derived> | |
struct DebugLogging { | |
DebugLogging() { spdlog::info("{} constructed", debugId()); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"RadioPanel.txt" | |
{ | |
//"SFUI_StandardRadio" | |
//"SFUI_GroupRadio" | |
//"SFUI_ReportRadio" | |
"Groups" | |
{ | |
"standard" | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -Wall -Wextra -O0 -g -o log_test | |
#include <atomic> | |
#include <optional> | |
// Vyukov MPSC (wait-free multiple producers, single consumer) queue | |
// https://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue | |
template <typename T> | |
class MpscQueue { | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Launch options: -console -novid -threads 4 -high -nojoy | |
echo " ___ _ _ ___ _ | |
echo " |_ | | |( ) / _ \ | | " | |
echo " | | ___ ___ | ||/ ___ / /_\ \ _ _ | |_ ___ ___ __ __ ___ ___ " | |
echo " | | / _ \ / _ \| | / __| | _ || | | || __| / _ \ / _ \\ \/ / / _ \ / __|" | |
echo "/\__/ /| (_) || __/| | \__ \ | | | || |_| || |_ | (_) || __/ > < | __/| (__ " | |
echo "\____/ \___/ \___||_| |___/ \_| |_/ \__,_| \__| \___/ \___|/_/\_\ \___| \___|" | |
echo "" | |
echo "Saved in <Steam Library>\SteamApps\common\Counter-Strike Global Offensive\csgo\cfg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import argparse | |
import sys | |
import xml.etree.ElementTree as ET | |
# In general the attributes I copy are not the ones that BMFont allows, but the ones that löve will read: | |
# https://github.com/love2d/love/blob/fc4847c69d6c9ad7ed84501197427b23400ae1b4/src/modules/font/BMFontRasterizer.cpp | |
# That means in general this script might generate files that might not be fully compliant BMFont files | |
# but they should work with löve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
local oldSetColor = love.graphics.setColor | |
function love.graphics.setColor(r, g, b, a) | |
if type(r) == "table" then | |
assert(#r == 3 or #r == 4) | |
assert(g == nil and b == nil and a == nil) | |
r, g, b, a = unpack(r) | |
end | |
assert(type(r) == "number" and type(g) == "number" and type(b) == "number") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using VarType = int; | |
const VarType DEFAULT_VAR = 0; | |
struct doesHaveVar { | |
static const VarType var = 1; | |
}; | |
struct doesNotHaveVar { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local bit = require("bit") | |
local band, bor, bxor, bnot, lshift = bit.band, bit.bor, bit.bxor, bit.bnot, bit.lshift | |
local function pot(n) -- power of two | |
return lshift(1, n) | |
end | |
local BitMask = setmetatable({}, {__call = function(t, ...) | |
local self = setmetatable({}, t) | |
self:initialize(...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local potLut = {} | |
potLut[0] = 1 | |
for i = 1, 32 do | |
potLut[i] = potLut[i-1] * 2 | |
end | |
-- compare this with lshift(2, n) | |
local function potA(n) -- power of two | |
return potLut[n] | |
end |
NewerOlder