Skip to content

Instantly share code, notes, and snippets.

View kungfooman's full-sized avatar

Hermann Rolfes kungfooman

View GitHub Profile
@kungfooman
kungfooman / lume_test.html
Created November 21, 2023 11:43
Testing LUME in one file
<script>
const imports = {
lume: 'https://raw.githack.com/lume/lume/develop/dist/index.js',
'lume/': 'https://raw.githack.com/lume/lume/develop/',
'@lume/element': 'https://raw.githack.com/lume/element/main/dist/index.js',
'classy-solid': 'https://raw.githack.com/lume/classy-solid/main/dist/index.js',
'@lume/eventful': 'https://raw.githack.com/lume/eventful/main/dist/index.js',
'@lume/kiwi': 'https://raw.githack.com/lume/kiwi/main/dist/kiwi.js',
'@lume/three-projected-material/': 'https://raw.githack.com/lume/three-projected-material/main/',
'@lume/autolayout': 'https://raw.githack.com/lume/autolayout/main/dist/AutoLayout.js',
@kungfooman
kungfooman / con_passive.c
Created October 19, 2021 15:06
Fixed con_passive allowing STDIN while playing Quake 3 (ioquake3)
// REMEMBER: Change SUBSYSTEM:WINDOWS to SUBSYSTEM:CONSOLE
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
@kungfooman
kungfooman / ganja_slider.js
Last active June 6, 2021 09:38
Ganja slider no range limits
editor.getSession().selection.on('changeSelection', function(e) {
if (lock) {
return;
}
// Get the selection plus two extra chars.
var range = editor.getSelectionRange();
range.end.column += 1; range.start.column -= 1;
var t = editor.getSession().getTextRange(range);
// Remove old slider.
if (_slider) {
@kungfooman
kungfooman / playcanvas_for_nodejs.js
Created November 14, 2020 14:06
playcanvas for nodejs to prevent ReferenceError: window is not defined
global.window = {
navigator: {
userAgent: "node"
},
removeEventListener() {}
};
var fakeCanvas = {
id: "fakecanvas",
getBoundingClientRect: function() {
@kungfooman
kungfooman / libwebgame.js
Created December 20, 2018 16:57
emscripten generated glue code to libwebgame.wasm
// Copyright 2010 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.
// The Module object: Our interface to the outside world. We import
// and export values on it. There are various ways Module can be used:
// 1. Not defined. We create it here
// 2. A function parameter, function(Module) { ..generated code.. }
// 3. pre-run appended it, var Module = {}; ..generated code..
@kungfooman
kungfooman / error.log
Created July 5, 2018 17:39
lumix engine error log
Code:
---
68: vec2(0.6547356,0.373677),
69: vec2(-0.1999273,0.4483816),
70: vec2(0.167026,0.2838214),
71: vec2(0.2164582,0.6978411),
72: vec2(-0.7202712,-0.07400024),
73: vec2(-0.6624036,0.559697),
74: vec2(-0.1909649,0.8721116),
75: vec2(-0.6493049,-0.4945979),
# this file can be generated via:
# source = generateCallback("player_damage", Int32, Arg[Arg(Ptr{Int64}, "targ", Entity), Arg(Ptr{Int64}, "inflictor", Entity), Arg(Ptr{Int64}, "attacker", Entity), Arg(Ptr{Float32}, "dir", Vec3), Arg(Ptr{Float32}, "point", Vec3), Arg(Int32, "damage", nothing), Arg(Int32, "dflags", nothing), Arg(Int32, "mod", nothing)])
# file_put_contents("julia/callbacks/player_damage.jl", source)
#=
int (*callback_player_damage)(int *targ, int *inflictor, int *attacker, float *dir, float *point, int damage, int dflags, int mod) = NULL;
CCALL void set_callback_player_damage(int (*cb)(int *targ, int *inflictor, int *attacker, float *dir, float *point, int damage, int dflags, int mod)) {
callback_player_damage = cb;
}
ImGui::SetNextWindowPos( ImVec2(0,0) );
ImGui::SetNextWindowSize(io.DisplaySize); // this used to work, but not in latest imgui version... need to call SetWindowSize() now
ImGui::Begin("BCKGND", NULL, ImGui::GetIO().DisplaySize, 0.0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus);
//ImGuiWindow *bgwin = ImGui::GetCurrentWindow();
if (false) // comment out = work
ImGui::SetWindowSize(io.DisplaySize);
ImDrawList *drawlist = ImGui::GetWindowDrawList();
apt-get install libxml2-dev
apt-get install scons
apt-get install pkg-config
apt-get install libglib2.0-dev
apt-get install freeglut3-dev
apt-get install libgtkglext1-dev
apt-get install subversion
apt-get install libjpeg-dev
@kungfooman
kungfooman / offsetof_julia.jl
Created June 19, 2017 21:03
C's offsetof in julia
type ABC a::Int64; b::Int64; c::Int64 end
function offsetof(type_, member::Symbol)
for (i, item) in enumerate(fieldnames(type_))
if item == member
return fieldoffset(type_, i)
end
#print(typeof(i))
end
# what to do when symbol not in type_?