Skip to content

Instantly share code, notes, and snippets.

@vurtun
vurtun / gui.md
Last active October 4, 2023 15:44

Graphical User Interfaces

For the last few weeks I spend some time coding, writing and cleaning up my notes from almost a year since I published nuklear.

Basically this is a possible implementation for a graphical user interface builder backend with support for an immediate mode style API. So it provides a way to define non-mutating UI state, an immediate mode style API for dynamic UI components (lists,trees,...) and a combination of both.

The core implementation is ~800 LOC without any kind of default widgets or extensions. At first this seems quite counter intuitive. However since the inherent design allows for lots of different ways to define any widget like buttons it does not make sense to provide a specific default implementation. The way this code was architectured furthermore removes the need for style/skinning configurations used in Nuklear since widget painting is just calling a small

@bkaradzic
bkaradzic / why_i_think_immediate_mode_gui_is_way_to_go_for_gamedev_tools.md
Last active April 5, 2024 05:40
Why I think Immediate Mode GUI is way to go for GameDev tools

Why I think Immediate Mode GUI is way to go for GameDev tools

Prerequisites

Before you continue, if you don't know what IMGUI is don't bother reading this post, just ignore it, don't write anything in comments section, etc. If you're curious about IMGUI see bottom of this post, otherwise continue whatever you were doing, this post it's not for you. Thanks!

If you know what IMGUI is, for context read following presentations and blog posts:

  • Insomniac’s Web Tools Postmortem

API Design: Coroutines APIs (Janurary-2017)

I am currently dealing with a lot of libraries at work. Both third party as well as libraries written or being currently in process of being written by me. I absolutely love writing and working with libraries. Especially if they present or bring me to either a new or different approach to solve a problem. Or at least provide a different view.

Over time I noticed however that quite regulary we had to decide that we cannot use a third party library. Often it is the usual reason.

@mowings
mowings / masq.sh
Last active September 25, 2023 20:00
script to get xet xhyve working with all vpn interfaces
#!/bin/bash
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) )
rulefile="rules.tmp"
echo "" > $rulefile
sudo pfctl -a com.apple/tun -F nat
for i in "${interfaces[@]}"
do
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}"
echo $RULE >> $rulefile
done
@NatWeiss
NatWeiss / .vimrc
Last active August 12, 2022 22:39
syntax enable
colorscheme xcode-dark
" attempt to fix issue
" :95;0c is already typed on starting vim (not nvim)
set t_u7=
set t_SH=
" no need to press shift to enter command mode
noremap ; :
@vurtun
vurtun / Library writing.txt
Created September 12, 2016 11:20
Library writing
LIBRARY WRITING REFERENCE LIST
===============================
1.) Designing and Evaluating Reusable Components (Casey Muratori: http://mollyrocket.com/casey/stream_0028.html)
----------------------------------------------------------------------------------------------------------------
_THE_ reference on API design up to this day on the internet. Nobody should write a library without having seen this.
I come back to this talk every N number of weeks it is that good.
2.) stb_howto (Sean Barrett: https://github.com/nothings/stb/blob/master/docs/stb_howto.txt)
--------------------------------------------------------------------------------------------
Sean Barretts single header libraries (https://github.com/nothings/stb) was the first time for me that I came across
@pingec
pingec / PokemonCP.md
Last active August 6, 2016 18:13
Pokemon CP, IV etc,

Let's say we have 2 pokemons of the same type. Their CP will depend on the following values:

  • IV (IndividualStamina, IndividualAttack, IndividualDefense)
  • CpMultiplier
  • AdditionalCpMultiplier

These values, together with move types, weight, height are what makes your pokemon unique.

Mechanisms that change these values:

@paniq
paniq / twistpool.c
Last active August 28, 2019 22:17
Twisting Pool Allocator
/*
Twisting Pool Allocator
=======================
written by Leonard Ritter (leonard.ritter@duangle.com)
This file is in the public domain
I don't know if I was the first one to stumble upon this technique, so
I can't guarantee there's no patent on it, but let's hope there's not,
@AndreiRudenko
AndreiRudenko / SpatialHash.hx
Last active May 13, 2019 19:01
SpatialHash uniform-grid implementation
// SpatialHash uniform-grid implementation
// Broad-phase algorithm for collision detection
// Andrei Rudenko // SpatialHash.hx (24.07.2016)
import luxe.Vector;
import luxe.utils.Maths;
class SpatialHash {
public var min(default, null):Vector;
@jonathan-beebe
jonathan-beebe / alasset_to_phasset.swift
Created July 18, 2015 16:26
Convert ALAsset to iOS8+ PHAsset
import Photos
import AVFoundation
func ALAssetToPHAsset(asset:ALAsset) -> PHAsset {
var fetchOptions: PHFetchOptions = PHFetchOptions()
var url:NSURL = asset.valueForProperty(ALAssetPropertyAssetURL) as! NSURL
let fetchResult:PHFetchResult = PHAsset.fetchAssetsWithALAssetURLs([url], options: fetchOptions)
return fetchResult.firstObject as! PHAsset
}