Skip to content

Instantly share code, notes, and snippets.

View gszauer's full-sized avatar
💻
Living life 16.6 ms at a time

Gabor Szauer gszauer

💻
Living life 16.6 ms at a time
View GitHub Profile
@namandixit
namandixit / math3d.h
Last active August 17, 2023 11:46
3D Linear Algebra Library in C99 (Tested with OpenGL)
/* This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit

Last updated 2020/03/04

Some links from twitter on the topic of parsing PSD files (haven't looked into them in details). PSD include a flattened rasterized image so this is easy to load if that's the only thing you need. Most software / librairies have support for extracting this flattened data (e.g. stb_image.h does).

However if you want access to individual layers, render non-rasterized layers, emulate every photoshop features, extract or apply effects with more granularity, more code is needed. May range from easy to lots-of-work depending on what exactly you need.

As far as I know there isn't a trivial stb-like ready-to-use C++ library to do that sort of things. Posting all links here. Some are probably bloated or hard to use into your project, some lacking features.

TODO: Actually look into the pros/cons of all those.

@dwilliamson
dwilliamson / Out.cpp
Last active December 1, 2020 09:00
Can you force C++ call sites to prefix "out" for all mutate-via-reference parameters?
#define out OutCatcher() <<
template <typename TYPE> struct Out
{
explicit Out(TYPE& ref) : ref(ref) { }
TYPE& ref;
};
struct OutCatcher
{
@cobbpg
cobbpg / Unity-hotswapping-notes.md
Last active February 17, 2024 19:04
Unity hotswapping notes

Unity hotswapping notes

Unity has built-in support for hotswapping, which is a huge productivity booster. This feature works not only with graphics assets like bitmaps and meshes, but also with code: if you edit the source and save it, the editor will save the state of the running game, compile and load the new code, then load the saved state and continue where it left off. Unfortunately, this feature is very easy to break, and most available 3rd party plugins have little regard for it.

It looks like there’s a lot of confusion about hotswapping in Unity, and many developers are not even aware of its existence – which is no wonder if their only experience is seeing lots of errors on the console when they forget to stop the game before recompiling... This document is an attempt to clear up some of this confusion.

Nota bene, I’m not a Unity developer, so everything below is based on blog posts and experimentation. Corrections are most welcome!

The basic flow of hotswapping

@dwilliamson
dwilliamson / GUIDGenerator.cpp
Created September 14, 2015 17:56
GUID Generator
namespace core
{
//
// A globally unique identifier with a generator that should allow multiple machines/users
// to never generate the same ID.
//
struct clcpp_attr(reflect) Guid
{
Guid()
: mac_address_hash(0)
@ocornut
ocornut / printf_tips.cpp
Last active March 24, 2023 11:23
C/C++ tips for using printf-style functions
// C/C++ tips for using printf-style functions
// Lots of manipulation can be expressed simply and fast with printf-style formatting
// Also helps reducing the number of temporaries, memory allocations or copies
// ( If you are looking for a simple C++ string class that is printf-friendly and not heap-abusive,
// I've been using this one: https://github.com/ocornut/Str )
// If you are interested in a FASTER implementation of sprintf functions, see stb_sprintf.h
// https://github.com/nothings/stb/blob/master/stb_sprintf.h
// How to concatenate non-zero terminated strings
@jorgenpt
jorgenpt / extract_runtime.sh
Created May 26, 2014 01:33
Helper scripts to update & extract the steam-runtime for direct distribution.
#!/bin/bash -e
# Helper script for extracting the steam-runtime that:
# - Strips unused parts of the runtime (documentation)
# - Allows you to extract a single architecture
# - Extracts it to a directory that doesn't contain the runtime date.
function fatal() { echo "$@" >&2; exit 1; }
if [ $# -lt 3 ]; then
fatal "Usage: $0 <steam-runtime path> <amd64|i386|all> <output directory>" >&2
//2014.4.11 ken initial version. modified from https://alastaira.wordpress.com/2013/10/25/animal-crossing-curved-world-shader/
Shader "Custom/CurvedWorld" {
Properties {
// Diffuse texture
_MainTex ("Base (RGB)", 2D) = "white" {}
// Degree of curvature
_Curvature ("Curvature", Float) = 0.001
_HorizontalCurvature ("Horizontal Curvature", Float) = 0.001
_RelativePos ("Relative Position", Vector) = (0, 0, 0, 0)
@aksakalli
aksakalli / SimpleHTTPServer.cs
Last active April 22, 2024 13:20
SimpleHTTPServer in C#
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
@gszauer
gszauer / git-fuckit
Last active January 3, 2016 07:19
git-fuckit
alias git-fuckit='git reset --hard; git clean -fd; git reset --hard'
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"