Skip to content

Instantly share code, notes, and snippets.

@tripleslash
tripleslash / WPEGestureDetector.cpp
Last active October 27, 2025 20:45
WPE Gesture Detector
/*
* Copyright (C) 2024 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@tripleslash
tripleslash / scheduler.c
Created February 3, 2025 13:22
Simple cooperative task scheduler in C
#define _XOPEN_SOURCE 700
#include <stdio.h>
#include <stdlib.h>
#include <ucontext.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/time.h>
#define MAX_TASKS 10
/// Manually disconnects all tile connections which cannot be climbed by the characters.
/// This is required because at the time of navmesh generation, the values were set to infinite.
/// @param chf Compact heightfield object which will be updated.
/// @param walkableClime The walkable climb height value in voxels.
static void selectivelyEnforceWalkableClimb(rcCompactHeightfield &chf, int walkableClimb)
{
for (int y = 0; y < chf.height; ++y)
{
for (int x = 0; x < chf.width; ++x)
{