Skip to content

Instantly share code, notes, and snippets.

View kungfooman's full-sized avatar

Hermann Rolfes kungfooman

View GitHub Profile
/*
Copyright (c) 2012 Martin Sustrik All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
@kungfooman
kungfooman / test.js
Created March 23, 2017 18:10
ET JavaScript Dynamic Brushes and Safe/Load position mod
// MIT License, have fun
function sprintf() {
var ret = "";
var param = 1; // maps to first %
var msg = arguments[0];
for (var i=0; i<msg.length; i++) {
if (msg[i] == "%") {
// %% will be printed as normal %
if (msg[i+1] == "%") {
@kungfooman
kungfooman / asd
Created March 24, 2017 21:10
asd
textures/aaaaaaaaaaa/kungfuckintest
{
qer_editorimage textures/kungtile/tile6_dio.jpg
surfaceparm woodsteps
map textures/kungtile/tile6_dio.jpg
bumpMap textures/kungtile/tile6_dio_n.jpg
implicitMap textures/kungtile/tile6_dio.jpg
}
@kungfooman
kungfooman / tr_backend.c
Created March 27, 2017 15:24
Kinda works, but then not...
// When it works: https://i.gyazo.com/cf1ddce65f0eb0233e2389e63487a8ee.jpg
// When it doesn't work: https://i.gyazo.com/42e3ef72ffa244c26f2a9503e70af5e6.png
// I am calling simpletriangle() in renderer2/tr_backend.c at the end of RB_RenderViewFront:
// https://github.com/etlegacy/etlegacy/blob/master/src/renderer2/tr_backend.c#L6045
static void simpletriangle() {
GLuint shader_programme;
GLuint vao;
@kungfooman
kungfooman / dukman.c
Created May 4, 2017 19:29
global test
#include <stdio.h>
#include "duktape.h"
duk_ret_t duk_func_log(duk_context *ctx) {
int i;
int n = duk_get_top(ctx); /* #args */
char *res;
for (i = 0; i < n; i++) {
res = (char *)duk_to_string(ctx, i);
printf("%s", res);
@kungfooman
kungfooman / dukman2.c
Created May 4, 2017 20:12
statemachine test
#include <stdio.h>
#include "duktape.h"
duk_ret_t duk_func_log(duk_context *ctx) {
int i;
int n = duk_get_top(ctx); /* #args */
char *res;
for (i = 0; i < n; i++) {
res = (char *)duk_to_string(ctx, i);
printf("%s", res);
@kungfooman
kungfooman / statemachine.js
Created May 4, 2017 20:18
statemachine without export stuff
var StateMachine = {
//---------------------------------------------------------------------------
VERSION: "2.4.0",
//---------------------------------------------------------------------------
Result: {
print("Haii")
function log(str)
#return ccall(:julia_log, Int, (Cstring,), str)
#print(str)
leetmenu_log(leetmenu, str);
end
function pprint(data)
type keyboard_s
forward::Int32
backward::Int32
left::Int32
right::Int32
jump::Int32
end
address = ccall(:malloc, (Int64), (Int64, ), sizeof(keyboard_s))
ptr = Ptr{keyboard_s}(address)
thekeyboard = unsafe_load(ptr)
# julia -i readwritepointer.js
type keyboard_s
forward::Int32
backward::Int32
left::Int32
right::Int32
jump::Int32
end
address = ccall(:malloc, (Int64), (Int64, ), sizeof(keyboard_s))