Skip to content

Instantly share code, notes, and snippets.

View Fulgen301's full-sized avatar

Fulgen301

  • TU Vienna
View GitHub Profile
@Fulgen301
Fulgen301 / docs.md
Last active July 26, 2024 14:47
Sections

Sections

CreateSection

Description

Creates a new section from the given data. The section is loaded asynchronously, and the engine calls the passed specified callback in the given object when all clients have loaded the section.

Syntax

int CreateSection(any data, string callback, object obj);
@Fulgen301
Fulgen301 / mwe.cpp
Last active March 6, 2023 07:15
Destroying a secondary OpenGL context in another thread turns the window black permanently on macOS
#include <thread>
#define GL_SILENCE_DEPRECATION
#include <OpenGL/gl.h>
#include <SDL2/SDL.h>
int main()
{
SDL_Init(SDL_INIT_VIDEO);
@Fulgen301
Fulgen301 / GuiScrollableArea.cs
Created November 7, 2021 18:54
GuiScrollableArea.cs
using System;
using System.Reflection;
using Vintagestory.API.Client;
namespace GuiExtensions
{
public class GuiScrollableArea : GuiElement
{
public ElementBounds ClippingBounds { get; private init; }
@Fulgen301
Fulgen301 / StdGLHelpers.cpp
Created October 19, 2021 20:05
StdGLHelpers
/*
*LegacyClonk
*
*Copyright (c) 2021, The LegacyClonk Team and contributors
*
*Distributed under the terms of the ISC license; see accompanying file
*"COPYING" for details.
*
*"Clonk" is a registered trademark of Matthes Bender, used with permission.
*See accompanying file "TRADEMARK" for details.
@Fulgen301
Fulgen301 / GuiCompositeSettingsEx.xml
Last active July 26, 2021 12:32
GuiCompositeSettingsEx.dll documentation 0.1.0
<?xml version="1.0"?>
<doc>
<assembly>
<name>GuiCompositeSettingsEx</name>
</assembly>
<members>
<member name="T:GuiExtensions.GuiCompositeSettingsEx">
<summary>
Allows the developer to add custom settings dialog panels.
Panels consist of a key, which is also used for translation, and a delegate that is called to create the UI.
import keyboard
import pyxinput
class Key(object):
__slots__ = "key", "mapping", "value_pressed", "value_released"
def __init__(self, key, mapping : str, value_pressed, value_released):
self.key = key
self.mapping = mapping
self.value_pressed = value_pressed
@Fulgen301
Fulgen301 / youtube2mpd.py
Last active May 12, 2019 18:32
YouTube to MPD-suitable URL
#!/usr/bin/env python3
import youtube_dl, re, sys
from mpd import MPDClient
class SilentLogger(object):
def debug(self, msg):
pass
def warning(self, msg):
pass
#!/usr/bin/env python3
import json, sys
from hashlib import md5
import numpy as np
import matplotlib.pyplot as plot
from collections import defaultdict
vwa = "/home/tokgeo/Downloads/vwa.json"
vwa_options = "/home/tokgeo/Downloads/vwa_options.json"
def _redispatch_message_common(message, type):
target, text = get_target(message.params[0]), message.params[1]
user = get_user(message.source) if message.source else None
signal(type).send(message, user=user, target=target, text=text)
if target == message.client.nickname:
signal("private-{}".format(type)).send(message, user=user, target=target, text=text)
else:
signal("public-{}".format(type)).send(message, user=user, target=target, text=text)
import configparser
import os.path
class ClonkSection(configparser.SectionProxy):
def __getitem__(self, item):
try:
return super(ClonkSection, self)[item]
except KeyError:
return None